List of usage examples for javax.swing JCheckBox isSelected
public boolean isSelected()
From source file:AppearanceExplorer.java
PointAttributesEditor(PointAttributes init) { super(BoxLayout.Y_AXIS); pointAttr = init;/* w w w . j av a 2s .c o m*/ pointSize = pointAttr.getPointSize(); pointAAEnable = pointAttr.getPointAntialiasingEnable(); LogFloatLabelJSlider pointSizeSlider = new LogFloatLabelJSlider("Size", 0.1f, 100.0f, pointSize); pointSizeSlider.setMajorTickSpacing(1.0f); pointSizeSlider.setPaintTicks(true); pointSizeSlider.addFloatListener(new FloatListener() { public void floatChanged(FloatEvent e) { pointSize = e.getValue(); pointAttr.setPointSize(pointSize); } }); add(pointSizeSlider); JCheckBox pointAACheckBox = new JCheckBox(antiAliasString); pointAACheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); pointAAEnable = checkbox.isSelected(); pointAttr.setPointAntialiasingEnable(pointAAEnable); } }); add(new LeftAlignComponent(pointAACheckBox)); }
From source file:AppearanceExplorer.java
LineAttributesEditor(LineAttributes init) { super(BoxLayout.Y_AXIS); lineAttr = init;//from w w w . ja v a 2 s. c om lineWidth = lineAttr.getLineWidth(); linePattern = lineAttr.getLinePattern(); lineAAEnable = lineAttr.getLineAntialiasingEnable(); FloatLabelJSlider lineWidthSlider = new FloatLabelJSlider("Width", 0.1f, 0.0f, 5.0f, lineWidth); lineWidthSlider.setMajorTickSpacing(1.0f); lineWidthSlider.setPaintTicks(true); lineWidthSlider.addFloatListener(new FloatListener() { public void floatChanged(FloatEvent e) { lineWidth = e.getValue(); lineAttr.setLineWidth(lineWidth); } }); lineWidthSlider.setAlignmentX(Component.LEFT_ALIGNMENT); add(lineWidthSlider); String[] patternNames = { "PATTERN_SOLID", "PATTERN_DASH", "PATTERN_DOT", "PATTERN_DASH_DOT" }; int[] patternValues = { LineAttributes.PATTERN_SOLID, LineAttributes.PATTERN_DASH, LineAttributes.PATTERN_DOT, LineAttributes.PATTERN_DASH_DOT }; IntChooser patternChooser = new IntChooser("Pattern:", patternNames, patternValues, linePattern); patternChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { int value = event.getValue(); lineAttr.setLinePattern(value); } }); patternChooser.setAlignmentX(Component.LEFT_ALIGNMENT); add(patternChooser); JCheckBox lineAACheckBox = new JCheckBox(antiAliasString); lineAACheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); lineAAEnable = checkbox.isSelected(); lineAttr.setLineAntialiasingEnable(lineAAEnable); } }); lineAACheckBox.setAlignmentX(Component.LEFT_ALIGNMENT); // add the checkbox to the panel add(lineAACheckBox); }
From source file:com.nikonhacker.gui.EmulatorUI.java
private void dumpOptionCheckboxes(List<JCheckBox> outputOptionsCheckBoxes, Set<OutputOption> outputOptions) { for (JCheckBox checkBox : outputOptionsCheckBoxes) { try {/*from w w w . j a v a2 s . c o m*/ OutputOption.setOption(outputOptions, checkBox.getText(), checkBox.isSelected()); } catch (ParsingException e) { e.printStackTrace(); } } }
From source file:AppearanceExplorer.java
public MaterialEditor(Material init) { super(BoxLayout.Y_AXIS); material = init;//from w w w .j a va 2 s. c om lightingEnable = material.getLightingEnable(); material.getAmbientColor(ambientColor); material.getDiffuseColor(diffuseColor); material.getEmissiveColor(emissiveColor); material.getSpecularColor(specularColor); shininess = material.getShininess(); lightingEnableCheckBox = new JCheckBox("Lighting Enable", lightingEnable); lightingEnableCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); lightingEnable = checkbox.isSelected(); material.setLightingEnable(lightingEnable); } }); // add the checkbox to the panel add(new LeftAlignComponent(lightingEnableCheckBox)); ambientEditor = new Color3fEditor("Ambient Color ", ambientColor); ambientEditor.addColor3fListener(new Color3fListener() { public void colorChanged(Color3fEvent event) { event.getValue(ambientColor); material.setAmbientColor(ambientColor); } }); add(ambientEditor); diffuseEditor = new Color3fEditor("Diffuse Color ", diffuseColor); diffuseEditor.addColor3fListener(new Color3fListener() { public void colorChanged(Color3fEvent event) { event.getValue(diffuseColor); material.setDiffuseColor(diffuseColor); } }); add(diffuseEditor); emissiveEditor = new Color3fEditor("Emissive Color", emissiveColor); emissiveEditor.addColor3fListener(new Color3fListener() { public void colorChanged(Color3fEvent event) { event.getValue(emissiveColor); material.setEmissiveColor(emissiveColor); } }); add(emissiveEditor); specularEditor = new Color3fEditor("Specular Color ", specularColor); specularEditor.addColor3fListener(new Color3fListener() { public void colorChanged(Color3fEvent event) { event.getValue(specularColor); material.setSpecularColor(specularColor); } }); add(specularEditor); shininessSlider = new FloatLabelJSlider("Shininess: ", 1.0f, 0.0f, 128.0f, shininess); shininessSlider.setMajorTickSpacing(16.0f); shininessSlider.setPaintTicks(true); shininessSlider.addFloatListener(new FloatListener() { public void floatChanged(FloatEvent e) { shininess = e.getValue(); material.setShininess(shininess); } }); add(shininessSlider); }
From source file:AppearanceExplorer.java
PolygonAttributesEditor(PolygonAttributes init) { super(BoxLayout.Y_AXIS); polygonAttr = init;/*from www . jav a2s .c om*/ polygonMode = polygonAttr.getPolygonMode(); cullFace = polygonAttr.getCullFace(); polygonOffset = polygonAttr.getPolygonOffset(); polygonOffsetFactor = polygonAttr.getPolygonOffsetFactor(); backFaceNormalFlip = polygonAttr.getBackFaceNormalFlip(); String[] modeNames = { "POLYGON_POINT", "POLYGON_LINE", "POLYGON_FILL", }; int[] modeValues = { PolygonAttributes.POLYGON_POINT, PolygonAttributes.POLYGON_LINE, PolygonAttributes.POLYGON_FILL, }; IntChooser modeChooser = new IntChooser("Mode:", modeNames, modeValues, polygonMode); modeChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { polygonMode = event.getValue(); polygonAttr.setPolygonMode(polygonMode); } }); add(modeChooser); String[] cullNames = { "CULL_NONE", "CULL_BACK", "CULL_FRONT", }; int[] cullValues = { PolygonAttributes.CULL_NONE, PolygonAttributes.CULL_BACK, PolygonAttributes.CULL_FRONT, }; IntChooser cullChooser = new IntChooser("Cull:", cullNames, cullValues, cullFace); cullChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { cullFace = event.getValue(); polygonAttr.setCullFace(cullFace); } }); add(cullChooser); FloatLabelJSlider polygonOffsetSlider = new FloatLabelJSlider("Offset", 0.1f, 0.0f, 2.0f, polygonOffset); polygonOffsetSlider.setMajorTickSpacing(1.0f); polygonOffsetSlider.setPaintTicks(true); polygonOffsetSlider.addFloatListener(new FloatListener() { public void floatChanged(FloatEvent e) { polygonOffset = e.getValue(); polygonAttr.setPolygonOffset(polygonOffset); } }); add(polygonOffsetSlider); LogFloatLabelJSlider polygonOffsetFactorSlider = new LogFloatLabelJSlider("Offset Factor", 0.1f, 10000.0f, polygonOffsetFactor); polygonOffsetFactorSlider.addFloatListener(new FloatListener() { public void floatChanged(FloatEvent e) { polygonOffsetFactor = e.getValue(); polygonAttr.setPolygonOffsetFactor(polygonOffsetFactor); } }); add(polygonOffsetFactorSlider); JCheckBox backFaceNormalFlipCheckBox = new JCheckBox("BackFaceNormalFlip", backFaceNormalFlip); backFaceNormalFlipCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); backFaceNormalFlip = checkbox.isSelected(); polygonAttr.setBackFaceNormalFlip(backFaceNormalFlip); } }); // no ablity to change without replcing polygon attributes backFaceNormalFlipCheckBox.setEnabled(false); add(new LeftAlignComponent(backFaceNormalFlipCheckBox)); }
From source file:br.com.bgslibrary.gui.MainFrame.java
private void changeParam(String pname, javax.swing.JCheckBox checkBox, String filePath) { String nvalue = (checkBox.isSelected() ? 1 : 0) + ""; changeParam(pname, nvalue, filePath); }
From source file:AppearanceExplorer.java
RenderingAttributesEditor(RenderingAttributes init) { renderingAttr = init;// ww w . j a v a 2 s. co m visible = renderingAttr.getVisible(); depthBufferEnable = renderingAttr.getDepthBufferEnable(); depthBufferWriteEnable = renderingAttr.getDepthBufferWriteEnable(); ignoreVertexColors = renderingAttr.getIgnoreVertexColors(); rasterOpEnable = renderingAttr.getRasterOpEnable(); rasterOp = renderingAttr.getRasterOp(); alphaTestFunction = renderingAttr.getAlphaTestFunction(); alphaTestValue = renderingAttr.getAlphaTestValue(); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JCheckBox visibleCheckBox = new JCheckBox("Visible", visible); visibleCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); visible = checkbox.isSelected(); renderingAttr.setVisible(visible); } }); // add the checkbox to the panel add(new LeftAlignComponent(visibleCheckBox)); JCheckBox ignoreVertexColorsCheckBox = new JCheckBox("Ignore Vertex Colors", ignoreVertexColors); ignoreVertexColorsCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); ignoreVertexColors = checkbox.isSelected(); renderingAttr.setIgnoreVertexColors(ignoreVertexColors); } }); // add the checkbox to the panel add(new LeftAlignComponent(ignoreVertexColorsCheckBox)); JCheckBox depthBufferEnableCheckBox = new JCheckBox("Depth Buffer Enable", depthBufferEnable); depthBufferEnableCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); depthBufferEnable = checkbox.isSelected(); renderingAttr.setDepthBufferEnable(depthBufferEnable); } }); // add the checkbox to the panel add(new LeftAlignComponent(depthBufferEnableCheckBox)); // no cap bit for depth buffer enable depthBufferEnableCheckBox.setEnabled(false); JCheckBox depthBufferWriteEnableCheckBox = new JCheckBox("Depth Buffer Write Enable", depthBufferWriteEnable); depthBufferWriteEnableCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); depthBufferWriteEnable = checkbox.isSelected(); renderingAttr.setDepthBufferWriteEnable(depthBufferWriteEnable); } }); // add the checkbox to the panel add(new LeftAlignComponent(depthBufferWriteEnableCheckBox)); // no cap bit for depth buffer enable depthBufferWriteEnableCheckBox.setEnabled(false); JCheckBox rasterOpEnableCheckBox = new JCheckBox("Raster Operation Enable", rasterOpEnable); rasterOpEnableCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JCheckBox checkbox = (JCheckBox) e.getSource(); rasterOpEnable = checkbox.isSelected(); renderingAttr.setRasterOpEnable(rasterOpEnable); } }); // add the checkbox to the panel add(new LeftAlignComponent(rasterOpEnableCheckBox)); String[] rasterOpNames = { "ROP_COPY", "ROP_XOR", }; int[] rasterOpValues = { RenderingAttributes.ROP_COPY, RenderingAttributes.ROP_XOR, }; IntChooser rasterOpChooser = new IntChooser("Raster Operation:", rasterOpNames, rasterOpValues, rasterOp); rasterOpChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { rasterOp = event.getValue(); renderingAttr.setRasterOp(rasterOp); } }); add(rasterOpChooser); String[] alphaTestFunctionNames = { "ALWAYS", "NEVER", "EQUAL", "NOT_EQUAL", "LESS", "LESS_OR_EQUAL", "GREATER", "GREATER_OR_EQUAL", }; int[] alphaTestFunctionValues = { RenderingAttributes.ALWAYS, RenderingAttributes.NEVER, RenderingAttributes.EQUAL, RenderingAttributes.NOT_EQUAL, RenderingAttributes.LESS, RenderingAttributes.LESS_OR_EQUAL, RenderingAttributes.GREATER, RenderingAttributes.GREATER_OR_EQUAL, }; IntChooser alphaTestFunctionChooser = new IntChooser("Alpha Test Function:", alphaTestFunctionNames, alphaTestFunctionValues, alphaTestFunction); alphaTestFunctionChooser.addIntListener(new IntListener() { public void intChanged(IntEvent event) { alphaTestFunction = event.getValue(); renderingAttr.setAlphaTestFunction(alphaTestFunction); } }); add(alphaTestFunctionChooser); FloatLabelJSlider alphaTestValueSlider = new FloatLabelJSlider("Alpha Test Value: ", 0.1f, 0.0f, 1.0f, alphaTestValue); alphaTestValueSlider.setMajorTickSpacing(1.0f); alphaTestValueSlider.setPaintTicks(true); alphaTestValueSlider.addFloatListener(new FloatListener() { public void floatChanged(FloatEvent e) { alphaTestValue = e.getValue(); renderingAttr.setAlphaTestValue(alphaTestValue); } }); add(alphaTestValueSlider); }
From source file:be.agiv.security.demo.Main.java
private void showPreferences() { JTabbedPane tabbedPane = new JTabbedPane(); GridBagLayout proxyGridBagLayout = new GridBagLayout(); GridBagConstraints proxyGridBagConstraints = new GridBagConstraints(); JPanel proxyPanel = new JPanel(proxyGridBagLayout) { private static final long serialVersionUID = 1L; @Override//from w w w . j a v a2 s. c o m public Insets getInsets() { return new Insets(10, 10, 10, 10); } }; tabbedPane.addTab("Proxy", proxyPanel); JCheckBox proxyEnableCheckBox = new JCheckBox("Enable proxy", this.proxyEnable); proxyGridBagConstraints.gridx = 0; proxyGridBagConstraints.gridy = 0; proxyGridBagConstraints.anchor = GridBagConstraints.WEST; proxyGridBagConstraints.ipadx = 5; proxyGridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; proxyGridBagLayout.setConstraints(proxyEnableCheckBox, proxyGridBagConstraints); proxyPanel.add(proxyEnableCheckBox); proxyGridBagConstraints.gridwidth = 1; JLabel proxyHostLabel = new JLabel("Host:"); proxyGridBagConstraints.gridx = 0; proxyGridBagConstraints.gridy++; proxyGridBagLayout.setConstraints(proxyHostLabel, proxyGridBagConstraints); proxyPanel.add(proxyHostLabel); JTextField proxyHostTextField = new JTextField(this.proxyHost, 20); proxyGridBagConstraints.gridx++; proxyGridBagLayout.setConstraints(proxyHostTextField, proxyGridBagConstraints); proxyPanel.add(proxyHostTextField); JLabel proxyPortLabel = new JLabel("Port:"); proxyGridBagConstraints.gridx = 0; proxyGridBagConstraints.gridy++; proxyGridBagLayout.setConstraints(proxyPortLabel, proxyGridBagConstraints); proxyPanel.add(proxyPortLabel); JTextField proxyPortTextField = new JTextField(Integer.toString(this.proxyPort), 8); proxyGridBagConstraints.gridx++; proxyGridBagLayout.setConstraints(proxyPortTextField, proxyGridBagConstraints); proxyPanel.add(proxyPortTextField); JLabel proxyTypeLabel = new JLabel("Type:"); proxyGridBagConstraints.gridx = 0; proxyGridBagConstraints.gridy++; proxyGridBagLayout.setConstraints(proxyTypeLabel, proxyGridBagConstraints); proxyPanel.add(proxyTypeLabel); JComboBox proxyTypeComboBox = new JComboBox(new Object[] { Proxy.Type.HTTP, Proxy.Type.SOCKS }); proxyTypeComboBox.setSelectedItem(this.proxyType); proxyGridBagConstraints.gridx++; proxyGridBagLayout.setConstraints(proxyTypeComboBox, proxyGridBagConstraints); proxyPanel.add(proxyTypeComboBox); int dialogResult = JOptionPane.showConfirmDialog(this, tabbedPane, "Preferences", JOptionPane.OK_CANCEL_OPTION); if (dialogResult == JOptionPane.CANCEL_OPTION) { return; } this.statusBar.setStatus("Applying new preferences..."); this.proxyHost = proxyHostTextField.getText(); this.proxyPort = Integer.parseInt(proxyPortTextField.getText()); this.proxyType = (Proxy.Type) proxyTypeComboBox.getSelectedItem(); this.proxyEnable = proxyEnableCheckBox.isSelected(); }
From source file:com.nikonhacker.gui.EmulatorUI.java
/** * Create a JCheckbox corresponding to the given Output Option, reflecting its current state in prefs and changing it when modified * @param chip//from w ww . ja v a 2 s.c o m * @param option one of the defined options * @param outputOptions the options list to initialize field from (and to which change will be written if reflectChange is true) * @param reflectChange if true, changing the checkbox immediately changes the option in the given outputOptions * @return */ private JCheckBox makeOutputOptionCheckBox(final int chip, final OutputOption option, Set<OutputOption> outputOptions, boolean reflectChange) { final JCheckBox checkBox = new JCheckBox(option.getKey()); String help = (chip == Constants.CHIP_FR) ? option.getFrHelp() : option.getTxHelp(); if (help == null) return null; checkBox.setToolTipText(help); checkBox.setSelected(outputOptions.contains(option)); if (reflectChange) { checkBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { prefs.setOutputOption(chip, option, checkBox.isSelected()); } }); } return checkBox; }
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapFillingFrame.java
/** * Constructor.//from w ww . ja v a 2s .co m */ public GapFillingFrame(final AbstractTabView atv, final Instances dataSet, final Attribute attr, final int dateIdx, final int valuesBeforeAndAfter, final int position, final int gapsize, final StationsDataProvider gcp, final boolean inBatchMode) { super(); setTitle("Gap filling for " + attr.name() + " (" + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position).value(dateIdx)) + " -> " + dataSet.attribute(dateIdx).formatDate(dataSet.instance(position + gapsize).value(dateIdx)) + ")"); LogoHelper.setLogo(this); this.atv = atv; this.dataSet = dataSet; this.attr = attr; this.dateIdx = dateIdx; this.valuesBeforeAndAfter = valuesBeforeAndAfter; this.position = position; this.gapsize = gapsize; this.gcp = gcp; final Instances testds = WekaDataProcessingUtil.buildFilteredDataSet(dataSet, 0, dataSet.numAttributes() - 1, Math.max(0, position - valuesBeforeAndAfter), Math.min(position + gapsize + valuesBeforeAndAfter, dataSet.numInstances() - 1)); this.attrNames = WekaTimeSeriesUtil.getNamesOfAttributesWithoutGap(testds); this.isGapSimulated = (this.attrNames.contains(attr.name())); this.originaldataSet = new Instances(dataSet); if (this.isGapSimulated) { setTitle(getTitle() + " [SIMULATED GAP]"); /*final JXLabel fictiveGapLabel=new JXLabel(" FICTIVE GAP"); fictiveGapLabel.setForeground(Color.RED); fictiveGapLabel.setFont(new Font(fictiveGapLabel.getFont().getName(), Font.PLAIN,fictiveGapLabel.getFont().getSize()*2)); final JXPanel fictiveGapPanel=new JXPanel(); fictiveGapPanel.setLayout(new BorderLayout()); fictiveGapPanel.add(fictiveGapLabel,BorderLayout.CENTER); getContentPane().add(fictiveGapPanel,BorderLayout.NORTH);*/ this.attrNames.remove(attr.name()); this.originalDataBeforeGapSimulation = dataSet.attributeToDoubleArray(attr.index()); for (int i = position; i < position + gapsize; i++) dataSet.instance(i).setMissing(attr); } final Object[] attrNamesObj = this.attrNames.toArray(); this.centerPanel = new JXPanel(); this.centerPanel.setLayout(new BorderLayout()); getContentPane().add(this.centerPanel, BorderLayout.CENTER); //final JXPanel algoPanel=new JXPanel(); //getContentPane().add(algoPanel,BorderLayout.NORTH); final JXPanel filterPanel = new JXPanel(); //filterPanel.setLayout(new BoxLayout(filterPanel, BoxLayout.Y_AXIS)); filterPanel.setLayout(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 1; gbc.weighty = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(10, 10, 10, 10); getContentPane().add(filterPanel, BorderLayout.WEST); final JXComboBox algoCombo = new JXComboBox(Algo.values()); algoCombo.setBorder(new TitledBorder("Algorithm")); filterPanel.add(algoCombo, gbc); gbc.gridy++; final JXLabel infoLabel = new JXLabel("Usable = with no missing values on the period"); //infoLabel.setBorder(new TitledBorder("")); filterPanel.add(infoLabel, gbc); gbc.gridy++; final JList<Object> timeSeriesList = new JList<Object>(attrNamesObj); timeSeriesList.setBorder(new TitledBorder("Usable time series")); timeSeriesList.setSelectionMode(DefaultListSelectionModel.MULTIPLE_INTERVAL_SELECTION); final JScrollPane jcpMap = new JScrollPane(timeSeriesList); jcpMap.setPreferredSize(new Dimension(225, 150)); jcpMap.setMinimumSize(new Dimension(225, 150)); filterPanel.add(jcpMap, gbc); gbc.gridy++; final JXPanel mapPanel = new JXPanel(); mapPanel.setBorder(new TitledBorder("")); mapPanel.setLayout(new BorderLayout()); mapPanel.add(gcp.getMapPanel(Arrays.asList(attr.name()), this.attrNames, true), BorderLayout.CENTER); filterPanel.add(mapPanel, gbc); gbc.gridy++; final JXLabel mssLabel = new JXLabel( "<html>Most similar usable serie: <i>[... computation ...]</i></html>"); mssLabel.setBorder(new TitledBorder("")); filterPanel.add(mssLabel, gbc); gbc.gridy++; final JXLabel nsLabel = new JXLabel("<html>Nearest usable serie: <i>[... computation ...]</i></html>"); nsLabel.setBorder(new TitledBorder("")); filterPanel.add(nsLabel, gbc); gbc.gridy++; final JXLabel ussLabel = new JXLabel("<html>Upstream serie: <i>[... computation ...]</i></html>"); ussLabel.setBorder(new TitledBorder("")); filterPanel.add(ussLabel, gbc); gbc.gridy++; final JXLabel dssLabel = new JXLabel("<html>Downstream serie: <i>[... computation ...]</i></html>"); dssLabel.setBorder(new TitledBorder("")); filterPanel.add(dssLabel, gbc); gbc.gridy++; final JCheckBox hideOtherSeriesCB = new JCheckBox("Hide the others series"); hideOtherSeriesCB.setSelected(DEFAULT_HIDE_OTHER_SERIES_OPTION); filterPanel.add(hideOtherSeriesCB, gbc); gbc.gridy++; final JCheckBox showErrorCB = new JCheckBox("Show error on plot"); filterPanel.add(showErrorCB, gbc); gbc.gridy++; final JCheckBox zoomCB = new JCheckBox("Auto-adjusted size"); zoomCB.setSelected(DEFAULT_ZOOM_OPTION); filterPanel.add(zoomCB, gbc); gbc.gridy++; final JCheckBox multAxisCB = new JCheckBox("Multiple axis"); filterPanel.add(multAxisCB, gbc); gbc.gridy++; final JCheckBox showEnvelopeCB = new JCheckBox("Show envelope (all algorithms, SLOW)"); filterPanel.add(showEnvelopeCB, gbc); gbc.gridy++; final JXButton showModelButton = new JXButton("Show the model"); filterPanel.add(showModelButton, gbc); gbc.gridy++; showModelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JXFrame dialog = new JXFrame(); dialog.setTitle("Model"); LogoHelper.setLogo(dialog); dialog.getContentPane().removeAll(); dialog.getContentPane().setLayout(new BorderLayout()); final JTextPane modelTxtPane = new JTextPane(); modelTxtPane.setText(gapFiller.getModel()); modelTxtPane.setBackground(Color.WHITE); modelTxtPane.setEditable(false); final JScrollPane jsp = new JScrollPane(modelTxtPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jsp.setSize(new Dimension(400 - 20, 400 - 20)); dialog.getContentPane().add(jsp, BorderLayout.CENTER); dialog.setSize(new Dimension(400, 400)); dialog.setLocationRelativeTo(centerPanel); dialog.pack(); dialog.setVisible(true); } }); algoCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); showModelButton.setEnabled(gapFiller.hasExplicitModel()); } catch (final Exception e1) { e1.printStackTrace(); } } }); timeSeriesList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); mapPanel.removeAll(); final List<String> currentlySelected = new ArrayList<String>(); currentlySelected.add(attr.name()); for (final Object sel : timeSeriesList.getSelectedValues()) currentlySelected.add(sel.toString()); mapPanel.add(gcp.getMapPanel(currentlySelected, attrNames, true), BorderLayout.CENTER); } catch (final Exception e1) { e1.printStackTrace(); } } }); hideOtherSeriesCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (final Exception e1) { e1.printStackTrace(); } } }); showErrorCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); zoomCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); showEnvelopeCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); multAxisCB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), timeSeriesList.getSelectedIndices(), hideOtherSeriesCB.isSelected(), showErrorCB.isSelected(), zoomCB.isSelected(), showEnvelopeCB.isSelected(), multAxisCB.isSelected()); } catch (Exception e1) { e1.printStackTrace(); } } }); this.inBatchMode = inBatchMode; if (!inBatchMode) { try { refresh(Algo.valueOf(algoCombo.getSelectedItem().toString()), new int[0], DEFAULT_HIDE_OTHER_SERIES_OPTION, false, DEFAULT_ZOOM_OPTION, false, false); showModelButton.setEnabled(gapFiller.hasExplicitModel()); } catch (Exception e1) { e1.printStackTrace(); } } if (!inBatchMode) { /* automatically select computed series */ new AbstractSimpleAsync<Void>(true) { @Override public Void execute() throws Exception { mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames, false); mssLabel.setText("<html>Most similar usable serie: <b>" + mostSimilar + "</b></html>"); nearest = gcp.findNearestStation(attr.name(), attrNames); nsLabel.setText("<html>Nearest usable serie: <b>" + nearest + "</b></html>"); upstream = gcp.findUpstreamStation(attr.name(), attrNames); if (upstream != null) { ussLabel.setText("<html>Upstream usable serie: <b>" + upstream + "</b></html>"); } else { ussLabel.setText("<html>Upstream usable serie: <b>N/A</b></html>"); } downstream = gcp.findDownstreamStation(attr.name(), attrNames); if (downstream != null) { dssLabel.setText("<html>Downstream usable serie: <b>" + downstream + "</b></html>"); } else { dssLabel.setText("<html>Downstream usable serie: <b>N/A</b></html>"); } timeSeriesList.setSelectedIndices( new int[] { attrNames.indexOf(mostSimilar), attrNames.indexOf(nearest), attrNames.indexOf(upstream), attrNames.indexOf(downstream) }); return null; } @Override public void onSuccess(final Void result) { } @Override public void onFailure(final Throwable caught) { caught.printStackTrace(); } }.start(); } else { try { mostSimilar = WekaTimeSeriesSimilarityUtil.findMostSimilarTimeSerie(testds, attr, attrNames, false); } catch (Exception e1) { e1.printStackTrace(); } nearest = gcp.findNearestStation(attr.name(), attrNames); upstream = gcp.findUpstreamStation(attr.name(), attrNames); downstream = gcp.findDownstreamStation(attr.name(), attrNames); } }