List of usage examples for javax.swing JCheckBoxMenuItem getText
public String getText()
From source file:uk.co.petertribble.jkstat.gui.KstatBaseChartFrame.java
public void actionPerformed(ActionEvent e) { if (e.getSource() == exitItem) { kbc.stopLoop();/* w w w . j a v a 2 s . c o m*/ setVisible(false); dispose(); } else if (e.getSource() == saveItem) { saveImage(); } else if (e.getSource() == sleepItem1) { setDelay(1); } else if (e.getSource() == sleepItem2) { setDelay(2); } else if (e.getSource() == sleepItem5) { setDelay(5); } else if (e.getSource() == sleepItem10) { setDelay(10); } else if (e.getSource() instanceof JCheckBoxMenuItem) { JCheckBoxMenuItem jmi = (JCheckBoxMenuItem) e.getSource(); String stat = jmi.getText(); if (jmi.isSelected()) { kbc.addStatistic(stat); } else { kbc.removeStatistic(stat); } } }
From source file:edu.ku.brc.af.core.SchemaI18NService.java
/** * Checks (selects) the MenuItem of the current locale. *//*from w w w. j ava2s . com*/ public void checkCurrentLocaleMenu() { for (JCheckBoxMenuItem cbmi : localeMenuItems) { if (cbmi.getText().equals(currentLocale.getDisplayName())) { cbmi.setSelected(true); } else { cbmi.setSelected(false); } } }
From source file:com.mirth.connect.client.ui.components.MirthTable.java
private JPopupMenu getColumnMenu() { JPopupMenu columnMenu = new JPopupMenu(); DefaultTableModel model = (DefaultTableModel) getModel(); for (int i = 0; i < model.getColumnCount(); i++) { final String columnName = model.getColumnName(i); // Get the column object by name. Using an index may not return the column object if the column is hidden TableColumnExt column = getColumnExt(columnName); // Create the menu item final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(columnName); // Show or hide the checkbox menuItem.setSelected(column.isVisible()); menuItem.addActionListener(new ActionListener() { @Override//from w w w . j a v a 2s .c om public void actionPerformed(ActionEvent evt) { TableColumnExt column = getColumnExt(menuItem.getText()); // Determine whether to show or hide the selected column boolean enable = !column.isVisible(); // Do not hide a column if it is the last remaining visible column if (enable || getColumnCount() > 1) { column.setVisible(enable); saveColumnOrder(); } } }); columnMenu.add(menuItem); } columnMenu.addSeparator(); JMenuItem menuItem = new JMenuItem("Restore Default"); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { restoreDefaultColumnPreferences(); } }); columnMenu.add(menuItem); return columnMenu; }
From source file:com.mirth.connect.client.ui.components.MirthTreeTable.java
private JPopupMenu getColumnMenu() { SortableTreeTableModel model = (SortableTreeTableModel) getTreeTableModel(); JPopupMenu columnMenu = new JPopupMenu(); for (int i = 0; i < model.getColumnCount(); i++) { final String columnName = model.getColumnName(i); // Get the column object by name. Using an index may not return the column object if the column is hidden TableColumnExt column = getColumnExt(columnName); // Create the menu item final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(columnName); // Show or hide the checkbox menuItem.setSelected(column.isVisible()); menuItem.addActionListener(new ActionListener() { @Override//w ww .j a v a2 s. c o m public void actionPerformed(ActionEvent arg0) { TableColumnExt column = getColumnExt(menuItem.getText()); // Determine whether to show or hide the selected column boolean enable = !column.isVisible(); // Do not hide a column if it is the last remaining visible column if (enable || getColumnCount() > 1) { column.setVisible(enable); Set<String> customHiddenColumns = customHiddenColumnMap.get(channelId); if (customHiddenColumns != null) { if (enable) { customHiddenColumns.remove(columnName); } else { customHiddenColumns.add(columnName); } } } saveColumnOrder(); } }); columnMenu.add(menuItem); } columnMenu.addSeparator(); JMenuItem menuItem = new JMenuItem("Collapse All"); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { collapseAll(); } }); columnMenu.add(menuItem); menuItem = new JMenuItem("Expand All"); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { expandAll(); } }); columnMenu.add(menuItem); columnMenu.addSeparator(); menuItem = new JMenuItem("Restore Default"); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (metaDataColumns != null) { defaultVisibleColumns.addAll(metaDataColumns); } restoreDefaultColumnPreferences(); } }); columnMenu.add(menuItem); return columnMenu; }
From source file:homenetapp.HomeNetAppGui.java
private void startHomeNetApp() { this.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent winEvt) { // Perhaps ask user if they want to save any unsaved files first. exit();//from w w w. ja va 2s .c om } }); homenetapp.homenet.addPortListener(new homenet.PortListener() { ArrayList<String> local = new ArrayList<String>(); ArrayList<String> remote = new ArrayList<String>(); private boolean isRemote(String port) { return port.equals("xmlrpc"); } public void portAdded(String port) { // System.out.println("portAddedEvent"); if (isRemote(port)) { remote.add(port); remoteStatusLabel.setText("Connected"); } else { local.add(port); localStatusLabel.setText("Connected"); } } public void portRemoved(String port) { //System.out.println("portRemovedEvent"); if (isRemote(port)) { remote.remove(port); if (remote.size() < 1) { remoteStatusLabel.setText("Not Connected"); } } else { local.remove(port); if (local.size() < 1) { localStatusLabel.setText("Not Connected"); } } } public void portSendingStart(String port) { // System.out.println("portSendingStartEvent"); if (isRemote(port)) { remoteSendingLabel.setText("(X)"); } else { localSendingLabel.setText("(X)"); } } public void portSendingEnd(String port) { // System.out.println("portSendingEndEvent"); if (isRemote(port)) { Thread delayThread = new Thread() { public void run() { try { Thread.sleep(500); } catch (Exception e) { } remoteSendingLabel.setText("( )"); } }; delayThread.start(); } else { Thread delayThread = new Thread() { public void run() { try { Thread.sleep(500); } catch (Exception e) { } localSendingLabel.setText("( )"); } }; delayThread.start(); } } public void portReceivingStart(String port) { // System.out.println("portRecievingStartEvent"); if (isRemote(port)) { remoteReceivingLabel.setText("(X)"); } else { localReceivingLabel.setText("(X)"); } } public void portReceivingEnd(String port) { // System.out.println("portRecievingEndEvent"); if (isRemote(port)) { Thread delayThread = new Thread() { public void run() { try { Thread.sleep(500); } catch (Exception e) { } remoteReceivingLabel.setText("( )"); } }; delayThread.start(); } else { Thread delayThread = new Thread() { public void run() { try { Thread.sleep(500); } catch (Exception e) { } localReceivingLabel.setText("( )"); } }; delayThread.start(); } } }); try { homenetapp.start(); } catch (Exception e) { //show popup and exit program javax.swing.JOptionPane.showMessageDialog(null, "Error: " + e.getMessage(), "Error", javax.swing.JOptionPane.ERROR_MESSAGE); System.err.println(e.getMessage()); } loadSettings(); SendPacketFrame.setLocationRelativeTo(null); homenetapp.homenet.addPacketListener(new homenet.PacketListener() { public void packetRecieved(homenet.Packet packet) { addPacketToList(packet); } }); homenetapp.serialmanager.addListener(new SerialListener() { public void portAdded(String name) { // System.out.println("portAddedEvent"); javax.swing.JCheckBoxMenuItem serialPortCheckBox = new javax.swing.JCheckBoxMenuItem(name); serialPortCheckBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { JCheckBoxMenuItem checkbox = (JCheckBoxMenuItem) evt.getSource(); if (checkbox.isSelected()) { try { homenetapp.serialmanager.activatePort(checkbox.getText()); } catch (Exception e) { javax.swing.JOptionPane.showMessageDialog(null, "Port " + checkbox.getText() + " Error: " + e.getMessage(), "Error", javax.swing.JOptionPane.ERROR_MESSAGE); } } else { homenetapp.serialmanager.deactivatePort(checkbox.getText()); } } }); // serialPortCheckBox.setMnemonic(java.awt.event.KeyEvent.VK_1); menuItems.put(name, serialPortCheckBox); menuSerialPorts.add(serialPortCheckBox); } public void portRemoved(String name) { // System.out.println("portRemovedEvent"); menuSerialPorts.remove(menuItems.get(name)); } public void portActivated(String name) { // System.out.println("portActivatedEvent"); menuItems.get(name).setSelected(true); } public void portDeactivated(String name) { // System.out.println("portDeactivatedEvent"); menuItems.get(name).setSelected(false); } }); try { homenetapp.serialmanager.start(); } catch (Exception e) { javax.swing.JOptionPane.showMessageDialog(null, "Port Error: " + e.getMessage(), "Error", javax.swing.JOptionPane.ERROR_MESSAGE); } }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Setup the program's initial state based on the configuration * properties.// ww w .j a v a 2 s . c o m */ private void processProperties() { String value; lastDirectoryUsed = new File(properties.getProperty(ConfigurationProperty.LAST_DIRECTORY.key(), ".")); LOGGER.debug("Last directory used from properties file: " + lastDirectoryUsed.getAbsolutePath()); value = properties.getProperty(ConfigurationProperty.INPUT_LANGUAGE.key(), "?"); language.setSelectedItem(value); value = properties.getProperty(ConfigurationProperty.REASONING_LEVEL.key(), "-1"); try { final Integer index = Integer.parseInt(value); if (index < 0 || index >= reasoningLevel.getItemCount()) { throw new IllegalArgumentException("Incorrect reasoning level index property value: " + value); } reasoningLevel.setSelectedIndex(index); } catch (Throwable throwable) { LOGGER.warn("Index for reasoner level must be a number from zero to " + (reasoningLevel.getItemCount() - 1)); } reasoningLevel.setToolTipText(((ReasonerSelection) reasoningLevel.getSelectedItem()).description()); value = properties.getProperty(ConfigurationProperty.OUTPUT_FORMAT.key(), "?"); for (JCheckBoxMenuItem outputLanguage : setupOutputAssertionLanguage) { if (outputLanguage.getText().equalsIgnoreCase(value)) { outputLanguage.setSelected(true); } } value = properties.getProperty(ConfigurationProperty.OUTPUT_CONTENT.key(), "?"); if (setupOutputModelTypeAssertionsAndInferences.getText().equalsIgnoreCase(value)) { setupOutputModelTypeAssertionsAndInferences.setSelected(true); } else { setupOutputModelTypeAssertions.setSelected(true); } setupAllowMultilineResultOutput.setSelected( properties.getProperty(ConfigurationProperty.SPARQL_DISPLAY_ALLOW_MULTILINE_OUTPUT.key(), "Y") .toUpperCase().startsWith("Y")); setupOutputFqnNamespaces.setSelected(properties .getProperty(ConfigurationProperty.SHOW_FQN_NAMESPACES.key(), "Y").toUpperCase().startsWith("Y")); setupOutputDatatypesForLiterals .setSelected(properties.getProperty(ConfigurationProperty.SHOW_DATATYPES_ON_LITERALS.key(), "Y") .toUpperCase().startsWith("Y")); setupOutputFlagLiteralValues .setSelected(properties.getProperty(ConfigurationProperty.FLAG_LITERALS_IN_RESULTS.key(), "N") .toUpperCase().startsWith("Y")); setupApplyFormattingToLiteralValues.setSelected( properties.getProperty(ConfigurationProperty.APPLY_FORMATTING_TO_LITERAL_VALUES.key(), "N") .toUpperCase().startsWith("Y")); setupDisplayImagesInSparqlResults.setSelected( properties.getProperty(ConfigurationProperty.SPARQL_DISPLAY_IMAGES_IN_RESULTS.key(), "N") .toUpperCase().startsWith("Y")); // SPARQL query export format - default to CSV if (properties .getProperty(ConfigurationProperty.EXPORT_SPARQL_RESULTS_FORMAT.key(), EXPORT_FORMAT_LABEL_CSV) .equalsIgnoreCase(EXPORT_FORMAT_LABEL_TSV)) { setupExportSparqlResultsAsTsv.setSelected(true); } else { setupExportSparqlResultsAsCsv.setSelected(true); } setupSparqlResultsToFile .setSelected(properties.getProperty(ConfigurationProperty.SPARQL_RESULTS_TO_FILE.key(), "N") .toUpperCase().startsWith("Y")); value = properties.getProperty(ConfigurationProperty.SPARQL_SERVICE_USER_ID.key()); if (value != null) { sparqlServiceUserId.setText(value); } value = properties.getProperty(ConfigurationProperty.SPARQL_DEFAULT_GRAPH_URI.key()); if (value != null) { defaultGraphUri.setText(value); } setupEnableStrictMode.setSelected(properties .getProperty(ConfigurationProperty.ENABLE_STRICT_MODE.key(), "Y").toUpperCase().startsWith("Y")); filterEnableFilters .setSelected(properties.getProperty(ConfigurationProperty.ENFORCE_FILTERS_IN_TREE_VIEW.key(), "Y") .toUpperCase().startsWith("Y")); showFqnInTree.setSelected(properties.getProperty(ConfigurationProperty.DISPLAY_FQN_IN_TREE_VIEW.key(), "Y") .toUpperCase().startsWith("Y")); filterShowAnonymousNodes.setSelected( properties.getProperty(ConfigurationProperty.DISPLAY_ANONYMOUS_NODES_IN_TREE_VIEW.key(), "N") .toUpperCase().startsWith("Y")); setFont(getFontFromProperties(), getColorFromProperties()); extractSkipObjectsFromProperties(); extractRecentAssertedTriplesFilesFromProperties(); extractRecentSparqlQueryFilesFromProperties(); // SPARQL Split Pane Position value = properties.getProperty(ConfigurationProperty.SPARQL_SPLIT_PANE_POSITION.key()); if (value != null) { try { final int position = Integer.parseInt(value); if (position > 0) { sparqlQueryAndResults.setDividerLocation(position); } } catch (Throwable throwable) { LOGGER.warn("Cannot use the SPARQL split pane divider location value: " + value, throwable); } } // Sparql server port value = properties.getProperty(ConfigurationProperty.SPARQL_SERVER_PORT.key()); if (value != null) { try { final Integer port = Integer.parseInt(value); if (port > 0) { SparqlServer.getInstance().setListenerPort(port); } else { LOGGER.warn("Configured port for SPARQL Server must be greater than zero. Was set to " + port); } } catch (Throwable throwable) { LOGGER.warn("Configured port for SPARQL Server must be a number greater than zero. Was set to " + value); } } // SPARQL server max runtime value = properties.getProperty(ConfigurationProperty.SPARQL_SERVER_MAX_RUNTIME.key()); if (value != null) { try { final Integer maxRuntimeSeconds = Integer.parseInt(value); if (maxRuntimeSeconds > 0) { SparqlServer.getInstance().setMaxRuntimeSeconds(maxRuntimeSeconds); } else { LOGGER.warn( "Configured maximum runtime for the SPARQL Server must be greater than zero seconds. Was set to " + maxRuntimeSeconds); } } catch (Throwable throwable) { LOGGER.warn( "Configured maximum runtime for the SPARQL Server must be a number greater than zero. Was set to " + value); } } // SPARQL server remote updates permitted SparqlServer.getInstance().setRemoteUpdatesPermitted( properties.getProperty(ConfigurationProperty.SPARQL_SERVER_ALLOW_REMOTE_UPDATE.key(), "N") .toUpperCase().startsWith("Y")); // Proxy proxyServer = properties.getProperty(ConfigurationProperty.PROXY_SERVER.key()); value = properties.getProperty(ConfigurationProperty.PROXY_PORT.key()); if (value != null) { try { proxyPort = Integer.parseInt(value); } catch (Throwable throwable) { LOGGER.warn("Illegal proxy port number in the properties file: " + value); } } proxyProtocolHttp = properties.getProperty(ConfigurationProperty.PROXY_HTTP.key(), "N").toUpperCase() .startsWith("Y"); proxyProtocolSocks = properties.getProperty(ConfigurationProperty.PROXY_SOCKS.key(), "N").toUpperCase() .startsWith("Y"); proxyEnabled = properties.getProperty(ConfigurationProperty.PROXY_ENABLED.key(), "N").toUpperCase() .startsWith("Y"); setupProxy(); populateSparqlServiceUrls(); extractXsdFormatsFromProperties(); }
From source file:com.monead.semantic.workbench.SemanticWorkbench.java
/** * Save the current program configuration to the properties file. */// w w w. j ava 2s . co m private void saveProperties() { Writer writer = null; // Remove the recent asserted triples files entries. // They will be recreated from the new list removePrefixedProperties(ConfigurationProperty.PREFIX_RECENT_ASSERTIONS_FILE.key()); // Remove the recent SPARQL query files entries. // They will be recreated from the new list removePrefixedProperties(ConfigurationProperty.PREFIX_RECENT_SPARQL_QUERY_FILE.key()); // Remove the set of SPARQL service URL entries. // They will be recreated from the dropdown removePrefixedProperties(ConfigurationProperty.PREFIX_SPARQL_SERVICE_URL.key()); updatePropertiesWithClassesToSkipInTree(); updatePropertiesWithPredicatesToSkipInTree(); updatePropertiesWithServiceUrls(); // Add the set of recent asserted triples files for (int index = 0; index < MAX_PREVIOUS_FILES_TO_STORE && index < recentAssertionsFiles.size(); ++index) { properties.put(ConfigurationProperty.PREFIX_RECENT_ASSERTIONS_FILE.key() + index, (recentAssertionsFiles.get(index).isFile() ? "FILE:" : "URL:") + recentAssertionsFiles.get(index).getAbsolutePath()); } // Add the set of recent SPARQL query files for (int index = 0; index < MAX_PREVIOUS_FILES_TO_STORE && index < recentSparqlFiles.size(); ++index) { properties.put(ConfigurationProperty.PREFIX_RECENT_SPARQL_QUERY_FILE.key() + index, recentSparqlFiles.get(index).getAbsolutePath()); } properties.setProperty(ConfigurationProperty.LAST_HEIGHT.key(), this.getSize().height + ""); properties.setProperty(ConfigurationProperty.LAST_WIDTH.key(), this.getSize().width + ""); properties.setProperty(ConfigurationProperty.LAST_TOP_X_POSITION.key(), this.getLocation().x + ""); properties.setProperty(ConfigurationProperty.LAST_TOP_Y_POSITION.key(), this.getLocation().y + ""); // Only store the divider position if it is not at an extreme setting (e.g. // both the query and results panels are visible) if (sparqlQueryAndResults.getDividerLocation() > 1 && sparqlQueryAndResults.getHeight() - (sparqlQueryAndResults.getDividerLocation() + sparqlQueryAndResults.getDividerSize()) > 1) { properties.setProperty(ConfigurationProperty.SPARQL_SPLIT_PANE_POSITION.key(), sparqlQueryAndResults.getDividerLocation() + ""); } else { LOGGER.debug("SPARQL split pane position not being stored - Size:" + sparqlQueryAndResults.getHeight() + " DividerLoc:" + sparqlQueryAndResults.getDividerLocation() + " DividerSize:" + sparqlQueryAndResults.getDividerSize()); properties.remove(ConfigurationProperty.SPARQL_SPLIT_PANE_POSITION.key()); } properties.setProperty(ConfigurationProperty.LAST_DIRECTORY.key(), lastDirectoryUsed.getAbsolutePath()); properties.setProperty(ConfigurationProperty.INPUT_LANGUAGE.key(), language.getSelectedItem().toString()); properties.setProperty(ConfigurationProperty.REASONING_LEVEL.key(), reasoningLevel.getSelectedIndex() + ""); for (JCheckBoxMenuItem outputLanguage : setupOutputAssertionLanguage) { if (outputLanguage.isSelected()) { properties.setProperty(ConfigurationProperty.OUTPUT_FORMAT.key(), outputLanguage.getText()); } } if (setupOutputModelTypeAssertionsAndInferences.isSelected()) { properties.setProperty(ConfigurationProperty.OUTPUT_CONTENT.key(), setupOutputModelTypeAssertionsAndInferences.getText()); } else { properties.setProperty(ConfigurationProperty.OUTPUT_CONTENT.key(), setupOutputModelTypeAssertions.getText()); } properties.setProperty(ConfigurationProperty.SPARQL_DISPLAY_ALLOW_MULTILINE_OUTPUT.key(), setupAllowMultilineResultOutput.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.SHOW_FQN_NAMESPACES.key(), setupOutputFqnNamespaces.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.SHOW_DATATYPES_ON_LITERALS.key(), setupOutputDatatypesForLiterals.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.FLAG_LITERALS_IN_RESULTS.key(), setupOutputFlagLiteralValues.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.APPLY_FORMATTING_TO_LITERAL_VALUES.key(), setupApplyFormattingToLiteralValues.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.SPARQL_DISPLAY_IMAGES_IN_RESULTS.key(), setupDisplayImagesInSparqlResults.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); if (setupExportSparqlResultsAsTsv.isSelected()) { properties.setProperty(ConfigurationProperty.EXPORT_SPARQL_RESULTS_FORMAT.key(), EXPORT_FORMAT_LABEL_TSV); } else { properties.setProperty(ConfigurationProperty.EXPORT_SPARQL_RESULTS_FORMAT.key(), EXPORT_FORMAT_LABEL_CSV); } properties.setProperty(ConfigurationProperty.SPARQL_RESULTS_TO_FILE.key(), setupSparqlResultsToFile.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); if (sparqlServiceUserId.getText().trim().length() > 0) { properties.setProperty(ConfigurationProperty.SPARQL_SERVICE_USER_ID.key(), sparqlServiceUserId.getText().trim()); } else { properties.remove(ConfigurationProperty.SPARQL_SERVICE_USER_ID.key()); } if (defaultGraphUri.getText().trim().length() > 0) { properties.setProperty(ConfigurationProperty.SPARQL_DEFAULT_GRAPH_URI.key(), defaultGraphUri.getText().trim()); } else { properties.remove(ConfigurationProperty.SPARQL_DEFAULT_GRAPH_URI.key()); } properties.setProperty(ConfigurationProperty.ENABLE_STRICT_MODE.key(), setupEnableStrictMode.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.ENFORCE_FILTERS_IN_TREE_VIEW.key(), filterEnableFilters.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.DISPLAY_FQN_IN_TREE_VIEW.key(), showFqnInTree.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.DISPLAY_ANONYMOUS_NODES_IN_TREE_VIEW.key(), filterShowAnonymousNodes.isSelected() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.SPARQL_SERVER_PORT.key(), SparqlServer.getInstance().getListenerPort() + ""); properties.setProperty(ConfigurationProperty.SPARQL_SERVER_MAX_RUNTIME.key(), SparqlServer.getInstance().getMaxRuntimeSeconds() + ""); properties.setProperty(ConfigurationProperty.SPARQL_SERVER_ALLOW_REMOTE_UPDATE.key(), SparqlServer.getInstance().areRemoteUpdatesPermitted() ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.PROXY_ENABLED.key(), proxyEnabled ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); if (proxyServer != null) { properties.setProperty(ConfigurationProperty.PROXY_SERVER.key(), proxyServer); } else { properties.remove(ConfigurationProperty.PROXY_SERVER.key()); } if (proxyPort != null) { properties.setProperty(ConfigurationProperty.PROXY_PORT.key(), proxyPort + ""); } else { properties.remove(ConfigurationProperty.PROXY_PORT.key()); } properties.setProperty(ConfigurationProperty.PROXY_HTTP.key(), proxyProtocolHttp ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); properties.setProperty(ConfigurationProperty.PROXY_SOCKS.key(), proxyProtocolSocks ? DEFAULT_PROPERTY_VALUE_YES : DEFAULT_PROPERTY_VALUE_NO); try { writer = new FileWriter(getUserHomeDirectory() + "/" + PROPERTIES_FILE_NAME, false); properties.store(writer, "Generated by Semantic Workbench version " + VERSION + " on " + new Date()); } catch (Throwable throwable) { LOGGER.warn("Unable to write the properties file: " + PROPERTIES_FILE_NAME, throwable); } finally { if (writer != null) { try { writer.close(); } catch (Throwable throwable) { LOGGER.warn("Unable to close the properties file: " + PROPERTIES_FILE_NAME, throwable); } } } }
From source file:org.rivalry.swingui.table.VisibleColumnsPopupMenu.java
/** * @return a new action listener./*from ww w. j a v a2s . c o m*/ */ private ActionListener createActionListener() { return new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { final JCheckBoxMenuItem source = (JCheckBoxMenuItem) event.getSource(); // Change the column visibility in the table model. final String columnName = source.getText(); final boolean isVisible = source.isSelected(); setColumnVisible(columnName, isVisible); } }; }
From source file:org.tros.torgo.ControllerBase.java
@Override public void enable(String name) { for (JCheckBoxMenuItem item : viz) { if (item.getText().equals(name)) { item.setState(true);/*from w ww.ja va 2 s. co m*/ } } }
From source file:org.tros.torgo.ControllerBase.java
@Override public void disable(String name) { for (JCheckBoxMenuItem item : viz) { if (item.getText().equals(name)) { item.setState(false);//from ww w .ja v a 2 s.c o m } } }