List of usage examples for javax.swing JCheckBox isSelected
public boolean isSelected()
From source file:org.genedb.jogra.plugins.TermRationaliser.java
/** * Supplies the JPanel which is displayed in the main Jogra window. *//* w w w . jav a2 s . c o m*/ public JPanel getMainWindowPlugin() { final JPanel ret = new JPanel(); final JButton loadButton = new JButton("Load Term Rationaliser"); final JLabel chooseType = new JLabel("Select term: "); final JComboBox termTypeBox = new JComboBox(instances.keySet().toArray()); final JCheckBox showEVCFilter = new JCheckBox("Highlight terms with evidence codes", true); loadButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent ae) { new SwingWorker<JFrame, Void>() { @Override protected JFrame doInBackground() throws Exception { ret.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); setTermType(instances.get((String) termTypeBox.getSelectedItem())); setShowEVC(showEVCFilter.isSelected()); return makeWindow(); } @Override public void done() { try { final GeneDBMessage e = new OpenWindowEvent(TermRationaliser.this, get()); EventBus.publish(e); } catch (final InterruptedException exp) { exp.printStackTrace(); } catch (final ExecutionException exp) { exp.printStackTrace(); } ret.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }.execute(); } }); Box verticalBox = Box.createVerticalBox(); Box horizontalBox = Box.createHorizontalBox(); horizontalBox.add(chooseType); horizontalBox.add(termTypeBox); verticalBox.add(horizontalBox); verticalBox.add(loadButton); verticalBox.add(showEVCFilter); ret.add(verticalBox); return ret; }
From source file:org.javaswift.cloudie.CloudiePanel.java
private ContainerSpecification doGetContainerSpec() { JTextField name = new JTextField(); JCheckBox priv = new JCheckBox("private container"); if (JOptionPane.showConfirmDialog(this, new Object[] { "Name", name, priv }, "Create Container", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) { return new ContainerSpecification(name.getText(), priv.isSelected()); }/*from w ww .j av a 2 s . c om*/ return null; }
From source file:org.kuali.test.ui.components.panels.FileTestPanel.java
private boolean isFileComparisonSelected() { boolean retval = false; for (JCheckBox cb : fileComparisons) { if (cb.isSelected()) { retval = true;/*from w w w . j av a 2s.co m*/ break; } } return retval; }
From source file:org.kuali.test.ui.components.panels.FileTestPanel.java
/** * * @return/* w w w.j a v a 2s.c o m*/ */ public List<String> getSelectedFileComparisons() { List<String> retval = new ArrayList<String>(); for (JCheckBox cb : fileComparisons) { if (cb.isSelected()) { retval.add(cb.getActionCommand()); } } return retval; }
From source file:org.languagetool.gui.ConfigurationDialog.java
private void createOfficeElements(GridBagConstraints cons, JPanel portPanel) { int numParaCheck = config.getNumParasToCheck(); JRadioButton[] radioButtons = new JRadioButton[3]; ButtonGroup numParaGroup = new ButtonGroup(); radioButtons[0] = new JRadioButton(Tools.getLabel(messages.getString("guiCheckOnlyParagraph"))); radioButtons[0].setActionCommand("ParagraphCheck"); radioButtons[1] = new JRadioButton(Tools.getLabel(messages.getString("guiCheckFullText"))); radioButtons[1].setActionCommand("FullTextCheck"); radioButtons[2] = new JRadioButton(Tools.getLabel(messages.getString("guiCheckNumParagraphs"))); radioButtons[2].setActionCommand("NParagraphCheck"); radioButtons[2].setSelected(true);/* w w w.jav a 2 s . com*/ JTextField numParaField = new JTextField(Integer.toString(5), 2); numParaField.setEnabled(radioButtons[2].isSelected()); numParaField.setMinimumSize(new Dimension(30, 25)); for (int i = 0; i < 3; i++) { numParaGroup.add(radioButtons[i]); } if (numParaCheck == 0) { radioButtons[0].setSelected(true); numParaField.setEnabled(false); } else if (numParaCheck < 0) { radioButtons[1].setSelected(true); numParaField.setEnabled(false); } else { radioButtons[2].setSelected(true); numParaField.setText(Integer.toString(numParaCheck)); numParaField.setEnabled(true); } radioButtons[0].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { numParaField.setEnabled(false); config.setNumParasToCheck(0); } }); radioButtons[1].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { numParaField.setEnabled(false); config.setNumParasToCheck(-1); } }); radioButtons[2].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int numParaCheck = Integer.parseInt(numParaField.getText()); if (numParaCheck < 1) numParaCheck = 1; else if (numParaCheck > 99) numParaCheck = 99; config.setNumParasToCheck(numParaCheck); numParaField.setForeground(Color.BLACK); numParaField.setText(Integer.toString(numParaCheck)); numParaField.setEnabled(true); } }); numParaField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { changedUpdate(e); } @Override public void removeUpdate(DocumentEvent e) { changedUpdate(e); } @Override public void changedUpdate(DocumentEvent e) { try { int numParaCheck = Integer.parseInt(numParaField.getText()); if (numParaCheck > 0 && numParaCheck < 99) { numParaField.setForeground(Color.BLACK); config.setNumParasToCheck(numParaCheck); } else { numParaField.setForeground(Color.RED); } } catch (NumberFormatException ex) { numParaField.setForeground(Color.RED); } } }); JLabel textChangedLabel = new JLabel(Tools.getLabel(messages.getString("guiTextChangeLabel"))); cons.gridy++; portPanel.add(textChangedLabel, cons); cons.gridy++; cons.insets = new Insets(0, 30, 0, 0); for (int i = 0; i < 3; i++) { portPanel.add(radioButtons[i], cons); if (i < 2) cons.gridy++; } cons.gridx = 1; portPanel.add(numParaField, cons); JCheckBox noMultiResetbox = new JCheckBox(Tools.getLabel(messages.getString("guiNoMultiReset"))); noMultiResetbox.setSelected(config.isNoMultiReset()); noMultiResetbox.setEnabled(config.isResetCheck()); noMultiResetbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { config.setNoMultiReset(noMultiResetbox.isSelected()); } }); JCheckBox resetCheckbox = new JCheckBox(Tools.getLabel(messages.getString("guiDoResetCheck"))); resetCheckbox.setSelected(config.isResetCheck()); resetCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { config.setDoResetCheck(resetCheckbox.isSelected()); noMultiResetbox.setEnabled(resetCheckbox.isSelected()); } }); cons.insets = new Insets(0, 4, 0, 0); cons.gridx = 0; // JLabel dummyLabel = new JLabel(" "); // cons.gridy++; // portPanel.add(dummyLabel, cons); cons.gridy++; portPanel.add(resetCheckbox, cons); cons.insets = new Insets(0, 30, 0, 0); cons.gridx = 0; cons.gridy++; portPanel.add(noMultiResetbox, cons); JCheckBox fullTextCheckAtFirstBox = new JCheckBox( Tools.getLabel(messages.getString("guiCheckFullTextAtFirst"))); fullTextCheckAtFirstBox.setSelected(config.doFullCheckAtFirst()); fullTextCheckAtFirstBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { config.setFullCheckAtFirst(fullTextCheckAtFirstBox.isSelected()); } }); cons.insets = new Insets(0, 4, 0, 0); cons.gridx = 0; // cons.gridy++; // JLabel dummyLabel2 = new JLabel(" "); // portPanel.add(dummyLabel2, cons); cons.gridy++; portPanel.add(fullTextCheckAtFirstBox, cons); JCheckBox isMultiThreadBox = new JCheckBox(Tools.getLabel(messages.getString("guiIsMultiThread"))); isMultiThreadBox.setSelected(config.isMultiThread()); isMultiThreadBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { config.setMultiThreadLO(isMultiThreadBox.isSelected()); } }); cons.gridy++; JLabel dummyLabel3 = new JLabel(" "); portPanel.add(dummyLabel3, cons); cons.gridy++; portPanel.add(isMultiThreadBox, cons); }
From source file:org.languagetool.gui.ConfigurationDialog.java
private JPanel getSpecialRuleValuePanel() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints cons = new GridBagConstraints(); cons.gridx = 0;/*w w w.j a va 2s. co m*/ cons.gridy = 0; cons.weightx = 0.0f; cons.anchor = GridBagConstraints.WEST; List<JCheckBox> ruleCheckboxes = new ArrayList<JCheckBox>(); List<JLabel> ruleLabels = new ArrayList<JLabel>(); List<JTextField> ruleValueFields = new ArrayList<JTextField>(); for (int i = 0; i < configurableRules.size(); i++) { Rule rule = configurableRules.get(i); JCheckBox ruleCheckbox = new JCheckBox(rule.getDescription()); ruleCheckboxes.add(ruleCheckbox); ruleCheckbox.setSelected(getEnabledState(rule)); cons.insets = new Insets(3, 0, 0, 0); panel.add(ruleCheckbox, cons); cons.insets = new Insets(0, 24, 0, 0); cons.gridy++; JLabel ruleLabel = new JLabel(rule.getConfigureText()); ruleLabels.add(ruleLabel); ruleLabel.setEnabled(ruleCheckbox.isSelected()); panel.add(ruleLabel, cons); cons.gridx++; int value = config.getConfigurableValue(rule.getId()); if (config.getConfigurableValue(rule.getId()) < 0) { value = rule.getDefaultValue(); } JTextField ruleValueField = new JTextField(Integer.toString(value), 2); ruleValueFields.add(ruleValueField); ruleValueField.setEnabled(ruleCheckbox.isSelected()); ruleValueField.setMinimumSize(new Dimension(35, 25)); // without this the box is just a few pixels small, but why? panel.add(ruleValueField, cons); ruleCheckbox.addActionListener(new ActionListener() { @Override public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { ruleValueField.setEnabled(ruleCheckbox.isSelected()); ruleLabel.setEnabled(ruleCheckbox.isSelected()); if (ruleCheckbox.isSelected()) { config.getEnabledRuleIds().add(rule.getId()); config.getDisabledRuleIds().remove(rule.getId()); } else { config.getEnabledRuleIds().remove(rule.getId()); config.getDisabledRuleIds().add(rule.getId()); } } }); ruleValueField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { changedUpdate(e); } @Override public void removeUpdate(DocumentEvent e) { changedUpdate(e); } @Override public void changedUpdate(DocumentEvent e) { try { int num = Integer.parseInt(ruleValueField.getText()); if (num < rule.getMinConfigurableValue()) { num = rule.getMinConfigurableValue(); ruleValueField.setForeground(Color.RED); } else if (num > rule.getMaxConfigurableValue()) { num = rule.getMaxConfigurableValue(); ruleValueField.setForeground(Color.RED); } else { ruleValueField.setForeground(null); } config.setConfigurableValue(rule.getId(), num); } catch (Exception ex) { ruleValueField.setForeground(Color.RED); } } }); cons.gridx = 0; cons.gridy++; } return panel; }
From source file:org.n52.ifgicopter.spf.gui.SPFMainFrame.java
/** * the gui representation of the framework *//*w ww . ja v a 2 s.c o m*/ public SPFMainFrame() { /* * handled by worker thread. */ this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); this.setTitle("Sensor Platform Framework"); this.menu = new JMenuBar(); try { File f = new File("img/icon.png"); InputStream in; if (!f.exists()) { in = ImageMapMarker.class.getResourceAsStream("/img/icon.png"); } else { in = new FileInputStream(f); } this.setIconImage(ImageIO.read(in)); } catch (IOException e) { this.log.warn(e.getMessage(), e); } /* * simple menu bar */ JMenu file = new JMenu("File"); JMenuItem exit = new JMenuItem("Exit"); /* * shutdown the engine if closed */ exit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { shutdownFrame(); } }); this.pnp = new JCheckBoxMenuItem("Plug'n'Play mode"); this.pnp.setSelected(false); /* * switch the pnp mode */ this.pnp.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean flag = SPFMainFrame.this.pnp.isSelected(); if (flag && !SPFMainFrame.this.dontShow) { JCheckBox checkbox = new JCheckBox("Do not show this message again."); String message = "During Plug'n'Play mode the output generation is blocked."; Object[] params = { message, checkbox }; JOptionPane.showMessageDialog(SPFMainFrame.this, params); SPFMainFrame.this.dontShow = checkbox.isSelected(); } /* * check if we need to restart the output plugins */ if (!flag && SPFMainFrame.this.inputChanged) { SPFRegistry.getInstance().restartOutputPlugins(); } SPFRegistry.getInstance().setPNPMode(flag); } }); JMenuItem restart = new JMenuItem("Restart"); restart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { shutdownFrame(RESTART_CODE); } }); JMenuItem managePlugins = new JMenuItem("Manage available Plugins"); managePlugins.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { PluginRegistrationDialog prd = new PluginRegistrationDialog(SPFMainFrame.this); if (prd.isCanceled()) return; updateConfigurationFile(prd.getSelectedNewPlugins(), prd.getSelectedOldPlugins()); int ret = JOptionPane.showConfirmDialog(SPFMainFrame.this, "<html><body><div>" + "Changes will have effect after restart of the application. " + "</div><div>A restart is highly recommended due to memory usage." + "</div><div><br />Restart now?</div></body></html>", "Restart application", JOptionPane.YES_NO_OPTION); if (ret == 0) { shutdownFrame(RESTART_CODE); } } }); file.add(managePlugins); file.add(this.pnp); file.add(new FixedSeparator()); file.add(restart); file.add(new FixedSeparator()); file.add(exit); this.menu.add(file); this.inputPluginMenu = new JMenu("InputPlugins"); this.outputPluginMenu = new JMenu("OutputPlugins"); this.menu.add(this.inputPluginMenu); this.menu.add(this.outputPluginMenu); /* * help */ this.aboutDialog = new AboutDialog(SPFMainFrame.this); JMenu help = new JMenu("Help"); JMenuItem about = new JMenuItem("About"); about.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SPFMainFrame.this.aboutDialog.showSelf(SPFMainFrame.this); } }); help.add(about); this.menu.add(help); this.setJMenuBar(this.menu); /* * the tabbed pane. every tab represents a input plugin */ this.pane = new JTabbedPane(); this.pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); /* * shutdown the engine if closed */ this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { SPFMainFrame.this.shutdownFrame(); } }); /* * the framework core tab */ this.corePanel = new FrameworkCorePanel(); this.addTab(this.corePanel, "Framework Core", BLUE_IMAGE); /* * the map panel */ if (Boolean.parseBoolean(SPFRegistry.getInstance().getConfigProperty(SPFRegistry.OVERVIEW_MAP_ENABLED))) { this.mapPanel = new MapPanel(); this.addTab(this.mapPanel, "Overview Map", BLUE_IMAGE); } /* * other stuff */ this.getContentPane().add(this.pane); JPanel statusBar = new JPanel(); statusBar.setLayout(new BorderLayout()); statusBar.setPreferredSize(new Dimension(200, 25)); JPanel statusBarWrapper = new JPanel(new BorderLayout()); statusBarWrapper.add(Box.createRigidArea(new Dimension(3, 3)), BorderLayout.WEST); statusBarWrapper.add(statusBar); statusBarWrapper.add(Box.createRigidArea(new Dimension(3, 3)), BorderLayout.EAST); this.statusLabel = new JLabel("SPFramework startup finished."); statusBar.add(this.statusLabel, BorderLayout.EAST); this.outputLabel = new JLabel("(no output yet)"); statusBar.add(this.outputLabel, BorderLayout.WEST); this.getContentPane().add(statusBarWrapper, BorderLayout.SOUTH); this.getContentPane().setBackground(this.pane.getBackground()); this.setPreferredSize(new Dimension(1280, 720)); this.pack(); /* * full screen? */ if (Boolean.parseBoolean(SPFRegistry.getInstance().getConfigProperty(SPFRegistry.MAXIMIZED))) { this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); } this.setLocationRelativeTo(null); }
From source file:org.nebulaframework.ui.swing.node.NodeMainUI.java
/** * Setup General (Control Center) Tab//from ww w .ja v a 2 s .c o m * * @return JPanel for Control Center */ private JPanel setupGeneral() { JPanel generalPanel = new JPanel(); generalPanel.setLayout(new BorderLayout()); /* -- Stats Panel -- */ JPanel statsPanel = new JPanel(); generalPanel.add(statsPanel, BorderLayout.NORTH); statsPanel.setLayout(new GridLayout(0, 2, 10, 10)); JPanel eastPanel = new JPanel(); statsPanel.add(eastPanel, BorderLayout.EAST); eastPanel.setLayout(new BorderLayout()); JPanel westPanel = new JPanel(); statsPanel.add(westPanel, BorderLayout.WEST); westPanel.setLayout(new BorderLayout()); // Grid Information Panel JPanel gridInfoPanel = new JPanel(); eastPanel.add(gridInfoPanel, BorderLayout.NORTH); gridInfoPanel.setBorder(BorderFactory.createTitledBorder("Grid Information")); gridInfoPanel.setLayout(new GridLayout(0, 2, 10, 10)); JLabel nodeIdLabel = new JLabel("Node ID :"); gridInfoPanel.add(nodeIdLabel); JLabel nodeId = new JLabel("#nodeid#"); gridInfoPanel.add(nodeId); addUIElement("general.stats.nodeid", nodeId); // Add to components map JLabel nodeIpLabel = new JLabel("Node IP :"); gridInfoPanel.add(nodeIpLabel); JLabel nodeIp = new JLabel("#nodeip#"); gridInfoPanel.add(nodeIp); addUIElement("general.stats.nodeip", nodeIp); // Add to components map JLabel clusterIdLabel = new JLabel("Cluster ID :"); gridInfoPanel.add(clusterIdLabel); JLabel clusterId = new JLabel("#clusterid#"); gridInfoPanel.add(clusterId); addUIElement("general.stats.clusterid", clusterId); // Add to components map JLabel clusterServiceLabel = new JLabel("Cluster Service :"); gridInfoPanel.add(clusterServiceLabel); JLabel clusterService = new JLabel("#clusterservice#"); gridInfoPanel.add(clusterService); addUIElement("general.stats.clusterservice", clusterService); // Add to components map // Node Status Panel JPanel nodeStatusPanel = new JPanel(); eastPanel.add(nodeStatusPanel, BorderLayout.SOUTH); nodeStatusPanel.setBorder(BorderFactory.createTitledBorder("GridNode Status")); nodeStatusPanel.setLayout(new GridLayout(0, 2, 10, 10)); JLabel statusLabel = new JLabel("Status :"); nodeStatusPanel.add(statusLabel); JLabel status = new JLabel("#status#"); nodeStatusPanel.add(status); addUIElement("general.stats.status", status); // Add to components map JLabel uptimeLabel = new JLabel("Node Up Time :"); nodeStatusPanel.add(uptimeLabel); JLabel uptime = new JLabel("#uptime#"); nodeStatusPanel.add(uptime); addUIElement("general.stats.uptime", uptime); // Add to components map JLabel execTimeLabel = new JLabel("Execution Time :"); nodeStatusPanel.add(execTimeLabel); JLabel execTime = new JLabel("#exectime#"); nodeStatusPanel.add(execTime); addUIElement("general.stats.exectime", execTime); // Add to components map // Execution Statistics Panel JPanel execStatsPanel = new JPanel(); westPanel.add(execStatsPanel, BorderLayout.NORTH); execStatsPanel.setLayout(new GridLayout(0, 2, 10, 10)); execStatsPanel.setBorder(BorderFactory.createTitledBorder("Execution Statistics")); JLabel totalJobsLabel = new JLabel("Total Jobs :"); execStatsPanel.add(totalJobsLabel); JLabel totalJobs = new JLabel("0"); execStatsPanel.add(totalJobs); addUIElement("general.stats.totaljobs", totalJobs); // Add to components map JLabel totalTasksLabel = new JLabel("Total Tasks :"); execStatsPanel.add(totalTasksLabel); JLabel totalTasks = new JLabel("0"); execStatsPanel.add(totalTasks); addUIElement("general.stats.totaltasks", totalTasks); // Add to components map JLabel totalBansLabel = new JLabel("Banments :"); execStatsPanel.add(totalBansLabel); JLabel totalBans = new JLabel("0"); execStatsPanel.add(totalBans); addUIElement("general.stats.totalbans", totalBans); // Add to components map // Execution Active Job Panel JPanel activeJobPanel = new JPanel(); westPanel.add(activeJobPanel, BorderLayout.SOUTH); activeJobPanel.setLayout(new GridLayout(0, 2, 10, 10)); activeJobPanel.setBorder(BorderFactory.createTitledBorder("Active Job")); JLabel jobNameLabel = new JLabel("GridJob Name :"); activeJobPanel.add(jobNameLabel); JLabel jobName = new JLabel("#jobname#"); activeJobPanel.add(jobName); addUIElement("general.stats.jobname", jobName); // Add to components map JLabel durationLabel = new JLabel("Duration :"); activeJobPanel.add(durationLabel); JLabel duration = new JLabel("#duration#"); activeJobPanel.add(duration); addUIElement("general.stats.duration", duration); // Add to components map JLabel tasksLabel = new JLabel("Tasks Executed :"); activeJobPanel.add(tasksLabel); JLabel tasks = new JLabel("#xyz#"); activeJobPanel.add(tasks); addUIElement("general.stats.tasks", tasks); // Add to components map JLabel failuresLabel = new JLabel("Failures :"); activeJobPanel.add(failuresLabel); JLabel failures = new JLabel("#failures#"); activeJobPanel.add(failures); addUIElement("general.stats.failures", failures); // Add to components map /* -- Log Panel -- */ JPanel logPanel = new JPanel(); generalPanel.add(logPanel, BorderLayout.CENTER); logPanel.setLayout(new BorderLayout()); logPanel.setBorder(BorderFactory.createTitledBorder("Log Output")); JTextPane logTextPane = new JTextPane(); logTextPane.setEditable(false); logTextPane.setBackground(Color.BLACK); logTextPane.setForeground(Color.WHITE); logPanel.add(new JScrollPane(logTextPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); addUIElement("general.log", logTextPane); // Add to component map JPanel logOptionsPanel = new JPanel(); logPanel.add(logOptionsPanel, BorderLayout.SOUTH); logOptionsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); final JCheckBox logScrollCheckbox = new JCheckBox("Auto-Scroll Log"); logScrollCheckbox.setSelected(true); logScrollCheckbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JTextPaneAppender.setAutoScroll(logScrollCheckbox.isSelected()); } }); logOptionsPanel.add(logScrollCheckbox); // Enable Logging JTextPaneAppender.setTextPane(logTextPane); /* -- Buttons Panel -- */ JPanel buttonsPanel = new JPanel(); generalPanel.add(buttonsPanel, BorderLayout.SOUTH); buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); // Shutdown Button JButton shutdownButton = new JButton("Shutdown"); buttonsPanel.add(shutdownButton); shutdownButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doShutdownNode(); } }); // Start Up time Thread Thread t = new Thread(new Runnable() { public void run() { long start = System.currentTimeMillis(); while (true) { try { Thread.sleep(1000); } catch (InterruptedException e) { log.warn("Interrupted Exception in Up Time Thread", e); } final String uptime = TimeUtils.timeDifference(start); SwingUtilities.invokeLater(new Runnable() { public void run() { JLabel upTime = getUIElement("general.stats.uptime"); upTime.setText(uptime); } }); } } }); t.setDaemon(true); t.start(); // Auto-Discovery Thread Thread autoDiscovery = new Thread(new Runnable() { public void run() { while (true) { try { // Attempt every 30 seconds Thread.sleep(30000); } catch (InterruptedException e) { log.warn("Interrupted Exception in Up Time Thread", e); } if (autodiscover && (!Grid.isNode())) { // 30 Second Intervals doDiscover(true); } } } }); autoDiscovery.setDaemon(true); autoDiscovery.start(); return generalPanel; }
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private PanelWizardStep newStep1(final MainFrameTab ifrm) { final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); final PanelWizardStep step = new PanelWizardStep( localeDelegate.getMessage("dbtransfer.import.step1.1", "Konfigurationsdatei"), localeDelegate.getMessage("dbtransfer.import.step1.2", "Bitte w\u00e4hlen Sie eine Konfigurationsdatei aus.")); final JLabel lbFile = new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.3", "Datei")); utils.initJPanel(step,// w ww . j av a2s. co m new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }, new double[] { 20, TableLayout.PREFERRED, lbFile.getPreferredSize().height, TableLayout.FILL }); final JButton btnBrowse = new JButton("..."); //final JProgressBar progressBar = new JProgressBar(0, 230); final JCheckBox chbxImportAsNuclon = new JCheckBox( localeDelegate.getMessage("configuration.transfer.import.as.nuclon", "Import als Nuclon")); chbxImportAsNuclon.setEnabled(false); final JEditorPane editWarnings = new JEditorPane(); editWarnings.setContentType("text/html"); editWarnings.setEditable(false); editWarnings.setBackground(Color.WHITE); final JScrollPane scrollWarn = new JScrollPane(editWarnings); scrollWarn.setPreferredSize(new Dimension(680, 250)); scrollWarn.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); scrollWarn.getVerticalScrollBar().setUnitIncrement(20); scrollWarn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollWarn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JScrollPane scrollPrev = new JScrollPane(jpnPreviewContent); scrollPrev.setPreferredSize(new Dimension(680, 250)); scrollPrev.setBorder(new LineBorder(Color.LIGHT_GRAY, 1)); scrollPrev.getVerticalScrollBar().setUnitIncrement(20); scrollPrev.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPrev.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); final JPanel jpnPreview = new JPanel(new BorderLayout()); jpnPreview.add(jpnPreviewHeader, BorderLayout.NORTH); jpnPreview.add(scrollPrev, BorderLayout.CENTER); jpnPreview.add(jpnPreviewFooter, BorderLayout.SOUTH); jpnPreview.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); jpnPreview.setBackground(Color.WHITE); jpnPreviewHeader.setBackground(Color.WHITE); jpnPreviewContent.setBackground(Color.WHITE); jpnPreviewFooter.setBackground(Color.WHITE); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(localeDelegate.getMessage("configuration.transfer.prepare.warnings.tab", "Warnungen"), scrollWarn); final String sDefaultPreparePreviewTabText = localeDelegate .getMessage("configuration.transfer.prepare.preview.tab", "Vorschau der Schema Aenderungen"); tabbedPane.addTab(sDefaultPreparePreviewTabText, jpnPreview); final JLabel lbNewUser = new JLabel(); step.add(lbFile, "0,0"); step.add(tfTransferFile, "1,0"); step.add(btnBrowse, "2,0"); step.add(chbxImportAsNuclon, "1,1");//step.add(progressBar, "1,1"); step.add(lbNewUser, "0,2,3,2"); step.add(tabbedPane, "0,3,3,3"); tfTransferFile.setEditable(false); final ActionListener prepareImportAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { ifrm.lockLayerWithProgress(Transfer.TOPIC_CORRELATIONID_PREPARE); Thread t = new Thread() { @Override public void run() { step.setComplete(false); boolean blnTransferWithWarnings = false; //progressBar.setValue(0); //progressBar.setVisible(true); try { String fileName = tfTransferFile.getText(); if (StringUtils.isNullOrEmpty(fileName)) { return; } File f = new File(fileName); long size = f.length(); final InputStream fin = new BufferedInputStream(new FileInputStream(f)); final byte[] transferFile; try { transferFile = utils.getBytes(fin, (int) size); } finally { fin.close(); } resetStep2(); importTransferObject = getTransferFacadeRemote().prepareTransfer(isNuclon, transferFile); chbxImportAsNuclon.setEnabled(importTransferObject.getTransferOptions() .containsKey(TransferOption.IS_NUCLON_IMPORT_ALLOWED)); step.setComplete(!importTransferObject.result.hasCriticals()); if (!importTransferObject.result.hasCriticals() && !importTransferObject.result.hasWarnings()) { editWarnings.setText(localeDelegate.getMessage( "configuration.transfer.prepare.no.warnings", "Keine Warnungen")); } else { editWarnings.setText("<html><body><font color=\"#800000\">" + importTransferObject.result.getCriticals() + "</font>" + (importTransferObject.result.hasCriticals() ? "<br />" : "") + importTransferObject.result.getWarnings() + "</body></html>"); } int iPreviewSize = importTransferObject.getPreviewParts().size(); blnTransferWithWarnings = setupPreviewPanel(importTransferObject.getPreviewParts()); tabbedPane.setTitleAt(1, sDefaultPreparePreviewTabText + (iPreviewSize == 0 ? "" : " (" + iPreviewSize + ")")); lbNewUser.setText( "Neue Benutzer" + ": " + (importTransferObject.getNewUserCount() == 0 ? "keine" : importTransferObject.getNewUserCount())); } catch (Exception e) { // progressBar.setVisible(false); Errors.getInstance().showExceptionDialog(ifrm, e); } finally { btnBrowse.setEnabled(true); // progressBar.setVisible(false); ifrm.unlockLayer(); } if (blnTransferWithWarnings) { JOptionPane.showMessageDialog(jpnPreviewContent, localeDelegate.getMessage( "dbtransfer.import.step1.19", "Nicht alle Statements knnen durchgefhrt werden!\nBitte kontrollieren Sie die mit rot markierten Eintrge!", "Warning", JOptionPane.WARNING_MESSAGE)); } } }; t.start(); } }; final ActionListener browseAction = new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { final JFileChooser filechooser = utils.getFileChooser( localeDelegate.getMessage("configuration.transfer.file.nuclet", "Nuclet-Dateien"), ".nuclet"); final int iBtn = filechooser.showOpenDialog(ifrm); if (iBtn == JFileChooser.APPROVE_OPTION) { final File file = filechooser.getSelectedFile(); if (file != null) { tfTransferFile.setText(""); btnBrowse.setEnabled(false); //progressBar.setVisible(true); String fileName = file.getPath(); if (StringUtils.isNullOrEmpty(fileName)) { return; } tfTransferFile.setText(fileName); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } } } }; final ActionListener importAsNuclonAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { isNuclon = chbxImportAsNuclon.isSelected(); prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare")); } }; btnBrowse.addActionListener(browseAction); chbxImportAsNuclon.addActionListener(importAsNuclonAction); // progressBar.setVisible(false); return step; }
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 a 2 s . co 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()); } } }); }