Example usage for javax.swing JTabbedPane getSelectedIndex

List of usage examples for javax.swing JTabbedPane getSelectedIndex

Introduction

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

Prototype

@Transient
public int getSelectedIndex() 

Source Link

Document

Returns the currently selected index for this tabbedpane.

Usage

From source file:com.mc.printer.model.panel.task.BuildGuideTask.java

@Override
public Object doBackgrounp() {
    javax.swing.JTabbedPane tabs = AutoPrinterApp.getMainView().getMainWorkPanel();
    if (tabs != null) {
        if (tabs.getSelectedIndex() >= 0) {
            Component selectedcom = tabs.getSelectedComponent();
            if (selectedcom instanceof GuideWork) {
                GuideWork selectPanel = (GuideWork) selectedcom;
                GuideBean presentBeansForm = selectPanel.getBeansForm();

                logger.debug("selected tab:" + selectPanel.getName());
                //?
                GuideBean beansForm;/*from ww w .j a  v  a 2  s  . c om*/
                try {
                    beansForm = presentBeansForm.clone();
                } catch (CloneNotSupportedException ex) {
                    logger.error(ex.getMessage());
                    beansForm = presentBeansForm;
                }

                String backGroundImg = beansForm.getBackgoundImg();

                //
                Set<String> imgArray = new HashSet();

                if (backGroundImg != null) {
                    File file = new File(backGroundImg);
                    if (file.exists() && file.isFile()) {
                        beansForm.setBackgoundImg(file.getName());
                        imgArray.add(backGroundImg);
                    } else {
                        beansForm.setBackgoundImg("");
                    }
                } else {
                    beansForm.setBackgoundImg("");
                }

                HashMap<String, GuideCompBean> parameterMap = new HashMap<String, GuideCompBean>();
                HashMap<String, GuideCompBean> parentParameterMap = selectPanel.getSavedForms();
                deepCloneMap(parameterMap, parentParameterMap);

                if (parameterMap.size() > 0) {
                    Set set = parameterMap.keySet();
                    //???
                    List<GuideCompBean> beans = new ArrayList();
                    Iterator it = set.iterator();
                    while (it.hasNext()) {
                        GuideCompBean com = parameterMap.get(it.next().toString());
                        beans.add(com);

                        String pressedIcon = com.getPressedIcon();
                        String icon = com.getIcon();
                        if (pressedIcon != null && !pressedIcon.equals("")) {

                            File pressfile = new File(pressedIcon);
                            if (pressfile.exists() && pressfile.isFile()) {
                                imgArray.add(pressedIcon);
                                com.setPressedIcon(pressfile.getName());
                            } else {
                                com.setPressedIcon("");
                            }

                        }
                        if (icon != null && !icon.equals("")) {
                            File iconfile = new File(icon);
                            if (iconfile.exists() && iconfile.isFile()) {
                                imgArray.add(icon);
                                com.setIcon(iconfile.getName());
                            } else {
                                com.setIcon("");
                            }
                        }
                    }
                    beansForm.setElements(beans);

                    BaseFileChoose fileChoose = new BaseFileChoose("?",
                            new String[] { Constants.MODEL_SUFFIX }, AutoPrinterApp.getMainFrame());
                    String selectedPath = fileChoose.showSaveDialog();
                    if (!selectedPath.trim().equals("")) {

                        //get formname
                        selectedPath = selectedPath + File.separator + beansForm.getGuideName();
                        //String time=DateHelper.format(new Date(), "yyyyMMddHHmmss");
                        String finalZip = selectedPath;
                        if (!selectedPath.endsWith("." + Constants.GUIDE_SUFFIX)) {
                            finalZip = selectedPath + "." + Constants.GUIDE_SUFFIX;
                        }

                        String tempDir = selectedPath + File.separator + Constants.GUIDE_TEMP_DIR;

                        String xmlPath = tempDir + File.separator + beansForm.getGuideName() + ".xml";
                        XMLHelper helper = new XMLHelper(xmlPath, beansForm);
                        try {
                            helper.write();
                        } catch (JAXBException ex) {
                            ex.printStackTrace();
                            logger.error(ex.getMessage());
                            return ex;
                        }

                        File paramFile = new File(xmlPath);
                        if (paramFile.isFile() && paramFile.exists()) {
                            try {
                                logger.info("copy file and zip temp for:" + tempDir + ",total of attached file:"
                                        + imgArray.size());
                                File _temp = new File(tempDir);
                                for (String img : imgArray) {
                                    File imgFile = new File(img);
                                    logger.debug("copy image:" + imgFile.getName());
                                    FileUtils.copyFileToDirectory(imgFile, _temp);
                                }

                                ZipHelper.createZip(tempDir, finalZip);
                                logger.info("zip file successfully.");
                                return "??.\r\n" + finalZip;
                            } catch (IOException ex) {
                                ex.printStackTrace();
                                logger.error(ex.getMessage());
                                return ex;
                            } finally {
                                try {
                                    FileUtils.deleteDirectory(new File(selectedPath));
                                } catch (IOException ex) {
                                    ex.printStackTrace();
                                    logger.error(ex.getMessage());
                                    return ex;
                                }
                            }
                        } else {
                            logger.error("generator faild for:" + xmlPath);
                        }
                    }
                } else {
                    return "??.";
                }
            } else {
                return "??????.";
            }
        } else {
            return "?.";
        }
    } else {
        return "?.";
    }
    return null;
}

From source file:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyMain.java

/**
 * This method initializes jTabbedPane   
 *    //  w  ww. j ava 2  s  .  c o  m
 * @return javax.swing.JTabbedPane   
 */
public JTabbedPane getJTabbedPaneFileNavigation() {

    if (jTabbedPaneFileNavigation == null) {
        jTabbedPaneFileNavigation = new JTabbedPane();
        jTabbedPaneFileNavigation.addTab("Tree", null, getJScrollPaneTree(), null);
        jTabbedPaneFileNavigation.addTab("List", null, getJScrollPaneList(), null);
        jTabbedPaneFileNavigation.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        jTabbedPaneFileNavigation.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                JTabbedPane pane = (JTabbedPane) e.getSource();
                int selectedTab = pane.getSelectedIndex();
                log.debug("[JPanIdentifyMain.getJTabbedPaneFileNavigation()]  selectedTab : " + selectedTab);

                SelectedFilePathInfo selectedFilePathInfo = IdentifyMediator.getInstance()
                        .getSelectedFilePathInfo();
                String selectedPath = selectedFilePathInfo.getSelectedPath();
                log.debug("[JPanIdentifyMain.getJTabbedPaneFileNavigation()]  selectedPath : " + selectedPath);
                IdentifyMediator.getInstance().setFilePointerToSelectedFile(selectedPath);

                actForTab(selectedTab);
                String projectName = IdentifyMediator.getInstance().getSelectedProjectName();
                refreshChildFrameForMatchedType(projectName);

            }

        });
    }
    return jTabbedPaneFileNavigation;
}

From source file:net.rptools.maptool.client.ui.AddResourceDialog.java

public void initTabPane() {

    final JTabbedPane tabPane = (JTabbedPane) getComponent("tabPane");

    tabPane.getModel().addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            // Hmmm, this is fragile (breaks if the order changes) rethink this later
            switch (tabPane.getSelectedIndex()) {
            case 0:
                model.tab = Tab.LOCAL;/*from  ww w  .j a v  a2  s.  c  o m*/
                break;
            case 1:
                model.tab = Tab.WEB;
                break;
            case 2:
                model.tab = Tab.RPTOOLS;
                downloadLibraryList();
                break;
            }
        }
    });
}

From source file:com.t3.client.ui.AddResourceDialog.java

public void initTabPane() {

    final JTabbedPane tabPane = (JTabbedPane) getComponent("tabPane");

    tabPane.getModel().addChangeListener(new ChangeListener() {
        @Override/* w  ww. j a v  a2  s.  c  om*/
        public void stateChanged(ChangeEvent e) {
            // Hmmm, this is fragile (breaks if the order changes) rethink this later
            switch (tabPane.getSelectedIndex()) {
            case 0:
                model.tab = Tab.LOCAL;
                break;
            case 1:
                model.tab = Tab.WEB;
                break;
            case 2:
                model.tab = Tab.TABLETOPTOOL_SITE;
                downloadLibraryList();
                break;
            }
        }
    });
}

From source file:org.nuclos.client.layout.wysiwyg.component.properties.PropertyChartPropertyDomainStep.java

@Override
public void prepare() {
    super.prepare();

    chart = model.getChart();/*from  w ww. j  a v  a  2 s .c o  m*/
    wysiwygChart = model.getWYSIWYGChart();

    String sPrefix = getChartProperty(Chart.PROPERTY_COMBINED_PREFIXES);
    combinedPrefixes = (sPrefix == null) ? new StringBuffer("") : new StringBuffer(sPrefix);

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

    final ChartFunction chartFunction = getChartFunction();

    if (!chartFunction.isCombinedChart()) {
        panel.add(getPanelComponent(chartFunction, ""), BorderLayout.CENTER);
    } else {
        JPanel editorType = new JPanel();
        editorType.setLayout(new GridBagLayout());
        JLabel propTypeValue = new JLabel(
                //SpringLocaleDelegate.getInstance().getMessage("wysiwyg.chart.wizard.domain.value",
                "Diagramm hinzufgen:"/*)*/);
        editorType.add(propTypeValue, new GridBagConstraints(0, 0, 0, 1, 1D, 1D, GridBagConstraints.NORTHWEST,
                GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 0), 0, 0));
        final JComboBox propTypeComponent = new JComboBox(chartFunction.getCombinedChartFunctions());
        editorType.add(propTypeComponent, new GridBagConstraints(0, 1, 1, 1, 1D, 1D,
                GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 15, 0), 0, 0));

        final JTabbedPane tabbedPane = new JTabbedPane();

        JButton removeButton = new JButton(iconRemove);
        removeButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (tabbedPane.getSelectedIndex() != -1) {
                    PanelComponent panelComponent = (PanelComponent) tabbedPane.getSelectedComponent();
                    combinedPrefixes = new StringBuffer(
                            combinedPrefixes.toString().replaceAll(panelComponent.prefix, ""));
                    tabbedPane.remove(panelComponent);
                }
            }
        });
        editorType.add(removeButton, new GridBagConstraints(1, 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHEAST,
                GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
        JButton addButton = new JButton(iconAdd);
        addButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                ChartFunction cFunction = (ChartFunction) propTypeComponent.getSelectedItem();
                String prefix = cFunction.name() + "." + (Math.random() + "").replaceAll("\\.", "") + ":";

                combinedPrefixes.append(prefix);
                tabbedPane.add(cFunction.name(), getPanelComponent(cFunction, prefix));
                tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
            }
        });
        editorType.add(addButton, new GridBagConstraints(2, 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST,
                GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));

        String[] prefixes = combinedPrefixes.toString().split(":");
        for (String prefix : prefixes) {
            if (prefix.length() > 0) {
                try {
                    ChartFunction cFunction = ChartFunction.valueOf(prefix.split("\\.")[0]);
                    tabbedPane.add(cFunction.name(), getPanelComponent(cFunction, prefix + ":"));
                } catch (Exception e) {
                    // ignore.
                }
            }
        }
        panel.add(editorType, BorderLayout.NORTH);
        panel.add(tabbedPane, BorderLayout.CENTER);
    }
}

From source file:org.ash.detail.DetailPanels.java

/**
 * Initialize DetailFrame//ww w . j  a  v  a  2 s .  c o m
 */
private void initialize() {

    this.setLayout(new BorderLayout());
    this.setVisible(true);

    this.cpuSplitPaneMainDetail = new JSplitPane();
    this.schedulerSplitPaneMainDetail = new JSplitPane();
    this.userIOSplitPaneMainDetail = new JSplitPane();
    this.systemIOSplitPaneMainDetail = new JSplitPane();
    this.concurrencySplitPaneMainDetail = new JSplitPane();
    this.applicationSplitPaneMainDetail = new JSplitPane();
    this.commitSplitPaneMainDetail = new JSplitPane();
    this.configurationSplitPaneMainDetail = new JSplitPane();
    this.administrativeSplitPaneMainDetail = new JSplitPane();
    this.networkSplitPaneMainDetail = new JSplitPane();
    this.queuningSplitPaneMainDetail = new JSplitPane();
    this.clusterSplitPaneMainDetail = new JSplitPane();
    this.otherSplitPaneMainDetail = new JSplitPane();

    this.cpuChartPanel = this.cpuStackedChartMainObjectDetail.createChartPanel();
    this.schedulerChartPanel = this.schedulerStackedChartMainObjectDetail.createChartPanel();
    this.userIOChartPanel = this.userIOStackedChartMainObjectDetail.createChartPanel();
    this.systemIOChartPanel = this.systemIOStackedChartMainObjectDetail.createChartPanel();
    this.concurrencyChartPanel = this.concurrencyStackedChartMainObjectDetail.createChartPanel();
    this.applicationChartPanel = this.applicationStackedChartMainObjectDetail.createChartPanel();
    this.commitChartPanel = this.commitStackedChartMainObjectDetail.createChartPanel();
    this.configurationChartPanel = this.configurationStackedChartMainObjectDetail.createChartPanel();
    this.administrativeChartPanel = this.administrativeStackedChartMainObjectDetail.createChartPanel();
    this.networkChartPanel = this.networkStackedChartMainObjectDetail.createChartPanel();
    this.queuningChartPanel = this.queuningStackedChartMainObjectDetail.createChartPanel();
    this.clusterChartPanel = this.clusterStackedChartMainObjectDetail.createChartPanel();
    this.otherChartPanel = this.otherStackedChartMainObjectDetail.createChartPanel();

    /** Gantt graph */
    this.cpuSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("cpuLabel.text"));
    this.schedulerSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("schedulerLabel.text"));
    this.userIOSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("userIOLabel.text"));
    this.systemIOSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("systemIOLabel.text"));
    this.concurrencySqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("concurrencyLabel.text"));
    this.applicationSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("applicationsLabel.text"));
    this.commitSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("commitLabel.text"));
    this.configurationSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("configurationLabel.text"));
    this.administrativeSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("administrativeLabel.text"));
    this.networkSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("networkLabel.text"));
    this.queuningSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("queueningLabel.text"));
    this.clusterSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("clusterLabel.text"));
    this.otherSqlsAndSessions = new GanttDetails(this.mainFrame, this.database,
            Options.getInstance().getResource("otherLabel.text"));

    this.cpuSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.cpuSplitPaneMainDetail.add(this.cpuChartPanel, "top");
    this.cpuSplitPaneMainDetail.add(this.cpuSqlsAndSessions, "bottom");
    this.cpuSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.cpuSplitPaneMainDetail.setOneTouchExpandable(true);

    this.schedulerSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.schedulerSplitPaneMainDetail.add(this.schedulerChartPanel, "top");
    this.schedulerSplitPaneMainDetail.add(this.schedulerSqlsAndSessions, "bottom");
    this.schedulerSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.schedulerSplitPaneMainDetail.setOneTouchExpandable(true);

    this.userIOSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.userIOSplitPaneMainDetail.add(this.userIOChartPanel, "top");
    this.userIOSplitPaneMainDetail.add(this.userIOSqlsAndSessions, "bottom");
    this.userIOSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.userIOSplitPaneMainDetail.setOneTouchExpandable(true);

    this.systemIOSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.systemIOSplitPaneMainDetail.add(this.systemIOChartPanel, "top");
    this.systemIOSplitPaneMainDetail.add(this.systemIOSqlsAndSessions, "bottom");
    this.systemIOSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.systemIOSplitPaneMainDetail.setOneTouchExpandable(true);

    this.concurrencySplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.concurrencySplitPaneMainDetail.add(this.concurrencyChartPanel, "top");
    this.concurrencySplitPaneMainDetail.add(this.concurrencySqlsAndSessions, "bottom");
    this.concurrencySplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.concurrencySplitPaneMainDetail.setOneTouchExpandable(true);

    this.applicationSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.applicationSplitPaneMainDetail.add(this.applicationChartPanel, "top");
    this.applicationSplitPaneMainDetail.add(this.applicationSqlsAndSessions, "bottom");
    this.applicationSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.applicationSplitPaneMainDetail.setOneTouchExpandable(true);

    this.commitSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.commitSplitPaneMainDetail.add(this.commitChartPanel, "top");
    this.commitSplitPaneMainDetail.add(this.commitSqlsAndSessions, "bottom");
    this.commitSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.commitSplitPaneMainDetail.setOneTouchExpandable(true);

    this.configurationSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.configurationSplitPaneMainDetail.add(this.configurationChartPanel, "top");
    this.configurationSplitPaneMainDetail.add(this.configurationSqlsAndSessions, "bottom");
    this.configurationSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.configurationSplitPaneMainDetail.setOneTouchExpandable(true);

    this.administrativeSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.administrativeSplitPaneMainDetail.add(this.administrativeChartPanel, "top");
    this.administrativeSplitPaneMainDetail.add(this.administrativeSqlsAndSessions, "bottom");
    this.administrativeSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.administrativeSplitPaneMainDetail.setOneTouchExpandable(true);

    this.networkSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.networkSplitPaneMainDetail.add(this.networkChartPanel, "top");
    this.networkSplitPaneMainDetail.add(this.networkSqlsAndSessions, "bottom");
    this.networkSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.networkSplitPaneMainDetail.setOneTouchExpandable(true);

    this.queuningSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.queuningSplitPaneMainDetail.add(this.queuningChartPanel, "top");
    this.queuningSplitPaneMainDetail.add(this.queuningSqlsAndSessions, "bottom");
    this.queuningSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.queuningSplitPaneMainDetail.setOneTouchExpandable(true);

    this.clusterSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.clusterSplitPaneMainDetail.add(this.clusterChartPanel, "top");
    this.clusterSplitPaneMainDetail.add(this.clusterSqlsAndSessions, "bottom");
    this.clusterSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.clusterSplitPaneMainDetail.setOneTouchExpandable(true);

    this.otherSplitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    this.otherSplitPaneMainDetail.add(this.otherChartPanel, "top");
    this.otherSplitPaneMainDetail.add(this.otherSqlsAndSessions, "bottom");
    this.otherSplitPaneMainDetail.setDividerLocation(this.dividerLocation);
    this.otherSplitPaneMainDetail.setOneTouchExpandable(true);

    this.tabsDetail.add(this.cpuSplitPaneMainDetail, Options.getInstance().getResource("cpuLabel.text"));
    this.tabsDetail.add(this.schedulerSplitPaneMainDetail,
            Options.getInstance().getResource("schedulerLabel.text"));
    this.tabsDetail.add(this.userIOSplitPaneMainDetail, Options.getInstance().getResource("userIOLabel.text"));
    this.tabsDetail.add(this.systemIOSplitPaneMainDetail,
            Options.getInstance().getResource("systemIOLabel.text"));
    this.tabsDetail.add(this.concurrencySplitPaneMainDetail,
            Options.getInstance().getResource("concurrencyLabel.text"));
    this.tabsDetail.add(this.applicationSplitPaneMainDetail,
            Options.getInstance().getResource("applicationsLabel.text"));
    this.tabsDetail.add(this.commitSplitPaneMainDetail, Options.getInstance().getResource("commitLabel.text"));
    this.tabsDetail.add(this.configurationSplitPaneMainDetail,
            Options.getInstance().getResource("configurationLabel.text"));
    this.tabsDetail.add(this.administrativeSplitPaneMainDetail,
            Options.getInstance().getResource("administrativeLabel.text"));
    this.tabsDetail.add(this.networkSplitPaneMainDetail,
            Options.getInstance().getResource("networkLabel.text"));
    this.tabsDetail.add(this.queuningSplitPaneMainDetail,
            Options.getInstance().getResource("queueningLabel.text"));
    this.tabsDetail.add(this.clusterSplitPaneMainDetail,
            Options.getInstance().getResource("clusterLabel.text"));
    this.tabsDetail.add(this.otherSplitPaneMainDetail, Options.getInstance().getResource("otherLabel.text"));

    this.cpuChartPanel.addListenerReleaseMouse(this.cpuSqlsAndSessions);
    this.schedulerChartPanel.addListenerReleaseMouse(this.schedulerSqlsAndSessions);
    this.userIOChartPanel.addListenerReleaseMouse(this.userIOSqlsAndSessions);
    this.systemIOChartPanel.addListenerReleaseMouse(this.systemIOSqlsAndSessions);
    this.concurrencyChartPanel.addListenerReleaseMouse(this.concurrencySqlsAndSessions);
    this.applicationChartPanel.addListenerReleaseMouse(this.applicationSqlsAndSessions);
    this.commitChartPanel.addListenerReleaseMouse(this.commitSqlsAndSessions);
    this.configurationChartPanel.addListenerReleaseMouse(this.configurationSqlsAndSessions);
    this.administrativeChartPanel.addListenerReleaseMouse(this.administrativeSqlsAndSessions);
    this.networkChartPanel.addListenerReleaseMouse(this.networkSqlsAndSessions);
    this.queuningChartPanel.addListenerReleaseMouse(this.queuningSqlsAndSessions);
    this.clusterChartPanel.addListenerReleaseMouse(this.clusterSqlsAndSessions);
    this.otherChartPanel.addListenerReleaseMouse(this.otherSqlsAndSessions);

    this.cpuChartPanel.addListenerReleaseMouse(this.statusBar);
    this.schedulerChartPanel.addListenerReleaseMouse(this.statusBar);
    this.userIOChartPanel.addListenerReleaseMouse(this.statusBar);
    this.systemIOChartPanel.addListenerReleaseMouse(this.statusBar);
    this.concurrencyChartPanel.addListenerReleaseMouse(this.statusBar);
    this.applicationChartPanel.addListenerReleaseMouse(this.statusBar);
    this.commitChartPanel.addListenerReleaseMouse(this.statusBar);
    this.configurationChartPanel.addListenerReleaseMouse(this.statusBar);
    this.administrativeChartPanel.addListenerReleaseMouse(this.statusBar);
    this.networkChartPanel.addListenerReleaseMouse((Object) this.statusBar);
    this.queuningChartPanel.addListenerReleaseMouse((Object) this.statusBar);
    this.clusterChartPanel.addListenerReleaseMouse((Object) this.statusBar);
    this.otherChartPanel.addListenerReleaseMouse((Object) this.statusBar);

    ChangeListener changeListener = new ChangeListener() {
        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
            int index = sourceTabbedPane.getSelectedIndex();
            statusBar.updateLabelStringDetail(sourceTabbedPane.getTitleAt(index));
        }
    };
    tabsDetail.addChangeListener(changeListener);

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

From source file:net.schweerelos.parrot.CombinedParrotApp.java

private void initGUI(Properties properties) {
    try {/*from w ww. j av  a  2  s . co  m*/
        this.setTitle(APP_TITLE);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                for (MainViewComponent mainViewComponent : mainViews) {
                    if (mainViewComponent instanceof ParrotStateListener) {
                        ((ParrotStateListener) mainViewComponent).parrotExiting();
                    }
                }
            }
        });
        setSize(920, 690);

        getContentPane().setLayout(new BorderLayout());

        UserInterfaceManager uiManager = new UserInterfaceManager(properties);
        navigators = new ArrayList<NavigatorComponent>(4);

        // main view
        listView = uiManager.createMainViewComponent(Style.TABLE);
        graphView = uiManager.createMainViewComponent(Style.GRAPH);
        mainViews.add(listView);
        mainViews.add(graphView);

        final JTabbedPane mainPanel = new JTabbedPane();
        mainPanel.add(graphView.getTitle(), graphView.asJComponent());
        mainPanel.add(listView.getTitle(), listView.asJComponent());

        mainPanel.setSelectedIndex(0);
        activeMainView = graphView;
        mainPanel.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                if (e.getSource() != mainPanel) {
                    return;
                }
                int selectedIndex = mainPanel.getSelectedIndex();
                if (selectedIndex == 0) {
                    activeMainView = graphView;
                } else if (selectedIndex == 1) {
                    activeMainView = listView;
                } else {
                    Logger logger = Logger.getLogger(CombinedParrotApp.class);
                    logger.warn("unknown tab index selected: " + selectedIndex);
                }
            }
        });

        add(mainPanel, BorderLayout.CENTER);

        // navigators
        JToolBar navigatorsBar = new JToolBar(JToolBar.HORIZONTAL);
        navigatorsBar.setMargin(new Insets(0, 11, 0, 0));
        navigatorsBar.setFloatable(false);
        getContentPane().add(navigatorsBar, BorderLayout.PAGE_START);

        // timeline
        NavigatorComponent timelineNavigator = uiManager.createTimelineNavigationComponent();
        navigators.add(timelineNavigator);

        JFrame timelineFrame = new JFrame(timelineNavigator.getNavigatorName() + "  " + APP_TITLE);

        timelineFrame.getContentPane().add(timelineNavigator.asJComponent());
        timelineFrame.pack();
        Point preferredLocation = new Point(0, 0);
        preferredFrameLocations.put(timelineFrame, preferredLocation);

        if (timelineNavigator.hasShowHideListener()) {
            timelineFrame.addComponentListener(timelineNavigator.getShowHideListener());
        }
        timelineFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

        JToggleButton timelineButton = setupNavigatorButton(timelineNavigator.getNavigatorName(),
                timelineNavigator.getAcceleratorKey(), timelineNavigator);
        navigatorsBar.add(timelineButton);

        // map      
        NavigatorComponent mapNavigator = uiManager.createMapNavigationComponent();
        navigators.add(mapNavigator);

        JFrame mapFrame = new JFrame(mapNavigator.getNavigatorName() + "  " + APP_TITLE);

        mapFrame.getContentPane().add(mapNavigator.asJComponent());
        mapFrame.pack();
        preferredLocation = new Point(0,
                Toolkit.getDefaultToolkit().getScreenSize().height - mapFrame.getHeight());
        preferredFrameLocations.put(mapFrame, preferredLocation);

        if (mapNavigator.hasShowHideListener()) {
            mapFrame.addComponentListener(mapNavigator.getShowHideListener());
        }
        mapFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

        JToggleButton mapButton = setupNavigatorButton(mapNavigator.getNavigatorName(),
                mapNavigator.getAcceleratorKey(), mapNavigator);
        navigatorsBar.add(mapButton);

        // search      
        NavigatorComponent searchNavigator = uiManager.createSearchComponent();
        navigators.add(searchNavigator);

        JFrame searchFrame = new JFrame(searchNavigator.getNavigatorName() + "  " + APP_TITLE);

        searchFrame.getContentPane().add(searchNavigator.asJComponent());
        searchFrame.pack();
        preferredLocation = new Point(
                Toolkit.getDefaultToolkit().getScreenSize().width - searchFrame.getWidth(), 0);
        preferredFrameLocations.put(searchFrame, preferredLocation);

        if (searchNavigator.hasShowHideListener()) {
            searchFrame.addComponentListener(searchNavigator.getShowHideListener());
        }
        searchFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

        JToggleButton searchButton = setupNavigatorButton(searchNavigator.getNavigatorName(),
                searchNavigator.getAcceleratorKey(), searchNavigator);
        navigatorsBar.add(searchButton);

        // connections
        NavigatorComponent chainNavigator = uiManager.createChainNavigationComponent();
        navigators.add(chainNavigator);

        if (chainNavigator instanceof PickListener) {
            for (MainViewComponent mainViewComponent : mainViews) {
                mainViewComponent.addPickListener((PickListener) chainNavigator);
            }
        }

        if (chainNavigator.hasShowHideListener()) {
            chainNavigator.asJComponent().addComponentListener(chainNavigator.getShowHideListener());
        }

        JToggleButton connectionsButton = setupNavigatorButton(chainNavigator.getNavigatorName(),
                chainNavigator.getAcceleratorKey(), chainNavigator);
        navigatorsBar.add(connectionsButton);

        add(chainNavigator.asJComponent(), BorderLayout.PAGE_END);
        chainNavigator.asJComponent().setVisible(false);
    } catch (RuntimeException e) {
        e.printStackTrace(System.err);
        System.exit(1);
    } catch (UnknownStyleException e) {
        e.printStackTrace(System.err);
        System.exit(1);
    }
}

From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java

private void jTabbedPane1StateChanged(ChangeEvent evt) {
    JTabbedPane pane = (JTabbedPane) evt.getSource();

    // Get current tab
    int sel = pane.getSelectedIndex();

    if (sel == 1) {
        symbolTableModel.reload();/*from  w  w  w . jav  a2 s. c o  m*/
    }
}

From source file:com.mirth.connect.client.ui.DashboardPanel.java

public DashboardPanel() {
    this.parent = PlatformUI.MIRTH_FRAME;

    haltableStates.add(DeployedState.DEPLOYING);
    haltableStates.add(DeployedState.UNDEPLOYING);
    haltableStates.add(DeployedState.STARTING);
    haltableStates.add(DeployedState.STOPPING);
    haltableStates.add(DeployedState.PAUSING);
    haltableStates.add(DeployedState.SYNCING);
    haltableStates.add(DeployedState.UNKNOWN);

    initComponents();/*  ww  w.  j  a  va  2 s  . c o  m*/
    initLayout();

    loadTabPlugins();
    ChangeListener changeListener = new ChangeListener() {

        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
            int index = sourceTabbedPane.getSelectedIndex();

            if (LoadedExtensions.getInstance().getDashboardTabPlugins().size() > 0) {
                loadPanelPlugin(LoadedExtensions.getInstance().getDashboardTabPlugins()
                        .get(sourceTabbedPane.getTitleAt(index)));
            }
        }
    };
    tabPane.addChangeListener(changeListener);

    defaultVisibleColumns = new LinkedHashSet<String>();

    makeStatusTable();
    loadTablePlugins();

    this.setDoubleBuffered(true);

    DashboardTreeTableModel model = (DashboardTreeTableModel) dashboardTable.getTreeTableModel();

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("channelGroupViewEnabled", true)) {
        tableModeGroupsButton.setSelected(true);
        tableModeGroupsButton.setContentFilled(true);
        tableModeChannelsButton.setContentFilled(false);
        model.setGroupModeEnabled(true);
    } else {
        tableModeChannelsButton.setSelected(true);
        tableModeChannelsButton.setContentFilled(true);
        tableModeGroupsButton.setContentFilled(false);
        model.setGroupModeEnabled(false);
    }
}

From source file:com.emental.mindraider.ui.outline.OutlineJPanel.java

/**
 * Creates notebook outline.// ww w .ja va  2s.  c  om
 */
private OutlineJPanel() {
    setDoubleBuffered(true);
    setLayout(new BorderLayout());

    /*
     * toolbar
     */

    JToolBar toolbar = createToolbar();

    /*
     * tree
     */

    // tree table itself
    outlineTableTree = OutlineTreeInstance.getInstance();
    outlineTableTreeModel = new NotebookOutlineModel(outlineTableTree.getOutlineRoot());
    treeTable = new JTreeTable(outlineTableTreeModel);
    treeTable.tree.addTreeSelectionListener(new TreeSelectionListenerImplementation());
    // add key listener
    treeTable.addKeyListener(new KeyListenerImplementation());

    // label column
    TableColumn tableColumn = treeTable
            .getColumn(NotebookOutlineModel.columnNames[NotebookOutlineModel.COLUMN_LABEL]);
    tableColumn.setMaxWidth(LABEL_COLUMN_MAX_WIDTH);
    tableColumn.setMinWidth(0);
    tableColumn.setPreferredWidth(LABEL_COLUMN_PREFERRED_WIDTH);
    // date column
    tableColumn = treeTable.getColumn(NotebookOutlineModel.columnNames[NotebookOutlineModel.COLUMN_CREATED]);
    tableColumn.setMaxWidth(DATE_COLUMN_MAX_WIDTH);
    tableColumn.setMinWidth(0);
    tableColumn.setPreferredWidth(DATE_COLUMN_PREFERRED_WIDTH);
    // and the rest will be annotation
    JScrollPane treeTableScrollPane = new JScrollPane(treeTable);

    // outline treetabble + toolbar panel
    JPanel treeAndToolbarPanel = new JPanel(new BorderLayout());
    treeAndToolbarPanel.add(toolbar, BorderLayout.NORTH);
    treeAndToolbarPanel.add(treeTableScrollPane, BorderLayout.CENTER);

    /*
     * outline / list tabbed pane
     */

    outlineAndTreeTabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);
    outlineAndTreeTabbedPane.add(treeAndToolbarPanel, "Outline");
    outlineSorterJPanel = new OutlineSorterJPanel();
    outlineAndTreeTabbedPane.add(outlineSorterJPanel, "Sorter");
    outlineArchiveJPanel = new OutlineArchiveJPanel();
    outlineAndTreeTabbedPane.add(outlineArchiveJPanel, "Archive");

    /*
     * concept sidebar
     */

    conceptJPanel = (ConceptJPanel) MindRaiderSpringContext.getCtx().getBean("conceptPanel");

    /*
     * vertical split of notebook outline and RDF graph
     */

    treeAndSpidersSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    treeAndSpidersSplit.setContinuousLayout(true);
    treeAndSpidersSplit.setOneTouchExpandable(true);
    treeAndSpidersSplit.setDividerLocation(200);
    treeAndSpidersSplit.setLastDividerLocation(150);
    treeAndSpidersSplit.setDividerSize(6);
    treeAndSpidersSplit.add(outlineAndTreeTabbedPane);

    // spiders & tags visual navigation
    spidersAndTagsTabs = new JTabbedPane(JTabbedPane.BOTTOM);
    if (MindRaider.profile.isEnableSpiders()) {
        // notebook mind map
        spidersAndTagsTabs.addTab("Mind Map", MindRaider.spidersGraph.getPanel()); // TODO bundle
    }
    // global tags
    spidersAndTagsTabs.addTab("Tag Cloud", MindRaider.tagCustodian.getPanel()); // TODO bundle
    // global mind map
    //spidersAndTagsTabs.addTab("Global Mind Map",new JPanel()); // TODO bundle

    // lazy spiders rendering
    spidersAndTagsTabs.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
            if (sourceTabbedPane.getSelectedIndex() == 0) {
                MindRaider.spidersGraph.renderModel();
            }
        }
    });

    if (!new ConfigurationBean().isDefaultTabMindMap()) {
        spidersAndTagsTabs.setSelectedIndex(1);
    }

    MindRaider.tagCustodian.redraw();

    // add spiders panel
    treeAndSpidersSplit.add(spidersAndTagsTabs);

    /*
     * horizontal split of outline/graph slit and concept sidebar
     */

    rightSiderbarSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeAndSpidersSplit, conceptJPanel);
    rightSiderbarSplitPane.setOneTouchExpandable(true);
    rightSiderbarSplitPane.setContinuousLayout(true);
    rightSiderbarSplitPane.setDividerLocation(500);
    rightSiderbarSplitPane.setLastDividerLocation(500);
    rightSiderbarSplitPane.setDividerSize(6);

    add(rightSiderbarSplitPane);
}