List of usage examples for com.jgoodies.looks Options HEADER_STYLE_KEY
String HEADER_STYLE_KEY
To view the source code for com.jgoodies.looks Options HEADER_STYLE_KEY.
Click Source Link
From source file:org.rainbow.gui.RainbowToolbar.java
License:Open Source License
/** * It initialises the tool bar./*from w w w. j a v a2 s .c o m*/ * * @return the tool bar. */ private void createToolBar() { btnNew = new JButton(IconUtilsRainbow.getGeneralIcon("new")); btnNew.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.createConfiguration(); } }); btnNew.setToolTipText(Language.getOpenConfigurationTT()); btnNewRandom = new JButton(IconUtilsRainbow.getGeneralIcon("new")); // change // icon btnNewRandom.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.createRandomConfiguration(); } }); btnNewRandom.setToolTipText("Random Configuration"); btnModify = new JButton(IconUtilsRainbow.getGeneralIcon("edit")); btnModify.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.modifyConfiguration(); } }); btnModify.setToolTipText(Language.getModifyConfigurationTT()); btnOpen = new JButton(IconUtilsRainbow.getGeneralIcon("open")); ; btnOpen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.openConfigurationFile(); } }); btnOpen.setToolTipText(Language.getLoadSavedConfigurationTT()); btnSave = new JButton(IconUtilsRainbow.getGeneralIcon("save")); btnSave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.saveConfiguration(); } }); btnSave.setToolTipText(Language.getSaveConfigurationTT()); btnSummary = new JButton(IconUtilsRainbow.getGeneralIcon("summary")); btnSummary.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.startConfigurationSummary(); } }); btnSummary.setToolTipText(Language.getConfigurationSummary()); btnBackwardStep = new JButton(IconUtilsRainbow.getNavigationIcon("backward")); btnBackwardStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.moveBackwardStep(); } }); btnBackwardStep.setToolTipText(Language.getMoveBackwardStepTT()); btnForwardStep = new JButton(IconUtilsRainbow.getNavigationIcon("forward")); btnForwardStep.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.moveForwardStep(); } }); btnForwardStep.setToolTipText(Language.getMoveForwardStepTT()); btnStart = new JButton(IconUtilsRainbow.getNavigationIcon("begin")); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.moveAtStart(); } }); btnStart.setToolTipText(Language.getMoveToInitialStateTT()); btnEnd = new JButton(IconUtilsRainbow.getNavigationIcon("end")); btnEnd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { rainbow.moveAtEnd(); } }); btnEnd.setToolTipText(Language.getMoveToFinalStateTT()); jSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 50, 1)); jSpinner.setMaximumSize(new Dimension(10, 40)); jSpinner.setToolTipText(Language.getSetDelaySimulationTT()); btnForwardStep.setEnabled(false); btnBackwardStep.setEnabled(false); btnStart.setEnabled(false); btnEnd.setEnabled(false); btnSave.setEnabled(false); btnModify.setEnabled(false); jSpinner.setEnabled(false); toolPanel = new JPanel(); toolPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); JToolBar toolBarFile = new JToolBar(); toolBarFile.setRollover(true); toolBarFile.add(btnNew); toolBarFile.add(btnNewRandom); toolBarFile.add(btnModify); toolBarFile.add(btnOpen); toolBarFile.add(btnSave); toolBarFile.add(Box.createHorizontalGlue()); toolBarFile.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); JToolBar toolBarSimul = new JToolBar(); toolBarSimul.setRollover(true); toolBarSimul.add(btnSummary); toolBarSimul.add(btnStart); toolBarSimul.add(btnBackwardStep); toolBarSimul.add(btnForwardStep); toolBarSimul.add(btnEnd); toolBarSimul.add(Box.createHorizontalGlue()); toolBarSimul.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); JToolBar toolBarFunc = new JToolBar(); toolBarFunc.setRollover(true); toolBarFunc.add(jSpinner); toolBarFunc.add(Box.createHorizontalGlue()); toolBarFunc.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); toolPanel.add(toolBarFile); toolPanel.add(toolBarSimul); toolPanel.add(toolBarFunc); }
From source file:phex.gui.common.MainFrame.java
License:Open Source License
private void setupComponents(DGuiSettings guiSettings) { tabbedPane = new JTabbedPane(); tabbedPane.setMinimumSize(new Dimension(50, 50)); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent e) { Component comp = tabbedPane.getSelectedComponent(); if (comp instanceof FWTab) { ((FWTab) comp).tabSelectedNotify(); }//from www . j a va 2s.c om } }); Servent servent = GUIRegistry.getInstance().getServent(); // Net Tab networkTab = new NetworkTab(); networkTab.initComponent(guiSettings); initializeTab(networkTab, NETWORK_TAB_ID, guiSettings); // Search Tab QueryManager queryService = servent.getQueryService(); searchTab = new SearchTab(queryService.getSearchContainer(), queryService.getSearchFilterRules(), servent.getDownloadService()); searchTab.initComponent(guiSettings); initializeTab(searchTab, SEARCH_TAB_ID, guiSettings); // SWDownload Tab swDownloadTab = new SWDownloadTab(servent.getDownloadService()); swDownloadTab.initComponent(guiSettings); initializeTab(swDownloadTab, DOWNLOAD_TAB_ID, guiSettings); // Upload Tab uploadTab = new UploadTab(); uploadTab.initComponent(guiSettings); initializeTab(uploadTab, UPLOAD_TAB_ID, guiSettings); // Library Tab libraryTab = new LibraryTab(); libraryTab.initComponent(guiSettings); initializeTab(libraryTab, LIBRARY_TAB_ID, guiSettings); // Security Tab securityTab = new SecurityTab(); securityTab.initComponent(guiSettings); initializeTab(securityTab, SECURITY_TAB_ID, guiSettings); // Statistics Tab statisticsTab = new StatisticsTab(); statisticsTab.initComponent(guiSettings); initializeTab(statisticsTab, STATISTICS_TAB_ID, guiSettings); // Search Monitor Tab QueryHistoryMonitor queryHistoryMonitor = new QueryHistoryMonitor(); servent.getMessageService().addMessageSubscriber(QueryMsg.class, queryHistoryMonitor); searchMonitorTab = new SearchMonitorTab(queryHistoryMonitor); searchMonitorTab.initComponent(guiSettings); initializeTab(searchMonitorTab, SEARCH_MONITOR_TAB_ID, guiSettings); // Result Monitor Tab resultMonitorTab = new ResultMonitorTab(servent.getDownloadService()); resultMonitorTab.initComponent(guiSettings); initializeTab(resultMonitorTab, RESULT_MONITOR_TAB_ID, guiSettings); if (tabbedPane.getTabCount() == 0) { getContentPane().add(BorderLayout.CENTER, getLogoPanel()); } else { tabbedPane.setSelectedIndex(0); getContentPane().add(BorderLayout.CENTER, tabbedPane); } // menu bar JMenuBar menubar = new MainMenuBar(this, guiSettings); setJMenuBar(menubar); // property changed to HeaderStyle.BOTH in case a toolbar is activated. menubar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.SINGLE); // toolbar boolean isToolbarVisible = true; if (guiSettings != null && guiSettings.isSetToolbarVisible()) { isToolbarVisible = guiSettings.isToolbarVisible(); } if (isToolbarVisible) { setToolbarVisible(true); } // Status Bar boolean isStatusbarVisible = true; if (guiSettings != null && guiSettings.isSetStatusbarVisible()) { isStatusbarVisible = guiSettings.isStatusbarVisible(); } if (isStatusbarVisible) { setStatusbarVisible(true); } }
From source file:phex.gui.common.MainFrame.java
License:Open Source License
public void setToolbarVisible(boolean state) { if (state) {// ww w . ja v a2s .c om if (toolbar != null) { //already visible return; } toolbar = new FWToolBar(JToolBar.HORIZONTAL); toolbar.setShowText(false); toolbar.addAction(GUIRegistry.getInstance().getGlobalAction(GUIRegistry.EXIT_PHEX_ACTION)); toolbar.addSeparator(); toolbar.addAction(GUIRegistry.getInstance().getGlobalAction(GUIRegistry.CONNECT_NETWORK_ACTION)); toolbar.addAction(GUIRegistry.getInstance().getGlobalAction(GUIRegistry.DISCONNECT_NETWORK_ACTION)); toolbar.addSeparator(); toolbar.addAction(networkTab.getToggleTabViewAction()); //toolbar.addAction( searchTab.getToggleTabViewAction() ); toolbar.addAction(searchTab.getToggleTabViewAction()); toolbar.addAction(swDownloadTab.getToggleTabViewAction()); toolbar.addAction(uploadTab.getToggleTabViewAction()); toolbar.addAction(libraryTab.getToggleTabViewAction()); toolbar.addAction(securityTab.getToggleTabViewAction()); toolbar.addAction(statisticsTab.getToggleTabViewAction()); toolbar.addAction(searchMonitorTab.getToggleTabViewAction()); toolbar.addAction(resultMonitorTab.getToggleTabViewAction()); toolbar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); getJMenuBar().putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); getContentPane().add(BorderLayout.NORTH, toolbar); getContentPane().validate(); } else { getContentPane().remove(toolbar); getContentPane().validate(); toolbar = null; } }
From source file:ro.fortsoft.momo.QueryPanel.java
License:Apache License
private JComponent createHistoryPanel() { queryHistory = QueryHistory.load();/* w w w. ja va2 s.c o m*/ JToolBar toolBar = new JToolBar(); toolBar.setFloatable(true); toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); previouslyButton = new JButton(ImageUtils.getImageIcon("previously.png")); previouslyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { onPreviouslyHistory(); } }); toolBar.add(previouslyButton); nextButton = new JButton(ImageUtils.getImageIcon("next.png")); nextButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { onNextHistory(); } }); toolBar.add(nextButton); refreshHistoryStatusButtons(); return toolBar; }
From source file:ro.nextreports.designer.chart.ChartLayoutPanel.java
License:Apache License
private JToolBar createToolBar() { JToolBar toolBar = new JToolBar(); toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); toolBar.setBorderPainted(false);// w w w.j a v a 2 s. com dataSourcesComboBox = new JComboBox(); dataSourcesComboBox.setPreferredSize(comboDim); dataSourcesComboBox.setMinimumSize(comboDim); dataSourcesComboBox.setMaximumSize(comboDim); dataSourcesComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //must reset parameters values because for a different data source // we may have different values. RuntimeParametersPanel.resetParametersValues(); } }); toolBar.add(dataSourcesComboBox); toolBar.add(Box.createHorizontalStrut(5)); toolBar.add(previewHTML5Action); toolBar.add(previewFlashAction); if (previewFlashAction.isSupported()) { previewFlashAction.setEnabled(false); } toolBar.add(previewImageAction); SwingUtil.addCustomSeparator(toolBar); toolBar.add(applyTemplateAction); toolBar.add(extractTemplateAction); return toolBar; }
From source file:ro.nextreports.designer.MainMenuBar.java
License:Apache License
public MainMenuBar() { putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); add(createFileMenu());/*from w w w . j a va2s . c o m*/ add(createViewsMenu()); add(createToolsMenu()); add(createHelpMenu()); actionUpdate(Globals.getConnection() != null); Globals.setMainMenuBar(this); }
From source file:ro.nextreports.designer.MainToolBar.java
License:Apache License
public MainToolBar() { putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); add(new NewQueryAction()); add(saveAction);/*from w w w. j a va 2s . c o m*/ SwingUtil.addCustomSeparator(this); add(wizardAction); add(publishAction); SwingUtil.addCustomSeparator(this); add(new OpenQueryPerspectiveAction()); add(openLayoutPersAction = new OpenLayoutPerspectiveAction()); Globals.setMainToolBar(this); newQueryActionUpdate(); actionUpdate(Globals.getConnection() != null); enableLayoutPerspective(false); SwingUtil.addCustomSeparator(this); backAction = new BackToParentAction(); backAction.setEnabled(false); add(backAction); add(parent); }
From source file:ro.nextreports.designer.property.FormattingConditionsPanel.java
License:Apache License
private void initUI() { setLayout(new BorderLayout()); JToolBar toolBar = new JToolBar(); toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); if (title == null) { toolBar.setBorderPainted(false); }/* ww w.ja v a 2 s.com*/ toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("add"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("condition.add"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { add(); } }); toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("edit"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("condition.edit"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { modify(); } }); toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("delete"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("condition.delete"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { delete(); } }); if (title != null) { toolBar.add(new JLabel(title)); } add(toolBar, BorderLayout.NORTH); createTable(); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { modify(); } } }); table.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent event) { int keyCode = event.getKeyCode(); if (keyCode == KeyEvent.VK_ENTER) { modify(); // don't let anyone else handle the event event.consume(); } else if (keyCode == KeyEvent.VK_INSERT) { add(); // don't let anyone else handle the event event.consume(); } else if (keyCode == KeyEvent.VK_DELETE) { delete(); // don't let anyone else handle the event event.consume(); } } }); add(new JScrollPane(table), BorderLayout.CENTER); if (title != null) { table.setPreferredScrollableViewportSize(new Dimension(300, 200)); } else { table.setPreferredScrollableViewportSize(new Dimension(400, 200)); } if (title == null) { setPrefferedColumnsSize(); } }
From source file:ro.nextreports.designer.querybuilder.ParametersPanel.java
License:Apache License
private void initUI() { setLayout(new BorderLayout()); JToolBar toolBar = new JToolBar(); toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); toolBar.setBorderPainted(false);//from w w w . j a va 2 s.com toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("add"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("parameter.add"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { add(); } }); toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("add_par"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("parameter.add.from.report"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { addFromReport(); } }); toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("parameter_clone"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("parameter.add.clone"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { cloneParameter(); } }); toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("edit"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("parameter.edit"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { modify(); } }); toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("delete"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("parameter.delete"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { delete(); } }); toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("parameter_up"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("parameter.up"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { up(); } }); toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("parameter_down"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("parameter.down"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { down(); } }); // SwingUtil.registerButtonsForFocus(buttonsPanel); add(toolBar, BorderLayout.NORTH); createTable(); table.getColumnModel().getColumn(1).setCellRenderer(new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); String tmp = (String) value; tmp = tmp.substring(tmp.lastIndexOf('.') + 1); /* if ("Object".equals(tmp)) { tmp = "Any"; } */ setText(tmp); return this; } }); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 2) { modify(); } } }); table.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent event) { int keyCode = event.getKeyCode(); if (keyCode == KeyEvent.VK_ENTER) { modify(); // don't let anyone else handle the event event.consume(); } else if (keyCode == KeyEvent.VK_INSERT) { add(); // don't let anyone else handle the event event.consume(); } else if (keyCode == KeyEvent.VK_DELETE) { delete(); // don't let anyone else handle the event event.consume(); } } }); add(new JScrollPane(table), BorderLayout.CENTER); table.setPreferredScrollableViewportSize(new Dimension(250, 200)); }
From source file:ro.nextreports.designer.querybuilder.QueryBuilderPanel.java
License:Apache License
private void initUI() { JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.setDividerLocation(250);//from w w w . j a v a 2 s .c o m split.setOneTouchExpandable(true); JToolBar toolBar = new JToolBar(); toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); toolBar.setBorderPainted(false); // add refresh action toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("refresh"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("querybuilder.refresh"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { try { if (Globals.getConnection() == null) { return; } // refresh tables, views, procedures TreeUtil.refreshDatabase(); // add new queries to tree TreeUtil.refreshQueries(); // add new reports to tree TreeUtil.refreshReports(); // add new charts to tree TreeUtil.refreshCharts(); } catch (Exception ex) { Show.error(ex); } } }); // add expand action toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("expandall"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("querybuilder.expand.all"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { TreeUtil.expandAll(dbBrowserTree); } }); // add collapse action toolBar.add(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("collapseall"); } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) { return I18NSupport.getString("querybuilder.collapse.all"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { TreeUtil.collapseAll(dbBrowserTree); } }); // add properties button /* JButton propButton = new MagicButton(new AbstractAction() { public Object getValue(String key) { if (AbstractAction.SMALL_ICON.equals(key)) { return ImageUtil.getImageIcon("properties"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { DBBrowserPropertiesPanel joinPanel = new DBBrowserPropertiesPanel(); JDialog dlg = new DBBrowserPropertiesDialog(joinPanel); dlg.pack(); dlg.setResizable(false); Show.centrateComponent(Globals.getMainFrame(), dlg); dlg.setVisible(true); } }); propButton.setToolTipText(I18NSupport.getString("querybuilder.properties")); */ //browserButtonsPanel.add(propButton); // ro.nextreports.designer.util.SwingUtil.registerButtonsForFocus(browserButtonsPanel); browserPanel = new JXPanel(new BorderLayout()); browserPanel.add(toolBar, BorderLayout.NORTH); // browser tree JScrollPane scroll = new JScrollPane(dbBrowserTree); browserPanel.add(scroll, BorderLayout.CENTER); split.setLeftComponent(browserPanel); tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM); // tabbedPane.putClientProperty(Options.EMBEDDED_TABS_KEY, Boolean.TRUE); // look like eclipse JSplitPane split2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT); split2.setResizeWeight(0.66); split2.setOneTouchExpandable(true); // desktop pane desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); desktop.setDropTarget( new DropTarget(desktop, DnDConstants.ACTION_MOVE, new DesktopPaneDropTargetListener(), true)); // create the toolbar JToolBar toolBar2 = new JToolBar(); toolBar2.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders toolBar2.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); toolBar2.setBorderPainted(false); Action distinctAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (distinctButton.isSelected()) { selectQuery.setDistinct(true); } else { selectQuery.setDistinct(false); } } }; distinctAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("query.distinct")); distinctAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("querybuilder.distinct")); toolBar2.add(distinctButton = new JToggleButton(distinctAction)); Action groupByAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { groupBy = groupByButton.isSelected(); Globals.getEventBus().publish(new GroupByEvent(QueryBuilderPanel.this.desktop, groupBy)); } }; groupByAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("query.group_by")); groupByAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("querybuilder.group.by")); toolBar2.add(groupByButton = new JToggleButton(groupByAction)); Action clearAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { clear(false); } }; clearAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("clear")); clearAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("querybuilder.clear")); toolBar2.add(clearAction); // add separator SwingUtil.addCustomSeparator(toolBar2); // add run button Action runQueryAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { selectSQLViewTab(); sqlView.doRun(); } }; runQueryAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("run")); KeyStroke ks = KeyStroke.getKeyStroke(ShortcutsUtil.getShortcut("query.run.accelerator", "control 4")); runQueryAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("run.query") + " (" + ShortcutsUtil.getShortcut("query.run.accelerator.display", "Ctrl 4") + ")"); runQueryAction.putValue(Action.ACCELERATOR_KEY, ks); toolBar2.add(runQueryAction); // register run query shortcut GlobalHotkeyManager hotkeyManager = GlobalHotkeyManager.getInstance(); InputMap inputMap = hotkeyManager.getInputMap(); ActionMap actionMap = hotkeyManager.getActionMap(); inputMap.put((KeyStroke) runQueryAction.getValue(Action.ACCELERATOR_KEY), "runQueryAction"); actionMap.put("runQueryAction", runQueryAction); JScrollPane scroll2 = new JScrollPane(desktop, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scroll2.setPreferredSize(DBTablesDesktopPane.PREFFERED_SIZE); DecoratedScrollPane.decorate(scroll2); JPanel topPanel = new JPanel(); topPanel.setLayout(new GridBagLayout()); topPanel.add(toolBar2, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); topPanel.add(scroll2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); split2.setTopComponent(topPanel); designPanel = new DesignerTablePanel(selectQuery); split2.setBottomComponent(designPanel); split2.setDividerLocation(400); tabbedPane.addTab(I18NSupport.getString("querybuilder.query.designer"), ImageUtil.getImageIcon("designer"), split2); tabbedPane.setMnemonicAt(0, 'D'); sqlView = new SQLViewPanel(); sqlView.getEditorPane().setDropTarget(new DropTarget(sqlView.getEditorPane(), DnDConstants.ACTION_MOVE, new SQLViewDropTargetListener(), true)); tabbedPane.addTab(I18NSupport.getString("querybuilder.query.editor"), ImageUtil.getImageIcon("sql"), sqlView); tabbedPane.setMnemonicAt(1, 'E'); split.setRightComponent(tabbedPane); // register a change listener tabbedPane.addChangeListener(new ChangeListener() { // this method is called whenever the selected tab changes public void stateChanged(ChangeEvent ev) { if (ev.getSource() == QueryBuilderPanel.this.tabbedPane) { // get current tab int sel = QueryBuilderPanel.this.tabbedPane.getSelectedIndex(); if (sel == 1) { // sql view String query; if (!synchronizedPanels) { query = sqlView.getQueryString(); synchronizedPanels = true; } else { if (Globals.getConnection() != null) { query = getSelectQuery().toString(); } else { query = ""; } // if (query.equals("")) { // query = sqlView.getQueryString(); // } } if (resetTable) { sqlView.clear(); resetTable = false; } //System.out.println("query="+query); sqlView.setQueryString(query); } else if (sel == 0) { // design view if (queryWasModified(false)) { Object[] options = { I18NSupport.getString("optionpanel.yes"), I18NSupport.getString("optionpanel.no") }; String m1 = I18NSupport.getString("querybuilder.lost"); String m2 = I18NSupport.getString("querybuilder.continue"); int option = JOptionPane.showOptionDialog(Globals.getMainFrame(), "<HTML>" + m1 + "<BR>" + m2 + "</HTML>", I18NSupport.getString("querybuilder.confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]); if (option != JOptionPane.YES_OPTION) { synchronizedPanels = false; tabbedPane.setSelectedIndex(1); } else { resetTable = true; } } } else if (sel == 2) { // report view } } } }); // this.add(split, BorderLayout.CENTER); parametersPanel = new ParametersPanel(); }