Example usage for javax.swing JCheckBoxMenuItem isSelected

List of usage examples for javax.swing JCheckBoxMenuItem isSelected

Introduction

In this page you can find the example usage for javax.swing JCheckBoxMenuItem isSelected.

Prototype

public boolean isSelected() 

Source Link

Document

Returns the state of the button.

Usage

From source file:ffx.ui.MainPanel.java

/**
 * <p>//  w w  w .  j a v  a  2 s  .c  om
 * showTree</p>
 *
 * @param evt a {@link java.awt.event.ActionEvent} object.
 */
public void showTree(ActionEvent evt) {
    JCheckBoxMenuItem treeCheckBox = (JCheckBoxMenuItem) evt.getSource();
    if (treeCheckBox.isSelected()) {
        if (splitPaneDivider < frame.getWidth() * (1.0f / 4.0f)) {
            splitPaneDivider = (int) (frame.getWidth() * (1.0f / 4.0f));
        }
        splitPane.setDividerLocation(splitPaneDivider);
    } else {
        splitPaneDivider = splitPane.getDividerLocation();
        splitPane.setDividerLocation(0.0);
    }
}

From source file:ffx.ui.MainPanel.java

/**
 * <p>//from w w w. ja  v a 2 s  .  co  m
 * showToolBar</p>
 *
 * @param evt a {@link java.awt.event.ActionEvent} object.
 */
public void showToolBar(ActionEvent evt) {
    JCheckBoxMenuItem toolBarCheckBox = (JCheckBoxMenuItem) evt.getSource();
    if (toolBarCheckBox.isSelected()) {
        add(mainMenu.getToolBar(), BorderLayout.NORTH);
        frame.validate();
    } else {
        remove(mainMenu.getToolBar());
        frame.validate();
    }
}

From source file:ffx.ui.MainPanel.java

/**
 * <p>//from   ww w  . ja va 2  s. c  o  m
 * highlightSelections</p>
 *
 * @param evt a {@link java.awt.event.ActionEvent} object.
 */
public void highlightSelections(ActionEvent evt) {
    if (evt.getSource() instanceof JCheckBoxMenuItem) {
        JCheckBoxMenuItem jcb = (JCheckBoxMenuItem) evt.getSource();
        if (jcb.isSelected()) {
            hierarchy.setHighlighting(true);
        } else {
            hierarchy.setHighlighting(false);
        }
    } else {
        boolean highlighting = RendererCache.highlightSelections;
        if (highlighting) {
            hierarchy.setHighlighting(false);
            mainMenu.setHighlighting(false);
        } else {
            hierarchy.setHighlighting(true);
            mainMenu.setHighlighting(true);
        }
    }
}

From source file:com.declarativa.interprolog.gui.ListenerWindow.java

void constructMenu() {
    JMenuBar mb;/*  w w w .j  av  a  2s .  com*/
    mb = new JMenuBar();
    setJMenuBar(mb);

    final CallsFromArgBuilder2XSB calls2XSB = new CallsFromArgBuilder2XSB();

    /**
     * ****************************************************************
     * ***************ENTRY POINT FOR CALLING THE ARGXSB ANALYSIS *****
     * ****************************************************************
     *
     * Carga un archivo con las reglas para crear los argumentos
     */
    loadRules = new JMenu("");
    loadRules.setMnemonic('A');
    mb.add(loadRules);
    addItemToMenu(loadRules, "Select a Program", 'S', new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            //jLayeredPane1.setVisible(true);
            //WORKFLOW:
            //1. Load File
            //2. clause partition
            //3. graph creation
            //4. extract subgraphs
            //5. create a file for each subgraph
            //6. consult via XSB, each sub-file (sub-graph)
            /**
             * deleteing previous files
             */
            String calls_for_table = "";//maybe temporal
            String returns_for_call = "";

            //the file is loaded
            GraphAnalysis();

            try {
                ReDrawGraph();
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
                //System.out.println("EXCEPCION EN REDRAW CALL");
            }

            /*
             //remueve el .P del archivo 
             String nameFile = calls2XSB.File2Consult(getNameOfFileToLoad());
             System.out.println("=============_" + nameFile);
             //StringTokenizer st2 = new StringTokenizer(getNameOfFileToLoad(), ".");
             //String nameFile = st2.nextElement().toString();
             sendCallToProlog("consult(" + nameFile + ").");
                    
                    
             //retorna los valores de True False de cada atomo
             //estos debeian guardarse en la base de datos para luego
             // obtener los argumentos
             calls_for_table = calls2XSB.FindCallsForTable(engine);
             returns_for_call = calls2XSB.FindReturnsForCall(engine);
             */
            java.util.List<String> filenames = new ArrayList();
            filenames = printArguments();

            for (Iterator<String> it = filenames.iterator(); it.hasNext();) {
                String string = it.next();
                //System.out.println("\t\t --------------> name:" + string);
                //System.out.println("\t \t *************************************************");

                /*
                 try {
                 System.out.println(new File(".").getCanonicalPath());
                 System.out.println("DIR:" + new File("../examples/").getCanonicalPath());
                 System.out.println("DIR:" + new File("../examples/"+string).getCanonicalPath());
                        
                 } catch (java.io.IOException ex) {
                 System.out.println("ex." + ex.getLocalizedMessage());
                 }
                 */
                consultFile("../examples/" + string);

                String nameFile3 = calls2XSB.File2Consult(string);
                //sendCallToProlog("consult(" + nameFile3 + ").");
                sendCallToProlog(nameFile3);

                //calls_for_table = calls2XSB.FindCallsForTable(engine);
                //returns_for_call = calls2XSB.FindReturnsForCall(engine, string);
                calls2XSB.WFSEvaluation(engine, string);

                //System.out.println("\t \t *************************************************");
            }

            ArgumentWriter();

            drawArguments();

            /*
             String atomGoal ="p(X)";
             String atomGoal2 = "findall(Y,p(Y), L)";
             String atomGoal3 ="findall(Call,get_calls_for_table(p/1,Call),List)";
             String atomGoal4 ="findall(Answer,get_returns_for_call(p(_),Answer),List2)";
                    
                    
             try {
             String G = "(X=a;X=b)";
             String T = "X";
                       
             String GG = "findall(TM, ("+atomGoal3+",buildTermModel(List,TM)), L), ipObjectSpec('ArrayOfObject',L,LM)";                   
             String GG2 = "findall(TM, ("+atomGoal4+",buildTermModel(List2,TM)), L), ipObjectSpec('ArrayOfObject',L,LM)";
                    
             Object[] bindings0 = engine.deterministicGoal(atomGoal,null);                  
             Object[] bindings = engine.deterministicGoal(atomGoal3,null);
                    
             Object[] get_calls_for_table = (Object[])engine.deterministicGoal(GG,"[LM]")[0];                    
             Object[] get_returns_for_call = (Object[])engine.deterministicGoal(GG2,"[LM]")[0];
                    
             //System.out.println("Number of solutions:"+get_calls_for_table.length);
             for(int I=0;I<get_calls_for_table.length;I++)
             System.out.println("Solution "+I+":"+get_calls_for_table[I]);
                    
             //System.out.println("Number of bindings:"+get_returns_for_call.length);
             for(int I=0;I<get_returns_for_call.length;I++)
             System.out.println("Solution2 "+I+":"+get_returns_for_call[I]);
                      
                    
             } catch (IPAbortedException exc) {
             exc.printStackTrace();
             System.out.println("Exception!: "+exc.getLocalizedMessage());
             } catch (IPInterruptedException ex) {
             ex.printStackTrace();
             System.out.println("Exception!: "+ex.getLocalizedMessage());
             }
                    
             */
        }
    });

    fileMenu = new JMenu("File");
    fileMenu.setMnemonic('F');
    //        mb.add(fileMenu);

    addItemToMenu(fileMenu, "Consult...", 'C', new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            reconsultFile();
        }
    });

    if (engine.getImplementationPeer() instanceof XSBPeer) {
        addItemToMenu(fileMenu, "Load dynamically...", 'L', new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                load_dynFile();
            }
        });
    }

    fileMenu.addSeparator();

    JMenu toolMenu = new JMenu("Tools");
    toolMenu.setMnemonic('T');
    //       mb.add(toolMenu);

    final JCheckBoxMenuItem debugging = new JCheckBoxMenuItem("Engine debugging");
    toolMenu.add(debugging);
    debugging.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            engine.setDebug(debugging.isSelected());
        }
    });

    addItemToMenu(toolMenu, "See Object Specifications", 'S', new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            engine.command("showObjectVariables");
        }
    });

    addItemToMenu(toolMenu, "Interrupt Prolog", 'I', new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            engine.interrupt();
        }
    });
    /*
     addItemToMenu(toolMenu,"Serialize JFrame",new ActionListener(){
     public void actionPerformed(ActionEvent e){
     Object [] toSerialize = {new JFrame("My window")};
     engine.setDebug(true);
     System.out.println(engine.deterministicGoal("true","[Object]",toSerialize));
     }
     });*/

    historyMenu = new JMenu("History", true);
    historyMenu.setMnemonic('H');
    //        mb.add(historyMenu);
    historyMenu.addSeparator(); // to avoid Swing bug handling key events
}

From source file:ffx.ui.MainPanel.java

/**
 * <p>//www  .  j av a2  s  .  c  o m
 * showGlobalAxes</p>
 *
 * @param evt a {@link java.awt.event.ActionEvent} object.
 */
public void showGlobalAxes(ActionEvent evt) {
    JCheckBoxMenuItem showAxesCheckBox = (JCheckBoxMenuItem) evt.getSource();
    graphicsCanvas.setAxisShowing(showAxesCheckBox.isSelected());
}

From source file:org.yccheok.jstock.gui.charting.ChartJDialog.java

/**
 * Build menu items for TA.//from www . j a  v  a2 s  . c o  m
 */
private void buildTAMenuItems() {
    final int[] days = { 14, 28, 50, 100, 200 };
    final MACD.Period[] macd_periods = { MACD.Period.newInstance(12, 26, 9) };

    // day_keys, week_keys and month_keys should be having same length as
    // days.        
    final String[] day_keys = { "ChartJDialog_14Days", "ChartJDialog_28Days", "ChartJDialog_50Days",
            "ChartJDialog_100Days", "ChartJDialog_200Days" };
    final String[] week_keys = { "ChartJDialog_14Weeks", "ChartJDialog_28Weeks", "ChartJDialog_50Weeks",
            "ChartJDialog_100Weeks", "ChartJDialog_200Weeks" };
    final String[] month_keys = { "ChartJDialog_14Months", "ChartJDialog_28Months", "ChartJDialog_50Months",
            "ChartJDialog_100Months", "ChartJDialog_200Months" };
    assert (days.length == day_keys.length);
    assert (days.length == week_keys.length);
    assert (days.length == week_keys.length);
    // macd_day_keys, macd_week_keys and macd_month_keys should be having 
    // same length as macd_periods.
    final String[] macd_day_keys = { "ChartJDialog_12_26_9Days" };
    final String[] macd_week_keys = { "ChartJDialog_12_26_9Weeks" };
    final String[] macd_month_keys = { "ChartJDialog_12_26_9Months" };
    assert (macd_periods.length == macd_day_keys.length);
    assert (macd_periods.length == macd_week_keys.length);
    assert (macd_periods.length == macd_month_keys.length);

    String[] keys = null;
    String[] macd_keys = null;
    if (this.getCurrentInterval() == Interval.Daily) {
        keys = day_keys;
        macd_keys = macd_day_keys;
    } else if (this.getCurrentInterval() == Interval.Weekly) {
        keys = week_keys;
        macd_keys = macd_week_keys;
    } else if (this.getCurrentInterval() == Interval.Monthly) {
        keys = month_keys;
        macd_keys = macd_month_keys;
    } else {
        assert (false);
    }
    final TA[] tas = TA.values();
    final String[] ta_keys = { "ChartJDialog_SMA", "ChartJDialog_EMA", "ChartJDialog_MACD", "ChartJDialog_RSI",
            "ChartJDialog_MFI", "ChartJDialog_CCI" };
    final String[] ta_tip_keys = { "ChartJDialog_SimpleMovingAverage", "ChartJDialog_ExponentialMovingAverage",
            "ChartJDialog_MovingAverageConvergenceDivergence", "ChartJDialog_RelativeStrengthIndex",
            "ChartJDialog_MoneyFlowIndex", "ChartJDialog_CommodityChannelIndex" };
    final String[] custom_message_keys = { "info_message_please_enter_number_of_days_for_SMA",
            "info_message_please_enter_number_of_days_for_EMA", "dummy",
            "info_message_please_enter_number_of_days_for_RSI",
            "info_message_please_enter_number_of_days_for_MFI",
            "info_message_please_enter_number_of_days_for_CCI" };
    final Map<TA, Set<Object>> m = new EnumMap<TA, Set<Object>>(TA.class);
    final int taExSize = JStock.instance().getChartJDialogOptions().getTAExSize();
    for (int i = 0; i < taExSize; i++) {
        final TAEx taEx = JStock.instance().getChartJDialogOptions().getTAEx(i);
        if (m.containsKey(taEx.getTA()) == false) {
            m.put(taEx.getTA(), new HashSet<Object>());
        }
        m.get(taEx.getTA()).add(taEx.getParameter());
    }

    for (int i = 0, length = tas.length; i < length; i++) {
        final TA ta = tas[i];
        javax.swing.JMenu menu = new javax.swing.JMenu();
        menu.setText(GUIBundle.getString(ta_keys[i])); // NOI18N
        menu.setToolTipText(GUIBundle.getString(ta_tip_keys[i])); // NOI18N

        if (ta == TA.MACD) {
            for (int j = 0, length2 = macd_periods.length; j < length2; j++) {
                final int _j = j;
                final javax.swing.JCheckBoxMenuItem item = new javax.swing.JCheckBoxMenuItem();
                item.setText(GUIBundle.getString(macd_keys[j]));
                if (m.containsKey(ta)) {
                    if (m.get(ta).contains(macd_periods[_j])) {
                        item.setSelected(true);
                    }
                }
                item.addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        if (ta == TA.MACD) {
                            updateMACD(macd_periods[_j], item.isSelected());
                        }
                    }
                });
                menu.add(item);
            }
        } else {
            for (int j = 0, length2 = days.length; j < length2; j++) {
                final int _j = j;
                final javax.swing.JCheckBoxMenuItem item = new javax.swing.JCheckBoxMenuItem();
                item.setText(GUIBundle.getString(keys[j])); // NOI18N
                if (m.containsKey(ta)) {
                    if (m.get(ta).contains(days[_j])) {
                        item.setSelected(true);
                    }
                }
                item.addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        if (ta == TA.SMA) {
                            updateSMA(days[_j], item.isSelected());
                        } else if (ta == TA.EMA) {
                            updateEMA(days[_j], item.isSelected());
                        } else if (ta == TA.MFI) {
                            updateMFI(days[_j], item.isSelected());
                        } else if (ta == TA.RSI) {
                            updateRSI(days[_j], item.isSelected());
                        } else if (ta == TA.CCI) {
                            updateCCI(days[_j], item.isSelected());
                        }
                    }
                });
                menu.add(item);
            } // for
        } // if (ta == TA.MACD)

        menu.add(new javax.swing.JSeparator());
        javax.swing.JMenuItem item = new javax.swing.JMenuItem();
        item.setText(GUIBundle.getString("ChartJDialog_Custom...")); // NOI18N
        final int _i = i;
        item.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                if (ta == TA.MACD) {
                    showMACDCustomDialog();
                } else {
                    do {
                        final String days_string = JOptionPane.showInputDialog(ChartJDialog.this,
                                MessagesBundle.getString(custom_message_keys[_i]));
                        if (days_string == null) {
                            return;
                        }
                        try {
                            final int days = Integer.parseInt(days_string);
                            if (days <= 0) {
                                JOptionPane.showMessageDialog(ChartJDialog.this,
                                        MessagesBundle.getString("info_message_number_of_days_required"),
                                        MessagesBundle.getString("info_title_number_of_days_required"),
                                        JOptionPane.WARNING_MESSAGE);
                                continue;
                            }
                            ChartJDialog.this.updateTA(ta, days, true);
                            return;
                        } catch (java.lang.NumberFormatException exp) {
                            log.error(null, exp);
                            JOptionPane.showMessageDialog(ChartJDialog.this,
                                    MessagesBundle.getString("info_message_number_of_days_required"),
                                    MessagesBundle.getString("info_title_number_of_days_required"),
                                    JOptionPane.WARNING_MESSAGE);
                            continue;
                        }
                    } while (true);
                }
            }
        });
        menu.add(item);

        // TEMP DISABLE MACD
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        if (ta != TA.MACD) {
            this.jMenu2.add(menu);
        }
    } // for
    this.jMenu2.add(new javax.swing.JSeparator());
    javax.swing.JMenuItem item = new javax.swing.JMenuItem();
    item.setText(GUIBundle.getString("ChartJDialog_ClearAll")); // NOI18N
    item.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ChartJDialog.this.clearAll();
        }
    });
    this.jMenu2.add(item);
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Save the current program configuration to the properties file.
 *//*  w  w  w.j a va  2 s .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.broad.igv.track.TrackMenuUtils.java

private static JMenuItem getDrawBorderItem() {
    // Change track height by attribute

    final JCheckBoxMenuItem drawBorderItem = new JCheckBoxMenuItem("Draw borders");
    drawBorderItem.setSelected(FeatureTrack.isDrawBorder());
    drawBorderItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            FeatureTrack.setDrawBorder(drawBorderItem.isSelected());
            IGV.getInstance().repaintDataPanels();
        }/*w  w  w  .  j  av  a 2  s . c o m*/
    });

    return drawBorderItem;
}

From source file:org.broad.igv.track.TrackMenuUtils.java

public static JMenuItem getLogScaleItem(final Collection<Track> selectedTracks) {
    // Change track height by attribute

    final JCheckBoxMenuItem logScaleItem = new JCheckBoxMenuItem("Log scale");
    final boolean logScale = selectedTracks.iterator().next().getDataRange().isLog();
    logScaleItem.setSelected(logScale);/*from  w  ww . j  a va  2s .  c  o m*/
    logScaleItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            DataRange.Type scaleType = logScaleItem.isSelected() ? DataRange.Type.LOG : DataRange.Type.LINEAR;
            for (Track t : selectedTracks) {
                t.getDataRange().setType(scaleType);
            }
            IGV.getInstance().repaintDataPanels();
        }
    });

    return logScaleItem;
}

From source file:org.broad.igv.track.TrackMenuUtils.java

private static JMenuItem getAutoscaleItem(final Collection<Track> selectedTracks) {

    final JCheckBoxMenuItem autoscaleItem = new JCheckBoxMenuItem("Autoscale");
    if (selectedTracks.size() == 0) {
        autoscaleItem.setEnabled(false);

    } else {//from   w  w  w .j  a  v a 2s .c  om
        boolean autoScale = false;
        for (Track t : selectedTracks) {
            if (t instanceof DataTrack && ((DataTrack) t).isAutoscale()) {
                autoScale = true;
                break;
            }
        }

        autoscaleItem.setSelected(autoScale);
        autoscaleItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent evt) {

                boolean autoScale = autoscaleItem.isSelected();
                for (Track t : selectedTracks) {
                    if (t instanceof DataTrack) {
                        ((DataTrack) t).setAutoscale(autoScale);
                    }
                }
                IGV.getInstance().repaintDataPanels();
            }
        });
    }
    return autoscaleItem;
}