List of usage examples for javax.swing JSeparator JSeparator
public JSeparator(int orientation)
From source file:course_generator.frmMain.java
/** * Separator for the status bar// w w w.j a v a 2 s .co m * @return Separator object */ static JComponent createStatusbarSeparator() { JSeparator x = new JSeparator(SwingConstants.VERTICAL); x.setPreferredSize(new Dimension(3, 20)); return x; }
From source file:statistic.ca.gui.JCAStatisticPanel.java
private JPanel addPropertiesComponents() { JPanel p = new JPanel(new GridBagLayout()); String[] statisticTypeNames = { "Grundinformationen", "Ausgangsverteilung", "Ankunftskurve", "evakuierte Individuen in Prozent", "maximale Blockadezeit", "durchschnittliche Blockadezeit", "minimale Blockadezeit", "zurckgelegte Distanz", "minimale Distanz zum initialen Ausgang", "minimale Distanz zum nchsten Ausgang", "Distanz ber Zeit", "maximale Zeit bis Safe", "durchschnittliche Zeit bis Safe", "minimale Zeit bis Safe", "maximale Geschwindigkeit ber Zeit", "durschnittliche Geschwindigkeit ber Zeit", "maximale Geschwindigkeit", "durchschnittliche Geschwindigkeit", "Panik ber Zeit", "Erschpfung ber Zeit" }; statisticType = new JComboBox(statisticTypeNames); statisticType.addActionListener(new TypePerformed()); JPanel timeIntervalGroup = new JPanel(); timeInterval = new JLabel("Zeitintervall:"); timeIntervalFrom = new JTextField(4); timeIntervalTo = new JTextField(4); timeIntervalGroup.add(timeInterval); timeIntervalGroup.add(timeIntervalFrom); timeIntervalGroup.add(new JLabel(" - ")); timeIntervalGroup.add(timeIntervalTo); assignmentListModel = new DefaultListModel(); assignmentList = new JList(assignmentListModel); // data has type Object[] assignmentList.getSelectionModel().addListSelectionListener(new AssignmentTypeListSelect()); assignmentList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); assignmentList.setLayoutOrientation(JList.VERTICAL); assignmentList.setVisibleRowCount(-1); JScrollPane listScroller = new JScrollPane(assignmentList); listScroller.setPreferredSize(new Dimension(100, 50)); JPanel assignmentButtons = new JPanel(); JButton btn_group = new JButton("Group"); JButton btn_ungroup = new JButton("Ungroup"); btn_group.addActionListener(new GroupPreformed()); btn_ungroup.addActionListener(new UngroupPreformed()); assignmentButtons.add(btn_group);//from w ww . jav a 2s. c o m assignmentButtons.add(btn_ungroup); JButton btn_createDiagram = new JButton("Create Diagram"); btn_createDiagram.addActionListener(new CreateDiagramPerformed()); JButton btn_removeDiagram = new JButton("Remove Diagram"); btn_removeDiagram.addActionListener(new RemovePerformed()); JPanel diagramButtonGroup = new JPanel(); diagramButtonGroup.add(btn_createDiagram); diagramButtonGroup.add(btn_removeDiagram); diagramCategoryListModel = new DefaultListModel(); diagramCategoryList = new JList(diagramCategoryListModel); // data has type // Object[] diagramCategoryList.getSelectionModel().addListSelectionListener(new DiagramCategoryListSelect()); diagramCategoryList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); diagramCategoryList.setLayoutOrientation(JList.VERTICAL); diagramCategoryList.setVisibleRowCount(-1); JScrollPane diagramCategoryListScroller = new JScrollPane(diagramCategoryList); diagramCategoryListScroller.setPreferredSize(new Dimension(100, 50)); JPanel buttonGroup = new JPanel(); JButton btn_addToDiagram = new JButton("Add to Diagram"); JButton btn_removeFromDiagram = new JButton("Remove from Diagram"); buttonGroup.add(btn_addToDiagram); buttonGroup.add(btn_removeFromDiagram); btn_addToDiagram.addActionListener(new AddToDiagramPerformed()); btn_removeFromDiagram.addActionListener(new RemoveFromDiagramPerformed()); // Create statisticSource at last because we need the GUI Objects above to initialize // our selection in BatchResultEntryComboBoxModel.setSelectedItem () model = new BatchResultEntryComboBoxModel(); statisticSource = new JComboBox(model); int y = 0; p.add(statisticType, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); p.add(statisticSource, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); p.add(new JSeparator(SwingConstants.HORIZONTAL), new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); p.add(new JLabel("Belegungen"), new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); p.add(listScroller, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); p.add(assignmentButtons, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); p.add(new JSeparator(SwingConstants.HORIZONTAL), new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); p.add(buttonGroup, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); p.add(new JSeparator(SwingConstants.HORIZONTAL), new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); p.add(diagramCategoryListScroller, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.5, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); p.add(diagramButtonGroup, new GridBagConstraints(0, y++, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); return p; }
From source file:net.sourceforge.squirrel_sql.client.preferences.UpdatePreferencesPanel.java
private JSeparator getSep() { JSeparator sep = new JSeparator(SwingConstants.HORIZONTAL); // separators need preferred size in GridBagLayout sep.setPreferredSize(new Dimension(100, 20)); sep.setMinimumSize(new Dimension(100, 20)); return sep;/* w w w.java2s. com*/ }
From source file:org.apache.jackrabbit.oak.explorer.Explorer.java
private void createAndShowGUI(final File path, boolean skipSizeCheck) throws IOException { JTextArea log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setLineWrap(true);// www .j av a 2 s. c o m log.setEditable(false); final NodeStoreTree treePanel = new NodeStoreTree(backend, log, skipSizeCheck); final JFrame frame = new JFrame("Explore " + path + " @head"); frame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { IOUtils.closeQuietly(treePanel); System.exit(0); } }); JPanel content = new JPanel(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(treePanel), new JScrollPane(log)); splitPane.setDividerLocation(0.3); content.add(new JScrollPane(splitPane), c); frame.getContentPane().add(content); JMenuBar menuBar = new JMenuBar(); menuBar.setMargin(new Insets(2, 2, 2, 2)); JMenuItem menuReopen = new JMenuItem("Reopen"); menuReopen.setMnemonic(KeyEvent.VK_R); menuReopen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { try { treePanel.reopen(); } catch (IOException e) { throw new RuntimeException(e); } } }); JMenuItem menuCompaction = new JMenuItem("Time Machine"); menuCompaction.setMnemonic(KeyEvent.VK_T); menuCompaction.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { List<String> revs = backend.readRevisions(); String s = (String) JOptionPane.showInputDialog(frame, "Revert to a specified revision", "Time Machine", JOptionPane.PLAIN_MESSAGE, null, revs.toArray(), revs.get(0)); if (s != null && treePanel.revert(s)) { frame.setTitle("Explore " + path + " @" + s); } } }); JMenuItem menuRefs = new JMenuItem("Tar File Info"); menuRefs.setMnemonic(KeyEvent.VK_I); menuRefs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { List<String> tarFiles = new ArrayList<String>(); for (File f : path.listFiles()) { if (f.getName().endsWith(".tar")) { tarFiles.add(f.getName()); } } String s = (String) JOptionPane.showInputDialog(frame, "Choose a tar file", "Tar File Info", JOptionPane.PLAIN_MESSAGE, null, tarFiles.toArray(), tarFiles.get(0)); if (s != null) { treePanel.printTarInfo(s); } } }); JMenuItem menuSCR = new JMenuItem("Segment Refs"); menuSCR.setMnemonic(KeyEvent.VK_R); menuSCR.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { String s = JOptionPane.showInputDialog(frame, "Segment References\nUsage: <segmentId>", "Segment References", JOptionPane.PLAIN_MESSAGE); if (s != null) { treePanel.printSegmentReferences(s); } } }); JMenuItem menuDiff = new JMenuItem("SegmentNodeState diff"); menuDiff.setMnemonic(KeyEvent.VK_D); menuDiff.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { String s = JOptionPane.showInputDialog(frame, "SegmentNodeState diff\nUsage: <recordId> <recordId> [<path>]", "SegmentNodeState diff", JOptionPane.PLAIN_MESSAGE); if (s != null) { treePanel.printDiff(s); } } }); JMenuItem menuPCM = new JMenuItem("Persisted Compaction Maps"); menuPCM.setMnemonic(KeyEvent.VK_P); menuPCM.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { treePanel.printPCMInfo(); } }); menuBar.add(menuReopen); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuCompaction); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuRefs); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuSCR); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuDiff); menuBar.add(new JSeparator(JSeparator.VERTICAL)); menuBar.add(menuPCM); menuBar.add(new JSeparator(JSeparator.VERTICAL)); frame.setJMenuBar(menuBar); frame.pack(); frame.setSize(960, 720); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:org.eobjects.datacleaner.panels.WelcomePanel.java
private DCPanel createNewDatastorePanel() { final DCPanel panel = new DCPanel(); panel.setBorder(WidgetUtils.BORDER_LIST_ITEM); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); panel.add(createNewDatastoreButton("CSV file", "Comma-separated values (CSV) file (or file with other separators)", IconUtils.CSV_IMAGEPATH, CsvDatastore.class, CsvDatastoreDialog.class)); panel.add(createNewDatastoreButton("Excel spreadsheet", "Microsoft Excel spreadsheet. Either .xls (97-2003) or .xlsx (2007+) format.", IconUtils.EXCEL_IMAGEPATH, ExcelDatastore.class, ExcelDatastoreDialog.class)); panel.add(createNewDatastoreButton("Access database", "Microsoft Access database file (.mdb).", IconUtils.ACCESS_IMAGEPATH, AccessDatastore.class, AccessDatastoreDialog.class)); panel.add(createNewDatastoreButton("SAS library", "A directory of SAS library files (.sas7bdat).", IconUtils.SAS_IMAGEPATH, SasDatastore.class, SasDatastoreDialog.class)); panel.add(createNewDatastoreButton("DBase database", "DBase database file (.dbf)", IconUtils.DBASE_IMAGEPATH, DbaseDatastore.class, DbaseDatastoreDialog.class)); panel.add(createNewDatastoreButton("Fixed width file", "Text file with fixed width values. Each value spans a fixed amount of text characters.", IconUtils.FIXEDWIDTH_IMAGEPATH, FixedWidthDatastore.class, FixedWidthDatastoreDialog.class)); panel.add(createNewDatastoreButton("XML file", "Extensible Markup Language file (.xml)", IconUtils.XML_IMAGEPATH, XmlDatastore.class, XmlDatastoreDialog.class)); panel.add(createNewDatastoreButton("JSON file", "JavaScript Object NOtation file (.json).", IconUtils.JSON_IMAGEPATH, JsonDatastore.class, JsonDatastoreDialog.class)); panel.add(/*w ww. j av a 2 s . c o m*/ createNewDatastoreButton("OpenOffice.org Base database", "OpenOffice.org Base database file (.odb)", IconUtils.ODB_IMAGEPATH, OdbDatastore.class, OdbDatastoreDialog.class)); panel.add(Box.createHorizontalStrut(10)); panel.add(createNewDatastoreButton("Salesforce.com", "Connect to a Salesforce.com account", IconUtils.SALESFORCE_IMAGEPATH, SalesforceDatastore.class, SalesforceDatastoreDialog.class)); panel.add(createNewDatastoreButton("SugarCRM", "Connect to a SugarCRM system", IconUtils.SUGAR_CRM_IMAGEPATH, SugarCrmDatastore.class, SugarCrmDatastoreDialog.class)); panel.add(Box.createHorizontalStrut(10)); panel.add(createNewDatastoreButton("MongoDB database", "Connect to a MongoDB database", IconUtils.MONGODB_IMAGEPATH, MongoDbDatastore.class, MongoDbDatastoreDialog.class)); panel.add(createNewDatastoreButton("CouchDB database", "Connect to an Apache CouchDB database", IconUtils.COUCHDB_IMAGEPATH, CouchDbDatastore.class, CouchDbDatastoreDialog.class)); panel.add(createNewDatastoreButton("HBase database", "Connect to an Apache HBase database", IconUtils.HBASE_IMAGEPATH, HBaseDatastore.class, HBaseDatastoreDialog.class)); // set of databases that are displayed directly on panel final Set<String> databaseNames = new HashSet<String>(); createDefaultDatabaseButtons(panel, databaseNames); final JButton moreDatastoreTypesButton = new JButton("More", imageManager.getImageIcon(IconUtils.FILE_FOLDER, IconUtils.ICON_SIZE_SMALL)); moreDatastoreTypesButton.setMargin(new Insets(1, 1, 1, 4)); moreDatastoreTypesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final JPopupMenu popup = new JPopupMenu(); // installed databases final List<DatabaseDriverDescriptor> databaseDrivers = _databaseDriverCatalog .getInstalledWorkingDatabaseDrivers(); for (DatabaseDriverDescriptor databaseDriver : databaseDrivers) { final String databaseName = databaseDriver.getDisplayName(); if (!databaseNames.contains(databaseName)) { final String imagePath = databaseDriver.getIconImagePath(); final ImageIcon icon = imageManager.getImageIcon(imagePath, IconUtils.ICON_SIZE_SMALL); final JMenuItem menuItem = WidgetFactory.createMenuItem(databaseName, icon); menuItem.addActionListener(createJdbcActionListener(databaseName)); popup.add(menuItem); } } // custom/other jdbc connection { final ImageIcon icon = imageManager.getImageIcon(IconUtils.GENERIC_DATASTORE_IMAGEPATH, IconUtils.ICON_SIZE_SMALL); final JMenuItem menuItem = WidgetFactory.createMenuItem("Other database", icon); menuItem.addActionListener(createJdbcActionListener(null)); popup.add(menuItem); } // composite datastore final JMenuItem compositeMenuItem = WidgetFactory.createMenuItem("Composite datastore", imageManager.getImageIcon(IconUtils.COMPOSITE_IMAGEPATH, IconUtils.ICON_SIZE_SMALL)); compositeMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new CompositeDatastoreDialog(_datastoreCatalog, _analysisJobBuilderWindow.getWindowContext()).setVisible(true); } }); final JMenuItem databaseDriversMenuItem = WidgetFactory.createMenuItem("Manage database drivers...", imageManager.getImageIcon(IconUtils.MENU_OPTIONS, IconUtils.ICON_SIZE_SMALL)); databaseDriversMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { OptionsDialog dialog = _optionsDialogProvider.get(); dialog.selectDatabaseDriversTab(); dialog.setVisible(true); } }); popup.add(databaseDriversMenuItem); popup.add(new JSeparator(JSeparator.HORIZONTAL)); popup.add(compositeMenuItem); popup.setBorder(WidgetUtils.BORDER_THIN); popup.show(moreDatastoreTypesButton, 0, moreDatastoreTypesButton.getHeight()); } }); panel.add(Box.createHorizontalStrut(10)); panel.add(moreDatastoreTypesButton); return panel; }
From source file:org.kuali.test.ui.components.sqlquerypanel.WhereValueCellEditor.java
public WhereValueCellEditor(DatabasePanel dbPanel, JTextField tf) { super(new BorderLayout()); this.dbPanel = dbPanel; cellEditor = new DefaultCellEditor(tf); add(cellEditor.getComponent(), BorderLayout.CENTER); JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 2)); p.add(lookup = new SearchButton()); p.add(new JSeparator(JSeparator.VERTICAL)); if (dbPanel.isForCheckpoint()) { p.add(executionParameter = new SearchButton(Constants.ADD_PARAM_ICON)); executionParameter.addActionListener(this); }/*ww w . ja v a2 s. co m*/ add(p, BorderLayout.EAST); lookup.setEnabled(false); lookup.addActionListener(this); }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private boolean setupPreviewPanel(List<PreviewPart> previewParts) { boolean blnTransferWithWarnings = false; jpnPreviewHeader.removeAll();/*from w w w . j av a 2s. c o m*/ jpnPreviewFooter.removeAll(); // setup parameter scroll pane jpnPreviewContent.removeAll(); double[] rowContraints = new double[previewParts.size()]; for (int i = 0; i < previewParts.size(); i++) rowContraints[i] = TableLayout.PREFERRED; final int iWidthBeginnigSpace = 3; final int iWidthSeparator = 6; final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); JLabel lbPreviewHeaderEntity = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.11", "Entit\u00e4t")); JLabel lbPreviewHeaderTable = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.12", "Tabellenname")); JLabel lbPreviewHeaderRecords = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.4", "Datens\u00e4tze")); lbPreviewHeaderRecords.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.5", "Anzahl der betroffenen Datens\u00e4tze")); utils.initJPanel(jpnPreviewContent, new double[] { iWidthBeginnigSpace, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED }, rowContraints); int iWidthEntityLabelSize = 0; int iWidthTableLabelSize = 0; int iWidthRecordsLabelSize = 0; int iCountNew = 0; int iCountDeleted = 0; int iCountChanged = 0; int iRow = 0; for (final PreviewPart pp : previewParts) { String tooltip = ""; JLabel lbEntity = new JLabel(pp.getEntity()); JLabel lbTable = new JLabel(pp.getTable()); JLabel lbRecords = new JLabel(String.valueOf(pp.getDataRecords())); lbRecords.setHorizontalAlignment(SwingConstants.RIGHT); if (lbEntity.getPreferredSize().width < lbPreviewHeaderEntity.getPreferredSize().width) lbEntity.setPreferredSize(lbPreviewHeaderEntity.getPreferredSize()); if (lbTable.getPreferredSize().width < lbPreviewHeaderTable.getPreferredSize().width) lbTable.setPreferredSize(lbPreviewHeaderTable.getPreferredSize()); if (lbRecords.getPreferredSize().width < lbPreviewHeaderRecords.getPreferredSize().width) lbRecords.setPreferredSize(lbPreviewHeaderRecords.getPreferredSize()); iWidthEntityLabelSize = iWidthEntityLabelSize < lbEntity.getPreferredSize().width ? lbEntity.getPreferredSize().width : iWidthEntityLabelSize; iWidthTableLabelSize = iWidthTableLabelSize < lbTable.getPreferredSize().width ? lbTable.getPreferredSize().width : iWidthTableLabelSize; iWidthRecordsLabelSize = iWidthRecordsLabelSize < lbRecords.getPreferredSize().width ? lbRecords.getPreferredSize().width : iWidthRecordsLabelSize; Icon icoStatement = null; switch (pp.getType()) { case PreviewPart.NEW: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.6", "Entit\u00e4t wird hinzugef\u00fcgt"); icoStatement = ParameterEditor.COMPARE_ICON_NEW; iCountNew++; break; case PreviewPart.CHANGE: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.7", "Entit\u00e4t wird ge\u00e4ndert"); icoStatement = ParameterEditor.COMPARE_ICON_VALUE_CHANGED; iCountChanged++; break; case PreviewPart.DELETE: tooltip = localeDelegate.getMessage("dbtransfer.import.step1.8", "Entit\u00e4t wird gel\u00f6scht"); icoStatement = ParameterEditor.COMPARE_ICON_DELETED; iCountDeleted++; break; } JLabel lbIcon = new JLabel(icoStatement); JLabel lbStatemnts = new JLabel("<html><u>" + localeDelegate.getMessage("dbtransfer.import.step1.9", "Script anzeigen") + "...</u></html>"); lbStatemnts.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lbStatemnts.addMouseListener(new MouseListener() { @Override public void mouseReleased(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseClicked(MouseEvent e) { String statements = ""; for (String statement : pp.getStatements()) { statements = statements + statement + ";\n\n"; } JTextArea txtArea = new JTextArea(statements); txtArea.setEditable(false); txtArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JScrollPane scroll = new JScrollPane(txtArea); scroll.getVerticalScrollBar().setUnitIncrement(20); scroll.setPreferredSize(new Dimension(600, 300)); scroll.setBorder(BorderFactory.createEmptyBorder()); MainFrameTab overlayFrame = new MainFrameTab( localeDelegate.getMessage("dbtransfer.import.step1.10", "Script f\u00fcr") + " " + pp.getEntity() + " (" + pp.getTable() + ")"); overlayFrame.setLayeredComponent(scroll); ifrm.add(overlayFrame); } }); lbIcon.setToolTipText(tooltip); lbStatemnts.setToolTipText(tooltip); lbEntity.setToolTipText(tooltip); lbTable.setToolTipText(tooltip); jpnPreviewContent.add(lbEntity, "1," + iRow + ",l,c"); jpnPreviewContent.add(lbTable, "3," + iRow + ",l,c"); jpnPreviewContent.add(lbRecords, "5," + iRow + ",r,c"); jpnPreviewContent.add(lbIcon, "7," + iRow + ",l,c"); jpnPreviewContent.add(lbStatemnts, "8," + iRow + ",l,c"); if (pp.getWarning() > 0) { lbIcon.setIcon(Icons.getInstance().getIconPriorityCancel16()); blnTransferWithWarnings = true; } iRow++; } jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "2,0,2," + (iRow - 1)); jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "4,0,4," + (iRow - 1)); jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "6,0,6," + (iRow - 1)); // setup preview header utils.initJPanel(jpnPreviewHeader, new double[] { iWidthBeginnigSpace, iWidthEntityLabelSize, iWidthSeparator, iWidthTableLabelSize, iWidthSeparator, iWidthRecordsLabelSize, iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED, TableLayout.PREFERRED }, new double[] { TableLayout.PREFERRED }); if (previewParts.isEmpty()) { jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.18", "Keine Struktur\u00e4nderungen am Datenbankschema.")), "0,0,8,0"); return blnTransferWithWarnings; } jpnPreviewHeader.add(lbPreviewHeaderEntity, "1,0"); jpnPreviewHeader.add(lbPreviewHeaderTable, "3,0"); jpnPreviewHeader.add(lbPreviewHeaderRecords, "5,0"); jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.13", "\u00c4nderung")), "7,0"); // setup preview footer utils.initJPanel(jpnPreviewFooter, new double[] { TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED }, new double[] { TableLayout.PREFERRED }); final JLabel lbCompare = new JLabel( localeDelegate.getMessage("dbtransfer.import.step1.14", "\u00c4nderungen") + ":"); final JLabel lbCompareNew = new JLabel(iCountNew + ""); final JLabel lbCompareDeleted = new JLabel(iCountDeleted + ""); final JLabel lbCompareValueChanged = new JLabel(iCountChanged + ""); lbCompareNew.setIcon(ParameterEditor.COMPARE_ICON_NEW); lbCompareDeleted.setIcon(ParameterEditor.COMPARE_ICON_DELETED); lbCompareValueChanged.setIcon(ParameterEditor.COMPARE_ICON_VALUE_CHANGED); lbCompareNew.setToolTipText(localeDelegate.getMessage("dbtransfer.import.step1.15", "Neue Entit\u00e4ten")); lbCompareDeleted.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.17", "Gel\u00f6schte Entit\u00e4ten")); lbCompareValueChanged.setToolTipText( localeDelegate.getMessage("dbtransfer.import.step1.16", "Ge\u00e4nderte Entit\u00e4ten")); jpnPreviewFooter.add(lbCompare, "1,0,r,c"); jpnPreviewFooter.add(lbCompareNew, "2,0,r,c"); jpnPreviewFooter.add(lbCompareValueChanged, "3,0,r,c"); jpnPreviewFooter.add(lbCompareDeleted, "4,0,r,c"); return blnTransferWithWarnings; }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private void setupParameterPanel(Collection<EntityObjectVO> incomingParameterVOs) { final String entity = NuclosEntity.PARAMETER.getEntityName(); List<EntityObjectVO> currentParameterVOs = new ArrayList<EntityObjectVO>( CollectionUtils.transform(MasterDataDelegate.getInstance().getMasterData(entity), DalSupportForMD.getTransformerToEntityObjectVO(entity))); int iCountNew = 0; int iCountDeleted = 0; int iCountValueChanged = 0; final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); // find new parameter and existing List<ParameterComparison> allParameter = new ArrayList<ParameterComparison>(); for (EntityObjectVO incomingParameterVO : incomingParameterVOs) { boolean blnParamFound = false; String sCurrentValue = null; for (EntityObjectVO currentParameterVO : currentParameterVOs) { if ((incomingParameterVO.getField("name", String.class)) .equals(currentParameterVO.getField("name", String.class))) { blnParamFound = true;/*from ww w. ja v a 2 s .c om*/ sCurrentValue = currentParameterVO.getField("value", String.class); break; } } if (!blnParamFound) { allParameter.add(new ParameterComparison(incomingParameterVO, true, false, null)); iCountNew++; } else { ParameterComparison parameter = new ParameterComparison(incomingParameterVO, false, false, sCurrentValue); allParameter.add(parameter); if (parameter.isValueChanged()) iCountValueChanged++; } } // find deleted parameter for (EntityObjectVO currentParameterVO : currentParameterVOs) { boolean blnParamFound = false; for (EntityObjectVO incomingParamVO : incomingParameterVOs) { if ((incomingParamVO.getField("name", String.class)) .equals(currentParameterVO.getField("name", String.class))) { blnParamFound = true; break; } } if (!blnParamFound) { allParameter.add(new ParameterComparison(currentParameterVO, false, true, currentParameterVO.getField("value", String.class))); iCountDeleted++; } } // sort parameter VOs List<ParameterComparison> allParameterSorted = new ArrayList<ParameterComparison>(allParameter); Collections.sort(allParameterSorted, new Comparator<ParameterComparison>() { @Override public int compare(ParameterComparison o1, ParameterComparison o2) { return StringUtils.emptyIfNull(o1.getField("name", String.class)) .compareTo(StringUtils.emptyIfNull(o2.getField("name", String.class))); } }); jpnParameterHeader.removeAll(); jpnParameterFooter.removeAll(); // setup parameter scroll pane jpnParameter.removeAll(); double[] rowContraints = new double[allParameterSorted.size()]; for (int i = 0; i < allParameterSorted.size(); i++) rowContraints[i] = TableLayout.PREFERRED; final int iWidthBeginnigSpace = 3; final int iWidthSeparator = 6; final int iWidthRadioButton = 20; utils.initJPanel(jpnParameter, new double[] { iWidthBeginnigSpace, TableLayout.PREFERRED, iWidthSeparator, iWidthRadioButton, iWidthRadioButton, iWidthRadioButton, TableLayout.FILL }, rowContraints); int iWidthLabelSize = 0; int iRow = 0; lstParameterEditors.clear(); for (ParameterComparison parameter : allParameterSorted) { final ParameterEditor pe = new ParameterEditor(parameter); // init last state if (setSelectedCurrentParameter.contains(pe.getName())) pe.setCurrentValue(); if (setSelectedIncomingParameter.contains(pe.getName())) pe.setIncomingValue(); if (mapSelectedOtherParameter.containsKey(pe.getName())) pe.setOtherValue(mapSelectedOtherParameter.get(pe.getName())); // add change listener to update the radio buttons in footer pe.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { updateParameterAllSelection(); } }); pe.addToStepContent(jpnParameter, iRow); lstParameterEditors.add(pe); if (pe.getLabelPrefferedSize().width > iWidthLabelSize) iWidthLabelSize = pe.getLabelPrefferedSize().width; iRow++; } updateParameterAllSelection(); jpnParameter.add(new JSeparator(JSeparator.VERTICAL), "2,0,2," + (iRow - 1)); // setup parameter header utils.initJPanel(jpnParameterHeader, new double[] { iWidthBeginnigSpace, iWidthLabelSize + iWidthSeparator + (iWidthRadioButton / 2) + utils.TABLE_LAYOUT_H_GAP + 1/*Border*/, iWidthRadioButton, iWidthRadioButton, TableLayout.FILL }, new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, 4 }); if (allParameterSorted.isEmpty()) { jpnParameterHeader.add(new JLabel( localeDelegate.getMessage("dbtransfer.import.parameterpanel.18", "Keine Parameter vorhanden.")), "1,2,4,2"); return; } jpnParameterHeader.add( new JLabel(localeDelegate.getMessage("dbtransfer.import.parameterpanel.1", "Parameter")), "1,2"); jpnParameterHeader.add(new JLabel( localeDelegate.getMessage("dbtransfer.import.parameterpanel.2", "aktuellen Zustand beibehalten")), "2,0,4,0"); jpnParameterHeader.add(new JSeparator(JSeparator.VERTICAL), "2,1,2,3"); jpnParameterHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.parameterpanel.3", "importierten Zustand \u00fcbernehmen")), "3,1,4,1"); jpnParameterHeader.add(new JSeparator(JSeparator.VERTICAL), "3,2,3,3"); jpnParameterHeader.add( new JLabel(localeDelegate.getMessage("dbtransfer.import.parameterpanel.4", "anderen Wert setzen")), "4,2"); jpnParameterHeader.add(new JSeparator(JSeparator.VERTICAL), "4,3"); // setup parameter footer utils.initJPanel(jpnParameterFooter, new double[] { iWidthBeginnigSpace, iWidthLabelSize + iWidthSeparator + utils.TABLE_LAYOUT_H_GAP + 1/*Border*/, iWidthRadioButton, iWidthRadioButton, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED }, new double[] { TableLayout.PREFERRED }); final JLabel lbCompare = new JLabel( localeDelegate.getMessage("dbtransfer.import.parameterpanel.5", "\u00c4nderungen") + ":"); final JLabel lbCompareNew = new JLabel(iCountNew + ""); final JLabel lbCompareDeleted = new JLabel(iCountDeleted + ""); final JLabel lbCompareValueChanged = new JLabel(iCountValueChanged + ""); lbCompareNew.setIcon(ParameterEditor.COMPARE_ICON_NEW); lbCompareDeleted.setIcon(ParameterEditor.COMPARE_ICON_DELETED); lbCompareValueChanged.setIcon(ParameterEditor.COMPARE_ICON_VALUE_CHANGED); lbCompare.setToolTipText(localeDelegate.getMessage("dbtransfer.import.parameterpanel.6", "Vergleich von Aktueller- und Importkonfiguration")); lbCompareNew.setToolTipText(ParameterEditor.COMPARE_DESCRIPTION_NEW); lbCompareDeleted.setToolTipText(ParameterEditor.COMPARE_DESCRIPTION_DELETED); lbCompareValueChanged.setToolTipText(ParameterEditor.COMPARE_DESCRIPTION_VALUE_CHANGED); jpnParameterFooter.add(new JLabel( localeDelegate.getMessage("dbtransfer.import.parameterpanel.7", "auf alle Parameter anwenden")), "1,0,r,c"); jpnParameterFooter.add(rbCurrentAll, "2,0,l,c"); jpnParameterFooter.add(rbIncomingAll, "3,0,l,c"); jpnParameterFooter.add(lbCompare, "4,0,r,c"); jpnParameterFooter.add(lbCompareNew, "5,0,r,c"); jpnParameterFooter.add(lbCompareValueChanged, "6,0,r,c"); jpnParameterFooter.add(lbCompareDeleted, "7,0,r,c"); }
From source file:org.nuclos.client.ui.DateTimeSeries.java
/** * - creates the panels//from w ww .j a va2s.co m * - set properties and actionlisteners to all controls * - add all controls to the panels */ private synchronized void setupControl() { this.setLayout(new BorderLayout()); final double[] columns = new double[] { 2.0, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, 2.0 }; final double[] rows = new double[] { 4.0, 28.0, 28.0, 28.0, 28.0, 28.0, 4.0 }; tfTimeH.setInputVerifier(new TextFieldNumberVerifier(0, 23)); tfTimeH.setColumns(2); tfTimeM.setInputVerifier(new TextFieldNumberVerifier(0, 59)); tfTimeM.setColumns(2); final JPanel pnlHolder = new JPanel(); pnlHolder.setLayout(new TableLayout(columns, rows)); pnlHolder.setBorder(tfSeries.getBorder()); radioDaily.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(DAILY_MODE); } }); radioWeekly.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(WEEKLY_MODE); } }); radioMonthly.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(MONTHLY_MODE); } }); radioYearly.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(YEARLY_MODE); } }); radioNoMode.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setMode(NO_MODE); } }); bgMainModus.add(radioDaily); bgMainModus.add(radioWeekly); bgMainModus.add(radioMonthly); bgMainModus.add(radioYearly); bgMainModus.add(radioNoMode); pnlHolder.add(radioDaily, getConstraints(1, 1, 1, 1)); pnlHolder.add(radioWeekly, getConstraints(1, 1, 2, 2)); pnlHolder.add(radioMonthly, getConstraints(1, 1, 3, 3)); pnlHolder.add(radioYearly, getConstraints(1, 1, 4, 4)); if (isNoModeAvaiable) { pnlHolder.add(radioNoMode, getConstraints(1, 1, 5, 5)); } pnlHolder.add(new JSeparator(SwingConstants.VERTICAL), getConstraints(2, 2, 1, 5, TableLayoutConstants.CENTER, TableLayoutConstants.FULL)); final JLabel labStartTime = new JLabel("Uhrzeit "); constraintsPnlTime = getConstraints(1, 4, 1, 1); pnlTime = new JPanel(new TableLayout( new double[] { 2.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 2.0 }, new double[] { 4.0, 21.0, 4.0 })); pnlTime.add(labStartTime, getConstraints(1, 1, 1, 1)); pnlTime.add(tfTimeH, getConstraints(2, 2, 1, 1)); pnlTime.add(new JLabel(" : "), getConstraints(3, 3, 1, 1)); pnlTime.add(tfTimeM, getConstraints(4, 4, 1, 1)); final TableLayoutConstraints constraintsRight = getConstraints(3, 3, 1, 5, TableLayoutConstants.FULL, TableLayoutConstants.FULL); pnlEmpty = new JPanel(new TableLayout()); pnlHolder.add(pnlEmpty, constraintsRight); /** * DAILY MODE */ pnlDailyMode = new JPanel(new TableLayout( new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 4.0 }, new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel 21.0, 21.0, 4.0 })); tfDailyDays.setColumns(4); tfDailyDays.setInputVerifier(new TextFieldNumberVerifier(1, 366)); radioDailyAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfDailyDays.setEnabled(true); } }); radioDailyWorking.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfDailyDays.setEnabled(false); } }); final ButtonGroup bgDailyMode = new ButtonGroup(); bgDailyMode.add(this.radioDailyAll); bgDailyMode.add(this.radioDailyWorking); radioDailyAll.addActionListener(this); radioDailyWorking.addActionListener(this); pnlDailyMode.add(radioDailyAll, getConstraints(1, 1, 2, 2)); pnlDailyMode.add(radioDailyWorking, getConstraints(1, 3, 3, 3)); pnlDailyMode.add(tfDailyDays, getConstraints(2, 2, 2, 2)); pnlDailyMode.add(new JLabel(" Tag(e)"), getConstraints(3, 3, 2, 2)); pnlHolder.add(pnlDailyMode, constraintsRight); /** * WEEKLY MODE */ pnlWeeklyMode = new JPanel(new TableLayout( new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 4.0 }, new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel 21.0, 21.0, 21.0, 21.0, 21.0, 4.0 })); tfWeeklyWeeks.setColumns(3); tfWeeklyWeeks.setInputVerifier(new TextFieldNumberVerifier(1, 53)); pnlWeeklyMode.add(new JLabel("Jede/Alle "), getConstraints(1, 1, 2, 2)); pnlWeeklyMode.add(tfWeeklyWeeks, getConstraints(2, 2, 2, 2)); pnlWeeklyMode.add(new JLabel(" Woche(n) am"), getConstraints(3, 3, 2, 2)); pnlWeeklyMode.add(checkMonday, getConstraints(1, 2, 3, 3)); pnlWeeklyMode.add(checkTuesday, getConstraints(1, 2, 4, 4)); pnlWeeklyMode.add(checkWednesday, getConstraints(1, 2, 5, 5)); pnlWeeklyMode.add(checkThursday, getConstraints(1, 2, 6, 6)); pnlWeeklyMode.add(checkFriday, getConstraints(3, 3, 3, 3)); pnlWeeklyMode.add(checkSaturday, getConstraints(3, 3, 4, 4)); pnlWeeklyMode.add(checkSunday, getConstraints(3, 3, 5, 5)); checkMonday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkMonday.setSelected(true); } }); checkMonday.addActionListener(this); checkTuesday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkTuesday.setSelected(true); } }); checkTuesday.addActionListener(this); checkWednesday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkWednesday.setSelected(true); } }); checkWednesday.addActionListener(this); checkThursday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkThursday.setSelected(true); } }); checkThursday.addActionListener(this); checkFriday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkFriday.setSelected(true); } }); checkFriday.addActionListener(this); checkSaturday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkSaturday.setSelected(true); } }); checkSaturday.addActionListener(this); checkSunday.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!isAtLeastOneWeekdaySelected()) checkSunday.setSelected(true); } }); checkSunday.addActionListener(this); pnlHolder.add(pnlWeeklyMode, constraintsRight); /** * MONTHLY MODE */ pnlMonthlyMode = new JPanel(new TableLayout( new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 4.0 }, new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel 21.0, 21.0, 26.0, 21.0, 4.0 })); final ButtonGroup bgMonthlyMode = new ButtonGroup(); radioMonthly1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfMonthly1Day.setEnabled(true); tfMonthly1Month.setEnabled(true); comboMonthly2Number.setEnabled(false); comboMonthly2Weekday.setEnabled(false); tfMonthly2Month.setEnabled(false); } }); radioMonthly1.addActionListener(this); radioMonthly2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfMonthly1Day.setEnabled(false); tfMonthly1Month.setEnabled(false); comboMonthly2Number.setEnabled(true); comboMonthly2Weekday.setEnabled(true); tfMonthly2Month.setEnabled(true); } }); radioMonthly2.addActionListener(this); bgMonthlyMode.add(radioMonthly1); bgMonthlyMode.add(radioMonthly2); tfMonthly1Day.setColumns(3); tfMonthly1Day.setInputVerifier(new TextFieldNumberVerifier(1, 31)); tfMonthly1Month.setColumns(3); tfMonthly1Month.setInputVerifier(new TextFieldNumberVerifier(1, 12)); tfMonthly2Month.setColumns(3); tfMonthly2Month.setInputVerifier(new TextFieldNumberVerifier(1, 12)); comboMonthly2Number.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getNumberItems()) { comboMonthly2Number.addItem(sli); } comboMonthly2Weekday.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getWeekdayItems()) { comboMonthly2Weekday.addItem(sli); } pnlMonthlyMode.add(radioMonthly1, getConstraints(1, 1, 2, 2)); pnlMonthlyMode.add(radioMonthly2, getConstraints(1, 1, 4, 4, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlMonthlyMode.add(tfMonthly1Day, getConstraints(2, 2, 2, 2)); pnlMonthlyMode.add(new JLabel(" . Tag"), getConstraints(3, 3, 2, 2)); pnlMonthlyMode.add(new JLabel("jedes "), getConstraints(2, 2, 3, 3)); pnlMonthlyMode.add(tfMonthly1Month, getConstraints(3, 3, 3, 3)); pnlMonthlyMode.add(new JLabel(" . Monats"), getConstraints(4, 4, 3, 3)); pnlMonthlyMode.add(comboMonthly2Number, getConstraints(2, 3, 4, 4, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlMonthlyMode.add(comboMonthly2Weekday, getConstraints(4, 5, 4, 4, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlMonthlyMode.add(new JLabel("jedes "), getConstraints(2, 2, 5, 5)); pnlMonthlyMode.add(tfMonthly2Month, getConstraints(3, 3, 5, 5)); pnlMonthlyMode.add(new JLabel(" . Monats"), getConstraints(4, 4, 5, 5)); pnlHolder.add(pnlMonthlyMode, constraintsRight); /** * YEARLY MODE */ pnlYearlyMode = new JPanel(new TableLayout( new double[] { 4.0, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, 4.0 }, new double[] { 4.0, TableLayoutConstants.PREFERRED, // for start time panel 21.0, 26.0, 21.0, 4.0 })); final ButtonGroup bgYearlyMode = new ButtonGroup(); radioYearly1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfYearly1Day.setEnabled(true); comboYearly1Month.setEnabled(true); comboYearly2Number.setEnabled(false); comboYearly2Weekday.setEnabled(false); comboYearly2Month.setEnabled(false); } }); radioYearly1.addActionListener(this); radioYearly2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { tfYearly1Day.setEnabled(false); comboYearly1Month.setEnabled(false); comboYearly2Number.setEnabled(true); comboYearly2Weekday.setEnabled(true); comboYearly2Month.setEnabled(true); } }); radioYearly2.addActionListener(this); bgYearlyMode.add(radioYearly1); bgYearlyMode.add(radioYearly2); tfYearly1Day.setColumns(3); tfYearly1Day.setInputVerifier(new TextFieldNumberVerifier(1, 31)); comboYearly1Month.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getMonthItems()) { comboYearly1Month.addItem(sli); } comboYearly2Number.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getNumberItems()) { comboYearly2Number.addItem(sli); } comboYearly2Weekday.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getWeekdayItems()) { comboYearly2Weekday.addItem(sli); } comboYearly2Month.addActionListener(this); for (SeriesListItem sli : SeriesUtils.getMonthItems()) { comboYearly2Month.addItem(sli); } pnlYearlyMode.add(radioYearly1, getConstraints(1, 1, 2, 2)); pnlYearlyMode.add(radioYearly2, getConstraints(1, 1, 3, 3, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlYearlyMode.add(tfYearly1Day, getConstraints(2, 2, 2, 2)); pnlYearlyMode.add(new JLabel(" . "), getConstraints(3, 3, 2, 2)); pnlYearlyMode.add(comboYearly1Month, getConstraints(4, 5, 2, 2)); pnlYearlyMode.add(comboYearly2Number, getConstraints(2, 3, 3, 3, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlYearlyMode.add(comboYearly2Weekday, getConstraints(4, 5, 3, 3, TableLayoutConstants.LEFT, TableLayoutConstants.BOTTOM)); pnlYearlyMode.add(new JLabel("im "), getConstraints(2, 2, 4, 4)); pnlYearlyMode.add(comboYearly2Month, getConstraints(3, 5, 4, 4)); pnlHolder.add(pnlYearlyMode, constraintsRight); resetAllInputFieldsToDefault(); /* * add "Main" Panel */ this.add(pnlHolder, BorderLayout.CENTER); }
From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.PopupMenu.java
/** Builds and lays out the GUI. */ private void buildGUI() { setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); if (model.getType() == DataBrowserModel.GROUP) { add(resetPassword);//from w w w . j a va 2 s.c o m add(activatedUser); add(buildEditMenu()); add(removeElement); } else { JMenu menu; String text = "View"; switch (DataBrowserAgent.runAsPlugin()) { case DataBrowser.IMAGE_J: menu = new JMenu(text); menu.setIcon(view.getIcon()); menu.add(view); menu.add(controller.getAction(DataBrowserControl.VIEW_IN_IJ)); add(menu); break; case DataBrowser.KNIME: menu = new JMenu(text); menu.setIcon(view.getIcon()); menu.add(view); menu.add(controller.getAction(DataBrowserControl.VIEW_IN_KNIME)); add(menu); break; default: add(view); } ; add(openWithMenu); add(new JSeparator(JSeparator.HORIZONTAL)); add(buildEditMenu()); add(removeElement); JMenu m = createMoveToMenu(); if (m != null) add(m); add(new JSeparator(JSeparator.HORIZONTAL)); add(tagElement); add(newExperimentElement); add(new JSeparator(JSeparator.HORIZONTAL)); add(buildRenderingSettingsMenu()); } }