List of usage examples for javax.swing.event ChangeEvent getSource
public Object getSource()
From source file:org.jcurl.mr.gui.BroomPanel0.java
public void stateChanged(final ChangeEvent arg0) { if (arg0.getSource() == slider) model.setBroomX(new Measure((double) slider.getValue() / Granularity, dim)); }
From source file:org.jcurl.zui.piccolo.BroomPromptSimple.java
public void stateChanged(final ChangeEvent e) { // log.info(e); if (e.getSource() instanceof BoundedRangeModel) adjustSlider((BoundedRangeModel) e.getSource()); }
From source file:org.nekorp.workflow.desktop.view.binding.listener.BindingChangeListener.java
@Override public void stateChanged(ChangeEvent e) { try {/*from ww w. java 2s.c o m*/ if (e.getSource() instanceof JSlider) { JSlider js = (JSlider) e.getSource(); if (js.getValueIsAdjusting()) { return;//genera mucha basura de eventos. } } Object value = source.getModelValue(); source.ignoreUpdate(value); BeanUtils.setProperty(target, property, value); } catch (IllegalAccessException | InvocationTargetException ex) { BindingChangeListener.LOGGER.error(ex); } }
From source file:org.nuclos.client.genericobject.GenericObjectCollectController.java
@Override protected void setupSubFormController(Map<String, SubForm> mpSubForm, Map<String, ? extends SubFormController> mpSubFormController) { Map<SubForm, MasterDataSubFormController> mpSubFormController_tmp = new HashMap<SubForm, MasterDataSubFormController>(); final ParameterChangeListener changeListener = new ParameterChangeListener() { @Override/*from ww w . jav a 2 s . com*/ public void stateChanged(final ChangeEvent e) { if (e != null && e.getSource() instanceof SubForm) { UIUtils.invokeOnDispatchThread(new Runnable() { @Override public void run() { SubForm subform = (SubForm) e.getSource(); GenericObjectCollectController.this.getSubFormsLoader() .startLoading(subform.getEntityName()); } }); } } }; // create a map of subforms and their controllers for (String sSubFormEntityName : mpSubFormController.keySet()) { SubFormController subformcontroller = mpSubFormController.get(sSubFormEntityName); if (subformcontroller instanceof SearchConditionSubFormController) { ((SearchConditionSubFormController) subformcontroller).clear(); subformcontroller.getSubForm() .setRowHeight(subformcontroller.getPrefs().getInt(TableRowIndicator.SUBFORM_ROW_HEIGHT, subformcontroller.getSubForm().isDynamicRowHeightsDefault() ? SubForm.DYNAMIC_ROW_HEIGHTS : subformcontroller.getSubForm().getMinRowHeight())); } SubForm subform = subformcontroller.getSubForm(); if (!GenericObjectCollectController.this.getSubFormsLoader().isLoadingSubForms() && !(subformcontroller instanceof SearchConditionSubFormController)) { SizeKnownListener listener = subform.getSizeKnownListener(); if (listener != null) { listener.actionPerformed(new SizeKnownEvent(subform, subform.getJTable().getRowCount())); } } if (subformcontroller instanceof DetailsSubFormController<?>) { subform.addParameterListener(changeListener); ((DetailsSubFormController<CollectableGenericObjectWithDependants>) subformcontroller) .setCollectController(this); mpSubFormController_tmp.put(subform, (MasterDataSubFormController) subformcontroller); } // disable child subforms in searchpanel, because it's not possible to search for data in those subforms else if (subformcontroller instanceof SearchConditionSubFormController) if (subform.getParentSubForm() != null) subform.setEnabled(false); } // assign child subforms to their parents for (SubForm subform : mpSubFormController_tmp.keySet()) { SubForm parentsubform = mpSubForm.get(subform.getParentSubForm()); if (parentsubform != null) { MasterDataSubFormController subformcontroller = mpSubFormController_tmp.get(parentsubform); subformcontroller.addChildSubFormController(mpSubFormController_tmp.get(subform)); } } }
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
protected JComponent buildTabbedPanel() { tabbedPanel = new JTabbedPane(SwingConstants.TOP); tabbedPanel.addTab(NuxeoLauncherGUI.getMessage("tab.summary.title"), buildSummaryPanel()); logsTab = buildLogsTab();/* www . j av a 2 s . co m*/ tabbedPanel.addTab(NuxeoLauncherGUI.getMessage("tab.logs.title"), logsTab); tabbedPanel.addTab(NuxeoLauncherGUI.getMessage("tab.shell.title"), buildConsolePanel()); tabbedPanel.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JTabbedPane pane = (JTabbedPane) e.getSource(); if (pane.getSelectedIndex() == 2) { consolePanel.getConsole().requestFocusInWindow(); } } }); return tabbedPanel; }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private JPanel createScanPanel() { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JPanel tablePanel = new JPanel(); tablePanel.setLayout(new BorderLayout()); tablePanel.setBorder(new TitledBorder("Tables to scan")); tableList = new JList<String>(); tableList.setToolTipText("Specify the tables (or CSV files) to be scanned here"); tablePanel.add(new JScrollPane(tableList), BorderLayout.CENTER); JPanel tableButtonPanel = new JPanel(); tableButtonPanel.setLayout(new GridLayout(3, 1)); addAllButton = new JButton("Add all in DB"); addAllButton.setToolTipText("Add all tables in the database"); addAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addAllTables();/* ww w . j ava2s. c o m*/ } }); addAllButton.setEnabled(false); tableButtonPanel.add(addAllButton); JButton addButton = new JButton("Add"); addButton.setToolTipText("Add tables to list"); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickTables(); } }); tableButtonPanel.add(addButton); JButton removeButton = new JButton("Remove"); removeButton.setToolTipText("Remove tables from list"); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeTables(); } }); tableButtonPanel.add(removeButton); tablePanel.add(tableButtonPanel, BorderLayout.EAST); panel.add(tablePanel, BorderLayout.CENTER); JPanel southPanel = new JPanel(); southPanel.setLayout(new BoxLayout(southPanel, BoxLayout.Y_AXIS)); JPanel scanOptionsPanel = new JPanel(); scanOptionsPanel.setLayout(new BoxLayout(scanOptionsPanel, BoxLayout.X_AXIS)); scanValueScan = new JCheckBox("Scan field values", true); scanValueScan.setToolTipText("Include a frequency count of field values in the scan report"); scanValueScan.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { scanMinCellCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); scanRowCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); scanValuesCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); } }); scanOptionsPanel.add(scanValueScan); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Min cell count ")); scanMinCellCount = new JSpinner(); scanMinCellCount.setValue(5); scanMinCellCount.setToolTipText("Minimum frequency for a field value to be included in the report"); scanOptionsPanel.add(scanMinCellCount); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Max distinct values ")); scanValuesCount = new JComboBox<String>(new String[] { "100", "1,000", "10,000" }); scanValuesCount.setSelectedIndex(1); scanValuesCount.setToolTipText("Maximum number of distinct values per field to be reported"); scanOptionsPanel.add(scanValuesCount); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Rows per table ")); scanRowCount = new JComboBox<String>(new String[] { "100,000", "500,000", "1 million", "all" }); scanRowCount.setSelectedIndex(0); scanRowCount.setToolTipText("Maximum number of rows per table to be scanned for field values"); scanOptionsPanel.add(scanRowCount); southPanel.add(scanOptionsPanel); southPanel.add(Box.createVerticalStrut(3)); JPanel scanButtonPanel = new JPanel(); scanButtonPanel.setLayout(new BoxLayout(scanButtonPanel, BoxLayout.X_AXIS)); scanButtonPanel.add(Box.createHorizontalGlue()); JButton scanButton = new JButton("Scan tables"); scanButton.setBackground(new Color(151, 220, 141)); scanButton.setToolTipText("Scan the selected tables"); scanButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scanRun(); } }); componentsToDisableWhenRunning.add(scanButton); scanButtonPanel.add(scanButton); southPanel.add(scanButtonPanel); panel.add(southPanel, BorderLayout.SOUTH); return panel; }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.LocationDialog.java
/** * Listener for the swapping of Screen / Project tabs * @see ChangeListener/*from w ww. ja va 2 s.c o m*/ */ public void stateChanged(ChangeEvent evt) { Object source = evt.getSource(); if (source == tabbedPane) { JTabbedPane tabbedPane = (JTabbedPane) evt.getSource(); JPanel activePanel = (JPanel) tabbedPane.getSelectedComponent(); // default to projects int newDataType = Importer.PROJECT_TYPE; if (activePanel == screenPanel) newDataType = Importer.SCREEN_TYPE; storeCurrentSelections(); firePropertyChange(ImportDialog.REFRESH_LOCATION_PROPERTY, null, new ImportLocationDetails(newDataType, getSelectedUser().getId())); } }
From source file:org.openmicroscopy.shoola.agents.measurement.view.GraphPane.java
/** * Reacts to changes made by slider./*from w w w .j a va2 s. c om*/ * @see ChangeListener#stateChanged(ChangeEvent) */ public void stateChanged(ChangeEvent evt) { Object src = evt.getSource(); if (src == zSlider || src == tSlider) { formatPlane(); handleSliderReleased(); } }
From source file:org.openmicroscopy.shoola.agents.measurement.view.IntensityView.java
/** * Reacts to slider moves.//from w ww . j av a2s . co m * @see ChangeListener#stateChanged(ChangeEvent) */ public void stateChanged(ChangeEvent evt) { Object src = evt.getSource(); if (src == zSlider || src == tSlider) { formatPlane(); OneKnobSlider slider = (OneKnobSlider) src; if (!slider.isDragging()) { handleSliderReleased(); } } }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorControl.java
/** * Reacts to state changes in the {@link ImViewer}. * @see ChangeListener#stateChanged(ChangeEvent) *///from w ww .j a v a 2 s . c o m public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane pane = (JTabbedPane) e.getSource(); if (view.checkIfTabEnabled(pane.getSelectedIndex())) { if (pane.getSelectedIndex() == EditorUI.RND_INDEX) model.loadRenderingControl(RenderingControlLoader.LOAD); } } }