List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:org.jfree.data.time.TimeSeriesCollection.java
/** * Receives notification that the key for one of the series in the * collection has changed, and vetos it if the key is already present in * the collection./* www . j a va 2s . c o m*/ * * @param e the event. * * @since 1.0.17 */ @Override public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException { // if it is not the series name, then we have no interest if (!"Key".equals(e.getPropertyName())) { return; } // to be defensive, let's check that the source series does in fact // belong to this collection Series s = (Series) e.getSource(); if (getSeriesIndex(s.getKey()) == -1) { throw new IllegalStateException( "Receiving events from a series " + "that does not belong to this collection."); } // check if the new series name already exists for another series Comparable key = (Comparable) e.getNewValue(); if (getSeriesIndex(key) >= 0) { throw new PropertyVetoException("Duplicate key2", e); } }
From source file:org.isatools.isacreatorconfigurator.configui.FieldInterface.java
private void instantiateFields(String initFieldName) { // OVERALL CONTAINER JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.setBackground(UIHelper.BG_COLOR); JLabel fieldDefinitionLab = new JLabel(fieldDefinitionHeader, JLabel.CENTER); container.add(fieldDefinitionLab);/*from w w w . ja va 2s . c o m*/ container.add(Box.createVerticalStrut(5)); // FIELD LABEL & INPUT BOX CONTAINER JPanel fieldCont = new JPanel(new GridLayout(1, 2)); fieldCont.setBackground(UIHelper.BG_COLOR); fieldName = new RoundedJTextField(15); fieldName.setText(initFieldName); fieldName.setEditable(false); UIHelper.renderComponent(fieldName, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel fieldNameLab = UIHelper.createLabel("Field Name: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); fieldCont.add(fieldNameLab); fieldCont.add(fieldName); container.add(fieldCont); JPanel descCont = new JPanel(new GridLayout(1, 2)); descCont.setBackground(UIHelper.BG_COLOR); description = new RoundedJTextArea(); description.setLineWrap(true); description.setWrapStyleWord(true); UIHelper.renderComponent(description, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane descScroll = new JScrollPane(description, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); descScroll.setBackground(UIHelper.BG_COLOR); descScroll.setPreferredSize(new Dimension(150, 65)); descScroll.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(descScroll); JLabel descLab = UIHelper.createLabel("Description: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); descLab.setVerticalAlignment(JLabel.TOP); descCont.add(descLab); descCont.add(descScroll); container.add(descCont); // add datatype information JPanel datatypeCont = new JPanel(new GridLayout(1, 2)); datatypeCont.setBackground(UIHelper.BG_COLOR); DataTypes[] allowedDataTypes = initFieldName.equals(UNIT_STR) ? new DataTypes[] { DataTypes.ONTOLOGY_TERM } : DataTypes.values(); datatype = new JComboBox(allowedDataTypes); datatype.addActionListener(this); UIHelper.renderComponent(datatype, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel dataTypeLab = UIHelper.createLabel("Datatype:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); datatypeCont.add(dataTypeLab); datatypeCont.add(datatype); container.add(datatypeCont); defaultValContStd = new JPanel(new GridLayout(1, 2)); defaultValContStd.setBackground(UIHelper.BG_COLOR); defaultValCont = Box.createHorizontalBox(); defaultValCont.setPreferredSize(new Dimension(150, 25)); defaultValStd = new RoundedFormattedTextField(null, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.DARK_GREEN_COLOR); defaultValCont.setPreferredSize(new Dimension(120, 25)); defaultValStd.setFormatterFactory(new DefaultFormatterFactory( new RegExFormatter(".*", defaultValStd, false, UIHelper.DARK_GREEN_COLOR, UIHelper.RED_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR))); defaultValStd.setForeground(UIHelper.DARK_GREEN_COLOR); defaultValStd.setFont(UIHelper.VER_11_PLAIN); defaultValCont.add(defaultValStd); defaultValLabStd = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContStd.add(defaultValLabStd); defaultValContStd.add(defaultValCont); container.add(defaultValContStd); defaultValContBool = new JPanel(new GridLayout(1, 2)); defaultValContBool.setBackground(UIHelper.BG_COLOR); defaultValContBool.setVisible(false); listDataSourceCont = new JPanel(new GridLayout(2, 1)); listDataSourceCont.setBackground(UIHelper.BG_COLOR); listDataSourceCont.setVisible(false); JLabel listValLab = UIHelper.createLabel("Please enter comma separated list of values:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); listDataSourceCont.add(listValLab); listValues = new RoundedJTextArea("SampleVal1, SampleVal2, SampleVal3", 3, 5); listValues.setLineWrap(true); listValues.setWrapStyleWord(true); UIHelper.renderComponent(listValues, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane listScroll = new JScrollPane(listValues, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); listScroll.setBackground(UIHelper.BG_COLOR); listScroll.getViewport().setBackground(UIHelper.BG_COLOR); listDataSourceCont.add(listScroll); container.add(listDataSourceCont); IAppWidgetFactory.makeIAppScrollPane(listScroll); sourceEntryPanel = new JPanel(new BorderLayout()); sourceEntryPanel.setSize(new Dimension(125, 190)); sourceEntryPanel.setOpaque(false); sourceEntryPanel.setVisible(false); preferredOntologySource = new JPanel(); preferredOntologySource.setLayout(new BoxLayout(preferredOntologySource, BoxLayout.PAGE_AXIS)); preferredOntologySource.setVisible(false); recommendOntologySource = new JCheckBox("Use recommended ontology source?", false); UIHelper.renderComponent(recommendOntologySource, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); recommendOntologySource.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (recommendOntologySource.isSelected()) { sourceEntryPanel.setVisible(true); } else { sourceEntryPanel.setVisible(false); } } }); JPanel useOntologySourceCont = new JPanel(new GridLayout(1, 1)); useOntologySourceCont.add(recommendOntologySource); preferredOntologySource.add(useOntologySourceCont); JPanel infoCont = new JPanel(new GridLayout(1, 1)); JLabel infoLab = UIHelper.createLabel( "<html>click on the <strong>configure ontologies</strong> button to open the ontology configurator to edit the list of ontologies and search areas within an ontology</html>", UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR); infoLab.setPreferredSize(new Dimension(100, 40)); infoCont.add(infoLab); sourceEntryPanel.add(infoCont, BorderLayout.NORTH); JLabel preferredOntologiesLab = new JLabel(preferredOntologiesSidePanelIcon); preferredOntologiesLab.setVerticalAlignment(SwingConstants.TOP); sourceEntryPanel.add(preferredOntologiesLab, BorderLayout.WEST); ontologiesToUseModel = new DefaultTableModel(new String[0][2], ontologyColumnHeaders) { @Override public boolean isCellEditable(int i, int i1) { return false; } }; ontologiesToUse = new JTable(ontologiesToUseModel); ontologiesToUse.getTableHeader().setBackground(UIHelper.BG_COLOR); try { ontologiesToUse.setDefaultRenderer(Class.forName("java.lang.Object"), new CustomSpreadsheetCellRenderer()); } catch (ClassNotFoundException e) { // empty } renderTableHeader(); JScrollPane ontologiesToUseScroller = new JScrollPane(ontologiesToUse, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); ontologiesToUseScroller.setBorder(new EmptyBorder(0, 0, 0, 0)); ontologiesToUseScroller.setPreferredSize(new Dimension(100, 80)); ontologiesToUseScroller.setBackground(UIHelper.BG_COLOR); ontologiesToUseScroller.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(ontologiesToUseScroller); sourceEntryPanel.add(ontologiesToUseScroller); JPanel buttonCont = new JPanel(new BorderLayout()); final JLabel openConfigButton = new JLabel(ontologyConfigIcon); openConfigButton.setVerticalAlignment(SwingConstants.TOP); openConfigButton.setHorizontalAlignment(SwingConstants.RIGHT); MouseAdapter showOntologyConfigurator = new MouseAdapter() { public void mouseEntered(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIconOver); } public void mouseExited(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIcon); } public void mousePressed(MouseEvent mouseEvent) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (openConfigButton.isEnabled()) { openConfigButton.setIcon(ontologyConfigIcon); ontologyConfig = new OntologyConfigUI(ontologiesToQuery, selectedOntologies); ontologyConfig.addPropertyChangeListener("ontologySelected", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { selectedOntologies = (ListOrderedMap<String, RecommendedOntology>) propertyChangeEvent .getNewValue(); updateTable(); } }); showPopupInCenter(ontologyConfig); } } }); } }; openConfigButton.addMouseListener(showOntologyConfigurator); buttonCont.add(openConfigButton, BorderLayout.EAST); sourceEntryPanel.add(buttonCont, BorderLayout.SOUTH); preferredOntologySource.add(sourceEntryPanel); container.add(preferredOntologySource); String[] contents = new String[] { "true", "false" }; defaultValBool = new JComboBox(contents); UIHelper.renderComponent(defaultValBool, UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel defaultValLabBool = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContBool.add(defaultValLabBool); defaultValContBool.add(defaultValBool); container.add(defaultValContBool); // RegExp data entry isInputFormatted = new JCheckBox("Is the input formatted?", false); isInputFormatted.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); isInputFormatted.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(isInputFormatted, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); isInputFormatted.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(isInputFormatted)); inputFormatCont = new JPanel(); inputFormatCont.setLayout(new BoxLayout(inputFormatCont, BoxLayout.LINE_AXIS)); inputFormatCont.setVisible(false); inputFormatCont.setBackground(UIHelper.BG_COLOR); inputFormat = new RoundedJTextField(10); inputFormat.setText(".*"); inputFormat.setSize(new Dimension(150, 19)); inputFormat.setPreferredSize(new Dimension(160, 25)); inputFormat.setToolTipText("Field expects a regular expression describing the input format."); UIHelper.renderComponent(inputFormat, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel inputFormatLab = UIHelper.createLabel("Input format:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); inputFormatLab.setVerticalAlignment(SwingConstants.TOP); inputFormatCont.add(inputFormatLab); inputFormatCont.add(inputFormat); JLabel checkRegExp = new JLabel(checkRegExIcon, JLabel.RIGHT); checkRegExp.setOpaque(false); checkRegExp.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { String regexToCheck = inputFormat.getText(); final CheckRegExGUI regexChecker = new CheckRegExGUI(regexToCheck); SwingUtilities.invokeLater(new Runnable() { public void run() { regexChecker.createGUI(); } }); regexChecker.addPropertyChangeListener("close", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { main.getApplicationContainer().hideSheet(); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { main.getApplicationContainer().showJDialogAsSheet(regexChecker); } }); } } ); inputFormatCont.add(checkRegExp); container.add(inputFormatCont); usesTemplateForWizard = new JCheckBox("Requires template for wizard?", false); usesTemplateForWizard.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); usesTemplateForWizard.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(usesTemplateForWizard, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); usesTemplateForWizard.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(usesTemplateForWizard)); wizardTemplatePanel = new JPanel(new GridLayout(1, 2)); wizardTemplatePanel.setVisible(false); wizardTemplatePanel.setBackground(UIHelper.BG_COLOR); wizardTemplate = new RoundedJTextArea(); wizardTemplate.setToolTipText("A template for the wizard to auto-create the data..."); wizardTemplate.setLineWrap(true); wizardTemplate.setWrapStyleWord(true); UIHelper.renderComponent(wizardTemplate, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane wizScroll = new JScrollPane(wizardTemplate, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); wizScroll.getViewport().setBackground(UIHelper.BG_COLOR); wizScroll.setPreferredSize(new Dimension(70, 60)); IAppWidgetFactory.makeIAppScrollPane(wizScroll); JLabel wizardTemplateLab = UIHelper.createLabel("Template definition:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); wizardTemplateLab.setVerticalAlignment(JLabel.TOP); wizardTemplatePanel.add(wizardTemplateLab); wizardTemplatePanel.add(wizScroll); container.add(wizardTemplatePanel); JPanel checkCont = new JPanel(new GridLayout(3, 2)); checkCont.setBackground(UIHelper.BG_COLOR); checkCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 4), "Behavioural Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); required = new JCheckBox("Required ", true); UIHelper.renderComponent(required, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(required); acceptsMultipleValues = new JCheckBox("Allow multiple instances", false); UIHelper.renderComponent(acceptsMultipleValues, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsMultipleValues); acceptsFileLocations = new JCheckBox("Accepts file locations", false); acceptsFileLocations.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { acceptsMultipleValues.setSelected(false); acceptsMultipleValues.setEnabled(!acceptsFileLocations.isSelected()); } }); UIHelper.renderComponent(acceptsFileLocations, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsFileLocations); hidden = new JCheckBox("hidden?", false); UIHelper.renderComponent(hidden, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(hidden); forceOntologySelection = new JCheckBox("Force ontology selection", false); UIHelper.renderComponent(forceOntologySelection, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(forceOntologySelection); container.add(checkCont); JScrollPane contScroll = new JScrollPane(container, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); contScroll.setBorder(null); contScroll.setAutoscrolls(true); IAppWidgetFactory.makeIAppScrollPane(contScroll); add(contScroll, BorderLayout.NORTH); }
From source file:com.googlecode.vfsjfilechooser2.plaf.metal.MetalVFSFileChooserUI.java
private void doAccessoryChanged(PropertyChangeEvent e) { if (getAccessoryPanel() != null) { if (e.getOldValue() != null) { getAccessoryPanel().remove((JComponent) e.getOldValue()); }/*from ww w . j a va 2 s. c om*/ JComponent accessory = (JComponent) e.getNewValue(); if (accessory != null) { getAccessoryPanel().add(accessory, BorderLayout.CENTER); } } }
From source file:canreg.client.gui.management.CanReg4MigrationInternalFrame.java
@Action public void MigrationAction() { okButton.setEnabled(false);/*w w w . j a v a 2 s. c o m*/ doneButton.setEnabled(false); cancelButton.setEnabled(true); jList1.setEnabled(false); EditDatabaseVariableTableAssociationInternalFrame edvif = new EditDatabaseVariableTableAssociationInternalFrame(); int addServer = JOptionPane.showInternalConfirmDialog( CanRegClientApp.getApplication().getMainFrame().getContentPane(), java.util.ResourceBundle .getBundle("canreg/client/gui/management/resources/CanReg4SystemConverterInternalFrame") .getString("SUCCESSFULLY_CREATED_XML: ") + "\'" + Globals.CANREG_SERVER_SYSTEM_CONFIG_FOLDER + Globals.FILE_SEPARATOR + regcode + "\'.\n" + java.util.ResourceBundle.getBundle( "canreg/client/gui/management/resources/CanReg4SystemConverterInternalFrame") .getString("ADD_IT_TO_FAV_SERVERS?"), "Success", JOptionPane.YES_NO_OPTION); if (addServer == JOptionPane.YES_OPTION) { localSettings = CanRegClientApp.getApplication().getLocalSettings(); localSettings.addServerToServerList(dlm.get(list.getSelectedIndex()), "localhost", Globals.DEFAULT_PORT, regcode); localSettings.writeSettings(); } try { edvif.setTitle("Variables and Tables for " + WordUtils.capitalize(dlm.get(list.getSelectedIndex()).toLowerCase())); edvif.loadSystemDefinition( Globals.CANREG_SERVER_SYSTEM_CONFIG_FOLDER + Globals.FILE_SEPARATOR + regcode + ".xml"); edvif.setDesktopPane(desktopPane); CanRegClientView.showAndPositionInternalFrame(desktopPane, edvif); } catch (IOException ex) { Logger.getLogger(CanReg4SystemConverterInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (ParserConfigurationException ex) { Logger.getLogger(CanReg4SystemConverterInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (SAXException ex) { Logger.getLogger(CanReg4SystemConverterInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } edvif.saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //logout from canreg system before conversion if (CanRegClientApp.getApplication().loggedIn) { try { CanRegClientApp.getApplication().logOut(); } catch (RemoteException ex) { Logger.getLogger(CanReg4MigrationInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } } //check to see if there is a database already - rename it File databaseFolder = new File( Globals.CANREG_SERVER_DATABASE_FOLDER + Globals.FILE_SEPARATOR + regcode); if (databaseFolder.exists()) { int i = 0; File folder2 = databaseFolder; while (folder2.exists()) { i++; folder2 = new File( Globals.CANREG_SERVER_DATABASE_FOLDER + Globals.FILE_SEPARATOR + regcode + i); } databaseFolder.renameTo(folder2); debugOut("database: " + databaseFolder); try { canreg.common.Tools.fileCopy( Globals.CANREG_SERVER_SYSTEM_CONFIG_FOLDER + Globals.FILE_SEPARATOR + regcode + ".xml", Globals.CANREG_SERVER_SYSTEM_CONFIG_FOLDER + Globals.FILE_SEPARATOR + regcode + i + ".xml"); } catch (IOException ex) { Logger.getLogger(CanReg4MigrationInternalFrame.class.getName()).log(Level.SEVERE, null, ex); } } ProgressBar.setStringPainted(true); cTask = new ProgressTask( org.jdesktop.application.Application.getInstance(canreg.client.CanRegClientApp.class)); cTask.execute(); cTask.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { ProgressBar.setValue((Integer) evt.getNewValue()); ProgressBar.setString(evt.getNewValue().toString() + "%"); } } }); } }); }
From source file:edu.ku.brc.specify.tasks.subpane.images.ImagesPane.java
/** * // w w w. ja v a2 s. c o m */ private void searchForRecordSetAttachments() { final String MEGS = "MEGS"; final String STATUSBAR_NAME = "ImageSearchStatusBar"; rowsVector.clear(); items = recordSet.getOrderedItems(); final int numItems = items.size(); SwingWorker<Integer, Integer> backupWorker = new SwingWorker<Integer, Integer>() { @Override protected Integer doInBackground() throws Exception { final DBTableInfo ti = DBTableIdMgr.getInstance().getInfoById(recordSet.getDbTableId()); boolean isAttachmentTableItself = ti.getTableId() == Attachment.getClassTableId(); String sql; if (!isAttachmentTableItself) { sql = "SELECT a.AttachmentID, a.TableID, a.Title, a.AttachmentLocation, a.MimeType FROM attachment a " + "INNER JOIN %sattachment coa ON a.AttachmentID = coa.AttachmentID " + "WHERE coa.%s IN (%s) %s ORDER BY FIELD(%s, %s)"; } else { sql = "SELECT a.AttachmentID, a.TableID, a.Title, a.AttachmentLocation, a.MimeType FROM attachment a " + "WHERE AttachmentID IN (%s) ORDER BY FIELD(a.AttachmentID, %s)"; } int batchSize = 500; int attchIndex = 0; int batches = (numItems / batchSize) + (numItems % batchSize == 0 ? 0 : 1); if (numItems < batchSize) { batchSize = numItems; } Statement stmt = null; try { stmt = DBConnection.getInstance().getConnection().createStatement(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < batches; i++) { firePropertyChange(MEGS, 0, i + 1); sb.setLength(0); for (int j = 0; j < batchSize && attchIndex < numItems; j++) { RecordSetItemIFace rsi = items.get(attchIndex++); if (j > 0) sb.append(','); sb.append(rsi.getRecordId().toString()); } String filter = getFilterString(); if (StringUtils.isNotEmpty(filter)) { filter = " AND " + filter; } String fullSQL; if (!isAttachmentTableItself) { fullSQL = String.format(sql, ti.getName(), ti.getIdColumnName(), sb.toString(), filter, ti.getIdColumnName(), sb.toString()); } else { fullSQL = String.format(sql, sb.toString(), filter, sb.toString()); } log.debug(fullSQL); ResultSet rs = stmt.executeQuery(fullSQL); while (rs.next()) { ImageDataItem imgDataItem = new ImageDataItem(rs.getInt(1), rs.getInt(2), rs.getString(3), rs.getString(4), rs.getString(5)); rowsVector.add(imgDataItem); } rs.close(); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (stmt != null) stmt.close(); } catch (Exception e) { } } return null; } @Override protected void done() { super.done(); getStatusBar().setProgressDone(STATUSBAR_NAME); clearSimpleGlassPaneMsg(); if (rowsVector != null && rowsVector.size() > 0) { gridPanel.setItemList(rowsVector); JScrollPane sb = new JScrollPane(gridPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); add(sb, BorderLayout.CENTER); ((AttachmentsTask) task).attachmentSearchDone(ImagesPane.this); } else { ((AttachmentsTask) task).attachmentSearchDone(null); writeTimedSimpleGlassPaneMsg(getNotFoundMessage()); } } }; final JStatusBar statusBar = getStatusBar(); statusBar.setIndeterminate(STATUSBAR_NAME, true); writeSimpleGlassPaneMsg(getResourceString("ATTCH_SEARCH_IMGS"), 24); backupWorker.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { if (MEGS.equals(evt.getPropertyName())) { Integer value = (Integer) evt.getNewValue(); int val = (int) (((double) value / (double) numItems) * 100.0); statusBar.setText(Integer.toString(val));//getLocalizedMessage("MySQLBackupService.BACKUP_MEGS", val)); } } }); backupWorker.execute(); }
From source file:edu.ku.brc.specify.tasks.RecordSetTask.java
public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() instanceof RolloverCommand) { RolloverCommand roc = (RolloverCommand) evt.getSource(); renameRecordSet(roc, (RecordSetIFace) roc.getData(), (String) evt.getOldValue(), (String) evt.getNewValue()); }/*w ww . ja v a 2 s .c o m*/ }
From source file:co.com.soinsoftware.hotelero.view.JFRoom.java
private void watchPropertyChangeForJDateChooserControls() { this.jdcInitialDate.getDateEditor().addPropertyChangeListener(new PropertyChangeListener() { @Override// w w w .j av a2 s .c om public void propertyChange(PropertyChangeEvent e) { if ("date".equals(e.getPropertyName())) { final Date selectedDate = (Date) e.getNewValue(); final Calendar calendar = Calendar.getInstance(); calendar.setTime(selectedDate); setFinalDate(calendar); } } }); this.jdcFinalDate.getDateEditor().addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { if ("date".equals(e.getPropertyName())) { if (validateFinalDate()) { refreshNotEnabledSet(); } } } }); }
From source file:uiuc.dm.miningTools.ui.ParametersSelectionFrame.java
@Override public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { int progress = (Integer) evt.getNewValue(); downloadDatasetProgressBar.setValue(progress); }//from www . j av a2 s. c o m }
From source file:org.jdesktop.swingworker.AccumulativeRunnable.java
public final void testWorkFlow() throws Exception { final List<Object> goldenSequence = Arrays.asList(new Object[]{StateValue.STARTED, "done", StateValue.DONE}); final List<Object> sequence = Collections.synchronizedList(new ArrayList<Object>()); final Exchanger<List<Object>> listExchanger = new Exchanger<List<Object>>(); /* www . j a va2 s . co m*/ final SwingWorker<?,?> test = new SwingWorker<Object,Object>() { @Override protected Object doInBackground() throws Exception { return null; } @Override protected void done() { sequence.add("done"); } }; test.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if ("state".equals(evt.getPropertyName())) { sequence.add(evt.getNewValue()); if (StateValue.DONE == evt.getNewValue()) { try { listExchanger.exchange(sequence); } catch (Exception ignore) { ignore.printStackTrace(); } } } } }); test.execute(); assertEquals(goldenSequence, listExchanger.exchange(null, TIME_OUT, TIME_OUT_UNIT)); }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryObjectsTable.java
/** * Listens to property changes in the bound property * RegistryBrowser.PROPERTY_AUTHENTICATED. Certain menuItems are * hidden when user is unAuthenticated./*from w w w . java 2s . c o m*/ * * Listens to property changes in the bound property * RegistryBrowser.PROPERTY_LOCALE. Updates locale and UI strings * when the property changes. */ public void propertyChange(PropertyChangeEvent ev) { if (ev.getPropertyName().equals(RegistryBrowser.PROPERTY_AUTHENTICATED)) { boolean authenticated = ((Boolean) ev.getNewValue()).booleanValue(); setEditable(authenticated); } else if (ev.getPropertyName().equals(RegistryBrowser.PROPERTY_LOCALE)) { processLocaleChange((Locale) ev.getNewValue()); } }