Example usage for javax.swing JTree JTree

List of usage examples for javax.swing JTree JTree

Introduction

In this page you can find the example usage for javax.swing JTree JTree.

Prototype

public JTree() 

Source Link

Document

Returns a JTree with a sample model.

Usage

From source file:com.pironet.tda.TDA.java

/**
 * initializes tda panel/*from  w w  w.ja v  a2 s. c  om*/
 *
 * @param asJConsolePlugin specifies if tda is running as plugin
 */
public void init(boolean asJConsolePlugin, boolean asVisualVMPlugin) {
    // init everything
    tree = new JTree();
    addTreeListener(tree);
    runningAsJConsolePlugin = asJConsolePlugin;
    runningAsVisualVMPlugin = asVisualVMPlugin;

    //Create the HTML viewing pane.
    if (!this.runningAsVisualVMPlugin && !this.runningAsJConsolePlugin) {
        InputStream is = TDA.class.getResourceAsStream("/doc/welcome.html");

        htmlPane = new JEditorPane();

        String welcomeText = parseWelcomeURL(is);
        htmlPane.setContentType("text/html");
        htmlPane.setText(welcomeText);
    } else if (asJConsolePlugin) {
        htmlPane = new JEditorPane("text/html",
                "<html><body bgcolor=\"ffffff\"><i>Press Button above to request a thread dump.</i></body></html>");

    } else {
        htmlPane = new JEditorPane("text/html", "<html><body bgcolor=\"ffffff\"></body></html>");
    }
    htmlPane.putClientProperty(Const.AA_TEXT_INFO_PROPERTY_KEY, Boolean.TRUE);
    htmlPane.setEditable(false);

    if (!asJConsolePlugin && !asVisualVMPlugin) {
        hdt = new DropTarget(htmlPane, new FileDropTargetListener());
    }

    JEditorPane emptyPane = new JEditorPane("text/html", "");
    emptyPane.setEditable(false);

    htmlPane.addHyperlinkListener(evt -> {
        // if a link was clicked
        if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            if (evt.getDescription().startsWith("monitor")) {
                navigateToMonitor(evt.getDescription());
            } else if (evt.getDescription().startsWith("dump")) {
                navigateToDump();
            } else if (evt.getDescription().startsWith("wait")) {
                navigateToChild("Threads waiting");
            } else if (evt.getDescription().startsWith("sleep")) {
                navigateToChild("Threads sleeping");
            } else if (evt.getDescription().startsWith("dead")) {
                navigateToChild("Deadlocks");
            } else if (evt.getDescription().startsWith("threaddump")) {
                addMXBeanDump();
            } else if (evt.getDescription().startsWith("openlogfile") && !evt.getDescription().endsWith("//")) {
                File[] files = { new File(evt.getDescription().substring(14)) };
                openFiles(files, false);
            } else if (evt.getDescription().startsWith("openlogfile")) {
                chooseFile();
            } else if (evt.getDescription().startsWith("opensession") && !evt.getDescription().endsWith("//")) {
                File file = new File(evt.getDescription().substring(14));
                openSession(file, true);
            } else if (evt.getDescription().startsWith("opensession")) {
                openSession();
            } else if (evt.getDescription().startsWith("preferences")) {
                showPreferencesDialog();
            } else if (evt.getDescription().startsWith("filters")) {
                showFilterDialog();
            } else if (evt.getDescription().startsWith("categories")) {
                showCategoriesDialog();
            } else if (evt.getDescription().startsWith("overview")) {
                showHelp();
            } else if (evt.getURL() != null) {
                try {
                    // launch a browser with the appropriate URL
                    Browser.open(evt.getURL().toString());
                } catch (InterruptedException e) {
                    System.out.println("Error launching external browser.");
                } catch (IOException e) {
                    System.out.println("I/O error launching external browser." + e.getMessage());
                    e.printStackTrace();
                }
            }
        }
    });

    htmlView = new ViewScrollPane(htmlPane, runningAsVisualVMPlugin);
    ViewScrollPane emptyView = new ViewScrollPane(emptyPane, runningAsVisualVMPlugin);

    // create the top split pane
    topSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    topSplitPane.setLeftComponent(emptyView);
    topSplitPane.setDividerSize(Const.DIVIDER_SIZE);
    topSplitPane.setContinuousLayout(true);

    //Add the scroll panes to a split pane.
    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setBottomComponent(htmlView);
    splitPane.setTopComponent(topSplitPane);
    splitPane.setDividerSize(Const.DIVIDER_SIZE);
    splitPane.setContinuousLayout(true);

    if (this.runningAsVisualVMPlugin) {
        setOpaque(true);
        setBackground(Color.WHITE);
        setBorder(BorderFactory.createEmptyBorder(6, 0, 3, 0));
        topSplitPane.setBorder(BorderFactory.createEmptyBorder());
        topSplitPane.setOpaque(false);
        topSplitPane.setBackground(Color.WHITE);
        htmlPane.setBorder(BorderFactory.createEmptyBorder());
        htmlPane.setOpaque(false);
        htmlPane.setBackground(Color.WHITE);
        splitPane.setBorder(BorderFactory.createEmptyBorder());
        splitPane.setOpaque(false);
        splitPane.setBackground(Color.WHITE);
    }

    Dimension minimumSize = new Dimension(200, 50);
    htmlView.setMinimumSize(minimumSize);
    emptyView.setMinimumSize(minimumSize);

    //Add the split pane to this panel.
    add(htmlView, BorderLayout.CENTER);

    statusBar = new StatusBar(!(asJConsolePlugin || asVisualVMPlugin));
    add(statusBar, BorderLayout.SOUTH);

    firstFile = true;
    setFileOpen(false);

    if (!runningAsVisualVMPlugin) {
        setShowToolbar(PrefManager.get().getShowToolbar());
    }

    if (firstFile && runningAsVisualVMPlugin) {
        // init filechooser
        fc = new JFileChooser();
        fc.setMultiSelectionEnabled(true);
        fc.setCurrentDirectory(PrefManager.get().getSelectedPath());
    }
}

From source file:com.titan.mainframe.MainFrame.java

public MainFrame() {
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.toLowerCase().contains("mac")) {
        com.apple.eawt.Application macApp = com.apple.eawt.Application.getApplication();
        macApp.addApplicationListener(this);
    }/*w ww .j  a va  2s  . c o m*/
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            handleQuit();
        }

        @Override
        public void windowOpened(WindowEvent e) {
            windowOpened = true;
        }
    });
    setTitle("Titan " + Global.version);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    if (TitanSetting.getInstance().width == 0 || TitanSetting.getInstance().height == 0) {
        setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, 1200, 700);
    } else {
        setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, TitanSetting.getInstance().width,
                TitanSetting.getInstance().height);
    }

    setIconImage(new ImageIcon(getClass().getClassLoader().getResource("com/titan/image/titan_icon.png"))
            .getImage());

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new BorderLayout(0, 0));
    splitPane.setDividerLocation(TitanSetting.getInstance().mainframeDivX);
    contentPane.add(splitPane, BorderLayout.CENTER);

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout(0, 0));

    JLabel logoLabel = new JLabel();
    logoLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            mainContentPanel.removeAll();
            mainContentPanel.add(welcomePanel, BorderLayout.CENTER);
            mainContentPanel.updateUI();
        }
    });

    //      try {
    //         BufferedImage b = ImageIO.read(MainFrame.class.getResource("/com/titan/image/titanLogo.png"));
    //         Image i = b.getScaledInstance((int) (b.getWidth() * 0.6), (int) (b.getHeight() * 0.6), Image.SCALE_SMOOTH);
    logoLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/titanLogo.png")));
    //      } catch (IOException e1) {
    //         e1.printStackTrace();
    //      }
    //      logoLabel.setMaximumSize(new Dimension(150, 150));

    JPanel controlPanel = new JPanel();
    controlPanel.setBackground(new Color(239, 249, 255));
    controlPanel.setOpaque(true);
    panel.add(controlPanel, BorderLayout.CENTER);
    controlPanel.setLayout(new BorderLayout());

    JScrollPane computeScrollPane = new JScrollPane();
    tabbedPane.addTab("Compute", computeScrollPane);
    controlPanel.add(tabbedPane, BorderLayout.CENTER);

    serverTree = new JTree();
    serverTree.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            //            Object obj = mainContentPanel.getComponent(0);
            //            if (obj instanceof VMMainPanel) {
            //               ((MainPanel) obj).refresh();
            //            }
        }
    });
    serverTree.setModel(computeTreeModel);
    serverTree.setCellRenderer(new ZoneTreeRenderer());
    serverTree.setRootVisible(false);
    computeScrollPane.setViewportView(serverTree);
    updateComputeTree();

    JScrollPane zoneScrollPane = new JScrollPane();
    tabbedPane.addTab("Zone", zoneScrollPane);

    zoneTree = new JTree();
    zoneTree.setModel(zoneTreeModel);
    zoneTree.setCellRenderer(new ZoneTreeRenderer());
    zoneScrollPane.setViewportView(zoneTree);
    updateZoneTree();
    splitPane.setLeftComponent(panel);

    splitPane.setRightComponent(mainContentPanel);
    mainContentPanel.setLayout(new BorderLayout(0, 0));

    welcomePanel = new WelcomePanel();
    mainContentPanel.add(welcomePanel, BorderLayout.CENTER);
    welcomePanel.setLayout(new BorderLayout(0, 0));
    welcomePanel.add(mainScreenLabel, BorderLayout.CENTER);
    mainScreenLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/mainscreen.png")));

    JPanel panel_1 = new JPanel();
    welcomePanel.add(panel_1, BorderLayout.SOUTH);

    JButton licenseButton = new JButton("License");
    licenseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            InputStream in = MainFrame.class.getResourceAsStream("/com/titan/license.txt");
            try {
                LicenseDialog dialog = new LicenseDialog(MainFrame.this, IOUtils.toString(in));
                CommonLib.centerDialog(dialog);
                dialog.setVisible(true);
            } catch (IOException e1) {
                e1.printStackTrace();
            } finally {
                IOUtils.closeQuietly(in);
            }
        }
    });
    panel_1.add(licenseButton);

    ribbonPanel = new JPanel();
    contentPane.add(ribbonPanel, BorderLayout.NORTH);
    ribbonPanel.setLayout(new BorderLayout(0, 0));

    ribbonTabbedPane = new JTabbedPane(JTabbedPane.TOP);
    ribbonTabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            //            if (!windowOpened) {
            //               return;
            //            }
            String tab = ribbonTabbedPane.getTitleAt(ribbonTabbedPane.getSelectedIndex());
            if (tab.equals("Server")) {
                if (mainServerPanel == null || !mainServerPanel.serverPanel.jprogressBarDialog.isActive()) {
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            mainContentPanel.removeAll();
                            mainServerPanel = new MainServerPanel(MainFrame.this);
                            mainContentPanel.add(mainServerPanel, BorderLayout.CENTER);
                            mainContentPanel.updateUI();
                        }
                    });
                }
            } else if (tab.equals("VM")) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        mainContentPanel.removeAll();
                        mainContentPanel.add(new VMMainPanel(MainFrame.this), BorderLayout.CENTER);
                        mainContentPanel.updateUI();
                    }
                });
            } else if (tab.equals("Keystone")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new KeystonePanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Flavor")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new FlavorPanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Storage")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new StoragePanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Network")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new SDNPanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            } else if (tab.equals("Setting")) {
                mainContentPanel.removeAll();
                mainContentPanel.add(new SettingPanel(MainFrame.this), BorderLayout.CENTER);
                mainContentPanel.updateUI();
            }
        }
    });
    ribbonTabbedPane.putClientProperty("type", "ribbonType");
    ribbonTabbedPane.setPreferredSize(new Dimension(1000, 140));
    ribbonPanel.add(ribbonTabbedPane, BorderLayout.CENTER);

    serverPanel = new JRibbonPanel();
    serverPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][grow][]", "[grow][grow][]"));
    ribbonTabbedPane.addTab("Server", null, serverPanel, null);

    logoutButton = new JRibbonBigButton("Logout");
    logoutButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            logout();
        }
    });

    rbnbgbtnAddServer = new JRibbonBigButton();
    rbnbgbtnAddServer.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    rbnbgbtnAddServer.setText("Add Server");
    serverPanel.add(rbnbgbtnAddServer, "cell 0 0 1 3,growy");

    rbnbgbtnDeleteServer = new JRibbonBigButton();
    rbnbgbtnDeleteServer
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    rbnbgbtnDeleteServer.setText("Delete Server");
    serverPanel.add(rbnbgbtnDeleteServer, "cell 1 0 1 3,growy");
    logoutButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/logout.png")));
    logoutButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    logoutButton.setHorizontalTextPosition(SwingConstants.CENTER);
    serverPanel.add(logoutButton, "cell 14 0 1 3,growy");

    vmPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("VM", null, vmPanel, null);
    vmPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][][grow][]", "[grow][grow][]"));

    launchButton = new JRibbonBigButton("Launch");
    launchButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new LaunchInstanceDialog(MainFrame.this).setVisible(true);
        }
    });
    launchButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/launch.png")));
    launchButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    launchButton.setHorizontalTextPosition(SwingConstants.CENTER);
    vmPanel.add(launchButton, "cell 0 0 1 3,growy");

    pauseButton = new JRibbonButton("Pause");
    pauseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova pause");
        }
    });
    pauseButton.setHorizontalAlignment(SwingConstants.LEFT);
    pauseButton.setIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_pause.png")));
    vmPanel.add(pauseButton, "cell 2 0,growx");

    stopButton = new JRibbonButton("Stop");
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova stop");
        }
    });
    stopButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/stop.png")));
    stopButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    stopButton.setHorizontalTextPosition(SwingConstants.CENTER);
    vmPanel.add(stopButton, "cell 1 0 1 3,growy");

    unpauseButton = new JRibbonButton("Unpause");
    unpauseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova unpause");
        }
    });
    unpauseButton.setHorizontalAlignment(SwingConstants.LEFT);
    unpauseButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_play.png")));

    suspendButton = new JRibbonButton("Suspend");
    suspendButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova suspend");
        }
    });
    suspendButton.setHorizontalAlignment(SwingConstants.LEFT);
    suspendButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/disk.png")));
    vmPanel.add(suspendButton, "cell 3 0,growx");

    softRebootButton = new JRibbonButton("Soft reboot");
    softRebootButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova soft-reboot");
        }
    });
    softRebootButton.setHorizontalAlignment(SwingConstants.LEFT);
    softRebootButton.setIcon(new ImageIcon(
            MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_rotate_clockwise.png")));

    selectAllVMButton = new JRibbonButton("Select all");
    selectAllVMButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.selectAll();
        }
    });
    vmPanel.add(selectAllVMButton, "cell 4 0,growx");
    vmPanel.add(softRebootButton, "cell 9 0,growx");

    createMacroButton = new JRibbonButton("Create macro");
    createMacroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png")));
    createMacroButton.setHorizontalAlignment(SwingConstants.LEFT);

    setGroupNameButton = new JRibbonButton("Set group name");
    setGroupNameButton.setHorizontalAlignment(SwingConstants.LEFT);
    setGroupNameButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.setGroupName();
        }
    });
    vmPanel.add(setGroupNameButton, "cell 10 0");
    vmPanel.add(createMacroButton, "cell 13 0,growx");

    ribbonSeparator_3 = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator_3, "cell 14 0 1 3,growy");
    vmPanel.add(unpauseButton, "cell 2 1,growx");

    remoteButton = new JRibbonButton("Remote");
    remoteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.remote();
        }
    });
    remoteButton.setHorizontalAlignment(SwingConstants.LEFT);
    remoteButton.setIcon(new ImageIcon(
            MainFrame.class.getResource("/com/titan/image/famfamfam/application_osx_terminal.png")));

    unselectAllButton = new JRibbonButton("Unselect all");
    unselectAllButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.unselectAll();
        }
    });
    vmPanel.add(unselectAllButton, "cell 4 1,growx");
    vmPanel.add(remoteButton, "cell 2 2,growx");

    performanceMeterButton = new JRibbonButton("Performance meter");
    performanceMeterButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_curve.png")));
    performanceMeterButton.setHorizontalAlignment(SwingConstants.LEFT);
    vmPanel.add(performanceMeterButton, "cell 13 1,growx");

    resumeButton = new JRibbonButton("Resume");
    resumeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova resume");
        }
    });
    resumeButton.setHorizontalAlignment(SwingConstants.LEFT);
    resumeButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/drive_disk.png")));
    vmPanel.add(resumeButton, "cell 3 1,growx");

    deleteButton = new JRibbonBigButton("Delete");
    deleteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova delete");
        }
    });
    vmPanel.add(deleteButton, "cell 7 0 1 3,alignx center,growy");
    deleteButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    deleteButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    deleteButton.setHorizontalTextPosition(SwingConstants.CENTER);

    logButton = new JRibbonBigButton("Log");
    logButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.log();
        }
    });
    vmPanel.add(logButton, "cell 6 0 1 3,alignx center,growy");
    logButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/log.png")));
    logButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    logButton.setHorizontalTextPosition(SwingConstants.CENTER);

    hardRebootButton = new JRibbonButton("Hard reboot");
    hardRebootButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0);
            vmMainPanel.action("from titan: nova hard-reboot");
        }
    });
    hardRebootButton.setHorizontalAlignment(SwingConstants.LEFT);
    hardRebootButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_undo.png")));

    ribbonSeparator = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator, "cell 5 0 1 3,alignx center,growy");

    ribbonSeparator_1 = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator_1, "cell 8 0 1 3,alignx center,growy");
    vmPanel.add(hardRebootButton, "cell 9 1,growx");

    ribbonSeparator_2 = new JRibbonSeparator();
    vmPanel.add(ribbonSeparator_2, "cell 11 0 1 3,grow");

    macroButton = new JRibbonBigButton("Macro");
    macroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/code.png")));
    macroButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    macroButton.setHorizontalTextPosition(SwingConstants.CENTER);
    vmPanel.add(macroButton, "cell 12 0 1 3,growy");

    snapshotButton = new JRibbonButton("Snapshot");
    snapshotButton.setHorizontalAlignment(SwingConstants.LEFT);
    snapshotButton.setIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/application_cascade.png")));
    vmPanel.add(snapshotButton, "cell 3 2,growx");

    advanceButton = new JRibbonButton("Advance");
    advanceButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    advanceButton.setHorizontalAlignment(SwingConstants.LEFT);
    advanceButton.setIcon(new ImageIcon(
            MainFrame.class.getResource("/com/titan/image/famfamfam/application_view_detail.png")));
    vmPanel.add(advanceButton, "cell 9 2,growx");

    executionMapButton = new JRibbonButton("Execution map");
    executionMapButton.setIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_organisation.png")));
    executionMapButton.setHorizontalAlignment(SwingConstants.LEFT);
    vmPanel.add(executionMapButton, "cell 13 2,growx");

    keystonePanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Keystone", null, keystonePanel, null);
    keystonePanel.setLayout(new MigLayout("", "[][][][][][][][][][]", "[grow][][][][]"));

    addUserButton = new JRibbonBigButton("Add user");
    addUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.addUser();
        }
    });
    addUserButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    addUserButton.setHorizontalTextPosition(SwingConstants.CENTER);
    addUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addUser.png")));
    keystonePanel.add(addUserButton, "cell 0 0 1 3,growy");

    editUserButton = new JRibbonButton("Edit user");
    editUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    editUserButton.setHorizontalAlignment(SwingConstants.LEFT);
    editUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    keystonePanel.add(editUserButton, "cell 1 0,growx");

    changePasswordButton = new JRibbonButton("Change password");
    keystonePanel.add(changePasswordButton, "cell 2 0");

    ribbonSeparator_4 = new JRibbonSeparator();
    keystonePanel.add(ribbonSeparator_4, "cell 3 0 1 3,growy");

    addRoleButton = new JRibbonBigButton("Add role");
    addRoleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.addRole();
        }
    });
    addRoleButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    addRoleButton.setHorizontalTextPosition(SwingConstants.CENTER);
    addRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addRole.png")));
    keystonePanel.add(addRoleButton, "cell 4 0 1 3,growy");

    deleteUserButton = new JRibbonButton("Delete user");
    deleteUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    deleteUserButton.setHorizontalAlignment(SwingConstants.LEFT);
    deleteUserButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));

    editRoleButton = new JRibbonButton("Edit role");
    editRoleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });
    editRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    editRoleButton.setHorizontalAlignment(SwingConstants.LEFT);
    keystonePanel.add(editRoleButton, "cell 5 0,growx");

    ribbonSeparator_5 = new JRibbonSeparator();
    keystonePanel.add(ribbonSeparator_5, "cell 6 0 1 3,growy");

    createTenantButton = new JRibbonBigButton("Create tenant");
    createTenantButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.createTenant();
        }
    });
    createTenantButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    createTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    createTenantButton.setHorizontalTextPosition(SwingConstants.CENTER);
    keystonePanel.add(createTenantButton, "cell 7 0 1 3,growy");

    deleteTenantButton = new JRibbonBigButton("Delete tenant");
    deleteTenantButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.deleteTenant();
        }
    });
    deleteTenantButton
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    deleteTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    deleteTenantButton.setHorizontalTextPosition(SwingConstants.CENTER);
    keystonePanel.add(deleteTenantButton, "cell 8 0 1 3,growy");
    keystonePanel.add(deleteUserButton, "cell 1 1,growx");

    detailUserButton = new JRibbonButton("Detail user");
    detailUserButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.showUserDetail();
        }
    });
    detailUserButton.setHorizontalAlignment(SwingConstants.LEFT);
    detailUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png")));
    keystonePanel.add(detailUserButton, "cell 1 2,growx");

    btnDeleteRole = new JRibbonButton("Delete role");
    btnDeleteRole.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.deleteRole();
        }
    });
    btnDeleteRole.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    keystonePanel.add(btnDeleteRole, "cell 5 1,growx");

    assignRoleButton = new JRibbonButton("Assign role");
    assignRoleButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0);
            keystonePanel.assignRole();
        }
    });
    assignRoleButton.setSelectedIcon(
            new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/user_add.png")));
    keystonePanel.add(assignRoleButton, "cell 5 2,growx");

    lblUser = new JRibbonLabel("user");
    keystonePanel.add(lblUser, "cell 0 3 2 1,growx");

    rbnlblRole = new JRibbonLabel("role");
    keystonePanel.add(rbnlblRole, "cell 4 3 2 1,growx");

    rbnlblTenant = new JRibbonLabel();
    rbnlblTenant.setText("tenant");
    keystonePanel.add(rbnlblTenant, "cell 7 3 2 1,growx");

    flavorPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Flavor", null, flavorPanel, null);
    flavorPanel.setLayout(new MigLayout("", "[][]", "[grow][][][]"));

    rbnbgbtnCreateFlavor = new JRibbonBigButton();
    rbnbgbtnCreateFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    rbnbgbtnCreateFlavor.setText("Create Flavor");
    flavorPanel.add(rbnbgbtnCreateFlavor, "cell 0 0 1 3,growy");

    btnDeleteFlavor = new JRibbonBigButton("Delete Flavor");
    btnDeleteFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png")));
    flavorPanel.add(btnDeleteFlavor, "cell 1 0 1 3,growy");

    storagePanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Storage", null, storagePanel, null);
    storagePanel.setLayout(new MigLayout("", "[][][][][][]", "[grow][][][]"));

    uploadImageButton = new JRibbonBigButton("Upload");
    uploadImageButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    uploadImageButton.setVerticalTextPosition(SwingConstants.BOTTOM);
    uploadImageButton.setHorizontalTextPosition(SwingConstants.CENTER);
    storagePanel.add(uploadImageButton, "cell 0 0 1 3, growy");

    btnDelete = new JRibbonButton("Delete");
    btnDelete.setHorizontalAlignment(SwingConstants.LEFT);
    btnDelete.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    storagePanel.add(btnDelete, "cell 1 0,growx");

    ribbonSeparator_6 = new JRibbonSeparator();
    storagePanel.add(ribbonSeparator_6, "cell 2 0 1 3,grow");

    btnCreateVolume = new JRibbonBigButton("Create volume");
    btnCreateVolume.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png")));
    btnCreateVolume.setVerticalTextPosition(SwingConstants.BOTTOM);
    btnCreateVolume.setHorizontalTextPosition(SwingConstants.CENTER);
    storagePanel.add(btnCreateVolume, "cell 3 0 1 3,growy");

    btnDelete_1 = new JRibbonButton("Delete");
    btnDelete_1.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    btnDelete_1.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnDelete_1, "cell 4 0,growx");

    btnAttach = new JRibbonButton("Attach to vm");
    btnAttach.setHorizontalAlignment(SwingConstants.LEFT);
    btnAttach.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/attach.png")));
    storagePanel.add(btnAttach, "cell 5 0,growx");

    btnChangeName = new JRibbonButton("Change name");
    btnChangeName.setHorizontalAlignment(SwingConstants.LEFT);
    btnChangeName.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    storagePanel.add(btnChangeName, "cell 1 1,growx");

    btnDetail = new JRibbonButton("Detail");
    btnDetail.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png")));
    btnDetail.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnDetail, "cell 4 1,growx");

    btnDetachToVm = new JRibbonButton("Detach to vm");
    btnDetachToVm.setHorizontalAlignment(SwingConstants.LEFT);
    btnDetachToVm.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/delete.png")));
    storagePanel.add(btnDetachToVm, "cell 5 1,growx");

    btnPublicprivate = new JRibbonButton("public/private");
    btnPublicprivate.setHorizontalAlignment(SwingConstants.LEFT);
    btnPublicprivate.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/tick.png")));
    storagePanel.add(btnPublicprivate, "cell 1 2,growx");

    btnAddVolumeType = new JRibbonButton("Add volume type");
    btnAddVolumeType.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png")));
    btnAddVolumeType.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnAddVolumeType, "cell 4 2");

    btnDeleteVolumeType = new JRibbonButton("Delete volume type");
    btnDeleteVolumeType
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    btnDeleteVolumeType.setHorizontalAlignment(SwingConstants.LEFT);
    storagePanel.add(btnDeleteVolumeType, "cell 5 2");

    rbnlblImage = new JRibbonLabel();
    rbnlblImage.setText("Image");
    storagePanel.add(rbnlblImage, "cell 0 3 2 1,growx");

    rbnlblVolume = new JRibbonLabel();
    rbnlblVolume.setText("Volume");
    storagePanel.add(rbnlblVolume, "cell 3 3 3 1,growx");

    networkPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Network", null, networkPanel, null);

    settingPanel = new JRibbonPanel();
    ribbonTabbedPane.addTab("Setting", null, settingPanel, null);
    settingPanel.setLayout(new MigLayout("", "[][][]", "[grow][grow][]"));

    rbnbgbtnSystemSetting = new JRibbonBigButton();
    rbnbgbtnSystemSetting
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/systemSetting.png")));
    rbnbgbtnSystemSetting.setText("System Setting");
    settingPanel.add(rbnbgbtnSystemSetting, "cell 0 0 1 3,growy");

    rbnbgbtnDatabase = new JRibbonBigButton();
    rbnbgbtnDatabase
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/database.png")));
    rbnbgbtnDatabase.setText("Database");
    settingPanel.add(rbnbgbtnDatabase, "cell 1 0 1 3,growy");

    rbnbtnAddGroup = new JRibbonButton();
    rbnbtnAddGroup.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png")));
    rbnbtnAddGroup.setText("Add Group");
    settingPanel.add(rbnbtnAddGroup, "cell 2 0");

    rbnbtnEditGroup = new JRibbonButton();
    rbnbtnEditGroup
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png")));
    rbnbtnEditGroup.setText("Edit Group");
    settingPanel.add(rbnbtnEditGroup, "cell 2 1");

    rbnbtnDeleteGroup = new JRibbonButton();
    rbnbtnDeleteGroup
            .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png")));
    rbnbtnDeleteGroup.setText("Delete Group");
    settingPanel.add(rbnbtnDeleteGroup, "cell 2 2");

    logoPanel = new JRibbonPanel();
    ribbonPanel.add(logoPanel, BorderLayout.WEST);
    logoPanel.setLayout(new BorderLayout(0, 0));
    logoPanel.add(logoLabel, BorderLayout.CENTER);

    setLocationRelativeTo(null);

    new Thread(new TitanServerUpdateThread()).start();
}

From source file:edu.brown.gui.CatalogViewer.java

/**
 * //from  w w  w . j a  v a  2 s  . c  om
 */
protected void viewerInit() {
    // ----------------------------------------------
    // MENU
    // ----------------------------------------------
    JMenu menu;
    JMenuItem menuItem;

    // 
    // File Menu
    //
    menu = new JMenu("File");
    menu.getPopupMenu().setLightWeightPopupEnabled(false);
    menu.setMnemonic(KeyEvent.VK_F);
    menu.getAccessibleContext().setAccessibleDescription("File Menu");
    menuBar.add(menu);

    menuItem = new JMenuItem("Open Catalog From File");
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Open Catalog From File");
    menuItem.addActionListener(this.menuHandler);
    menuItem.putClientProperty(MenuHandler.MENU_ID, MenuOptions.CATALOG_OPEN_FILE);
    menu.add(menuItem);

    menuItem = new JMenuItem("Open Catalog From Jar");
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Open Catalog From Project Jar");
    menuItem.addActionListener(this.menuHandler);
    menuItem.putClientProperty(MenuHandler.MENU_ID, MenuOptions.CATALOG_OPEN_JAR);
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem("Quit", KeyEvent.VK_Q);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Quit Program");
    menuItem.addActionListener(this.menuHandler);
    menuItem.putClientProperty(MenuHandler.MENU_ID, MenuOptions.QUIT);
    menu.add(menuItem);

    // ----------------------------------------------
    // CATALOG TREE PANEL
    // ----------------------------------------------
    this.catalogTree = new JTree();
    this.catalogTree.setEditable(false);
    this.catalogTree.setCellRenderer(new CatalogViewer.CatalogTreeRenderer());
    this.catalogTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    this.catalogTree.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) CatalogViewer.this.catalogTree
                    .getLastSelectedPathComponent();
            if (node == null)
                return;

            Object user_obj = node.getUserObject();
            String new_text = ""; // <html>";
            boolean text_mode = true;
            if (user_obj instanceof WrapperNode) {
                CatalogType catalog_obj = ((WrapperNode) user_obj).getCatalogType();
                new_text += CatalogViewer.this.getAttributesText(catalog_obj);
            } else if (user_obj instanceof AttributesNode) {
                AttributesNode wrapper = (AttributesNode) user_obj;
                new_text += wrapper.getAttributes();

            } else if (user_obj instanceof PlanTreeCatalogNode) {
                final PlanTreeCatalogNode wrapper = (PlanTreeCatalogNode) user_obj;
                text_mode = false;

                CatalogViewer.this.mainPanel.remove(0);
                CatalogViewer.this.mainPanel.add(wrapper.getPanel(), BorderLayout.CENTER);
                CatalogViewer.this.mainPanel.validate();
                CatalogViewer.this.mainPanel.repaint();

                if (SwingUtilities.isEventDispatchThread() == false) {
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            wrapper.centerOnRoot();
                        }
                    });
                } else {
                    wrapper.centerOnRoot();
                }

            } else {
                new_text += CatalogViewer.this.getSummaryText();
            }

            // Text Mode
            if (text_mode) {
                if (CatalogViewer.this.text_mode == false) {
                    CatalogViewer.this.mainPanel.remove(0);
                    CatalogViewer.this.mainPanel.add(CatalogViewer.this.textInfoPanel);
                }
                CatalogViewer.this.textInfoTextArea.setText(new_text);

                // Scroll to top
                CatalogViewer.this.textInfoTextArea.grabFocus();
            }

            CatalogViewer.this.text_mode = text_mode;
        }
    });
    this.generateCatalogTree(this.catalog, this.catalog_file_path.getName());

    //
    // Text Information Panel
    //
    this.textInfoPanel = new JPanel();
    this.textInfoPanel.setLayout(new BorderLayout());
    this.textInfoTextArea = new JTextArea();
    this.textInfoTextArea.setEditable(false);
    this.textInfoTextArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    this.textInfoTextArea.setText(this.getSummaryText());
    this.textInfoTextArea.addFocusListener(new FocusListener() {
        @Override
        public void focusLost(FocusEvent e) {
            // TODO Auto-generated method stub
        }

        @Override
        public void focusGained(FocusEvent e) {
            CatalogViewer.this.scrollTextInfoToTop();
        }
    });
    this.textInfoScroller = new JScrollPane(this.textInfoTextArea);
    this.textInfoPanel.add(this.textInfoScroller, BorderLayout.CENTER);
    this.mainPanel = new JPanel(new BorderLayout());
    this.mainPanel.add(textInfoPanel, BorderLayout.CENTER);

    //
    // Search Toolbar
    //
    JPanel searchPanel = new JPanel();
    searchPanel.setLayout(new BorderLayout());
    JPanel innerSearchPanel = new JPanel();
    innerSearchPanel.setLayout(new BoxLayout(innerSearchPanel, BoxLayout.X_AXIS));
    innerSearchPanel.add(new JLabel("Search: "));
    this.searchField = new JTextField(30);
    innerSearchPanel.add(this.searchField);
    searchPanel.add(innerSearchPanel, BorderLayout.EAST);

    this.searchField.addKeyListener(new KeyListener() {
        private String last = null;

        @Override
        public void keyReleased(KeyEvent e) {
            String value = CatalogViewer.this.searchField.getText().toLowerCase().trim();
            if (!value.isEmpty() && (this.last == null || !this.last.equals(value))) {
                CatalogViewer.this.search(value);
            }
            this.last = value;
        }

        @Override
        public void keyTyped(KeyEvent e) {
            // Do nothing...
        }

        @Override
        public void keyPressed(KeyEvent e) {
            // Do nothing...
        }
    });

    // Putting it all together
    JScrollPane scrollPane = new JScrollPane(this.catalogTree);
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    topPanel.add(searchPanel, BorderLayout.NORTH);
    topPanel.add(scrollPane, BorderLayout.CENTER);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, topPanel, this.mainPanel);
    splitPane.setDividerLocation(400);

    this.add(splitPane, BorderLayout.CENTER);
}

From source file:gov.nij.er.ui.EntityResolutionDemo.java

private void createUIWidgets() {
    resolvedDataTree = new JTree();
    rawDataTree = new JTree();
    parametersTable = new JTable();
    resolveButton = new JButton("Resolve");
    rawRecordCountLabel = new JLabel();
    resolvedRecordCountLabel = new JLabel();
    filterForSelectedCheckBox = new JCheckBox("Filter Raw Data For Selected");
    algorithmComboBox = new JComboBox();
}

From source file:com.orthancserver.SelectImageDialog.java

public SelectImageDialog() {
    tree_ = new JTree();

    tree_.addTreeWillExpandListener(new TreeWillExpandListener() {
        @Override//from  w  w  w . j a va 2 s. com
        public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
            TreePath path = event.getPath();
            if (path.getLastPathComponent() instanceof MyTreeNode) {
                MyTreeNode node = (MyTreeNode) path.getLastPathComponent();
                node.LoadChildren((DefaultTreeModel) tree_.getModel());
            }
        }

        @Override
        public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
        }
    });

    tree_.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            TreePath path = e.getNewLeadSelectionPath();
            if (path != null) {
                MyTreeNode node = (MyTreeNode) path.getLastPathComponent();
                if (node.UpdatePreview(preview_)) {
                    selectedType_ = node.GetResourceType();
                    selectedUuid_ = node.GetUuid();
                    selectedConnection_ = node.GetConnection();
                    okButton_.setEnabled(true);
                }

                removeServer_.setEnabled(node.GetResourceType() == ResourceType.SERVER);
            }
        }
    });

    tree_.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            TreePath path = tree_.getPathForLocation(e.getX(), e.getY());
            if (path != null) {
                MyTreeNode node = (MyTreeNode) path.getLastPathComponent();
                if (e.getClickCount() == 2 && node.GetResourceType() == ResourceType.INSTANCE) {
                    // Double click on an instance, close the dialog
                    isSuccess_ = true;
                    setVisible(false);
                }
            }
        }
    });

    final JPanel contentPanel = new JPanel();
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        JSplitPane splitPane = new JSplitPane();
        splitPane.setResizeWeight(0.6);
        contentPanel.add(splitPane);

        splitPane.setLeftComponent(new JScrollPane(tree_));
        splitPane.setRightComponent(preview_);
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton btnAddServer = new JButton("Add server");
            btnAddServer.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    OrthancConfigurationDialog dd = new OrthancConfigurationDialog();
                    dd.setLocationRelativeTo(null); // Center dialog on screen

                    OrthancConnection orthanc = dd.ShowModal();
                    if (orthanc != null) {
                        AddOrthancServer(orthanc);
                        ((DefaultTreeModel) tree_.getModel()).reload();
                    }
                }
            });
            buttonPane.add(btnAddServer);
        }

        {
            buttonPane.add(removeServer_);
            removeServer_.setEnabled(false);

            removeServer_.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    MyTreeNode selected = (MyTreeNode) tree_.getLastSelectedPathComponent();
                    if (selected.GetResourceType() == ResourceType.SERVER && JOptionPane.showConfirmDialog(null,
                            "Remove server \"" + selected.getUserObject() + "\"?", "WARNING",
                            JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                        ((DefaultTreeModel) tree_.getModel()).removeNodeFromParent(selected);
                    }
                }
            });
        }

        {
            okButton_.setEnabled(false);
            okButton_.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    isSuccess_ = true;
                    setVisible(false);
                }
            });
            buttonPane.add(okButton_);
            getRootPane().setDefaultButton(okButton_);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    setVisible(false);
                }
            });
            buttonPane.add(cancelButton);
        }
    }

    setUndecorated(false);
    setSize(500, 500);
    setTitle("Select some series or some instance in Orthanc");
    setModal(true);
}

From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java

private final void createComponents() throws RemoteException {
    profilingSymbolTable = new JTable();
    profilingMsgTable = new JTable();
    programTree = new JTree();
    buildProgramTreeNodes();//  ww  w  .  ja  v  a  2  s.  c  o  m
    mtbAssignmentData = mtbaManager.getMoteTestbedAssignmentList(testbed.getID());
}

From source file:edu.ku.brc.af.tasks.subpane.formeditor.ViewSetSelectorPanel.java

/**
 * //from  w ww.  j a v a 2 s .c om
 */
@SuppressWarnings("unchecked") //$NON-NLS-1$
public ViewSetSelectorPanel(final BasicFormPreviewPanel previewPanel) {
    this.previewPanel = previewPanel;

    Vector<String> levelsVec = new Vector<String>();
    SpecifyUser user = AppContextMgr.getInstance().getClassObject(SpecifyUser.class);
    @SuppressWarnings("unused")
    Hashtable<Discipline, Boolean> usedColTypes = new Hashtable<Discipline, Boolean>();

    levelsVec.add(user.getUserType());

    //        for (Agent agent : user.getAgents())
    //        {
    //            // XXX Commented Out
    //            /*Discipline ct = agent.getDiscipline();
    //            if (usedColTypes.get(ct) == null)
    //            {
    //                levelsVec.add(ct.getName());
    //                usedColTypes.put(ct, true);
    //            }*/
    //        }
    levelsVec.add("BackStop"); //$NON-NLS-1$

    addBtn = UIHelper.createIconBtn("PlusSign", "", new ActionListener() { //$NON-NLS-1$ //$NON-NLS-2$
        public void actionPerformed(ActionEvent arg0) {
            addControl();
        }
    });

    delBtn = UIHelper.createIconBtn("MinusSign", "", new ActionListener() { //$NON-NLS-1$ //$NON-NLS-2$
        public void actionPerformed(ActionEvent arg0) {
            delControl(TYPE.SelectedObj);
        }
    });

    ActionListener addViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addView();
        }
    };

    ActionListener delViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            delView();
        }
    };

    viewControlPanel = new EditDeleteAddPanel(null, delViewAL, addViewAL);

    ActionListener addAltViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addAltView();
        }
    };

    ActionListener delAltViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            delAltView();
        }
    };

    altViewControlPanel = new EditDeleteAddPanel(null, delAltViewAL, addAltViewAL);

    ActionListener addDefViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addViewDef();
        }
    };

    ActionListener delDefViewAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            delViewDef();
        }
    };

    viewDefControlPanel = new EditDeleteAddPanel(null, delDefViewAL, addDefViewAL);

    ActionListener saveAL = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            save();
        }
    };
    EditDeleteAddPanel saveControlPanel = new EditDeleteAddPanel(null, null, saveAL);
    saveControlPanel.getAddBtn().setIcon(IconManager.getIcon("Save", IconManager.IconSize.Std16)); //$NON-NLS-1$
    saveControlPanel.getAddBtn().setEnabled(true);

    setLayout(new BorderLayout());

    levelsList = new JList(levelsVec);
    panel = new EditorPropPanel(controlHash, subcontrolHash, null, true, this);
    //panel.setFormViewDef(null);

    PanelBuilder pb = new PanelBuilder(new FormLayout("p,4px,p, 6px,10px,6px, p,6px,p, 6px,10px,6px, p,f:p:g", //$NON-NLS-1$
            "p,2px,f:p:g,2px,p,10px,p,4px")); //$NON-NLS-1$
    CellConstraints cc = new CellConstraints();

    String[] labels = new String[] { "User Level", "ViewSets", " ", "Views", "AltViews", " ", "View Defs" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
    int x = 1;
    for (String label : labels) {
        pb.add(createLabel(label, SwingConstants.CENTER), cc.xy(x, 1));
        x += 2;
    }

    Color vsFGColor = new Color(224, 224, 224);
    Color vsBGColor = new Color(124, 124, 124);

    Dimension ps = new Dimension(200, 150);

    x = 1;
    JScrollPane sp = createScrollPane(levelsList);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    viewSetsList = new JList(new DefaultListModel());
    sp = createScrollPane(viewSetsList);
    sp.setPreferredSize(ps);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    pb.add(new VerticalSeparator(vsFGColor, vsBGColor), cc.xy(x, 3));
    x += 2;

    viewsList = new JList(new DefaultListModel());
    sp = new JScrollPane(viewsList, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sp.setPreferredSize(ps);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    altViewsList = new JList(new DefaultListModel());
    sp = createScrollPane(altViewsList);
    sp.setPreferredSize(ps);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    pb.add(new VerticalSeparator(vsFGColor, vsBGColor), cc.xy(x, 3));
    x += 2;

    viewDefsList = new JList(new DefaultListModel());
    sp = createScrollPane(viewDefsList);
    sp.setPreferredSize(ps);
    pb.add(sp, cc.xy(x, 3));
    x += 2;

    pb.add(saveControlPanel, cc.xy(1, 5));
    //pb.add(createLabel(" "),     cc.xy(3, 5));
    //pb.add(createLabel(" "),     cc.xy(5, 5));
    pb.add(viewControlPanel, cc.xy(7, 5));
    pb.add(altViewControlPanel, cc.xy(9, 5));
    //pb.add(createLabel(" "),     cc.xy(11, 5));
    pb.add(viewDefControlPanel, cc.xy(13, 5));

    pb.addSeparator("View Def Editor", cc.xywh(1, 7, 13, 1)); //$NON-NLS-1$

    add(pb.getPanel(), BorderLayout.NORTH);

    pb = new PanelBuilder(new FormLayout("max(250px;p),4px,f:p:g", "t:p")); //$NON-NLS-1$ //$NON-NLS-2$

    PanelBuilder inner = new PanelBuilder(new FormLayout("max(250px;p)", "t:p,2px,t:p")); //$NON-NLS-1$ //$NON-NLS-2$
    tree = new JTree();
    ((DefaultTreeModel) tree.getModel()).setRoot(null);
    sp = createScrollPane(tree);
    inner.add(sp, cc.xy(1, 1));

    PanelBuilder btnPb = new PanelBuilder(new FormLayout("f:p:g,p,2px,p", "p")); //$NON-NLS-1$ //$NON-NLS-2$
    btnPb.add(delBtn, cc.xy(2, 1));
    btnPb.add(addBtn, cc.xy(4, 1));
    inner.add(btnPb.getPanel(), cc.xy(1, 3));

    pb.add(inner.getPanel(), cc.xy(1, 1));
    pb.add(panel, cc.xy(3, 1));

    add(pb.getPanel(), BorderLayout.CENTER);

    tree.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            treeSelected();
        }
    });

    levelsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                levelSelected();
            }
        }
    });

    viewSetsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                viewSetSelected();
            }
        }
    });

    viewsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                viewSelected();
            }
        }
    });

    altViewsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                altViewSelected();
            }
        }
    });

    viewDefsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                viewDefSelected();
            }
        }
    });

    tree.addMouseListener(new MouseAdapter() {

        protected void doPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
                int xc = e.getX();
                int yc = e.getY();
                TreePath path = tree.getPathForLocation(xc, yc);
                if (path != null) {
                    tree.setSelectionPath(path);
                }

                treeSelected();

                DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) tree.getSelectionModel()
                        .getSelectionPath().getLastPathComponent();

                if (selectedCell != null || selectedRow != null) {
                    new TreePopupMenu((Component) e.getSource(), e, selectedCell);

                } else if (selectedNode.getUserObject() instanceof FormViewDef) {
                    new TreePopupMenu((Component) e.getSource(), e);
                }
            }
        }

        public void mouseReleased(MouseEvent e) {
            doPopup(e);
        }

        public void mousePressed(MouseEvent e) {
            doPopup(e);
        }
    });

    XStream xstream = new XStream();
    xstream.alias("control", Control.class); //$NON-NLS-1$
    xstream.useAttributeFor(Control.class, "type"); //$NON-NLS-1$
    xstream.useAttributeFor(Attr.class, "type"); //$NON-NLS-1$
    xstream.useAttributeFor(Attr.class, "name"); //$NON-NLS-1$
    xstream.useAttributeFor(Attr.class, "required"); //$NON-NLS-1$
    xstream.useAttributeFor(Attr.class, "defaultValue"); //$NON-NLS-1$
    xstream.aliasAttribute("default", "defaultValue"); //$NON-NLS-1$ //$NON-NLS-2$

    xstream.alias("uicontrols", Vector.class); //$NON-NLS-1$
    xstream.alias("attr", Attr.class); //$NON-NLS-1$
    xstream.alias("param", Param.class); //$NON-NLS-1$
    xstream.alias("subcontrol", SubControl.class); //$NON-NLS-1$
    xstream.aliasAttribute("desc", "desc"); //$NON-NLS-1$ //$NON-NLS-2$
    xstream.aliasAttribute(Attr.class, "values", "values"); //$NON-NLS-1$ //$NON-NLS-2$
    xstream.useAttributeFor(SubControl.class, "type"); //$NON-NLS-1$

    try {
        controls = (Vector<Control>) xstream.fromXML(FileUtils.readFileToString(new File("UIControls.xml"))); //$NON-NLS-1$
        for (Control control : controls) {
            controlHash.put(control.getType(), control);
            if (control.getSubcontrols() != null) {
                for (SubControl sc : control.getSubcontrols()) {
                    //System.out.println(" ["+sc.getType()+"]  ");
                    subcontrolHash.put(sc.getType(), sc);
                }
            }
        }

    } catch (IOException ex) {
        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ViewSetSelectorPanel.class, ex);
        ex.printStackTrace();
    }
}

From source file:eu.europa.ec.markt.dss.applet.util.ComponentFactory.java

/**
 * //  ww  w  .  j  av a2 s. com
 * @param name
 * @param model
 * @param cellRenderer
 * @return
 */
public static JTree tree(final String name, final TreeModel model, final TreeCellRenderer cellRenderer) {
    final JTree tree = new JTree();
    tree.setName(name);
    tree.setModel(model);
    if (cellRenderer != null) {
        tree.setCellRenderer(cellRenderer);
    }
    return tree;
}

From source file:net.openbyte.gui.WorkFrame.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Gary Lee
    menuBar1 = new JMenuBar();
    menu2 = new JMenu();
    menuItem8 = new JMenuItem();
    menuItem6 = new JMenuItem();
    menuItem4 = new JMenuItem();
    menuItem5 = new JMenuItem();
    menu3 = new JMenu();
    menuItem7 = new JMenuItem();
    menu6 = new JMenu();
    menuItem11 = new JMenuItem();
    menu1 = new JMenu();
    menuItem1 = new JMenuItem();
    menuItem2 = new JMenuItem();
    menuItem3 = new JMenuItem();
    menu4 = new JMenu();
    menuItem9 = new JMenuItem();
    menu5 = new JMenu();
    menuItem10 = new JMenuItem();
    scrollPane3 = new JScrollPane();
    tree1 = new JTree();
    rTextScrollPane1 = new RTextScrollPane();
    rSyntaxTextArea1 = new RSyntaxTextArea();

    //======== this ========
    setTitle("Project Workspace");
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS));

    //======== menuBar1 ========
    {//from   ww w. j  a v  a2s  . com

        //======== menu2 ========
        {
            menu2.setText("File");

            //---- menuItem8 ----
            menuItem8.setText("Add Class");
            menuItem8.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem8ActionPerformed(e);
                }
            });
            menu2.add(menuItem8);

            //---- menuItem6 ----
            menuItem6.setText("Add Package");
            menuItem6.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem6ActionPerformed(e);
                }
            });
            menu2.add(menuItem6);

            //---- menuItem4 ----
            menuItem4.setText("Save");
            menuItem4.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem4ActionPerformed(e);
                }
            });
            menu2.add(menuItem4);

            //---- menuItem5 ----
            menuItem5.setText("Close Project");
            menuItem5.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem5ActionPerformed(e);
                }
            });
            menu2.add(menuItem5);
        }
        menuBar1.add(menu2);

        //======== menu3 ========
        {
            menu3.setText("Edit");

            //---- menuItem7 ----
            menuItem7.setText("Delete");
            menuItem7.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem7ActionPerformed(e);
                }
            });
            menu3.add(menuItem7);
        }
        menuBar1.add(menu3);

        //======== menu6 ========
        {
            menu6.setText("View");

            //---- menuItem11 ----
            menuItem11.setText("Output");
            menuItem11.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem11ActionPerformed(e);
                }
            });
            menu6.add(menuItem11);
        }
        menuBar1.add(menu6);

        //======== menu1 ========
        {
            menu1.setText("Gradle");

            //---- menuItem1 ----
            menuItem1.setText("Run Client");
            menuItem1.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem1ActionPerformed(e);
                }
            });
            menu1.add(menuItem1);

            //---- menuItem2 ----
            menuItem2.setText("Run Server");
            menuItem2.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem2ActionPerformed(e);
                }
            });
            menu1.add(menuItem2);

            //---- menuItem3 ----
            menuItem3.setText("Build Mod JAR");
            menuItem3.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem3ActionPerformed(e);
                }
            });
            menu1.add(menuItem3);
        }
        menuBar1.add(menu1);

        //======== menu4 ========
        {
            menu4.setText("Git");

            //---- menuItem9 ----
            menuItem9.setText("Import into Git");
            menuItem9.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    menuItem9ActionPerformed(e);
                    menuItem9ActionPerformed(e);
                }
            });
            menu4.add(menuItem9);

            //======== menu5 ========
            {
                menu5.setText("Options");
                menu5.setEnabled(false);

                //---- menuItem10 ----
                menuItem10.setText("Commit");
                menuItem10.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        menuItem10ActionPerformed(e);
                    }
                });
                menu5.add(menuItem10);
            }
            menu4.add(menu5);
        }
        menuBar1.add(menu4);
    }
    setJMenuBar(menuBar1);

    //======== scrollPane3 ========
    {
        scrollPane3.setBorder(null);

        //---- tree1 ----
        tree1.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "File Manager"));
        tree1.setBackground(new Color(240, 240, 240));
        tree1.setPreferredSize(new Dimension(-600, 85));
        tree1.addTreeSelectionListener(new TreeSelectionListener() {
            @Override
            public void valueChanged(TreeSelectionEvent e) {
                tree1ValueChanged(e);
            }
        });
        scrollPane3.setViewportView(tree1);
    }
    contentPane.add(scrollPane3);

    //======== rTextScrollPane1 ========
    {
        rTextScrollPane1.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "Code Editor"));

        //---- rSyntaxTextArea1 ----
        rSyntaxTextArea1.setSyntaxEditingStyle("text/java");
        rSyntaxTextArea1.setBackground(Color.white);
        rTextScrollPane1.setViewportView(rSyntaxTextArea1);
    }
    contentPane.add(rTextScrollPane1);
    setSize(1230, 785);
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java

/**
 * Mostly created by Eclipse WindowBuilder
 *//*from   w  w  w .  j  a  v a 2 s .c  o  m*/
private void initComponents() {
    setTitle("perfLoad - Load Profile Configurator");
    setSize(1032, 984);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    SwingUtils.setUIFontStyle(Font.PLAIN);
    {
        JMenuBar menuBar = new JMenuBar();
        menuBar.setName("menuBar");
        setJMenuBar(menuBar);
        initMenuBar(menuBar);
    }

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new MigLayout("insets 0", "[grow][]", "[25px][400][grow]"));
    {
        JToolBar toolBar = new JToolBar() {
            @Override
            protected JButton createActionComponent(final Action a) {
                JButton button = super.createActionComponent(a);
                button.setFocusable(false);
                button.setHideActionText(false);
                return button;
            }
        };
        toolBar.setName("toolBar");
        contentPane.add(toolBar, "cell 0 0 2 1,growx,aligny top");
        initToolBar(toolBar);
    }
    {
        JScrollPane spTree = new JScrollPane();
        spTree.setBorder(new CompoundBorder(
                new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Load Profile Elements",
                        TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)),
                new EmptyBorder(4, 4, 4, 4)));
        contentPane.add(spTree, "cell 0 1,grow");
        spTree.setName("spTree");
        {
            tree = new JTree();
            tree.addKeyListener(new TreeKeyListener());
            tree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
            tree.addTreeSelectionListener(new TreeTreeSelectionListener());
            tree.setShowsRootHandles(true);
            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.setName("tree");
            spTree.setViewportView(tree);
        }
    }
    {
        JPanel pnlMain = new JPanel();
        contentPane.add(pnlMain, "cell 1 1");
        pnlMain.setName("pnlMain");
        pnlMain.setLayout(new MigLayout("insets 0", "[664!]", "[grow][]"));
        {
            JPanel pnlLoadProfileProperties = new JPanel();
            pnlLoadProfileProperties.setBorder(new TitledBorder(null, "Load Profile Properties",
                    TitledBorder.LEADING, TitledBorder.TOP, null, null));
            pnlLoadProfileProperties.setName("pnlLoadProfileProperties");
            pnlMain.add(pnlLoadProfileProperties, "flowx,cell 0 0,grow");
            pnlLoadProfileProperties
                    .setLayout(new MigLayout("insets 4", "[270,grow]8[]8[200]8[]8[200]", "[][][][grow]"));
            {
                lblName = new JLabel("Name");
                lblName.setDisplayedMnemonic('N');
                lblName.setHorizontalAlignment(SwingConstants.CENTER);
                lblName.setName("lblName");
                pnlLoadProfileProperties.add(lblName, "cell 0 0");
            }
            {
                JSeparator separator = new JSeparator();
                separator.setPreferredSize(new Dimension(0, 200));
                separator.setOrientation(SwingConstants.VERTICAL);
                separator.setName("separator");
                pnlLoadProfileProperties.add(separator, "cell 1 0 1 4, growy");
            }
            {
                JLabel lblClient = new JLabel("Clients");
                lblClient.setName("lblClient");
                pnlLoadProfileProperties.add(lblClient, "cell 2 0");
            }
            {
                JSeparator separator = new JSeparator();
                separator.setPreferredSize(new Dimension(0, 200));
                separator.setOrientation(SwingConstants.VERTICAL);
                separator.setName("separator");
                pnlLoadProfileProperties.add(separator, "cell 3 0 1 4, growy");
            }
            {
                lblTargets = new JLabel("Targets");
                lblTargets.setName("lblTargets");
                pnlLoadProfileProperties.add(lblTargets, "cell 4 0");
            }
            {
                txtName = new JTextField();
                lblName.setLabelFor(txtName);
                txtName.setColumns(10);
                txtName.setName("txtName");
                txtName.getDocument().addDocumentListener(dirtyListener);
                pnlLoadProfileProperties.add(txtName, "cell 0 1,growx");
            }
            {
                JScrollPane spClients = new JScrollPane();
                spClients.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spClients.setName("spClients");
                pnlLoadProfileProperties.add(spClients, "cell 2 1 1 3,grow");
                {
                    tblClients = new JCheckListTable();
                    tblClients.setName("tblClients");
                    spClients.setViewportView(tblClients);
                    spClients.setColumnHeaderView(null);
                }
            }
            {
                JScrollPane spTargets = new JScrollPane();
                spTargets.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spTargets.setName("spTargets");
                pnlLoadProfileProperties.add(spTargets, "cell 4 1 1 3,grow");
                {
                    tblTargets = new JCheckListTable();
                    tblTargets.setName("tblTargets");
                    spTargets.setViewportView(tblTargets);
                    spTargets.setColumnHeaderView(null);
                }
            }
            {
                lblDescription = new JLabel("Description");
                lblDescription.setDisplayedMnemonic('D');
                lblDescription.setName("lblDescription");
                pnlLoadProfileProperties.add(lblDescription, "cell 0 2");
            }
            {
                JScrollPane spDescription = new JScrollPane();
                spDescription.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spDescription.setName("spDescription");
                pnlLoadProfileProperties.add(spDescription, "cell 0 3,height 50:50:,grow");
                {
                    taDescription = new JTextArea();
                    taDescription.setFont(txtName.getFont());
                    lblDescription.setLabelFor(taDescription);
                    taDescription.setRows(3);
                    taDescription.setName("taDescription");
                    taDescription.getDocument().addDocumentListener(dirtyListener);
                    spDescription.setViewportView(taDescription);
                }
            }
        }
        {
            JPanel pnlCurveAssignment = new JPanel();
            pnlCurveAssignment.setBorder(new TitledBorder(null, "Active Load Curve Assignment",
                    TitledBorder.LEADING, TitledBorder.TOP, null, null));
            pnlMain.add(pnlCurveAssignment, "cell 0 1,grow");
            pnlCurveAssignment.setLayout(new MigLayout("insets 4", "[grow]", "[grow][]"));
            {
                pnlCard = new JPanel();
                pnlCard.setName("pnlCard");
                pnlCurveAssignment.add(pnlCard, "cell 0 0,grow");
                cardLayout = new CardLayout(0, 0);
                pnlCard.setLayout(cardLayout);
                {
                    stairsPanel = new StairsPanel();
                    stairsPanel.setName("stairsPanel");
                    pnlCard.add(stairsPanel, "stairs");
                }
                {
                    oneTimePanel = new OneTimePanel();
                    oneTimePanel.setName("oneTimePanel");
                    pnlCard.add(oneTimePanel, "oneTime");
                }
                {
                    markerPanel = new MarkerPanel();
                    markerPanel.setName("markerPanel");
                    pnlCard.add(markerPanel, "marker");
                }
                {
                    JLabel lblNoActiveCurve = new JLabel("no active curve assignment");
                    lblNoActiveCurve.setHorizontalAlignment(SwingConstants.CENTER);
                    pnlCard.add(lblNoActiveCurve, "none");
                    lblNoActiveCurve.setName("lblNoActiveCurve");
                }
            }
            {
                btnOk = new JButtonExt("OK");
                getRootPane().setDefaultButton(btnOk);
                btnOk.setEnabled(false);
                btnOk.addActionListener(new BtnOkActionListener());
                btnOk.setMnemonic(KeyEvent.VK_O);
                btnOk.setName("btnOk");
                pnlCurveAssignment.add(btnOk, "cell 0 1,alignx right");
            }
            {
                btnCancel = new JButtonExt("Cancel");
                btnCancel.setEnabled(false);
                btnCancel.addActionListener(new BtnCancelActionListener());
                btnCancel.setMnemonic(KeyEvent.VK_C);
                btnCancel.setName("btnCancel");
                pnlCurveAssignment.add(btnCancel, "cell 0 1,alignx right");
            }
        }
    }
}