List of usage examples for com.jgoodies.looks HeaderStyle BOTH
HeaderStyle BOTH
To view the source code for com.jgoodies.looks HeaderStyle BOTH.
Click Source Link
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);/* ww w . j av a2 s . c om*/ 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 ww .j a v a 2 s . 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);/* w w w . j a v a2 s. 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); }/* w w w . j a v a2s . co m*/ 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 ww .j a va 2s.c o m*/ 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);/*ww w .j av 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(); }
From source file:ro.nextreports.designer.querybuilder.SQLViewPanel.java
License:Apache License
private void initUI() { sqlEditor = new Editor() { public void afterCaretMove() { removeHighlightErrorLine();/*from w ww . j a v a 2 s . c o m*/ } }; this.queryArea = sqlEditor.getEditorPanel().getEditorPane(); queryArea.setText(DEFAULT_QUERY); errorPainter = new javax.swing.text.Highlighter.HighlightPainter() { @Override public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent c) { try { Rectangle r = c.modelToView(c.getCaretPosition()); g.setColor(Color.RED.brighter().brighter()); g.fillRect(0, r.y, c.getWidth(), r.height); } catch (BadLocationException e) { // ignore } } }; ActionMap actionMap = sqlEditor.getEditorPanel().getEditorPane().getActionMap(); // create the toolbar 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 cut action Action cutAction = actionMap.get(BaseEditorKit.cutAction); cutAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("cut")); cutAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("sqlviewpanel.cut")); toolBar.add(cutAction); // add copy action Action copyAction = actionMap.get(BaseEditorKit.copyAction); copyAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("copy")); copyAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("sqlviewpanel.copy")); toolBar.add(copyAction); // add paste action Action pasteAction = actionMap.get(BaseEditorKit.pasteAction); pasteAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("paste")); pasteAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("sqlviewpanel.paste")); toolBar.add(pasteAction); // add separator SwingUtil.addCustomSeparator(toolBar); // add undo action Action undoAction = actionMap.get(BaseEditorKit.undoAction); undoAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("undo")); undoAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("undo")); toolBar.add(undoAction); // add redo action Action redoAction = actionMap.get(BaseEditorKit.redoAction); redoAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("redo")); redoAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("redo")); toolBar.add(redoAction); // add separator SwingUtil.addCustomSeparator(toolBar); // add find action Action findReplaceAction = actionMap.get(BaseEditorKit.findReplaceAction); findReplaceAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("find")); findReplaceAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("sqleditor.findReplaceActionName")); toolBar.add(findReplaceAction); // add separator SwingUtil.addCustomSeparator(toolBar); // add run action runAction = new SQLRunAction(); runAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("run")); runAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(ShortcutsUtil.getShortcut("query.run.accelerator", "control 4"))); runAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("run.query") + " (" + ShortcutsUtil.getShortcut("query.run.accelerator.display", "Ctrl 4") + ")"); // runAction is globally registered in QueryBuilderPanel ! toolBar.add(runAction); // ro.nextreports.designer.util.SwingUtil.registerButtonsForFocus(buttonsPanel); // create the table resultTable = new JXTable(); resultTable.setDefaultRenderer(Integer.class, new ToStringRenderer()); // to remove thousand separators resultTable.setDefaultRenderer(Long.class, new ToStringRenderer()); resultTable.setDefaultRenderer(Date.class, new DateRenderer()); resultTable.setDefaultRenderer(Double.class, new DoubleRenderer()); resultTable.addMouseListener(new CopyTableMouseAdapter(resultTable)); TableUtil.setRowHeader(resultTable); resultTable.setColumnControlVisible(true); // resultTable.getTableHeader().setReorderingAllowed(false); resultTable.setHorizontalScrollEnabled(true); // highlight table Highlighter alternateHighlighter = HighlighterFactory.createAlternateStriping(Color.WHITE, ColorUtil.PANEL_BACKROUND_COLOR); Highlighter nullHighlighter = new TextHighlighter(ResultSetTableModel.NULL_VALUE, Color.YELLOW.brighter()); Highlighter blobHighlighter = new TextHighlighter(ResultSetTableModel.BLOB_VALUE, Color.GRAY.brighter()); Highlighter clobHighlighter = new TextHighlighter(ResultSetTableModel.CLOB_VALUE, Color.GRAY.brighter()); resultTable.setHighlighters(alternateHighlighter, nullHighlighter, blobHighlighter, clobHighlighter); resultTable.setBackground(ColorUtil.PANEL_BACKROUND_COLOR); resultTable.setGridColor(Color.LIGHT_GRAY); resultTable.setRolloverEnabled(true); resultTable.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.RED)); JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT); split.setResizeWeight(0.66); split.setOneTouchExpandable(true); JPanel topPanel = new JPanel(); topPanel.setLayout(new GridBagLayout()); topPanel.add(toolBar, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); topPanel.add(sqlEditor, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); JPanel bottomPanel = new JPanel(); bottomPanel.setLayout(new GridBagLayout()); JScrollPane scrPanel = new JScrollPane(resultTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); statusPanel = new SQLStatusPanel(); bottomPanel.add(scrPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); bottomPanel.add(statusPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); split.setTopComponent(topPanel); split.setBottomComponent(bottomPanel); split.setDividerLocation(400); setLayout(new BorderLayout()); this.add(split, BorderLayout.CENTER); }
From source file:ro.nextreports.designer.ReportLayoutPanel.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);/*from w w w . j a va 2 s . c om*/ Action widthAction = new AbstractAction() { public void actionPerformed(ActionEvent event) { if (!widthButton.isSelected()) { int option = JOptionPane.showConfirmDialog(Globals.getMainFrame(), I18NSupport.getString("width.action.loose"), "", JOptionPane.YES_NO_OPTION); if (option != JOptionPane.YES_OPTION) { widthButton.setSelected(true); return; } } LayoutHelper.getReportLayout().setUseSize(widthButton.isSelected()); // repaint headers to show/hide ruler reportGridPanel.repaintHeaders(); ReportLayoutUtil.updateColumnWidth(Globals.getReportGrid()); if (!widthButton.isSelected()) { Globals.getReportDesignerPanel().refresh(); } } }; widthAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("width")); widthAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("width.action")); widthButton = new JToggleButton(widthAction); toolBar.add(widthButton); SwingUtil.addCustomSeparator(toolBar); toolBar.add(new FormatPickerAction()); toolBar.add(new FormatPainterAction()); toolBar.add(new ApplyTemplateAction(true)); toolBar.add(new ExtractTemplateAction()); SwingUtil.addCustomSeparator(toolBar); toolBar.add(Globals.getReportUndoManager().getUndoAction()); toolBar.add(Globals.getReportUndoManager().getRedoAction()); SwingUtil.addCustomSeparator(toolBar); JPanel previewPanel = new JPanel(); previewPanel.setLayout(new BoxLayout(previewPanel, BoxLayout.X_AXIS)); previewPanel.setOpaque(false); maxRecordsCheckBox = new JCheckBox(I18NSupport.getString("max.records")); maxRecordsCheckBox.setOpaque(false); maxRecordsCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { maxRecordsTextField.setEditable(true); } else { maxRecordsTextField.setEditable(false); } } }); previewPanel.add(maxRecordsCheckBox); previewPanel.add(Box.createHorizontalStrut(5)); maxRecordsTextField = new IntegerTextField(); maxRecordsTextField.setText("10"); maxRecordsTextField.setEditable(false); maxRecordsTextField.setPreferredSize(dim); maxRecordsTextField.setMinimumSize(dim); maxRecordsTextField.setMaximumSize(dim); previewPanel.add(maxRecordsTextField); 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(); } }); previewPanel.add(Box.createHorizontalStrut(5)); previewPanel.add(dataSourcesComboBox); previewPanel.add(Box.createHorizontalStrut(5)); toolBar.add(previewPanel); DropDownButton dropDownButton = new DropDownButton(); dropDownButton.getPopupMenu().add(new ExportToExcelAction(null)); dropDownButton.getPopupMenu().add(new ExportToPdfAction(null)); dropDownButton.getPopupMenu().add(new ExportToDocxAction(null)); dropDownButton.getPopupMenu().add(new ExportToRtfAction(null)); dropDownButton.getPopupMenu().add(new ExportToCsvAction(null)); dropDownButton.getPopupMenu().add(new ExportToTsvAction(null)); dropDownButton.getPopupMenu().add(new ExportToXmlAction(null)); dropDownButton.getPopupMenu().add(new ExportToTxtAction(null)); dropDownButton.setAction(new ExportToHtmlAction(null)); dropDownButton.addToToolBar(toolBar); JSpinner zoomSpinner = new JSpinner(spinnerModel); zoomSpinner.setPreferredSize(spinnerDim); zoomSpinner.setMinimumSize(spinnerDim); zoomSpinner.setMaximumSize(spinnerDim); zoomSpinner.addChangeListener(this); JPanel zPanel = new JPanel(); zPanel.setLayout(new BoxLayout(zPanel, BoxLayout.X_AXIS)); zPanel.setOpaque(false); zPanel.add(Box.createHorizontalGlue()); zPanel.add(new JLabel(I18NSupport.getString("zoom"))); zPanel.add(Box.createHorizontalStrut(2)); zPanel.add(zoomSpinner); zPanel.add(Box.createHorizontalStrut(2)); zPanel.add(new JLabel("%")); zPanel.add(Box.createHorizontalStrut(5)); toolBar.add(zPanel); return toolBar; }
From source file:ro.nextreports.designer.StructurePanel.java
License:Apache License
private void initComponents() { setLayout(new BorderLayout()); rootNode = new StructureTreeNode(); rootNode.add(new StructureTreeNode(new Band(ReportLayout.HEADER_BAND_NAME))); rootNode.add(new StructureTreeNode(new Band(ReportLayout.DETAIL_BAND_NAME))); rootNode.add(new StructureTreeNode(new Band(ReportLayout.FOOTER_BAND_NAME))); structureTreeModel = new StructureTreeModel(rootNode); structureTree = new JXTree(structureTreeModel); structureTree.setShowsRootHandles(true); structureTree.setCellRenderer(new StructureTreeCellRenderer()); structureTree.setRolloverEnabled(true); structureTree.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.RED)); createPopup();// w ww.j av a 2s. co m // by default do not show empty cells Action showEmptyAction = new AbstractAction() { public void actionPerformed(ActionEvent event) { TreePath lastPath = structureTree.getSelectionPath(); structureTreeModel.activateFilter(!showEmptyButton.isSelected()); structureTreeModel.reload(); if (lastPath != null) { structureTree.expandPath(lastPath.getParentPath()); structureTree.setSelectionPath(lastPath); } } }; showEmptyAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("empty_cell")); showEmptyAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("report.structure.show.empty")); showEmptyButton = new JToggleButton(showEmptyAction); structureTreeModel.activateFilter(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 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(structureTree); } }); // 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(structureTree); } }); toolBar.add(showEmptyButton); add(toolBar, BorderLayout.NORTH); add(new JScrollPane(structureTree), BorderLayout.CENTER); }
From source file:ro.nextreports.designer.wizrep.SelectAlarmSettingsWizardPanel.java
License:Apache License
private void init() { setLayout(new GridBagLayout()); shadow = new JCheckBox(I18NSupport.getString("wizard.panel.display.shadow")); panel = new FormattingConditionsPanel(null, I18NSupport.getString("wizard.panel.alarm.conditions.name")); model = new DefaultListModel(); list = new JList(); list.setModel(model);//from ww w. ja v a 2 s .c om JScrollPane scrollPane = new JScrollPane(list); scrollPane.setPreferredSize(dim); JToolBar toolBar = new JToolBar(); toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); 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("wizard.panel.alarm.message.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("wizard.panel.alarm.message.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("wizard.panel.alarm.message.delete"); } return super.getValue(key); } public void actionPerformed(ActionEvent e) { delete(); } }); toolBar.add(new JLabel(I18NSupport.getString("wizard.panel.alarm.messages.name"))); JLabel imageLabel = new JLabel(ImageUtil.getImageIcon("alarm_main")); imageLabel.setPreferredSize(new Dimension(300, 80)); add(panel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); add(toolBar, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); add(scrollPane, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0)); add(shadow, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(imageLabel, new GridBagConstraints(1, 0, 1, 4, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0)); }