List of usage examples for java.awt.event ItemEvent SELECTED
int SELECTED
To view the source code for java.awt.event ItemEvent SELECTED.
Click Source Link
From source file:edu.purdue.cc.bionet.ui.CorrelationDisplayPanel.java
/** * The itemStateChanged method of the ItemListener interface. * @see ItemListener#itemStateChanged(ItemEvent) * // w w w .ja v a2 s . com * @param e The event which triggered this action. */ public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { Object item = e.getSource(); if (item == this.highContrastColorMenuItem) { graph.setBackground(Color.BLACK); graph.setForeground(Color.WHITE); graph.setPickedLabelColor(Color.WHITE); graph.setVertexPaint(Color.ORANGE.darker()); graph.setPickedVertexPaint(Color.RED); graph.setPickedEdgePaint(Color.WHITE); heatMapPanel.setBackground(Color.BLACK); heatMapPanel.setForeground(Color.WHITE); } else if (item == this.normalColorMenuItem) { graph.setBackground(Color.WHITE); graph.setForeground(Color.BLACK); graph.setPickedLabelColor(Color.BLUE); graph.setVertexPaint(Color.ORANGE); graph.setPickedVertexPaint(Color.YELLOW); graph.setPickedEdgePaint(Color.BLACK); heatMapPanel.setForeground(Color.BLACK); heatMapPanel.setBackground(Color.WHITE); } else if (item == pearsonCalculationMenuItem) { correlationMethod.setValue(Correlation.PEARSON); } else if (item == spearmanCalculationMenuItem) { correlationMethod.setValue(Correlation.SPEARMAN); } else if (item == kendallCalculationMenuItem) { correlationMethod.setValue(Correlation.KENDALL); } graph.filterEdges(); graph.repaint(); } }
From source file:com.openbravo.pos.panels.JTicketsFinder.java
private void jcboUserItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcboUserItemStateChanged if (evt.getStateChange() == ItemEvent.SELECTED) { jButton3ActionPerformed(null);/*from ww w . j a va2s .c o m*/ } }
From source file:lejos.pc.charting.LogChartFrame.java
/** All the setup of components, etc. What's scary is Swing is a "lightweight" GUI framework... * @throws Exception/*from w w w .j a v a2 s .c o m*/ */ private void jbInit() throws Exception { this.setJMenuBar(menuBar); this.setSize(new Dimension(819, 613)); this.setMinimumSize(new Dimension(819, 613)); this.setTitle("NXT Charting Logger"); this.setEnabled(true); // enforce minimum window size this.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { JFrame theFrame = (JFrame) e.getSource(); Dimension d1 = theFrame.getMinimumSize(); Dimension d2 = theFrame.getSize(); boolean enforce = false; if (theFrame.getWidth() < d1.getWidth()) { d2.setSize(d1.getWidth(), d2.getHeight()); enforce = true; } if (theFrame.getHeight() < d1.getHeight()) { d2.setSize(d2.getWidth(), d1.getHeight()); enforce = true; } if (enforce) theFrame.setSize(d2); } }); this.getContentPane().setLayout(gridBagLayout1); MenuActionListener menuItemActionListener = new MenuActionListener(); MenuEventListener menuListener = new MenuEventListener(); menu = new JMenu("Edit"); menu.setMnemonic(KeyEvent.VK_E); menuBar.add(menu); menuItem = new JMenuItem("Copy Chart Image", KeyEvent.VK_I); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menuItem = new JMenuItem("Copy Data Log", KeyEvent.VK_D); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menu = new JMenu("View"); menu.setMnemonic(KeyEvent.VK_V); menu.setActionCommand("VIEW_MENU"); menu.addMenuListener(menuListener); menuBar.add(menu); menuItem = new JMenuItem("Expand Chart", KeyEvent.VK_F); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menuItem = new JMenuItem("Chart in New Window", KeyEvent.VK_N); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menu = new JMenu("Help"); menu.setMnemonic(KeyEvent.VK_H); menuBar.add(menu); menuItem = new JMenuItem("Chart controls", KeyEvent.VK_C); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menuItem = new JMenuItem("Generate sample data", KeyEvent.VK_G); menuItem.addActionListener(menuItemActionListener); menu.add(menuItem); menuItem = new JMenuItem("About", KeyEvent.VK_A); menuItem.addActionListener(menuItemActionListener); jTabbedPane1.setPreferredSize(new Dimension(621, 199)); jTabbedPane1.setMinimumSize(new Dimension(621, 199)); menu.add(menuItem); jButtonConnect.setText("Connect"); jButtonConnect.setBounds(new Rectangle(25, 65, 115, 25)); jButtonConnect.setToolTipText("Connect/disconnect toggle"); jButtonConnect.setMnemonic('C'); jButtonConnect.setSelected(true); jButtonConnect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jButtonConnect_actionPerformed(e); } }); UIPanel.setSize(new Dimension(820, 200)); UIPanel.setLayout(null); UIPanel.setPreferredSize(new Dimension(300, 200)); UIPanel.setMinimumSize(new Dimension(300, 200)); UIPanel.setBounds(new Rectangle(0, 350, 820, 200)); UIPanel.setMaximumSize(new Dimension(300, 32767)); connectionPanel.setBounds(new Rectangle(10, 10, 175, 100)); connectionPanel.setBorder(BorderFactory.createTitledBorder("Connection")); connectionPanel.setLayout(null); connectionPanel.setFont(new Font("Tahoma", 0, 11)); jLabel1logfilename.setText("Log File:"); jLabel1logfilename.setBounds(new Rectangle(10, 125, 165, 20)); jLabel1logfilename.setHorizontalTextPosition(SwingConstants.RIGHT); jLabel1logfilename.setHorizontalAlignment(SwingConstants.LEFT); jLabel1logfilename.setToolTipText("Specify the name of your log file here"); jTextFieldNXTName.setBounds(new Rectangle(5, 40, 165, 20)); jTextFieldNXTName.setToolTipText( "The name or Address of the NXT. Leave empty and the first one found will be used."); jTextFieldNXTName.requestFocus(); jTextAreaStatus.setLineWrap(true); jTextAreaStatus.setFont(new Font("Tahoma", 0, 11)); jTextAreaStatus.setWrapStyleWord(true); jTextAreaStatus.setBackground(SystemColor.window); dataLogTextArea.setLineWrap(false); dataLogTextArea.setFont(new Font("Tahoma", 0, 11)); dataLogTextArea.setBackground(SystemColor.window); FQPathTextArea.setBounds(new Rectangle(5, 170, 185, 40)); FQPathTextArea.setLineWrap(true); FQPathTextArea.setText(getCanonicalName(new File(".", ""))); FQPathTextArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); FQPathTextArea.setRows(2); FQPathTextArea.setFont(new Font("Tahoma", 0, 9)); FQPathTextArea.setOpaque(false); FQPathTextArea.setEditable(false); selectFolderButton.setText("Folder..."); selectFolderButton.setBounds(new Rectangle(120, 125, 70, 20)); selectFolderButton.setMargin(new Insets(1, 1, 1, 1)); selectFolderButton.setFocusable(false); selectFolderButton.setMnemonic('F'); selectFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectFolderButton_actionPerformed(e); } }); // domain display limits GUI chartOptionsPanel.setLayout(null); chartDomLimitsPanel.setBounds(new Rectangle(5, 35, 180, 135)); chartDomLimitsPanel.setLayout(gridLayout1); chartDomLimitsPanel.setBorder(BorderFactory.createTitledBorder("Domain Display Limiting")); domainDisplayLimitSlider.setEnabled(false); domainDisplayLimitSlider.setMaximum(MAXDOMAIN_DATAPOINT_LIMIT); domainDisplayLimitSlider.setMinimum(MINDOMAIN_LIMIT); domainDisplayLimitSlider.setValue(MAXDOMAIN_DATAPOINT_LIMIT); domainDisplayLimitSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { domainDisplayLimitSlider_stateChanged(e); } }); useTimeRadioButton.setText("By Time"); useTimeRadioButton.setEnabled(false); useTimeRadioButton.setMnemonic('I'); useTimeRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { domainDisplayLimitRadioButton_actionPerformed(e); } }); useDataPointsRadioButton.setText("By Data Points"); ButtonGroup bg1 = new ButtonGroup(); bg1.add(useTimeRadioButton); bg1.add(useDataPointsRadioButton); useDataPointsRadioButton.setSelected(true); useDataPointsRadioButton.setEnabled(false); useDataPointsRadioButton.setMnemonic('P'); useDataPointsRadioButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { domainDisplayLimitRadioButton_actionPerformed(e); } }); datasetLimitEnableCheckBox.setText("Enable"); datasetLimitEnableCheckBox.setRolloverEnabled(true); datasetLimitEnableCheckBox.setMnemonic('A'); datasetLimitEnableCheckBox.setToolTipText("Enable Domain Clipping"); datasetLimitEnableCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { datasetLimitEnableCheckBox_actionPerformed(e); } }); domainLimitLabel.setText(String.format("%1$,d datapoints", MAXDOMAIN_DATAPOINT_LIMIT).toString()); domainLimitLabel.setEnabled(false); gridLayout1.setRows(5); gridLayout1.setColumns(1); jLabel1.setText("Chart Title:"); jLabel1.setBounds(new Rectangle(200, 10, 85, 20)); jLabel1.setPreferredSize(new Dimension(115, 14)); jLabel2.setText("Range Axis 1 Label:"); jLabel2.setBounds(new Rectangle(200, 35, 115, 20)); jLabel2.setSize(new Dimension(115, 20)); jLabel3.setText("Range Axis 2 Label:"); jLabel3.setBounds(new Rectangle(200, 60, 115, 20)); jLabel3.setSize(new Dimension(115, 20)); jLabel4.setText("Range Axis 3 Label:"); jLabel4.setBounds(new Rectangle(200, 85, 115, 20)); jLabel4.setSize(new Dimension(115, 20)); jLabel6.setText("Range Axis 4 Label:"); jLabel6.setBounds(new Rectangle(200, 110, 115, 20)); jLabel6.setSize(new Dimension(115, 20)); titleLabelChangeNotifier notifier = new titleLabelChangeNotifier(); chartTitleTextField.setBounds(new Rectangle(315, 10, 290, 20)); chartTitleTextField.getDocument().addDocumentListener(notifier); axis1LabelTextField.setBounds(new Rectangle(315, 35, 290, 20)); axis1LabelTextField.getDocument().addDocumentListener(notifier); axis2LabelTextField.setBounds(new Rectangle(315, 60, 290, 20)); axis2LabelTextField.getDocument().addDocumentListener(notifier); axis3LabelTextField.setBounds(new Rectangle(315, 85, 290, 20)); axis3LabelTextField.getDocument().addDocumentListener(notifier); axis4LabelTextField.setBounds(new Rectangle(315, 110, 290, 20)); showCommentsCheckBox.setText("Show Comment Markers"); showCommentsCheckBox.setBounds(new Rectangle(200, 140, 185, 25)); showCommentsCheckBox.setToolTipText("Show/Hide any comment markers on the chart"); showCommentsCheckBox.setRolloverEnabled(true); showCommentsCheckBox.setSelected(true); showCommentsCheckBox.setMnemonic('M'); showCommentsCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { customChartPanel.setCommentsVisible(e.getStateChange() == ItemEvent.SELECTED); } }); scrollDomainCheckBox.setText("Scroll Domain"); scrollDomainCheckBox.setBounds(new Rectangle(10, 5, 175, 20)); scrollDomainCheckBox.setSize(new Dimension(175, 25)); scrollDomainCheckBox.setSelected(true); scrollDomainCheckBox.setMnemonic('O'); scrollDomainCheckBox.setToolTipText("Checked to scroll domain as new data is received"); scrollDomainCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scrollDomainCheckBox_actionPerformed(e); } }); axis4LabelTextField.getDocument().addDocumentListener(notifier); logFileTextField.setBounds(new Rectangle(10, 145, 180, 20)); logFileTextField.setText("NXTData.txt"); logFileTextField.setPreferredSize(new Dimension(180, 20)); logFileTextField.setToolTipText("File name. Leave empty to not log to file."); statusScrollPane.setOpaque(false); dataLogScrollPane.setOpaque(false); customChartPanel.setMinimumSize(new Dimension(400, 300)); customChartPanel.setPreferredSize(new Dimension(812, 400)); jLabel5.setText("NXT Name/Address:"); jLabel5.setBounds(new Rectangle(5, 20, 160, 20)); jLabel5.setToolTipText(jTextFieldNXTName.getToolTipText()); jLabel5.setHorizontalTextPosition(SwingConstants.RIGHT); jLabel5.setHorizontalAlignment(SwingConstants.LEFT); connectionPanel.add(jTextFieldNXTName, null); connectionPanel.add(jButtonConnect, null); connectionPanel.add(jLabel5, null); dataLogScrollPane.setViewportView(dataLogTextArea); jTabbedPane1.addTab("Data Log", dataLogScrollPane); statusScrollPane.setViewportView(jTextAreaStatus); jTabbedPane1.addTab("Status", statusScrollPane); jTabbedPane1.addTab("Chart", chartOptionsPanel); chartDomLimitsPanel.add(datasetLimitEnableCheckBox, null); chartDomLimitsPanel.add(useDataPointsRadioButton, null); chartDomLimitsPanel.add(useTimeRadioButton, null); chartDomLimitsPanel.add(domainDisplayLimitSlider, null); chartDomLimitsPanel.add(domainLimitLabel, null); chartOptionsPanel.add(scrollDomainCheckBox, null); chartOptionsPanel.add(showCommentsCheckBox, null); chartOptionsPanel.add(axis4LabelTextField, null); chartOptionsPanel.add(axis3LabelTextField, null); chartOptionsPanel.add(axis2LabelTextField, null); chartOptionsPanel.add(axis1LabelTextField, null); chartOptionsPanel.add(chartTitleTextField, null); chartOptionsPanel.add(jLabel6, null); chartOptionsPanel.add(jLabel4, null); chartOptionsPanel.add(jLabel3, null); chartOptionsPanel.add(jLabel2, null); chartOptionsPanel.add(jLabel1, null); chartOptionsPanel.add(chartDomLimitsPanel, null); tglbtnpauseplay = new JToggleButton(""); tglbtnpauseplay.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (lpm == null) return; boolean doPause = false; if (e.getStateChange() == ItemEvent.SELECTED) { doPause = true; } lpm.setReaderPaused(doPause); } }); // tglbtnpauseplay.addChangeListener(new ChangeListener() { // public void stateChanged(ChangeEvent e) { // System.out.println(e.toString()); // //lpm.setReaderPaused(doPause) // } // }); tglbtnpauseplay .setSelectedIcon(new ImageIcon(LogChartFrame.class.getResource("/lejos/pc/charting/play.png"))); tglbtnpauseplay.setIcon(new ImageIcon(LogChartFrame.class.getResource("/lejos/pc/charting/pause.png"))); tglbtnpauseplay.setBounds(571, 135, 30, 30); chartOptionsPanel.add(tglbtnpauseplay); jTabbedPane1.setToolTipTextAt(0, "The tab-delimited log of the data sent from the NXT"); jTabbedPane1.setToolTipTextAt(1, "Status output"); jTabbedPane1.setToolTipTextAt(2, "Chart options"); jTabbedPane1.setMnemonicAt(0, KeyEvent.VK_D); jTabbedPane1.setMnemonicAt(1, KeyEvent.VK_S); jTabbedPane1.setMnemonicAt(2, KeyEvent.VK_T); this.getContentPane().add(customChartPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); this.getContentPane().add(UIPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), -107, 0)); this.getContentPane().add(jTabbedPane1, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); UIPanel.add(connectionPanel, null); UIPanel.add(selectFolderButton, null); UIPanel.add(logFileTextField, null); UIPanel.add(jLabel1logfilename, null); UIPanel.add(FQPathTextArea, null); ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { String theData = null; for (;;) { theData = LogChartFrame.this.logDataQueue.poll(); if (theData == null) break; try { dataLogTextArea.getDocument().insertString(dataLogTextArea.getDocument().getLength(), theData, null); } catch (BadLocationException e) { System.out.print( "BadLocationException in datalog textarea updater thread:" + e.toString() + "\n"); } } } }; this.updateLogTextAreaTimer = new Timer(1000, taskPerformer); this.updateLogTextAreaTimer.start(); }
From source file:net.pms.encoders.TsMuxeRVideo.java
@Override public JComponent config() { // Apply the orientation for the locale Locale locale = new Locale(configuration.getLanguage()); ComponentOrientation orientation = ComponentOrientation.getOrientation(locale); String colSpec = FormLayoutUtil.getColSpec(COL_SPEC, orientation); FormLayout layout = new FormLayout(colSpec, ROW_SPEC); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(Borders.EMPTY_BORDER); builder.setOpaque(false);//from w ww . j a v a2 s . c o m CellConstraints cc = new CellConstraints(); JComponent cmp = builder.addSeparator(Messages.getString("TSMuxerVideo.3"), FormLayoutUtil.flip(cc.xyw(2, 1, 1), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); tsmuxerforcefps = new JCheckBox(Messages.getString("TSMuxerVideo.2")); tsmuxerforcefps.setContentAreaFilled(false); if (configuration.isTsmuxerForceFps()) { tsmuxerforcefps.setSelected(true); } tsmuxerforcefps.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setTsmuxerForceFps(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(tsmuxerforcefps, FormLayoutUtil.flip(cc.xy(2, 3), colSpec, orientation)); muxallaudiotracks = new JCheckBox(Messages.getString("TSMuxerVideo.19")); muxallaudiotracks.setContentAreaFilled(false); if (configuration.isMuxAllAudioTracks()) { muxallaudiotracks.setSelected(true); } muxallaudiotracks.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setMuxAllAudioTracks(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(muxallaudiotracks, FormLayoutUtil.flip(cc.xy(2, 5), colSpec, orientation)); JPanel panel = builder.getPanel(); // Apply the orientation to the panel and all components in it panel.applyComponentOrientation(orientation); return panel; }
From source file:net.pms.encoders.FFmpegVideo.java
protected JComponent config(String languageLabel) { FormLayout layout = new FormLayout("left:pref, 0:grow", "p, 3dlu, p, 3dlu, p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(Borders.EMPTY_BORDER); builder.setOpaque(false);/*from ww w .j a va2 s . co m*/ CellConstraints cc = new CellConstraints(); JComponent cmp = builder.addSeparator(Messages.getString(languageLabel), cc.xyw(2, 1, 1)); cmp = (JComponent) cmp.getComponent(0); cmp.setFont(cmp.getFont().deriveFont(Font.BOLD)); multiThreadingCheckBox = new JCheckBox(Messages.getString("MEncoderVideo.35")); multiThreadingCheckBox.setContentAreaFilled(false); if (configuration.isFfmpegMultithreading()) { multiThreadingCheckBox.setSelected(true); } multiThreadingCheckBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setFfmpegMultithreading(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(multiThreadingCheckBox, cc.xy(2, 3)); videoRemuxCheckBox = new JCheckBox(Messages.getString("FFmpeg.0")); videoRemuxCheckBox.setContentAreaFilled(false); if (configuration.isFFmpegMuxWhenCompatible()) { videoRemuxCheckBox.setSelected(true); } videoRemuxCheckBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { configuration.setFFmpegMuxWhenCompatible(e.getStateChange() == ItemEvent.SELECTED); } }); builder.add(videoRemuxCheckBox, cc.xy(2, 5)); return builder.getPanel(); }
From source file:org.languagetool.gui.ConfigurationDialog.java
@NotNull private JPanel getMotherTonguePanel(GridBagConstraints cons) { JPanel motherTonguePanel = new JPanel(); if (insideOffice) { motherTonguePanel.setLayout(new GridBagLayout()); GridBagConstraints cons1 = new GridBagConstraints(); cons1.insets = new Insets(0, 0, 0, 0); cons1.gridx = 0;/*from w w w . j a v a 2s. co m*/ cons1.gridy = 0; cons1.anchor = GridBagConstraints.WEST; cons1.fill = GridBagConstraints.NONE; cons1.weightx = 0.0f; JRadioButton[] radioButtons = new JRadioButton[2]; ButtonGroup numParaGroup = new ButtonGroup(); radioButtons[0] = new JRadioButton(Tools.getLabel(messages.getString("guiUseDocumentLanguage"))); radioButtons[0].setActionCommand("DocLang"); radioButtons[0].setSelected(true); radioButtons[1] = new JRadioButton(Tools.getLabel(messages.getString("guiSetLanguageTo"))); radioButtons[1].setActionCommand("SelectLang"); JComboBox<String> motherTongueBox = new JComboBox<>(getPossibleMotherTongues()); if (config.getMotherTongue() != null) { motherTongueBox.setSelectedItem(config.getMotherTongue().getTranslatedName(messages)); } motherTongueBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { Language motherTongue; if (motherTongueBox.getSelectedItem() instanceof String) { motherTongue = getLanguageForLocalizedName( motherTongueBox.getSelectedItem().toString()); } else { motherTongue = (Language) motherTongueBox.getSelectedItem(); } config.setMotherTongue(motherTongue); config.setUseDocLanguage(false); radioButtons[1].setSelected(true); } } }); for (int i = 0; i < 2; i++) { numParaGroup.add(radioButtons[i]); } if (config.getUseDocLanguage()) { radioButtons[0].setSelected(true); } else { radioButtons[1].setSelected(true); } radioButtons[0].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { config.setUseDocLanguage(true); } }); radioButtons[1].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { config.setUseDocLanguage(false); Language motherTongue; if (motherTongueBox.getSelectedItem() instanceof String) { motherTongue = getLanguageForLocalizedName(motherTongueBox.getSelectedItem().toString()); } else { motherTongue = (Language) motherTongueBox.getSelectedItem(); } config.setMotherTongue(motherTongue); } }); motherTonguePanel.add(radioButtons[0], cons1); cons1.gridy++; motherTonguePanel.add(radioButtons[1], cons1); cons1.gridx = 1; motherTonguePanel.add(motherTongueBox, cons1); } else { motherTonguePanel.add(new JLabel(messages.getString("guiMotherTongue")), cons); JComboBox<String> motherTongueBox = new JComboBox<>(getPossibleMotherTongues()); if (config.getMotherTongue() != null) { motherTongueBox.setSelectedItem(config.getMotherTongue().getTranslatedName(messages)); } motherTongueBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { Language motherTongue; if (motherTongueBox.getSelectedItem() instanceof String) { motherTongue = getLanguageForLocalizedName( motherTongueBox.getSelectedItem().toString()); } else { motherTongue = (Language) motherTongueBox.getSelectedItem(); } config.setMotherTongue(motherTongue); } } }); motherTonguePanel.add(motherTongueBox, cons); } return motherTonguePanel; }
From source file:geovista.network.gui.NodeLinkView.java
protected void addControls(final JPanel jp) { // Satellite/*from w ww. j a va 2 s . c o m*/ // JComboBox modeBox = graphMouse.getModeComboBox(); // modeBox.addItemListener(((DefaultModalGraphMouse)satellite.getGraphMouse()).getModeListener()); // Control Panel jp.setBackground(Color.WHITE); jp.setLayout(new BorderLayout()); jp.add(vv, BorderLayout.CENTER); JPanel control_panel = new JPanel(new GridLayout(5, 1)); jp.add(control_panel, BorderLayout.EAST); // File_Layout Panel Class[] combos = getCombos(); final JComboBox jcb = new JComboBox(combos); jcb.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String valueString = value.toString(); valueString = valueString.substring(valueString.lastIndexOf('.') + 1); return super.getListCellRendererComponent(list, valueString, index, isSelected, cellHasFocus); } }); jcb.addActionListener(new LayoutChooser(jcb, vv)); jcb.setSelectedItem(FRLayout.class); final Box file_layout_panel = Box.createVerticalBox(); file_layout_panel.setBorder(BorderFactory.createTitledBorder("File_Layout")); final JComboBox graph_chooser = new JComboBox(g_names); graph_chooser.addActionListener(new GraphChooser(jcb)); JPanel layoutPanel = new JPanel(); jcb.setAlignmentX(Component.CENTER_ALIGNMENT); layoutPanel.add(jcb); graph_chooser.setAlignmentX(Component.CENTER_ALIGNMENT); layoutPanel.add(graph_chooser); file_layout_panel.add(layoutPanel); // Basic Operation Panel final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JButton reset = new JButton("reset"); reset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Layout<Integer, Number> layout = vv.getGraphLayout(); layout.initialize(); Relaxer relaxer = vv.getModel().getRelaxer(); if (relaxer != null) { relaxer.stop(); relaxer.prerelax(); relaxer.relax(); } } }); // Tranform and picking part final DefaultModalGraphMouse<Integer, Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(graphMouse); JComboBox modeBox = graphMouse.getModeComboBox(); modeBox.addItemListener(((DefaultModalGraphMouse<Integer, Number>) vv.getGraphMouse()).getModeListener()); JButton collapse = new JButton("Collapse"); JButton expand = new JButton("Expand"); final Box basic_panel = Box.createVerticalBox(); basic_panel.setBorder(BorderFactory.createTitledBorder("Basic_Operation")); JPanel zoomPanel = new JPanel(); // plus.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(plus); // minus.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(minus); // modeBox.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(modeBox); // reset.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(reset); // collapse.setAlignmentY(Component.CENTER_ALIGNMENT); zoomPanel.add(collapse); // expand.setAlignmentY(Component.CENTER_ALIGNMENT); zoomPanel.add(expand); basic_panel.add(zoomPanel); // Vertex Part String[] vertexScoreType = { "VertexScore", "Degree", "BarycenterScorer", "BetweennessCentrality", "ClosenessCentrality", "DistanceCentralityScorer", "EigenvectorCentrality" }; final JComboBox vertexScoreList = new JComboBox(vertexScoreType); vertexScoreList.setSelectedIndex(0); vertexScoreList.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { // Renderer.VertexLabel.Position position = // (Renderer.VertexLabel.Position)e.getItem(); // vv.getRenderer().getVertexLabelRenderer().setPosition(position); if (vertexScoreList.getSelectedIndex() == 0) { // vertexScores = new VertexScoreTransformer<Integer, // Double>(voltage_scores); // vv.getRenderContext().setVertexShapeTransformer(new // ConstantTransformer(null)); // vssa.setScaling(false); vv.getRenderContext().setVertexLabelTransformer(nonvertexLabel); vv.repaint(); } if (vertexScoreList.getSelectedIndex() == 1) { // vertexScores = new VertexScoreTransformer<Integer, // Double>(degreeScorer); /* * vssa = new * VertexShapeSizeAspect<Integer,Number>((Graph<Integer * ,Number>)g, transformerDegree); * vv.getRenderContext().setVertexShapeTransformer(vssa); * vssa.setScaling(true); */ vv.getRenderContext().setVertexLabelTransformer(vertexLabelDegree); vv.repaint(); } if (vertexScoreList.getSelectedIndex() == 2) { vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g, transformerBarycenter); vv.getRenderContext().setVertexShapeTransformer(vssa); vssa.setScaling(true); vv.getRenderContext().setVertexLabelTransformer(vertexLabelBarycenter); vv.repaint(); } if (vertexScoreList.getSelectedIndex() == 3) { // betweennessCentrality= new BetweennessCentrality(g); // voltages = new VertexScoreTransformer<Integer, // Double>(betweennessCentrality); vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g, transformerBetweenness); vv.getRenderContext().setVertexShapeTransformer(vssa); vssa.setScaling(true); vv.getRenderContext().setVertexLabelTransformer(vertexLabelBetweenness); vv.repaint(); } if (vertexScoreList.getSelectedIndex() == 4) { vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g, transformerCloseness); vv.getRenderContext().setVertexShapeTransformer(vssa); vssa.setScaling(true); vv.getRenderContext().setVertexLabelTransformer(vertexLabelCloseness); vv.repaint(); } if (vertexScoreList.getSelectedIndex() == 5) { vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g, transformerDistanceCentrality); vv.getRenderContext().setVertexShapeTransformer(vssa); vssa.setScaling(true); vv.getRenderContext().setVertexLabelTransformer(vertexLabelDistanceCentrality); vv.repaint(); } if (vertexScoreList.getSelectedIndex() == 6) { vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g, transformerEigenvector); vv.getRenderContext().setVertexShapeTransformer(vssa); vssa.setScaling(true); vv.getRenderContext().setVertexLabelTransformer(vertexLabelEigenvector); vv.repaint(); } } }); // cb.setSelectedItem(Renderer.VertexLabel.Position.SE); /* * v_shape = new JCheckBox("shape by degree"); * v_shape.addActionListener(this); v_size = new * JCheckBox("size by vertexScores"); v_size.addActionListener(this); * v_size.setSelected(true); v_aspect = new * JCheckBox("stretch by degree ratio"); * v_aspect.addActionListener(this); */ v_small = new JCheckBox("filter when degree < " + VertexDisplayPredicate.MIN_DEGREE); v_small.addActionListener(this); e_labels = new JCheckBox("show edge labels"); e_labels.addActionListener(this); // Vertex Panel final Box vertex_panel = Box.createVerticalBox(); vertex_panel.setBorder(BorderFactory.createTitledBorder("Vertices")); // vertex_panel.add(v_stroke); vertex_panel.add(vertexScoreList); // vertex_panel.add(v_degree_labels); /* * vertex_panel.add(v_shape); vertex_panel.add(v_size); * vertex_panel.add(v_aspect); */ vertex_panel.add(v_small); // Edge Part final Box edge_panel = Box.createVerticalBox(); edge_panel.setBorder(BorderFactory.createTitledBorder("Edges")); edge_panel.add(e_labels); final JToggleButton groupVertices = new JToggleButton("Group Clusters"); // Create slider to adjust the number of edges to remove when clustering final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL); edgeBetweennessSlider.setBackground(Color.WHITE); edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50)); edgeBetweennessSlider.setPaintTicks(true); edgeBetweennessSlider.setMaximum(g.getEdgeCount()); edgeBetweennessSlider.setMinimum(0); edgeBetweennessSlider.setValue(0); edgeBetweennessSlider.setMajorTickSpacing(10); edgeBetweennessSlider.setPaintLabels(true); edgeBetweennessSlider.setPaintTicks(true); // Cluster Part final Box cluster_panel = Box.createVerticalBox(); cluster_panel.setBorder(BorderFactory.createTitledBorder("Cluster")); cluster_panel.add(edgeBetweennessSlider); final String COMMANDSTRING = "Edges removed for clusters: "; final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue(); final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize); cluster_panel.setBorder(sliderBorder); cluster_panel.add(Box.createVerticalGlue()); groupVertices.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors, e.getStateChange() == ItemEvent.SELECTED); vv.repaint(); } }); clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected()); edgeBetweennessSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (!source.getValueIsAdjusting()) { int numEdgesToRemove = source.getValue(); clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected()); sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue()); cluster_panel.repaint(); vv.validate(); vv.repaint(); } } }); cluster_panel.add(groupVertices); control_panel.add(file_layout_panel); control_panel.add(vertex_panel); control_panel.add(edge_panel); control_panel.add(cluster_panel); control_panel.add(basic_panel); }
From source file:op.care.med.inventory.DlgNewStocks.java
private void cmbMProduktItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cmbMProduktItemStateChanged if (ignoreEvent || (evt != null && evt.getStateChange() != ItemEvent.SELECTED)) { return;//from w ww . jav a2s.c o m } tradeForm = (TradeForm) cmbMProdukt.getSelectedItem(); if (tradeForm != null) { DefaultComboBoxModel dcbm = new DefaultComboBoxModel(tradeForm.getPackages().toArray()); txtWeightControl.setVisible(tradeForm.isWeightControlled()); lblWeightControl.setVisible(tradeForm.isWeightControlled()); dcbm.insertElementAt("<Sonderpackung>", 0); cmbPackung.setModel(dcbm); cmbPackung.setRenderer(MedPackageTools.getMedPackungRenderer()); if (aPackage == null) { cmbPackung.setSelectedIndex(cmbPackung.getModel().getSize() - 1); } else { cmbPackung.setSelectedItem(aPackage); } cmbPackungItemStateChanged(null); } else { cmbPackung.setModel(new DefaultComboBoxModel()); aPackage = null; txtWeightControl.setVisible(false); lblWeightControl.setVisible(false); } initCmbVorrat(); }
From source file:org.nuclos.client.wizard.steps.NuclosEntityAttributeCommonPropertiesStep.java
@Override protected void initComponents() { double size[][] = { { 150, 20, TableLayout.FILL }, { 20, 20, 20, 20, 20, 20, 20, 20, 90, TableLayout.FILL } }; TableLayout layout = new TableLayout(size); layout.setVGap(3);//from w w w . j a v a2 s . c o m layout.setHGap(5); this.setLayout(layout); final LabeledComponentSupport support = new LabeledComponentSupport(); lbLabel = new JLabel( SpringLocaleDelegate.getInstance().getMessage("wizard.step.attributeproperties.10", "Feldname") + ": "); tfLabel = new JTextField(); tfLabel.addFocusListener(NuclosWizardUtils.createWizardFocusAdapter()); tfLabel.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.10", "Feldname")); lbDefaultValue = new JLabel( SpringLocaleDelegate.getInstance().getMessage("wizard.step.attributeproperties.11", "Standardwert") + ": "); tfDefaultValue = new JTextField(); tfDefaultValue.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.11", "Standardwert")); tfDefaultValue.addFocusListener(NuclosWizardUtils.createWizardFocusAdapter()); cbxDefaultValue = new JComboBox(); cbxDefaultValue.setVisible(false); cbxDefaultValue.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.11", "Standardwert")); lovDefaultValue = new ListOfValues(); lovDefaultValue.setVisible(false); lovDefaultValue.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.11", "Standardwert")); dateDefaultValue = new DateChooser(support, true); dateDefaultValue.setVisible(false); dateDefaultValue.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.11", "Standardwert")); cbDefaultValue = new JCheckBox(); cbDefaultValue.setVisible(false); cbDefaultValue.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.11", "Standardwert")); lbDistinct = new JLabel( SpringLocaleDelegate.getInstance().getMessage("wizard.step.attributeproperties.7", "Eindeutig") + ": "); cbDistinct = new JCheckBox(); cbDistinct.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.7", "Eindeutig")); lbLogBook = new JLabel( SpringLocaleDelegate.getInstance().getMessage("wizard.step.attributeproperties.8", "Logbuch") + ": "); cbLogBook = new JCheckBox(); cbLogBook.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.8", "Logbuch")); lbMandatory = new JLabel( SpringLocaleDelegate.getInstance().getMessage("wizard.step.attributeproperties.9", "Pflichtfeld") + ": "); cbMandatory = new JCheckBox(); cbMandatory.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.9", "Pflichtfeld")); tfMandatory = new JTextField(); tfMandatory.addFocusListener(NuclosWizardUtils.createWizardFocusAdapter()); tfMandatory.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.27", "Defaultwert fr Pflichtfeld")); cbxMandatory = new JComboBox(); cbxMandatory.setVisible(false); cbxMandatory.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.27", "Defaultwert fr Pflichtfeld")); lovMandatory = new ListOfValues(); lovMandatory.setVisible(false); lovMandatory.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.27", "Defaultwert fr Pflichtfeld")); dateMandatory = new DateChooser(support); dateMandatory.setVisible(false); dateMandatory.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.27", "Defaultwert fr Pflichtfeld")); cbMandatoryValue = new JCheckBox(); cbMandatoryValue.setVisible(false); cbMandatoryValue.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.27", "Defaultwert fr Pflichtfeld")); lbDBFieldName = new JLabel(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.12", "DB-Spaltename")); tfDBFieldName = new JTextField(); tfDBFieldName.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.12", "DB-Spaltename")); tfDBFieldName.addFocusListener(NuclosWizardUtils.createWizardFocusAdapter()); lbDBFieldNameComplete = new JLabel(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.18", "Vollst\u00e4ndiger Spaltenname")); tfDBFieldNameComplete = new JTextField(); tfDBFieldNameComplete.setEnabled(false); lbAttributeGroup = new JLabel(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.19", "Attributegruppe")); cbxAttributeGroup = new JComboBox(); cbxAttributeGroup.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.19", "Attributegruppe")); lbCalcFunction = new JLabel(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.20", "Berechungsvorschrift")); cbxCalcFunction = new JComboBox(); cbxCalcFunction.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.20", "Berechungsvorschrift")); lbCalculationScript = new JLabel(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.calculationscript.label", "Berechnungsausdruck")); lbCalculationScript.setToolTipText(SpringLocaleDelegate.getInstance().getMessage( "wizard.step.attributeproperties.calculationscript.description", "Berechnungsausdruck")); btCalculationScript = new JButton("..."); btCalculationScript.setToolTipText(SpringLocaleDelegate.getInstance().getMessage( "wizard.step.attributeproperties.calculationscript.description", "Berechnungsausdruck")); btCalculationScript.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ScriptEditor editor = new ScriptEditor(); if (getModel().getAttribute().getCalculationScript() != null) { editor.setScript(getModel().getAttribute().getCalculationScript()); } editor.run(); NuclosScript script = editor.getScript(); if (org.nuclos.common2.StringUtils.isNullOrEmpty(script.getSource())) { script = null; } getModel().getAttribute().setCalculationScript(script); } }); lbIndexed = new JLabel( SpringLocaleDelegate.getInstance().getMessage("wizard.step.attributeproperties.26", "Indiziert")); cbIndexed = new JCheckBox(); cbIndexed.setToolTipText(SpringLocaleDelegate.getInstance() .getMessage("wizard.step.attributeproperties.tooltip.26", "Indiziert")); pnlMoreOptions = new JPanel(); double sizeMoreOptions[][] = { { 150, TableLayout.FILL }, { 20, 20, 20, TableLayout.FILL } }; TableLayout tlMoreOptions = new TableLayout(sizeMoreOptions); tlMoreOptions.setVGap(3); tlMoreOptions.setHGap(5); pnlMoreOptions.setLayout(tlMoreOptions); pnlMoreOptions.add(lbDBFieldName, "0,0"); pnlMoreOptions.add(tfDBFieldName, "1,0"); pnlMoreOptions.add(lbDBFieldNameComplete, "0,1"); pnlMoreOptions.add(tfDBFieldNameComplete, "1,1"); pnlMoreOptions.add(lbIndexed, "0,2"); pnlMoreOptions.add(cbIndexed, "1,2"); MoreOptionPanel optionPanel = new MoreOptionPanel(pnlMoreOptions); this.add(lbLabel, "0,0"); this.add(tfLabel, "1,0 , 2,0"); this.add(lbDefaultValue, "0,1"); this.add(tfDefaultValue, "1,1 , 2,1"); this.add(cbxDefaultValue, "1,1 , 2,1"); this.add(lovDefaultValue, "1,1 , 2,1"); this.add(dateDefaultValue, "1,1 , 2,1"); this.add(cbDefaultValue, "1,1"); this.add(lbDistinct, "0,2"); this.add(cbDistinct, "1,2"); this.add(lbLogBook, "0,3"); this.add(cbLogBook, "1,3"); this.add(lbMandatory, "0,4"); this.add(cbMandatory, "1,4"); this.add(tfMandatory, "2,4"); this.add(cbxMandatory, "2,4"); this.add(lovMandatory, "2,4"); this.add(dateMandatory, "2,4"); this.add(cbMandatoryValue, "2,4"); this.add(lbAttributeGroup, "0,5"); this.add(cbxAttributeGroup, "1,5 , 2,5"); this.add(lbCalcFunction, "0,6"); this.add(cbxCalcFunction, "1,6 , 2,6"); this.add(lbCalculationScript, "0,7"); this.add(btCalculationScript, "1,7"); this.add(optionPanel, "0,8, 2,8"); tfLabel.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { doSomeWork(); } @Override public void keyReleased(KeyEvent e) { doSomeWork(); } @Override public void keyPressed(KeyEvent e) { doSomeWork(); } protected void doSomeWork() { blnLabelModified = true; } }); tfLabel.setDocument(new SpecialCharacterDocument()); tfLabel.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { doSomeWork(e); } @Override public void insertUpdate(DocumentEvent e) { doSomeWork(e); } @Override public void changedUpdate(DocumentEvent e) { doSomeWork(e); } protected void doSomeWork(DocumentEvent e) { int size = e.getDocument().getLength(); if (size > 0) { NuclosEntityAttributeCommonPropertiesStep.this.setComplete(true); } else { NuclosEntityAttributeCommonPropertiesStep.this.setComplete(false); } try { NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setInternalName(e.getDocument().getText(0, e.getDocument().getLength())); if (!NuclosEntityAttributeCommonPropertiesStep.this.getModel().isEditMode()) { String sPrefix = Attribute.getDBPrefix( NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute()); tfDBFieldName.setText(sPrefix + e.getDocument().getText(0, e.getDocument().getLength())); } } catch (BadLocationException ex) { Errors.getInstance().showExceptionDialog(NuclosEntityAttributeCommonPropertiesStep.this, ex); } } }); tfDefaultValue.getDocument().addDocumentListener(new DefaultValueDocumentListener()); tfMandatory.getDocument().addDocumentListener(new MandatoryValueDocumentListener()); tfMandatory.setLocale(SpringLocaleDelegate.getInstance().getLocale()); tfDBFieldName.setDocument(new LimitCharacterDocument()); tfDBFieldName.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { doSomeWork(e); } @Override public void insertUpdate(DocumentEvent e) { doSomeWork(e); } @Override public void changedUpdate(DocumentEvent e) { doSomeWork(e); } protected void doSomeWork(DocumentEvent e) { try { NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setDbName(e.getDocument().getText(0, e.getDocument().getLength())); String s = e.getDocument().getText(0, e.getDocument().getLength()); if (getModel().getAttribute().getMetaVO() != null && getModel().getAttribute().getField() != null) { s = "STRVALUE_" + s; } else if (getModel().getAttribute().getMetaVO() != null && getModel().getAttribute().getField() == null) { s = "INTID_" + s; } tfDBFieldNameComplete.setText(s); } catch (BadLocationException ex) { Errors.getInstance().showExceptionDialog(NuclosEntityAttributeCommonPropertiesStep.this, ex); } } }); cbDistinct.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { final JCheckBox cb = (JCheckBox) e.getItem(); NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setDistinct(cb.isSelected()); if (!cb.isSelected()) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { cbMandatory.setEnabled(true); } }); } } }); cbLogBook.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { JCheckBox cb = (JCheckBox) e.getItem(); NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setLogBook(cb.isSelected()); } }); cbMandatory.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { final JCheckBox cb = (JCheckBox) e.getItem(); NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setMandatory(cb.isSelected()); if (NuclosEntityAttributeCommonPropertiesStep.this.parentWizardModel.isEditMode() && cb.isSelected() && !parentWizardModel.isVirtual()) { if (NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .getMandatoryValue() == null) { (new Bubble(cb, SpringLocaleDelegate.getInstance().getMessage( "wizard.step.attributeproperties.tooltip.28", "Bitte tragen Sie einen Wert ein mit dem das Feld vorbelegt werden kann!"), 3, Position.UPPER)).setVisible(true); } } } }); cbIndexed.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { JCheckBox cb = (JCheckBox) e.getItem(); NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setIndexed(cb.isSelected()); } }); cbxDefaultValue.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { getModel().getAttribute().setIdDefaultValue((DefaultValue) e.getItem()); } } }); cbxMandatory.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { getModel().getAttribute().setMandatoryValue(((DefaultValue) e.getItem()).getId()); } } }); dateDefaultValue.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { doSomeWork(e); } @Override public void insertUpdate(DocumentEvent e) { doSomeWork(e); } @Override public void changedUpdate(DocumentEvent e) { doSomeWork(e); } protected void doSomeWork(DocumentEvent e) { try { String value = e.getDocument().getText(0, e.getDocument().getLength()); if ("Heute".equalsIgnoreCase(value)) { value = RelativeDate.today().toString(); } NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute().setDefaultValue(value); } catch (BadLocationException ex) { Errors.getInstance().showExceptionDialog(NuclosEntityAttributeCommonPropertiesStep.this, ex); } } }); cbDefaultValue.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { JCheckBox cb = (JCheckBox) e.getItem(); if (cb.isSelected()) { NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute().setDefaultValue("ja"); } else { NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setDefaultValue("nein"); } } }); cbMandatoryValue.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { JCheckBox cb = (JCheckBox) e.getItem(); if (cb.isSelected()) { NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setMandatoryValue(Boolean.TRUE); } else { NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setMandatoryValue(Boolean.FALSE); } } }); cbxAttributeGroup.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setAttributeGroup((String) e.getItem()); NuclosEntityAttributeCommonPropertiesStep.this.setComplete(true); } } }); cbxCalcFunction.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { NuclosEntityAttributeCommonPropertiesStep.this.getModel().getAttribute() .setCalcFunction((String) e.getItem()); } } }); }
From source file:org.netbeans.jpa.modeler.source.generator.ui.GenerateCodeDialog.java
private void businessLayerComboItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_businessLayerComboItemStateChanged if (evt.getStateChange() == ItemEvent.SELECTED) { changeBusinessLayer(getBusinessLayer()); setCompleteApplicationCompVisibility( getBusinessLayer().getTechnology().panel() != LayerConfigPanel.class); }// ww w .ja va 2 s.c om }