List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:org.tinymediamanager.ui.tvshows.TvShowPanel.java
/** * Instantiates a new tv show panel./*from ww w. jav a2 s . c om*/ */ public TvShowPanel() { super(); treeModel = new TvShowTreeModel(tvShowList.getTvShows()); tvShowSeasonSelectionModel = new TvShowSeasonSelectionModel(); tvShowEpisodeSelectionModel = new TvShowEpisodeSelectionModel(); // build menu menu = new JMenu(BUNDLE.getString("tmm.tvshows")); //$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("default:grow"), })); JSplitPane splitPane = new JSplitPane(); splitPane.setContinuousLayout(true); add(splitPane, "2, 2, fill, fill"); JPanel panelTvShowTree = new JPanel(); splitPane.setLeftComponent(panelTvShowTree); panelTvShowTree.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("3px:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); textField = EnhancedTextField.createSearchTextField(); panelTvShowTree.add(textField, "4, 1, right, bottom"); textField.setColumns(12); textField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(final DocumentEvent e) { applyFilter(); } @Override public void removeUpdate(final DocumentEvent e) { applyFilter(); } @Override public void changedUpdate(final DocumentEvent e) { applyFilter(); } public void applyFilter() { TvShowTreeModel filteredModel = (TvShowTreeModel) tree.getModel(); if (StringUtils.isNotBlank(textField.getText())) { filteredModel.setFilter(SearchOptions.TEXT, textField.getText()); } else { filteredModel.removeFilter(SearchOptions.TEXT); } filteredModel.filter(tree); } }); final JToggleButton btnFilter = new JToggleButton(IconManager.FILTER); btnFilter.setToolTipText(BUNDLE.getString("movieextendedsearch.options")); //$NON-NLS-1$ panelTvShowTree.add(btnFilter, "6, 1, default, bottom"); JScrollPane scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); panelTvShowTree.add(scrollPane, "2, 3, 5, 1, fill, fill"); JToolBar toolBar = new JToolBar(); toolBar.setRollover(true); toolBar.setFloatable(false); toolBar.setOpaque(false); panelTvShowTree.add(toolBar, "2, 1"); // 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(); buttonUpdateDatasource.getPopupMenu().add(new JMenuItem(actionUpdateDatasources2)); buttonUpdateDatasource.getPopupMenu().addSeparator(); for (String ds : TvShowModuleManager.SETTINGS.getTvShowDataSource()) { buttonUpdateDatasource.getPopupMenu() .add(new JMenuItem(new TvShowUpdateSingleDatasourceAction(ds))); } buttonUpdateDatasource.getPopupMenu().addSeparator(); buttonUpdateDatasource.getPopupMenu().add(new JMenuItem(actionUpdateTvShow)); 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.setSplitWidth(18); buttonScrape.setToolTipText(BUNDLE.getString("tvshow.scrape.selected")); //$NON-NLS-1$ // register for listener buttonScrape.addSplitButtonActionListener(new SplitButtonActionListener() { @Override public void buttonClicked(ActionEvent e) { actionScrape.actionPerformed(e); } @Override 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); item = new JMenuItem(actionScrapeNewItems); popup.add(item); buttonScrape.setPopupMenu(popup); toolBar.add(buttonScrape); toolBar.add(actionEdit); JButton btnMediaInformation = new JButton(); btnMediaInformation.setAction(actionMediaInformation); toolBar.add(btnMediaInformation); // install drawing of full with tree = new ZebraJTree(treeModel) { private static final long serialVersionUID = 2422163883324014637L; @Override public void paintComponent(Graphics g) { width = this.getWidth(); super.paintComponent(g); } }; tvShowSelectionModel = new TvShowSelectionModel(tree); TreeUI ui = new TreeUI() { @Override protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { bounds.width = width - bounds.x; super.paintRow(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); } }; tree.setUI(ui); tree.setRootVisible(false); tree.setShowsRootHandles(true); tree.setCellRenderer(new TvShowTreeCellRenderer()); tree.setRowHeight(0); scrollPane.setViewportView(tree); JPanel panelHeader = new JPanel() { private static final long serialVersionUID = -6914183798172482157L; @Override public void paintComponent(Graphics g) { super.paintComponent(g); JTattooUtilities.fillHorGradient(g, AbstractLookAndFeel.getTheme().getColHeaderColors(), 0, 0, getWidth(), getHeight()); } }; scrollPane.setColumnHeaderView(panelHeader); panelHeader.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("center:20px"), ColumnSpec.decode("center:20px"), ColumnSpec.decode("center:20px") }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, })); JLabel lblTvShowsColumn = new JLabel(BUNDLE.getString("metatag.tvshow")); //$NON-NLS-1$ lblTvShowsColumn.setHorizontalAlignment(JLabel.CENTER); panelHeader.add(lblTvShowsColumn, "2, 1"); JLabel lblNfoColumn = new JLabel(""); lblNfoColumn.setHorizontalAlignment(JLabel.CENTER); lblNfoColumn.setIcon(IconManager.INFO); lblNfoColumn.setToolTipText(BUNDLE.getString("metatag.nfo"));//$NON-NLS-1$ panelHeader.add(lblNfoColumn, "4, 1"); JLabel lblImageColumn = new JLabel(""); lblImageColumn.setHorizontalAlignment(JLabel.CENTER); lblImageColumn.setIcon(IconManager.IMAGE); lblImageColumn.setToolTipText(BUNDLE.getString("metatag.images"));//$NON-NLS-1$ panelHeader.add(lblImageColumn, "5, 1"); JLabel lblSubtitleColumn = new JLabel(""); lblSubtitleColumn.setHorizontalAlignment(JLabel.CENTER); lblSubtitleColumn.setIcon(IconManager.SUBTITLE); lblSubtitleColumn.setToolTipText(BUNDLE.getString("metatag.subtitles"));//$NON-NLS-1$ panelHeader.add(lblSubtitleColumn, "6, 1"); JPanel panel = new JPanel(); panelTvShowTree.add(panel, "2, 5, 3, 1, fill, fill"); panel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JLabel lblTvShowsT = new JLabel(BUNDLE.getString("metatag.tvshows") + ":"); //$NON-NLS-1$ panel.add(lblTvShowsT, "1, 2, fill, fill"); lblTvShows = new JLabel(""); panel.add(lblTvShows, "3, 2"); JLabel labelSlash = new JLabel("/"); panel.add(labelSlash, "5, 2"); JLabel lblEpisodesT = new JLabel(BUNDLE.getString("metatag.episodes") + ":"); //$NON-NLS-1$ panel.add(lblEpisodesT, "7, 2"); lblEpisodes = new JLabel(""); panel.add(lblEpisodes, "9, 2"); 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 JPanel(); layeredPaneRight.add(panelRight, "1, 1, 2, 2, fill, fill"); layeredPaneRight.setLayer(panelRight, 0); // glass pane final TvShowExtendedSearchPanel panelExtendedSearch = new TvShowExtendedSearchPanel(treeModel, tree); panelExtendedSearch.setVisible(false); // panelMovieList.add(panelExtendedSearch, "2, 5, 2, 1, fill, fill"); btnFilter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (panelExtendedSearch.isVisible() == true) { panelExtendedSearch.setVisible(false); } else { panelExtendedSearch.setVisible(true); } } }); // add a propertychangelistener which reacts on setting a filter tree.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if ("filterChanged".equals(evt.getPropertyName())) { if (Boolean.TRUE.equals(evt.getNewValue())) { btnFilter.setIcon(IconManager.FILTER_ACTIVE); btnFilter.setToolTipText(BUNDLE.getString("movieextendedsearch.options.active")); //$NON-NLS-1$ } else { btnFilter.setIcon(IconManager.FILTER); btnFilter.setToolTipText(BUNDLE.getString("movieextendedsearch.options")); //$NON-NLS-1$ } } } }); layeredPaneRight.add(panelExtendedSearch, "1, 1, fill, fill"); layeredPaneRight.setLayer(panelExtendedSearch, 1); splitPane.setRightComponent(layeredPaneRight); panelRight.setLayout(new CardLayout(0, 0)); JPanel panelTvShow = new TvShowInformationPanel(tvShowSelectionModel); panelRight.add(panelTvShow, "tvShow"); JPanel panelTvShowSeason = new TvShowSeasonInformationPanel(tvShowSeasonSelectionModel); panelRight.add(panelTvShowSeason, "tvShowSeason"); JPanel panelTvShowEpisode = new TvShowEpisodeInformationPanel(tvShowEpisodeSelectionModel); panelRight.add(panelTvShowEpisode, "tvShowEpisode"); tree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node != null) { // click on a tv show if (node.getUserObject() instanceof TvShow) { TvShow tvShow = (TvShow) node.getUserObject(); tvShowSelectionModel.setSelectedTvShow(tvShow); CardLayout cl = (CardLayout) (panelRight.getLayout()); cl.show(panelRight, "tvShow"); } // click on a season if (node.getUserObject() instanceof TvShowSeason) { TvShowSeason tvShowSeason = (TvShowSeason) node.getUserObject(); tvShowSeasonSelectionModel.setSelectedTvShowSeason(tvShowSeason); CardLayout cl = (CardLayout) (panelRight.getLayout()); cl.show(panelRight, "tvShowSeason"); } // click on an episode if (node.getUserObject() instanceof TvShowEpisode) { TvShowEpisode tvShowEpisode = (TvShowEpisode) node.getUserObject(); tvShowEpisodeSelectionModel.setSelectedTvShowEpisode(tvShowEpisode); CardLayout cl = (CardLayout) (panelRight.getLayout()); cl.show(panelRight, "tvShowEpisode"); } } else { // check if there is at least one tv show in the model TvShowRootTreeNode root = (TvShowRootTreeNode) tree.getModel().getRoot(); if (root.getChildCount() == 0) { // sets an inital show tvShowSelectionModel.setSelectedTvShow(null); } } } }); 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(); initDataBindings(); // selecting first TV show at startup if (tvShowList.getTvShows() != null && tvShowList.getTvShows().size() > 0) { DefaultMutableTreeNode firstLeaf = (DefaultMutableTreeNode) ((DefaultMutableTreeNode) tree.getModel() .getRoot()).getFirstChild(); tree.setSelectionPath(new TreePath(((DefaultMutableTreeNode) firstLeaf.getParent()).getPath())); tree.setSelectionPath(new TreePath(firstLeaf.getPath())); } }
From source file:de.lazyzero.kkMulticopterFlashTool.KKMulticopterFlashTool.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(ControllerPanel.CONTROLLER_CHANGED)) { firmwarePanel.firePropertyChange(ControllerPanel.CONTROLLER_CHANGED, 0, 1); eepromResetPanel.firePropertyChange(ControllerPanel.CONTROLLER_CHANGED, 0, 1); }/* www.j a v a 2s. c om*/ if (evt.getPropertyName().equals(MODE_CHANGED)) { firmwarePanel.firePropertyChange(ControllerPanel.CONTROLLER_CHANGED, 0, 1); if (isOfflineMode()) { mode = _("offline"); } else { mode = _("online"); } this.mainframe.setTitle(_("title") + " " + VERSION + " - " + mode); } if (evt.getPropertyName().equals(ProgrammerPanel.PROGRAMMER_CHANGED)) { //TODO Make controller dependent from Programmer. } }
From source file:ec.util.chart.swing.JTimeSeriesChart.java
private void enableProperties() { addPropertyChangeListener(new PropertyChangeListener() { @Override/*from www . java 2s. c o m*/ public void propertyChange(PropertyChangeEvent evt) { notification.suspend(); switch (evt.getPropertyName()) { case COLOR_SCHEME_SUPPORT_PROPERTY: onColorSchemeSupportChange(); break; case LINE_THICKNESS_PROPERTY: onLineThicknessChange(); break; case PERIOD_FORMAT_PROPERTY: onPeriodFormatChange(); break; case VALUE_FORMAT_PROPERTY: onValueFormatChange(); break; case SERIES_RENDERER_PROPERTY: onSeriesRendererChange(); break; case SERIES_FORMATTER_PROPERTY: onSeriesFormatterChange(); break; case SERIES_COLORIST_PROPERTY: onSeriesColoristChange(); break; case OBS_FORMATTER_PROPERTY: onObsFormatterChange(); break; case OBS_COLORIST_PROPERTY: onObsColoristChange(); break; case DASH_PREDICATE_PROPERTY: onDashPredicateChange(); break; case LEGEND_VISIBILITY_PREDICATE_PROPERTY: onLegendVisibilityPredicateChange(); break; case PLOT_DISPATCHER_PROPERTY: onPlotDispatcherChange(); break; case DATASET_PROPERTY: onDatasetChange(); break; case TITLE_PROPERTY: onTitleChange(); break; case NO_DATA_MESSAGE_PROPERTY: onNoDataMessageChange(); break; case PLOT_WEIGHTS_PROPERTY: onPlotWeightsChange(); break; case ELEMENT_VISIBLE_PROPERTY: onElementVisibleChange(); break; case CROSSHAIR_ORIENTATION_PROPERTY: onCrosshairOrientationChange(); break; case HOVERED_OBS_PROPERTY: onHoveredObsChange(); break; case SELECTED_OBS_PROPERTY: onSelectedObsChange(); break; case OBS_HIGHLIGHTER_PROPERTY: onObsHighlighterChange(); break; case TOOLTIP_TRIGGER_PROPERTY: onTooltipTriggerChange(); break; case CROSSHAIR_TRIGGER_PROPERTY: onCrosshairTriggerChange(); break; case REVEAL_OBS_PROPERTY: onRevealObsChange(); break; case "enabled": boolean enabled = isEnabled(); chartPanel.setDomainZoomable(enabled); chartPanel.setRangeZoomable(enabled); break; case "componentPopupMenu": onComponentPopupMenuChange(); break; } notification.resume(); } }); }
From source file:edu.ku.brc.specify.tasks.subpane.VisualQueryPanel.java
/** * @throws IOException /*from w w w . j av a2 s . c o m*/ * */ private void doSearch() throws IOException { final String CNT = "CNT"; UIFieldFormatterIFace fieldFmt = null; if (typeCBX.getSelectedIndex() == 0) { fieldFmt = DBTableIdMgr.getFieldFormatterFor(CollectionObject.class, "catalogNumber"); } final StringBuilder pmStr = new StringBuilder(); final String placeMark = " <Placemark><name>%s - %d / %d</name><Point><coordinates>%8.5f, %8.5f, 5</coordinates></Point></Placemark>\n"; polySB.setLength(0); boxSB.setLength(0); final JStatusBar statusBar = UIRegistry.getStatusBar(); final UIFieldFormatterIFace fldFmt = fieldFmt; SwingWorker<Integer, Integer> worker = new SwingWorker<Integer, Integer>() { @Override protected Integer doInBackground() throws Exception { // fills pntList from polyline // polyline was filled via clicks on WorldWind totalNumRecords = BasicSQLUtils.getCountAsInt(buildSQL(true)); availPoints.clear(); model = (DefaultListModel) dbObjList.getModel(); model.removeAllElements(); topIdHash.clear(); markers.clear(); polygon = new Polyline(polyline.getPositions()); polygon.setClosed(true); for (Position p : polyline.getPositions()) { polySB.append(String.format(" %8.5f, %8.5f, 20\n", p.longitude.degrees, p.latitude.degrees)); } int maxThreshold = 1000; int index = 0; Connection conn = null; Statement stmt = null; try { conn = DBConnection.getInstance().createConnection(); stmt = conn.createStatement(); int currCnt = 0; ResultSet rs = stmt.executeQuery(buildSQL(false)); while (rs.next()) { if (currCnt < maxThreshold) { double lat = rs.getBigDecimal(2).doubleValue(); double lon = rs.getBigDecimal(3).doubleValue(); Position pos = Position.fromDegrees(lat, lon, 0.0); // ZZZ // if (GeometryMath.isLocationInside(pos, polygon.getPositions())) // { // LatLonPoint llp = new LatLonPoint(rs.getInt(1), lat, lon); // String title = rs.getString(4); // if (title != null) // { // title = (fldFmt != null ? fldFmt.formatToUI(title) :title).toString(); // } else // { // title = "N/A"; // } // llp.setTitle(title); // llp.setIndex(index++); // availPoints.add(llp); // markers.add(llp); // topIdHash.add(llp.getLocId()); // System.out.println(index+" / "+currCnt+" In: "+lat+", "+lon); // pmStr.append(String.format(placeMark, "In: ",index, currCnt, lon, lat)); // // } else // { // System.out.println(index+" / "+currCnt+" Tossing: "+lat+", "+lon); // pmStr.append(String.format(placeMark, "Tossing: ", index, currCnt, lon, lat)); // } } currCnt++; if (currCnt % 100 == 0) { firePropertyChange(CNT, 0, currCnt); } } rs.close(); } catch (SQLException ex) { ex.printStackTrace(); /*UsageTracker.incrSQLUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(BaseTreeTask.class, ex); log.error("SQLException: " + ex.toString()); //$NON-NLS-1$ lo .error(ex.getMessage());*/ } finally { try { if (stmt != null) stmt.close(); if (conn != null) conn.close(); } catch (Exception ex) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(BaseTreeTask.class, ex); ex.printStackTrace(); } } return null; } /* (non-Javadoc) * @see javax.swing.SwingWorker#done() */ @Override protected void done() { super.done(); if (doDebug) { try { final String template = FileUtils.readFileToString(new File("template.kml")); final PrintWriter pw = new PrintWriter(new File("debug.kml")); String str = StringUtils.replace(template, "<!-- BOX -->", boxSB.toString()); str = StringUtils.replace(str, "<!-- POLYGON -->", polySB.toString()); str = StringUtils.replace(str, "<!-- PLACEMARKS -->", pmStr.toString()); pw.println(str); pw.flush(); pw.close(); } catch (IOException ex) { } } UIRegistry.clearSimpleGlassPaneMsg(); statusBar.setProgressDone(STATUSBAR_NAME); for (LatLonPlacemarkIFace llp : markers) { model.addElement(llp); } if (markers.size() > 0) { wwPanel.placeMarkers(markers, null); searchBtn.setEnabled(false); } else { doClearAll(true); startBtn.setEnabled(false); } clearAllBtn.setEnabled(true); clearSearchBtn.setEnabled(true); } }; statusBar.setIndeterminate(STATUSBAR_NAME, false); statusBar.setProgressRange(STATUSBAR_NAME, 0, 100); final SimpleGlassPane glassPane = UIRegistry .writeSimpleGlassPaneMsg(getLocalizedMessage("MySQLBackupService.BACKINGUP", "XXX"), 24); worker.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { if (CNT.equals(evt.getPropertyName())) { int value = (Integer) evt.getNewValue(); int progress = (int) (((double) value / (double) totalNumRecords) * 100.0); glassPane.setProgress(progress); statusBar.setValue(STATUSBAR_NAME, progress); } } }); worker.execute(); }
From source file:org.executequery.base.DockedTabContainer.java
/** * Provides notification of split pane divider movement events. * * @param the change event/*from w w w . j ava 2 s .c om*/ */ public void propertyChange(PropertyChangeEvent e) { String name = e.getPropertyName(); if ("dividerLocation".equals(name)) { String value = e.getNewValue().toString(); desktopMediator.splitPaneDividerMoved(orientation, Integer.parseInt(value)); /* Log.debug("property change: " + e.getPropertyName() + " old value: " + e.getOldValue() + " new value: " + e.getNewValue()); */ } }
From source file:edu.ku.brc.specify.tasks.subpane.wb.ImageFrame.java
public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("alwaysOnTop") && evt.getSource() == this) { // the alwaysOnTop bahavior of the window changed... update the menu item alwaysOnTopMI.setSelected(this.isAlwaysOnTop()); }// ww w. ja v a 2 s. co m }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorControl.java
/** * Reacts to property change.//ww w . j a va2 s . co m * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (SAVE_PROPERTY.equals(name) || DataComponent.DATA_MODIFIED_PROPERTY.equals(name) || PreviewPanel.PREVIEW_EDITED_PROPERTY.equals(name)) { view.setDataToSave(view.hasDataToSave()); } else if (MetadataViewer.SAVE_DATA_PROPERTY.equals(name)) { Boolean b = (Boolean) evt.getNewValue(); view.saveData(b.booleanValue()); } else if (MetadataViewer.CLEAR_SAVE_DATA_PROPERTY.equals(name) || MetadataViewer.ON_DATA_SAVE_PROPERTY.equals(name) || MetadataViewer.ADMIN_UPDATED_PROPERTY.equals(name)) { view.clearData(); } else if (UIUtilities.COLLAPSED_PROPERTY_JXTASKPANE.equals(name)) { view.handleTaskPaneCollapsed((JXTaskPane) evt.getSource()); } else if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) { File[] files = (File[]) evt.getNewValue(); view.attachFiles(files); } else if (AnnotationUI.REMOVE_ANNOTATION_PROPERTY.equals(name)) { Object object = evt.getNewValue(); if (object instanceof DocComponent) { DocComponent doc = (DocComponent) object; Object data = doc.getData(); if (data instanceof FileAnnotationData) { model.removeFileAnnotations(Collections.singletonList((FileAnnotationData) data)); } else if (data instanceof TagAnnotationData || data instanceof TermAnnotationData || data instanceof XMLAnnotationData || data instanceof LongAnnotationData || data instanceof DoubleAnnotationData || data instanceof BooleanAnnotationData) view.removeObject((DataObject) data); } else if (object instanceof TextualAnnotationComponent) { TextualAnnotationComponent doc = (TextualAnnotationComponent) object; view.removeObject(doc.getData()); } } else if (AnnotationUI.EDIT_TAG_PROPERTY.equals(name)) { Object object = evt.getNewValue(); if (object instanceof DocComponent) { //Save the tag w/o update. DataObject d = (DataObject) ((DocComponent) object).getData(); //Save the tag OmeroMetadataService svc = MetadataViewerAgent.getRegistry().getMetadataService(); long id = MetadataViewerAgent.getUserDetails().getId(); try { svc.saveData(model.getSecurityContext(), Arrays.asList(d), null, null, id); } catch (Exception e) { Logger l = MetadataViewerAgent.getRegistry().getLogger(); LogMessage msg = new LogMessage(); msg.print("Saving object"); msg.print(e); l.error(this, msg); } } } else if (OMEWikiComponent.WIKI_DATA_OBJECT_PROPERTY.equals(name)) { WikiDataObject object = (WikiDataObject) evt.getNewValue(); long id; switch (object.getIndex()) { case WikiDataObject.IMAGE: id = object.getId(); if (id < 0) viewImage(object.getName()); else viewImage(id); break; case WikiDataObject.PROTOCOL: viewProtocol(object.getId()); break; } } else if (SelectionWizard.SELECTED_ITEMS_PROPERTY.equals(name)) { Map m = (Map) evt.getNewValue(); if (m == null || m.size() != 1) return; Set set = m.entrySet(); Entry entry; Iterator i = set.iterator(); Class type; while (i.hasNext()) { entry = (Entry) i.next(); type = (Class) entry.getKey(); view.handleObjectsSelection(type, (Collection) entry.getValue()); } } else if (PreviewPanel.OPEN_FILE_PROPERTY.equals(name)) { Long id = (Long) evt.getNewValue(); if (id != null) viewProtocol(id.longValue()); } else if (MetadataViewer.SETTINGS_APPLIED_PROPERTY.equals(name)) { model.loadRenderingControl(RenderingControlLoader.RELOAD); view.onSettingsApplied(true); } else if (MetadataViewer.ACTIVITY_OPTIONS_PROPERTY.equals(name)) { List l = (List) evt.getNewValue(); view.activityOptions((Component) l.get(0), (Point) l.get(1), (Integer) l.get(2)); } else if (FigureDialog.CREATE_FIGURE_PROPERTY.equals(name)) { view.createFigure(evt.getNewValue()); } else if (FigureDialog.CLOSE_FIGURE_PROPERTY.equals(name)) { figureDialog = null; } else if (MetadataViewer.CLOSE_RENDERER_PROPERTY.equals(name)) { view.discardRenderer(evt.getNewValue()); } else if (MetadataViewer.RELATED_NODES_PROPERTY.equals(name)) { view.onRelatedNodesSet(); } else if (ScriptingDialog.RUN_SELECTED_SCRIPT_PROPERTY.equals(name)) { //view.manageScript((ScriptObject) evt.getNewValue(), // MetadataViewer.RUN); } else if (ScriptingDialog.DOWNLOAD_SELECTED_SCRIPT_PROPERTY.equals(name)) { Object value = evt.getNewValue(); if (value instanceof ScriptObject) view.manageScript((ScriptObject) value, MetadataViewer.DOWNLOAD); else if (value instanceof String) { ScriptObject script = view.getScriptFromName((String) value); if (script != null) view.manageScript(script, MetadataViewer.DOWNLOAD); } } else if (ScriptingDialog.VIEW_SELECTED_SCRIPT_PROPERTY.equals(name)) { Object value = evt.getNewValue(); if (value instanceof ScriptObject) view.manageScript((ScriptObject) value, MetadataViewer.VIEW); else if (value instanceof String) { ScriptObject script = view.getScriptFromName((String) value); if (script != null) view.manageScript(script, MetadataViewer.VIEW); } } else if (AnalysisResultsItem.ANALYSIS_RESULTS_DELETE.equals(name)) { AnalysisResultsItem item = (AnalysisResultsItem) evt.getNewValue(); List<FileAnnotationData> list = item.getAttachments(); view.fireAnnotationsDeletion(list); } else if (AnalysisResultsItem.ANALYSIS_RESULTS_VIEW.equals(name)) { AnalysisResultsItem item = (AnalysisResultsItem) evt.getNewValue(); if (view.getRndIndex() == MetadataViewer.RND_GENERAL) { model.displayAnalysisResults(item); /* ViewImage event = new ViewImage(item.getData(), null); event.setAnalysis(item); EventBus bus = MetadataViewerAgent.getRegistry().getEventBus(); bus.post(event); */ } else { model.displayAnalysisResults(item); } } else if (AnalysisResultsItem.ANALYSIS_RESULTS_CANCEL.equals(name)) { AnalysisResultsItem item = (AnalysisResultsItem) evt.getNewValue(); view.cancelAnalysisResultsLoading(item); } }
From source file:org.tinymediamanager.ui.movies.MoviePanel.java
/** * further initializations.//from www . j a va2 s . co m */ private void init() { // build menu buildMenu(); // moviename column table.getColumnModel().getColumn(0).setCellRenderer(new BorderCellRenderer()); table.getColumnModel().getColumn(0).setIdentifier("title"); //$NON-NLS-1$ // year column int width = table.getFontMetrics(table.getFont()).stringWidth(" 2000"); int titleWidth = table.getFontMetrics(table.getFont()).stringWidth(BUNDLE.getString("metatag.year")); //$NON-NLS-1$ if (titleWidth > width) { width = titleWidth; } table.getTableHeader().getColumnModel().getColumn(1).setPreferredWidth(width); table.getTableHeader().getColumnModel().getColumn(1).setMinWidth(width); table.getTableHeader().getColumnModel().getColumn(1).setMaxWidth((int) (width * 1.5)); table.getTableHeader().getColumnModel().getColumn(1).setIdentifier("year"); //$NON-NLS-1$ // rating column width = table.getFontMetrics(table.getFont()).stringWidth(" 10.0"); titleWidth = table.getFontMetrics(table.getFont()).stringWidth(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$ if (titleWidth > width) { width = titleWidth; } table.getTableHeader().getColumnModel().getColumn(2).setPreferredWidth((int) (width * 1.2)); table.getTableHeader().getColumnModel().getColumn(2).setMinWidth((int) (width * 1.2)); table.getTableHeader().getColumnModel().getColumn(2).setMaxWidth((int) (width * 1.5)); table.getTableHeader().getColumnModel().getColumn(2).setIdentifier("rating"); //$NON-NLS-1$ // date added column width = table.getFontMetrics(table.getFont()).stringWidth("01. Jan. 2000"); titleWidth = table.getFontMetrics(table.getFont()).stringWidth(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$ if (titleWidth > width) { width = titleWidth; } table.getTableHeader().getColumnModel().getColumn(3).setPreferredWidth((int) (width * 1.2)); table.getTableHeader().getColumnModel().getColumn(3).setMinWidth((int) (width * 1.2)); table.getTableHeader().getColumnModel().getColumn(3).setMaxWidth((int) (width * 1.2)); table.getTableHeader().getColumnModel().getColumn(3).setIdentifier("dateadded"); //$NON-NLS-1$ // NFO column table.getTableHeader().getColumnModel().getColumn(4) .setHeaderRenderer(new IconRenderer(BUNDLE.getString("tmm.nfo"))); //$NON-NLS-1$ table.getTableHeader().getColumnModel().getColumn(4).setMaxWidth(20); table.getColumnModel().getColumn(4).setHeaderValue(IconManager.INFO); table.getTableHeader().getColumnModel().getColumn(4).setIdentifier("nfo"); //$NON-NLS-1$ // Meta data column table.getTableHeader().getColumnModel().getColumn(5) .setHeaderRenderer(new IconRenderer(BUNDLE.getString("tmm.metadata"))); //$NON-NLS-1$ table.getTableHeader().getColumnModel().getColumn(5).setMaxWidth(20); table.getColumnModel().getColumn(5).setHeaderValue(IconManager.SEARCH); table.getTableHeader().getColumnModel().getColumn(5).setIdentifier("metadata"); //$NON-NLS-1$ // Images column table.getTableHeader().getColumnModel().getColumn(6) .setHeaderRenderer(new IconRenderer(BUNDLE.getString("tmm.images"))); //$NON-NLS-1$ table.getTableHeader().getColumnModel().getColumn(6).setMaxWidth(20); table.getColumnModel().getColumn(6).setHeaderValue(IconManager.IMAGE); table.getTableHeader().getColumnModel().getColumn(6).setIdentifier("images"); //$NON-NLS-1$ // trailer column table.getTableHeader().getColumnModel().getColumn(7) .setHeaderRenderer(new IconRenderer(BUNDLE.getString("tmm.trailer"))); //$NON-NLS-1$ table.getTableHeader().getColumnModel().getColumn(7).setMaxWidth(20); table.getColumnModel().getColumn(7).setHeaderValue(IconManager.CLAPBOARD); table.getTableHeader().getColumnModel().getColumn(7).setIdentifier("trailer"); //$NON-NLS-1$ // subtitles column table.getTableHeader().getColumnModel().getColumn(8) .setHeaderRenderer(new IconRenderer(BUNDLE.getString("tmm.subtitles"))); //$NON-NLS-1$ table.getTableHeader().getColumnModel().getColumn(8).setMaxWidth(20); table.getColumnModel().getColumn(8).setHeaderValue(IconManager.SUBTITLE); table.getTableHeader().getColumnModel().getColumn(8).setIdentifier("subtitle"); //$NON-NLS-1$ // watched column table.getTableHeader().getColumnModel().getColumn(9) .setHeaderRenderer(new IconRenderer(BUNDLE.getString("metatag.watched"))); //$NON-NLS-1$ table.getTableHeader().getColumnModel().getColumn(9).setMaxWidth(20); table.getColumnModel().getColumn(9).setHeaderValue(IconManager.PLAY_SMALL); table.getTableHeader().getColumnModel().getColumn(9).setIdentifier("watched"); //$NON-NLS-1$ table.setSelectionModel(movieSelectionModel.getSelectionModel()); // selecting first movie at startup if (movieList.getMovies() != null && movieList.getMovies().size() > 0) { ListSelectionModel selectionModel = table.getSelectionModel(); if (selectionModel.isSelectionEmpty()) { selectionModel.setSelectionInterval(0, 0); } } // hide columns if needed if (!MovieModuleManager.MOVIE_SETTINGS.isYearColumnVisible()) { table.hideColumn("year"); //$NON-NLS-1$ } if (!MovieModuleManager.MOVIE_SETTINGS.isRatingColumnVisible()) { table.hideColumn("rating"); //$NON-NLS-1$ } if (!MovieModuleManager.MOVIE_SETTINGS.isDateAddedColumnVisible()) { table.hideColumn("dateadded"); //$NON-NLS-1$ } if (!MovieModuleManager.MOVIE_SETTINGS.isNfoColumnVisible()) { table.hideColumn("nfo"); //$NON-NLS-1$ } if (!MovieModuleManager.MOVIE_SETTINGS.isMetadataColumnVisible()) { table.hideColumn("metadata"); //$NON-NLS-1$ } if (!MovieModuleManager.MOVIE_SETTINGS.isImageColumnVisible()) { table.hideColumn("images"); //$NON-NLS-1$ } if (!MovieModuleManager.MOVIE_SETTINGS.isTrailerColumnVisible()) { table.hideColumn("trailer"); //$NON-NLS-1$ } if (!MovieModuleManager.MOVIE_SETTINGS.isSubtitleColumnVisible()) { table.hideColumn("subtitle"); //$NON-NLS-1$ } if (!MovieModuleManager.MOVIE_SETTINGS.isWatchedColumnVisible()) { table.hideColumn("watched"); //$NON-NLS-1$ } // and add a propertychangelistener to the columnhider PropertyChangeListener settingsPropertyChangeListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() instanceof MovieSettings) { if ("yearColumnVisible".equals(evt.getPropertyName())) { setColumnVisibility("year", (Boolean) evt.getNewValue()); //$NON-NLS-1$ } if ("ratingColumnVisible".equals(evt.getPropertyName())) { setColumnVisibility("rating", (Boolean) evt.getNewValue()); //$NON-NLS-1$ } if ("nfoColumnVisible".equals(evt.getPropertyName())) { setColumnVisibility("nfo", (Boolean) evt.getNewValue()); } if ("metadataColumnVisible".equals(evt.getPropertyName())) { setColumnVisibility("metadata", (Boolean) evt.getNewValue()); } if ("dateAddedColumnVisible".equals(evt.getPropertyName())) { setColumnVisibility("dateadded", (Boolean) evt.getNewValue()); } if ("imageColumnVisible".equals(evt.getPropertyName())) { setColumnVisibility("images", (Boolean) evt.getNewValue()); //$NON-NLS-1$ } if ("trailerColumnVisible".equals(evt.getPropertyName())) { setColumnVisibility("trailer", (Boolean) evt.getNewValue()); //$NON-NLS-1$ } if ("subtitleColumnVisible".equals(evt.getPropertyName())) { setColumnVisibility("subtitle", (Boolean) evt.getNewValue()); //$NON-NLS-1$ } if ("watchedColumnVisible".equals(evt.getPropertyName())) { setColumnVisibility("watched", (Boolean) evt.getNewValue()); //$NON-NLS-1$ } } } private void setColumnVisibility(Object identifier, Boolean visible) { if (visible) { table.showColumn(identifier); } else { table.hideColumn(identifier); } } }; MovieModuleManager.MOVIE_SETTINGS.addPropertyChangeListener(settingsPropertyChangeListener); // initialize filteredCount lblMovieCountFiltered.setText(String.valueOf(movieTableModel.getRowCount())); addKeyListener(); }
From source file:com.dfki.av.sudplan.ui.MainFrame.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(EventHolder.LAYERINFO_RETREIVAL_COMPLETE)) { pbWMS.setIndeterminate(false);// w ww. j a va 2 s . c o m pbWMS.setVisible(false); cLayerList.removeAllItems(); if (evt.getNewValue() instanceof List<?>) { for (LayerInfo layerInfo : (List<LayerInfo>) evt.getNewValue()) { cLayerList.addItem(layerInfo); } } else if (evt.getNewValue() instanceof LayerInfo) { cLayerList.addItem((LayerInfo) evt.getNewValue()); } else { log.error("Wrong event value (not instanceof LayerInfo or List<LayerInfo>)"); } cLayerList.setEnabled(true); bAddWMSHeight.setEnabled(true); bGoWMSHeight.setEnabled(true); } if (evt.getPropertyName().equals(EventHolder.LAYERINFO_RETREIVAL_FAILED)) { resetWMSHeightDialog(); JOptionPane.showMessageDialog(dWMSHeight, "Could not retreive WMS data from server.", "WMS-Server Error", JOptionPane.WARNING_MESSAGE); } }
From source file:org.tinymediamanager.ui.movies.MoviePanel.java
/** * Create the panel.// ww w . java 2 s .co m */ 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()); } }