List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:org.tinymediamanager.ui.movies.MoviePanel.java
/** * Create the panel./*from w w w.j a v a 2 s .c om*/ */ public MoviePanel() { super(); // load movielist LOGGER.debug("loading MovieList"); movieList = MovieList.getInstance(); sortedMovies = new SortedList<>(GlazedListsSwing.swingThreadProxyList(movieList.getMovies()), new MovieComparator()); sortedMovies.setMode(SortedList.AVOID_MOVING_ELEMENTS); // build menu menu = new JMenu(BUNDLE.getString("tmm.movies")); //$NON-NLS-1$ JFrame mainFrame = MainWindow.getFrame(); JMenuBar menuBar = mainFrame.getJMenuBar(); menuBar.add(menu); setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("850px:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("500px:grow"), })); splitPaneHorizontal = new JSplitPane(); splitPaneHorizontal.setContinuousLayout(true); add(splitPaneHorizontal, "2, 2, fill, fill"); JPanel panelMovieList = new JPanel(); splitPaneHorizontal.setLeftComponent(panelMovieList); panelMovieList.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, }, new RowSpec[] { RowSpec.decode("26px"), FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:max(200px;default):grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JToolBar toolBar = new JToolBar(); toolBar.setRollover(true); toolBar.setFloatable(false); toolBar.setOpaque(false); panelMovieList.add(toolBar, "2, 1, left, fill"); // udpate datasource // toolBar.add(actionUpdateDataSources); final JSplitButton buttonUpdateDatasource = new JSplitButton(IconManager.REFRESH); // temp fix for size of the button buttonUpdateDatasource.setText(" "); buttonUpdateDatasource.setHorizontalAlignment(JButton.LEFT); // buttonScrape.setMargin(new Insets(2, 2, 2, 24)); buttonUpdateDatasource.setSplitWidth(18); buttonUpdateDatasource.setToolTipText(BUNDLE.getString("update.datasource")); //$NON-NLS-1$ buttonUpdateDatasource.addSplitButtonActionListener(new SplitButtonActionListener() { public void buttonClicked(ActionEvent e) { actionUpdateDataSources.actionPerformed(e); } public void splitButtonClicked(ActionEvent e) { // build the popupmenu on the fly buttonUpdateDatasource.getPopupMenu().removeAll(); JMenuItem item = new JMenuItem(actionUpdateDataSources2); buttonUpdateDatasource.getPopupMenu().add(item); buttonUpdateDatasource.getPopupMenu().addSeparator(); for (String ds : MovieModuleManager.MOVIE_SETTINGS.getMovieDataSource()) { buttonUpdateDatasource.getPopupMenu() .add(new JMenuItem(new MovieUpdateSingleDatasourceAction(ds))); } buttonUpdateDatasource.getPopupMenu().pack(); } }); JPopupMenu popup = new JPopupMenu("popup"); buttonUpdateDatasource.setPopupMenu(popup); toolBar.add(buttonUpdateDatasource); JSplitButton buttonScrape = new JSplitButton(IconManager.SEARCH); // temp fix for size of the button buttonScrape.setText(" "); buttonScrape.setHorizontalAlignment(JButton.LEFT); // buttonScrape.setMargin(new Insets(2, 2, 2, 24)); buttonScrape.setSplitWidth(18); buttonScrape.setToolTipText(BUNDLE.getString("movie.scrape.selected")); //$NON-NLS-1$ // register for listener buttonScrape.addSplitButtonActionListener(new SplitButtonActionListener() { public void buttonClicked(ActionEvent e) { actionScrape.actionPerformed(e); } public void splitButtonClicked(ActionEvent e) { } }); popup = new JPopupMenu("popup"); JMenuItem item = new JMenuItem(actionScrape2); popup.add(item); item = new JMenuItem(actionScrapeUnscraped); popup.add(item); item = new JMenuItem(actionScrapeSelected); popup.add(item); buttonScrape.setPopupMenu(popup); toolBar.add(buttonScrape); toolBar.add(actionEditMovie); btnRen = new JButton("REN"); btnRen.setAction(actionRename); toolBar.add(btnRen); btnMediaInformation = new JButton("MI"); btnMediaInformation.setAction(actionMediaInformation); toolBar.add(btnMediaInformation); JButton btnCreateOflline = new JButton(); btnCreateOflline.setAction(new MovieCreateOfflineAction(false)); toolBar.add(btnCreateOflline); textField = EnhancedTextField.createSearchTextField(); panelMovieList.add(textField, "3, 1, right, bottom"); textField.setColumns(13); // table = new JTable(); // build JTable MatcherEditor<Movie> textMatcherEditor = new TextComponentMatcherEditor<>(textField, new MovieFilterator()); MovieMatcherEditor movieMatcherEditor = new MovieMatcherEditor(); FilterList<Movie> extendedFilteredMovies = new FilterList<>(sortedMovies, movieMatcherEditor); textFilteredMovies = new FilterList<>(extendedFilteredMovies, textMatcherEditor); movieSelectionModel = new MovieSelectionModel(sortedMovies, textFilteredMovies, movieMatcherEditor); movieTableModel = new DefaultEventTableModel<>(GlazedListsSwing.swingThreadProxyList(textFilteredMovies), new MovieTableFormat()); table = new ZebraJTable(movieTableModel); movieTableModel.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { lblMovieCountFiltered.setText(String.valueOf(movieTableModel.getRowCount())); // select first movie if nothing is selected ListSelectionModel selectionModel = table.getSelectionModel(); if (selectionModel.isSelectionEmpty() && movieTableModel.getRowCount() > 0) { selectionModel.setSelectionInterval(0, 0); } if (selectionModel.isSelectionEmpty() && movieTableModel.getRowCount() == 0) { movieSelectionModel.setSelectedMovie(null); } } }); // install and save the comparator on the Table movieSelectionModel.setTableComparatorChooser( TableComparatorChooser.install(table, sortedMovies, TableComparatorChooser.SINGLE_COLUMN)); // table = new MyTable(); table.setNewFontSize((float) ((int) Math.round(getFont().getSize() * 0.916))); // scrollPane.setViewportView(table); // JScrollPane scrollPane = new JScrollPane(table); JScrollPane scrollPane = ZebraJTable.createStripedJScrollPane(table); panelMovieList.add(scrollPane, "2, 3, 4, 1, fill, fill"); { final JToggleButton filterButton = new JToggleButton(IconManager.FILTER); filterButton.setToolTipText(BUNDLE.getString("movieextendedsearch.options")); //$NON-NLS-1$ panelMovieList.add(filterButton, "5, 1, right, bottom"); // add a propertychangelistener which reacts on setting a filter movieSelectionModel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if ("filterChanged".equals(evt.getPropertyName())) { if (Boolean.TRUE.equals(evt.getNewValue())) { filterButton.setIcon(IconManager.FILTER_ACTIVE); filterButton.setToolTipText(BUNDLE.getString("movieextendedsearch.options.active")); //$NON-NLS-1$ } else { filterButton.setIcon(IconManager.FILTER); filterButton.setToolTipText(BUNDLE.getString("movieextendedsearch.options")); //$NON-NLS-1$ } } } }); panelExtendedSearch = new MovieExtendedSearchPanel(movieSelectionModel); panelExtendedSearch.setVisible(false); // panelMovieList.add(panelExtendedSearch, "2, 5, 2, 1, fill, fill"); filterButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (panelExtendedSearch.isVisible() == true) { panelExtendedSearch.setVisible(false); } else { panelExtendedSearch.setVisible(true); } } }); } JPanel panelStatus = new JPanel(); panelMovieList.add(panelStatus, "2, 6, 2, 1"); panelStatus.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("1px"), ColumnSpec.decode("146px:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { RowSpec.decode("fill:default:grow"), })); panelMovieCount = new JPanel(); panelStatus.add(panelMovieCount, "3, 1, left, fill"); lblMovieCount = new JLabel(BUNDLE.getString("tmm.movies") + ":"); //$NON-NLS-1$ panelMovieCount.add(lblMovieCount); lblMovieCountFiltered = new JLabel(""); panelMovieCount.add(lblMovieCountFiltered); lblMovieCountOf = new JLabel(BUNDLE.getString("tmm.of")); //$NON-NLS-1$ panelMovieCount.add(lblMovieCountOf); lblMovieCountTotal = new JLabel(""); panelMovieCount.add(lblMovieCountTotal); JLayeredPane layeredPaneRight = new JLayeredPane(); layeredPaneRight.setLayout( new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default"), ColumnSpec.decode("default:grow") }, new RowSpec[] { RowSpec.decode("default"), RowSpec.decode("default:grow") })); panelRight = new MovieInformationPanel(movieSelectionModel); layeredPaneRight.add(panelRight, "1, 1, 2, 2, fill, fill"); layeredPaneRight.setLayer(panelRight, 0); // glass pane layeredPaneRight.add(panelExtendedSearch, "1, 1, fill, fill"); layeredPaneRight.setLayer(panelExtendedSearch, 1); splitPaneHorizontal.setRightComponent(layeredPaneRight); splitPaneHorizontal.setContinuousLayout(true); // beansbinding init initDataBindings(); addComponentListener(new ComponentAdapter() { @Override public void componentHidden(ComponentEvent e) { menu.setVisible(false); super.componentHidden(e); } @Override public void componentShown(ComponentEvent e) { menu.setVisible(true); super.componentHidden(e); } }); // further initializations init(); // filter if (MovieModuleManager.MOVIE_SETTINGS.isStoreUiFilters()) { movieList.searchDuplicates(); movieSelectionModel.filterMovies(MovieModuleManager.MOVIE_SETTINGS.getUiFilters()); } }
From source file:org.jitsi.android.gui.call.VideoCallActivity.java
/** * Invoked by {@link #callConferenceListener} to notify this instance about * an <tt>EventObject</tt> related to the <tt>CallConference</tt> depicted * by this <tt>CallPanel</tt>, the <tt>Call</tt>s participating in it, * the <tt>CallPeer</tt>s associated with them, the * <tt>ConferenceMember</tt>s participating in any telephony conferences * organized by them, etc. In other words, notifies this instance about * any change which may cause an update to be required so that this view * i.e. <tt>CallPanel</tt> depicts the current state of its model i.e. * {@link #callConference}./*from www.j a v a 2s. c o m*/ * * @param ev the <tt>EventObject</tt> this instance is being notified * about. */ private void onCallConferenceEventObject(EventObject ev) { /* * The main task is to invoke updateViewFromModel() in order to make * sure that this view depicts the current state of its model. */ try { /* * However, we seem to be keeping track of the duration of the call * (i.e. the telephony conference) in the user interface. Stop the * Timer which ticks the duration of the call as soon as the * telephony conference depicted by this instance appears to have * ended. The situation will very likely occur when a Call is * removed from the telephony conference or a CallPeer is removed * from a Call. */ boolean tryStopCallTimer = false; if (ev instanceof CallPeerEvent) { tryStopCallTimer = (CallPeerEvent.CALL_PEER_REMOVED == ((CallPeerEvent) ev).getEventID()); } else if (ev instanceof PropertyChangeEvent) { PropertyChangeEvent pcev = (PropertyChangeEvent) ev; tryStopCallTimer = (CallConference.CALLS.equals(pcev) && (pcev.getOldValue() instanceof Call) && (pcev.getNewValue() == null)); } if (tryStopCallTimer && (callConference.isEnded() || callConference.getCallPeerCount() == 0)) { stopCallTimer(); doFinishActivity(); } } finally { updateViewFromModel(ev); } }
From source file:org.jcurl.demo.tactics.BroomPromptSwingBean.java
public void propertyChange(final PropertyChangeEvent evt) { if (log.isDebugEnabled()) log.debug(evt.getSource());/* w ww. ja v a2 s. co m*/ if (evt.getSource() == broom) { if ("idx16".equals(evt.getPropertyName())) syncM2V(broom == null ? -1 : broom.getIdx16()); else if ("outTurn".equals(evt.getPropertyName())) syncM2V(broom == null ? null : broom.getOutTurn()); else if ("splitTimeMillis".equals(evt.getPropertyName())) syncM2V(broom == null ? null : broom.getSplitTimeMillis()); else if ("broom".equals(evt.getPropertyName())) syncM2V(broom == null ? null : broom.getBroom()); } else if (evt.getSource() == x || evt.getSource() == y) { if ("valueIsAdjusting".equals(evt.getPropertyName())) if (Boolean.TRUE.equals(evt.getNewValue())) firstXY = new XYMemento(broom, broom.getBroom()); else { if (Boolean.FALSE.equals(evt.getNewValue())) getChanger().undoable(firstXY, new XYMemento(broom, x.getValue(), y.getValue())); firstXY = null; } } else log.warn("Unprocessed event from " + evt.getSource()); }
From source file:org.jitsi.videobridge.VideoChannel.java
@Override public void propertyChange(PropertyChangeEvent ev) { super.propertyChange(ev); String propertyName = ev.getPropertyName(); if (Endpoint.PINNED_ENDPOINTS_PROPERTY_NAME.equals(propertyName)) { lastNController.setPinnedEndpointIds((List<String>) ev.getNewValue()); } else if (Content.CHANNEL_MODIFIED_PROPERTY_NAME.equals(propertyName)) { // Another channel in this content has been modified ( // added/removed/modified source group, same with payload types, etc) // This has implications in SSRC rewriting, we need to update our // engine. logger.debug("Handling CHANNEL_MODIFIED_PROPERTY_NAME"); VideoChannel videoChannel = (VideoChannel) ev.getNewValue(); updateTranslatedVideoChannel(videoChannel); }//from w w w . j a v a2 s .c om }
From source file:uk.nhs.cfh.dsp.srth.desktop.uiframework.app.impl.ModularDockingApplicationView.java
/** * Creates the tas monitor and exit listeners. *//*from ww w. ja v a2 s .c o m*/ private synchronized void createTasMonitorAndExitListeners() { // connecting action tasks to status bar via TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext()); taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { String propertyName = evt.getPropertyName(); if ("started".equals(propertyName)) { busyLabel.setBusy(true); setTaskRunning(true); } else if ("done".equals(propertyName)) { busyLabel.setBusy(false); progressBar.setVisible(false); progressBar.setValue(0); setTaskRunning(false); } else if ("message".equals(propertyName)) { String text = (String) (evt.getNewValue()); statusMessageLabel.setText((text == null) ? "" : text); } else if ("progress".equals(propertyName)) { int value = (Integer) (evt.getNewValue()); busyLabel.setBusy(false); progressBar.setVisible(true); progressBar.setIndeterminate(false); progressBar.setValue(value); } else if ("cancel".equals(propertyName)) { statusMessageLabel.setText("Task cancelled"); } } }); // add exit listener Application.ExitListener exitListener = new Application.ExitListener() { private boolean canExit = false; public boolean canExit(EventObject e) { canExit = checkCanExit(); logger.info("Value of canExit : " + canExit); return canExit; } public void willExit(EventObject e) { // clean up before exiting cleanUpBeforeExit(); // save to log logger.info("Shutting down application"); } }; getApplication().addExitListener(exitListener); // add window listener getFrame().addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent windowEvent) { // call exit listener getApplication().exit(); } }); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserProfile.java
/** * Uploads the photo./* ww w. j av a 2s. co m*/ * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (UploadPictureDialog.UPLOAD_PHOTO_PROPERTY.equals(name)) { List l = (List) evt.getNewValue(); if (l == null || l.size() != 2) return; File f = (File) l.get(0); if (f == null) return; model.uploadPicture(f, (String) l.get(1)); } }
From source file:ome.formats.importer.gui.GuiImporter.java
public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (ScreenLogin.LOGIN_PROPERTY.equals(name)) { LoginCredentials lc = (LoginCredentials) evt.getNewValue(); if (lc != null) login(lc);//from ww w. ja va 2s. c om } else if (ScreenLogin.QUIT_PROPERTY.equals(name) || name.equals("quitpplication")) { if (GuiCommonElements.quitConfirmed(this, null) == true) { System.exit(0); } } else if (ScreenLogin.TO_FRONT_PROPERTY.equals(name) || ScreenLogo.MOVE_FRONT_PROPERTY.equals(name)) { //updateView(); } else if (name.equals("aboutApplication")) { // HACK - JOptionPane prevents shutdown on dispose setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); About.show(this, getConfig(), useSplashScreenAbout); } }
From source file:org.apache.catalina.cluster.session.DeltaManager.java
/** * Process property change events from our associated Context. * * @param event The property change event that has occurred *//*from w ww .jav a 2s . co m*/ public void propertyChange(PropertyChangeEvent event) { // Validate the source of this event if (!(event.getSource() instanceof Context)) return; Context context = (Context) event.getSource(); // Process a relevant property change if (event.getPropertyName().equals("sessionTimeout")) { try { setMaxInactiveInterval(((Integer) event.getNewValue()).intValue() * 60); } catch (NumberFormatException e) { log.error(sm.getString("standardManager.sessionTimeout", event.getNewValue().toString())); } } }
From source file:canreg.client.gui.dataentry.ImportView.java
/** * * @return// w ww . jav a2s . co m */ @Action() public Task importAction() { // TODO: Add a handler for errors in the file structure... localSettings.setProperty("import_path", path); localSettings.writeSettings(); progressBar.setStringPainted(true); importButton.setEnabled(false); // this.dispose(); importTask = new ImportActionTask( org.jdesktop.application.Application.getInstance(canreg.client.CanRegClientApp.class)); importTask.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { progressBar.setValue((Integer) evt.getNewValue()); progressBar.setString(evt.getNewValue().toString() + "%"); } else if ("finished".equals(evt.getPropertyName())) { dispose(); } } }); return importTask; }
From source file:com.googlecode.vfsjfilechooser2.plaf.metal.MetalVFSFileChooserUI.java
private void doSelectedFileChanged(PropertyChangeEvent e) { FileObject f = (FileObject) e.getNewValue(); VFSJFileChooser fc = getFileChooser(); if ((f != null) && ((fc.isFileSelectionEnabled() && !VFSUtils.isDirectory(f)) || (VFSUtils.isDirectory(f) && fc.isDirectorySelectionEnabled()))) { setFileName(fileNameString(f));/*from w ww . j av a 2s . c om*/ } }