List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:org.jboss.tools.openshift.internal.ui.wizard.newapp.fromtemplate.ApplicationSourceFromTemplateModel.java
private void handleSelectedAppSource(PropertyChangeEvent evt) { if (evt.getNewValue() instanceof IApplicationSource && ResourceKind.TEMPLATE.equals(((IApplicationSource) evt.getNewValue()).getKind())) { IApplicationSource source = (IApplicationSource) evt.getNewValue(); ITemplate newTemplate = (ITemplate) source.getSource(); if (!Objects.equals(newTemplate, this.template)) { this.template = newTemplate; updateTemplateParameters(newTemplate); }/*from w ww. j a v a 2 s.c o m*/ } }
From source file:FileChooserTest.java
/** * Constructs an ImagePreviewer./*ww w. j av a2 s.c o m*/ * @param chooser the file chooser whose property changes trigger an image change in this * previewer */ public ImagePreviewer(JFileChooser chooser) { setPreferredSize(new Dimension(100, 100)); setBorder(BorderFactory.createEtchedBorder()); chooser.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName() == JFileChooser.SELECTED_FILE_CHANGED_PROPERTY) { // the user has selected a new file File f = (File) event.getNewValue(); if (f == null) { setIcon(null); return; } // read the image into an icon ImageIcon icon = new ImageIcon(f.getPath()); // if the icon is too large to fit, scale it if (icon.getIconWidth() > getWidth()) icon = new ImageIcon( icon.getImage().getScaledInstance(getWidth(), -1, Image.SCALE_DEFAULT)); setIcon(icon); } } }); }
From source file:net.sf.maltcms.chromaui.project.spi.nodes.DescriptorNode.java
@Override public void propertyChange(PropertyChangeEvent pce) { if (pce.getPropertyName().equals(PROP_NAME) || pce.getPropertyName().equals(IDescriptor.PROP_NAME)) { fireNameChange((String) pce.getOldValue(), (String) pce.getNewValue()); }/*from w w w .jav a2 s. c o m*/ if (pce.getPropertyName().equals(PROP_DISPLAY_NAME) || pce.getPropertyName().equals(IDescriptor.PROP_DISPLAYNAME)) { fireDisplayNameChange((String) pce.getOldValue(), (String) pce.getNewValue()); } if (pce.getPropertyName().equals(PROP_SHORT_DESCRIPTION) || pce.getPropertyName().equals(IDescriptor.PROP_SHORTDESCRIPTION)) { fireShortDescriptionChange((String) pce.getOldValue(), (String) pce.getNewValue()); } if (pce.getPropertyName().equals(PROP_ICON)) { fireIconChange(); } if (pce.getPropertyName().equals(PROP_OPENED_ICON)) { fireOpenedIconChange(); } if (pce.getPropertyName().equals(IColorizableDescriptor.PROP_COLOR)) { fireIconChange(); fireOpenedIconChange(); } }
From source file:org.jboss.tools.openshift.internal.ui.wizard.newapp.fromimage.ApplicationSourceFromImageModel.java
private void handleEclipseProject(PropertyChangeEvent evt) { this.eclipseProject = (org.eclipse.core.resources.IProject) evt.getNewValue(); if (this.eclipseProject != null) { try {/*from w w w . ja va 2 s . co m*/ setGitRepositoryUrl(EGitUtils.getDefaultRemoteRepo(this.eclipseProject)); setGitReference(EGitUtils.getCurrentBranch(this.eclipseProject)); setContextDir(StringUtils.EMPTY); return; } catch (CoreException e) { OpenShiftUIActivator.getDefault().getLogger().logWarning( "Unable to retrieve the remote git repo from " + this.eclipseProject.getName(), e); } } setGitRepositoryUrl(null); setGitReference(null); setContextDir(null); }
From source file:edu.ku.brc.specify.tasks.WebSearchTask.java
/** * /*from ww w .jav a 2 s . c om*/ */ public void createAndSendBackup() { BackupServiceFactory.getInstance().doBackUp(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("Done")) { startCompression((String) evt.getNewValue()); } } }); }
From source file:joachimeichborn.geotag.model.Geocoding.java
@Override public void propertyChange(final PropertyChangeEvent aEvent) { propertyChangeSupport.firePropertyChange(aEvent.getPropertyName(), aEvent.getOldValue(), aEvent.getNewValue()); }
From source file:ui.panel.UIBucketSelect.java
public void runBucketSelect() { Panel p = new Panel(); Button b = new Button(); Label l = new Label(); setLayout(new BorderLayout()); JPanel pnlInstruction = p.createPanel(Layouts.flow); JLabel lblInstruction = l.createLabel("Bucket List"); pnlInstruction.setBackground(CustomColor.LightBlue.returnColor()); lblInstruction.setForeground(Color.white); lblInstruction.setFont(new Font("San Serif", Font.PLAIN, 18)); pnlInstruction.add(lblInstruction);/*from w ww. j av a2 s. co m*/ JPanel pnlBucketList = p.createPanel(Layouts.border); listBucket.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scrollBucket = new JScrollPane(listBucket); scrollBucket.setPreferredSize(new Dimension(300, 150)); pnlBucketList.add(scrollBucket, BorderLayout.CENTER); JPanel pnlButtons = p.createPanel(Layouts.flow); JButton btnBack = b.createButton("Back"); JButton btnSelectElements = b.createButton("Next"); JButton btnRefresh = b.createButton("Refresh Bucket List"); pnlButtons.add(btnBack); pnlButtons.add(btnRefresh); pnlButtons.add(btnSelectElements); add(pnlInstruction, BorderLayout.NORTH); add(pnlBucketList, BorderLayout.CENTER); add(pnlButtons, BorderLayout.SOUTH); setVisible(true); btnRefresh.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getBucketData(); } }); btnSelectElements.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SwingWorker<Void, Void> mySwingWorker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { int selected = listBucket.getSelectedRow(); if (selected == -1) { JOptionPane.showMessageDialog(Data.mainFrame, "Please Select a Bucket", "Error", JOptionPane.ERROR_MESSAGE); } else { Data.bucketID = (int) listBucket.getModel().getValueAt(selected, 0); Data.mainFrame.addPanel(Data.mainFrame.uiLicenseDetail = new UILicenseDetail(), "license"); Data.mainFrame.pack(); Data.mainFrame.showPanel("license"); } return null; } }; Window win = SwingUtilities.getWindowAncestor((AbstractButton) e.getSource()); final JDialog dialog = new JDialog(win, "Loading", ModalityType.APPLICATION_MODAL); mySwingWorker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("state")) { if (evt.getNewValue() == SwingWorker.StateValue.DONE) { dialog.dispose(); } } } }); mySwingWorker.execute(); JProgressBar progressBar = new JProgressBar(); progressBar.setIndeterminate(true); JPanel panel = new JPanel(new BorderLayout()); panel.add(progressBar, BorderLayout.CENTER); panel.add(new JLabel("Retrieving Licenses......."), BorderLayout.PAGE_START); dialog.add(panel); dialog.pack(); dialog.setBounds(50, 50, 300, 100); dialog.setLocationRelativeTo(Data.mainFrame); dialog.setVisible(true); } }); btnBack.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); Data.mainFrame.showPanel("inventory"); } }); }
From source file:com.croer.javaorange.diviner.SimpleOrangeDiviner.java
public SimpleOrangeDiviner(Mediator mediator) { super((Frame) null, true); initComponents();// w ww .j av a 2 s . c o m setUndecorated(true); Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("ENTER")); //Efectua la seleccin Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("control CONTROL")); //Cancela la consulta y oculta el dilogo Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("alt SPACE")); //Reinicia la seleccin de toda la tabla Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction(configuration.getString("Plus"))); //Incrementa en uno la cantidad Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("alt DOWN")); //Decrementa en uno la cantidad Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("UP")); //Recorrido hacia arriba Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("DOWN")); //Recorrido hacia abajo Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("PAGE_UP")); //Retrocede una pgina Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("PAGE_DOWN")); //Avanza una pgina Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("F5")); // // getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("pressed UP"), "go"); // getRootPane().getActionMap().put("go", new AbstractAction() { // // @Override // public void actionPerformed(ActionEvent e) { // System.out.println("Yepa " + System.currentTimeMillis()); // } // }); // getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_CONTROL, InputEvent.CTRL_MASK), "collapse"); // getRootPane().getActionMap().put("collapse", new AbstractAction() { // // @Override // public void actionPerformed(ActionEvent e) { // SimpleOrangeDiviner.this.setVisible(false); // } // }); jPanel1.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { System.out.println("Evento: " + evt.getPropertyName() + "-" + evt.getNewValue()); } }); }
From source file:com.sshtools.appframework.api.ui.ActionBuilder.java
protected void rebuildContextMenu(Collection<AppAction> enabledActions) { contextMenu.invalidate();/* ww w . j a v a 2s . c om*/ // Build the context menu action list List<AppAction> contextMenuActions = new ArrayList<AppAction>(); contextMenu.removeAll(); for (AppAction action : enabledActions) { if (Boolean.TRUE.equals(action.getValue(AppAction.ON_CONTEXT_MENU))) { contextMenuActions.add(action); } } log.debug("There are " + contextMenuActions.size() + " on the context menu"); Collections.sort(contextMenuActions, new ContextActionComparator()); // Build the context menu Integer grp = null; for (AppAction action : contextMenuActions) { if ((grp != null) && !grp.equals(action.getValue(AppAction.CONTEXT_MENU_GROUP))) { contextMenu.addSeparator(); } if (Boolean.TRUE.equals(action.getValue(AppAction.IS_TOGGLE_BUTTON))) { final JCheckBoxMenuItem item = new JCheckBoxMenuItem(action); action.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(AppAction.IS_SELECTED)) { item.setSelected(((Boolean) evt.getNewValue()).booleanValue()); } } }); contextMenu.add(item); item.setSelected(Boolean.TRUE.equals(action.getValue(AppAction.IS_SELECTED))); } else { contextMenu.add(action); } grp = (Integer) action.getValue(AppAction.CONTEXT_MENU_GROUP); } contextMenu.validate(); contextMenu.repaint(); }
From source file:org.adempiere.apps.graph.Graph.java
private void loadData() { list = builder.loadData();/* w w w . j av a 2 s . c om*/ JFreeChart chart = builder.createChart(builder.getMGoal().getChartType()); if (chartPanel != null) remove(chartPanel); chartPanel = new ChartPanel(chart); chartPanel.setSize(getSize()); chartPanel.addChartMouseListener(this); add(chartPanel, BorderLayout.CENTER); if (m_userSelection) { int AD_Reference_Value_ID = DB.getSQLValue(null, "SELECT AD_Reference_ID FROM AD_Reference WHERE Name = ?", "PA_Goal ChartType"); MLookupInfo info = MLookupFactory.getLookup_List(Env.getLanguage(Env.getCtx()), AD_Reference_Value_ID); MLookup mLookup = new MLookup(info, 0); VLookup lookup = new VLookup("ChartType", false, false, true, mLookup); lookup.addVetoableChangeListener(new VetoableChangeListener() { public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { Object value = evt.getNewValue(); if (value == null) return; JFreeChart chart = null; chart = builder.createChart(value.toString()); if (chart != null) { if (chartPanel != null) remove(chartPanel); chartPanel = new ChartPanel(chart); chartPanel.setSize(getSize()); chartPanel.addChartMouseListener(Graph.this); add(chartPanel, BorderLayout.CENTER); getParent().validate(); } } }); add(lookup, BorderLayout.NORTH); } this.setMinimumSize(paneldimension); }