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 org.netbeans.jellytools.actions.Action;
import org.netbeans.jellytools.actions.PropertiesAction;
import org.netbeans.jellytools.modules.db.actions.AddDriverAction;
import org.netbeans.jellytools.nodes.Node;
import org.netbeans.jemmy.operators.JTreeOperator;

import javax.swing.tree.TreePath;
import org.netbeans.jellytools.RuntimeTabOperator;


/** DriversNode Class
 * @author ms113234 */
public class DriversNode extends DBNode {
    private static final String MY_PATH = "Databases|Drivers";
    private static final Action addDriverAction = new AddDriverAction();
    private static final Action propertiesAction = new PropertiesAction();


    /** creates new DriversNode
     * @param tree JTreeOperator of tree
     * @param treePath String tree path */
    public DriversNode(JTreeOperator tree, String treePath) {
        super(tree, treePath);
    }

    /** creates new DriversNode
     * @param tree JTreeOperator of tree
     * @param treePath TreePath of node */
    private DriversNode(JTreeOperator tree, TreePath treePath) {
        super(tree, treePath);
    }

    /** creates new DriversNode
     * @param parent parent Node
     * @param treePath String tree path from parent Node */
    private DriversNode(Node parent, String treePath) {
        super(parent, treePath);
    }

    public static DriversNode getInstance() {
        RuntimeTabOperator.invoke();
        return new DriversNode(new RuntimeTabOperator().tree(), MY_PATH);
    }
    
    /** tests popup menu items for presence */
    public void verifyPopup() {
        verifyPopup(new Action[]{
            addDriverAction,
            propertiesAction
        });
    }

    /** performs AddDriverAction with this node */
    public void addDriver() {
        addDriverAction.perform(this);
    }

    /** performs PropertiesAction with this node */
    public void properties() {
        propertiesAction.perform(this);
    }
    
    // LIB ////////////////////////////////////////////////////////////////////
    
    public DriverNode getDriver(String displayName) {
        return (DriverNode) getChild(displayName, DriverNode.class);
    }
    
    public static void main(String[] args) {
        DriversNode.getInstance().verifyPopup();
        System.out.println("Finished");
    }
}
... 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.