alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.jellytools.modules.db.nodes;

import javax.swing.tree.TreePath;
import org.netbeans.jellytools.RuntimeTabOperator;
import org.netbeans.jellytools.actions.*;
/*
 * DatabasesNode.java
 *
 * Created on 1/14/03 5:01 PM
 */

import org.netbeans.jellytools.modules.db.actions.AddConnectionAction;
import org.netbeans.jellytools.modules.db.actions.DisableDebugAction;
import org.netbeans.jellytools.modules.db.actions.EnableDebugAction;
import org.netbeans.jellytools.nodes.Node;
import org.netbeans.jemmy.operators.JTreeOperator;


/** DatabasesNode Class
 * @author ms113234 */
public class DatabasesNode extends DBNode {
    private static final String MY_PATH = "Databases";
    private static final Action addConnectionAction = new AddConnectionAction();
    private static final Action enableDebugAction = new EnableDebugAction();
    private static final Action disableDebugAction = new DisableDebugAction();
    private static final Action cutAction = new CutAction();
    private static final Action copyAction = new CopyAction();
    private static final Action pasteAction = new PasteAction();
    private static final Action propertiesAction = new PropertiesAction();
    
    /** creates new DatabasesNode
     * @param tree JTreeOperator of tree
     * @param treePath String tree path */
    private DatabasesNode(JTreeOperator tree, String treePath) {
        super(tree, treePath);
    }
    
    /** creates new DatabasesNode
     * @param tree JTreeOperator of tree
     * @param treePath TreePath of node */
    private DatabasesNode(JTreeOperator tree, TreePath treePath) {
        super(tree, treePath);
    }
    
    /** creates new DatabasesNode
     * @param parent parent Node
     * @param treePath String tree path from parent Node */
    private DatabasesNode(Node parent, String treePath) {
        super(parent, treePath);
    }
    
    public static DatabasesNode getInstance() {
        return new DatabasesNode(RuntimeTabOperator.invoke().tree(), MY_PATH);
    }
    
    /** tests popup menu items for presence */
    public void verifyPopup() {
        verifyPopup(new Action[]{
            addConnectionAction,
            enableDebugAction,
            disableDebugAction,
            cutAction,
            copyAction,
            pasteAction,
            propertiesAction
        });
    }
    
    /** performs AddConnectionAction with this node */
    public void addConnection() {
        addConnectionAction.perform(this);
    }
    
    /** performs EnableDebugAction with this node */
    public void enableDebug() {
        enableDebugAction.perform(this);
    }
    
    /** performs DisableDebugAction with this node */
    public void disableDebug() {
        disableDebugAction.perform(this);
    }
    
    /** performs CutAction with this node */
    public void cut() {
        cutAction.perform(this);
    }
    
    /** performs CopyAction with this node */
    public void copy() {
        copyAction.perform(this);
    }
    
    /** performs PasteAction with this node */
    public void paste() {
        pasteAction.perform(this);
    }
    
    /** performs PropertiesAction with this node */
    public void properties() {
        propertiesAction.perform(this);
    }
    
    // LIB ////////////////////////////////////////////////////////////////////
    
    public ConnectionNode getConnection(String displayName) {
        return (ConnectionNode) getChild(displayName, ConnectionNode.class);
    }
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.