Example usage for java.beans PropertyChangeEvent getPropertyName

List of usage examples for java.beans PropertyChangeEvent getPropertyName

Introduction

In this page you can find the example usage for java.beans PropertyChangeEvent getPropertyName.

Prototype

public String getPropertyName() 

Source Link

Document

Gets the programmatic name of the property that was changed.

Usage

From source file:com.vmware.vfabric.ide.eclipse.tcserver.internal.ui.TcStaticResourcesEditorSection.java

protected void addConfigurationChangeListener() {
    listener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (TcServer.PROPERTY_ENHANCED_REDEPLOY.equals(event.getPropertyName())) {
                updateEnablement();/*from w  w  w. j  av a2  s.c  o  m*/
            } else if (TcServer.PROPERTY_STATIC_FILENAMES.equals(event.getPropertyName())) {
                filenamesTableViewer.setInput(server);
            }
        }

    };
    serverWorkingCopy.getServerWorkingCopy().addPropertyChangeListener(listener);
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.OriginalMetadataComponent.java

/**
 * Downloads the original file./*from   w ww .ja va2s  . c  om*/
 * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
 */
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) {
        File[] files = (File[]) evt.getNewValue();
        File folder = files[0];
        if (folder == null)
            folder = UIUtilities.getDefaultFolder();
        UserNotifier un = MetadataViewerAgent.getRegistry().getUserNotifier();
        ImageData img = model.getImage();
        if (img == null)
            return;
        IconManager icons = IconManager.getInstance();
        DownloadActivityParam activity = new DownloadActivityParam(img.getId(),
                DownloadActivityParam.METADATA_FROM_IMAGE, folder, icons.getIcon(IconManager.DOWNLOAD_22));
        un.notifyActivity(model.getSecurityContext(), activity);
    }
}

From source file:ui.panel.UILicenseDetail.java

public JPanel createButtonPanel() {
    JPanel panel = p.createPanel(Layouts.flow);
    panel.setLayout(new FlowLayout(FlowLayout.CENTER));

    btnSubmit = b.createButton("Next");
    btnBack = b.createButton("Back");
    btnAdd = b.createButton("Add License");

    panel.add(btnBack);/*from   ww w.  j a v a  2s  . co  m*/
    panel.add(btnAdd);
    panel.add(btnSubmit);
    btnBack.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Data.mainFrame.showPanel("bucket");
        }
    });

    btnAdd.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Data.mainFrame.addPanel(Data.mainFrame.uiLicenseAdd = new UILicenseAdd(), "licenseAdd");
            Data.mainFrame.showPanel("licenseAdd");
        }
    });
    btnSubmit.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            SwingWorker<Void, Void> mySwingWorker = new SwingWorker<Void, Void>() {
                @Override
                protected Void doInBackground() throws Exception {
                    int row = tblInfo.getSelectedRow();
                    if (row == -1) {
                        JOptionPane.showMessageDialog(Data.mainFrame, "Please Select a License", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    } else {
                        Data.licenseNumber = (String) tblInfo.getModel().getValueAt(row, 0);
                        Data.mainFrame.uiAccessKeySelect = new UIAccessKeySelect();
                        Data.mainFrame.addPanel(Data.mainFrame.uiAccessKeySelect, "access");
                        Data.mainFrame.showPanel("access");
                    }

                    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 Access Keys"), 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("bucket");
        }
    });

    btnAdd.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
            Data.mainFrame.addPanel(Data.mainFrame.uiLicenseAdd = new UILicenseAdd(), "licenseAdd");
            Data.mainFrame.pack();
            Data.mainFrame.showPanel("licenseAdd");
        }
    });

    return panel;
}

From source file:org.pentaho.ui.xul.binding.DefaultBinding.java

protected PropertyChangeListener setupBinding(final Reference a, final String va, final Reference b,
        final String vb, final Direction dir) {
    if (a.get() == null || va == null) {
        handleException(new BindingException("source bean or property is null"));
    }/*from  w  w w .  j  av  a 2 s . c o  m*/
    if (!(a.get() instanceof XulEventSource)) {
        handleException(new BindingException(
                "Binding error, source object " + a.get() + " not a XulEventSource instance"));
    }
    if (b.get() == null || vb == null) {
        handleException(new BindingException("target bean or property is null"));
    }
    Method sourceGetMethod = BindingUtil.findGetMethod(a.get(), va);

    Class getterClazz = BindingUtil.getMethodReturnType(sourceGetMethod, a.get());
    getterMethods.push(sourceGetMethod);

    // find set method
    final Method targetSetMethod = BindingUtil.findSetMethod(b.get(), vb, getterClazz);

    // setup prop change listener to handle binding
    PropertyChangeListener listener = new PropertyChangeListener() {
        public void propertyChange(final PropertyChangeEvent evt) {
            final PropertyChangeListener cThis = this;
            if (evt.getPropertyName().equalsIgnoreCase(va)) {
                try {
                    Object targetObject = b.get();
                    if (targetObject == null) {
                        logger.debug("Binding target was Garbage Collected, removing propListener");
                        DefaultBinding.this.destroyBindings();
                        return;
                    }

                    Object value = doConversions(evt.getNewValue(), dir);
                    final Object finalVal = evaluateExpressions(value);

                    logger.debug("Setting val: " + finalVal + " on: " + targetObject);
                    targetSetMethod.invoke(targetObject, finalVal);

                } catch (Exception e) {
                    logger.debug(e);
                    handleException(new BindingException("Error invoking setter method ["
                            + targetSetMethod.getName() + "] on target: " + target.get(), e));
                }
            }
        }
    };
    ((XulEventSource) a.get()).addPropertyChangeListener(listener);

    return listener;
}

From source file:org.openmicroscopy.shoola.agents.fsimporter.view.ImporterControl.java

/**
 * Handles a PropertyChangedEvent/*  w  w  w  .j  av a 2 s. c o  m*/
 * @param evt The event
 */
private void handlePropertyChangedEvent(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (ImportDialog.IMPORT_PROPERTY.equals(name)) {
        actionsMap.get(CANCEL_BUTTON).setEnabled(true);
        model.importData((ImportableObject) evt.getNewValue());
    } else if (ImportDialog.LOAD_TAGS_PROPERTY.equals(name)) {
        model.loadExistingTags();
    } else if (ImportDialog.CANCEL_SELECTION_PROPERTY.equals(name)) {
        model.close();
    } else if (ClosableTabbedPane.CLOSE_TAB_PROPERTY.equals(name)) {
        model.removeImportElement(evt.getNewValue());
    } else if (FileImportComponent.SUBMIT_ERROR_PROPERTY.equals(name)) {
        submitFiles((FileImportComponent) evt.getNewValue());
    } else if (ImportDialog.REFRESH_LOCATION_PROPERTY.equals(name)) {
        model.refreshContainers((ImportLocationDetails) evt.getNewValue());
    } else if (ImportDialog.CREATE_OBJECT_PROPERTY.equals(name)) {
        ObjectToCreate l = (ObjectToCreate) evt.getNewValue();
        model.createDataObject(l);
    } else if (StatusLabel.DEBUG_TEXT_PROPERTY.equals(name)) {
        view.appendDebugText((String) evt.getNewValue());
    } else if (MacOSMenuHandler.QUIT_APPLICATION_PROPERTY.equals(name)) {
        Action a = getAction(EXIT);
        ActionEvent event = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "");
        a.actionPerformed(event);
    } else if (ImportDialog.PROPERTY_GROUP_CHANGED.equals(name)) {
        GroupData newGroup = (GroupData) evt.getNewValue();
        model.setUserGroup(newGroup);
    } else if (StatusLabel.FILE_IMPORT_STARTED_PROPERTY.equals(name)
            || FileImportComponent.CANCEL_IMPORT_PROPERTY.equals(name)) {
        checkDisableCancelAllButtons();
    } else if (StatusLabel.IMPORT_DONE_PROPERTY.equals(name)) {
        model.onImportComplete((FileImportComponent) evt.getNewValue());
    } else if (StatusLabel.UPLOAD_DONE_PROPERTY.equals(name)) {
        model.onUploadComplete((FileImportComponent) evt.getNewValue());
    }
}

From source file:org.tinymediamanager.ui.tvshows.TvShowMediaInformationPanel.java

/**
 * Instantiates a new tv show media information panel.
 * /*from   w  w w . j a va 2s .c  o m*/
 * @param model
 *          the model
 */
public TvShowMediaInformationPanel(TvShowSelectionModel model) {
    this.selectionModel = model;
    mediaFileEventList = new ObservableElementList<>(
            GlazedLists.threadSafeList(new BasicEventList<MediaFile>()),
            GlazedLists.beanConnector(MediaFile.class));

    setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
            FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC,
            FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
            FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"),
                    FormFactory.NARROW_LINE_GAP_ROWSPEC, }));

    lblDateAddedT = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$
    add(lblDateAddedT, "2, 2");

    lblDateAdded = new JLabel("");
    add(lblDateAdded, "4, 2");

    lblWatchedT = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$
    add(lblWatchedT, "6, 2");

    cbWatched = new JCheckBox("");
    cbWatched.setEnabled(false);
    add(cbWatched, "8, 2");

    // btnPlay = new JButton("Play");
    // btnPlay.addActionListener(new ActionListener() {
    // public void actionPerformed(ActionEvent arg0) {
    // if (!StringUtils.isEmpty(lblMoviePath.getNormalText())) {
    // // get the location from the label
    // StringBuilder movieFile = new
    // StringBuilder(lblMoviePath.getNormalText());
    // movieFile.append(File.separator);
    // movieFile.append(movieSelectionModel.getselectedTvShowEpisode().getMediaFiles().get(0).getFilename());
    // File f = new File(movieFile.toString());
    //
    // try {
    // if (f.exists()) {
    //
    // String vlcF = f.getAbsolutePath();
    // // F I X M E: german umlauts do not decode correctly; Bug in
    // // libDvdNav? so workaround;
    // if (vlcF.matches(".*[].*")) {
    // LOGGER.debug("VLC: workaround: german umlauts found - use system player");
    // Desktop.getDesktop().open(f);
    // }
    // else {
    // try {
    //
    // if (!vlcF.startsWith("/")) {
    // // add the missing 3rd / if not start with one (eg windows)
    // vlcF = "/" + vlcF;
    // }
    // String mrl = new FileMrl().file(vlcF).value();
    //
    // final EmbeddedMediaPlayerComponent mediaPlayerComponent = new
    // EmbeddedMediaPlayerComponent();
    // JFrame frame = new JFrame("player");
    // frame.setLocation(100, 100);
    // frame.setSize(1050, 600);
    // frame.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
    // frame.setVisible(true);
    // frame.setContentPane(mediaPlayerComponent);
    // // mrl = mrl.replace("file://", ""); // does not work either
    //
    // LOGGER.debug("VLC: playing " + mrl);
    // Boolean ok = mediaPlayerComponent.getMediaPlayer().playMedia(mrl);
    // if (!ok) {
    // LOGGER.error("VLC: couldn't create player window!");
    // }
    // }
    // catch (RuntimeException e) {
    // LOGGER.warn("VLC: has not been initialized on startup - use system player");
    // Desktop.getDesktop().open(f);
    // }
    // catch (NoClassDefFoundError e) {
    // LOGGER.warn("VLC: has not been initialized on startup - use system player");
    // Desktop.getDesktop().open(f);
    // }
    //
    // } // end else
    // } // end exists
    // } // end try
    // catch (IOException e) {
    // LOGGER.error("Error opening file", e);
    // }
    // } // end isEmpty
    // }
    // });
    // add(btnPlay, "10, 2");

    lblTvShowPathT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$
    add(lblTvShowPathT, "2, 4");

    lblTvShowPath = new LinkLabel("");
    lblTvShowPath.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            if (!StringUtils.isEmpty(lblTvShowPath.getNormalText())) {
                // get the location from the label
                Path path = Paths.get(lblTvShowPath.getNormalText());
                try {
                    // check whether this location exists
                    if (Files.exists(path)) {
                        TmmUIHelper.openFile(path);
                    }
                } catch (Exception ex) {
                    LOGGER.error("open filemanager", ex);
                    MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, path,
                            "message.erroropenfolder", new String[] { ":", ex.getLocalizedMessage() }));
                }
            }
        }
    });
    lblTvShowPathT.setLabelFor(lblTvShowPath);
    lblTvShowPathT.setLabelFor(lblTvShowPath);
    add(lblTvShowPath, "4, 4, 5, 1");

    panelMediaFiles = new MediaFilesPanel(mediaFileEventList);
    add(panelMediaFiles, "2, 6, 9, 1, fill, fill");

    initDataBindings();

    // install the propertychangelistener
    PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            String property = propertyChangeEvent.getPropertyName();
            Object source = propertyChangeEvent.getSource();
            // react on selection of a tv show and change of media files
            if ((source.getClass() == TvShowSelectionModel.class && "selectedTvShow".equals(property))
                    || (source.getClass() == TvShowEpisode.class && "mediaFiles".equals(property))) {
                try {
                    mediaFileEventList.getReadWriteLock().writeLock().lock();
                    mediaFileEventList.clear();
                    mediaFileEventList.addAll(selectionModel.getSelectedTvShow().getMediaFiles());
                } catch (Exception e) {
                } finally {
                    mediaFileEventList.getReadWriteLock().writeLock().unlock();
                }
                try {
                    panelMediaFiles.adjustColumns();
                } catch (Exception e) {
                }
            }
        }
    };

    selectionModel.addPropertyChangeListener(propertyChangeListener);
}

From source file:com.emr.schemas.SavedProcessesDataMover.java

/**
 * Constructor//from   w ww .j  a va2s  . c om
 */
public SavedProcessesDataMover() {
    initComponents();
    this.setClosable(true);
    final Action processDelete = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JTable table = (JTable) e.getSource();
            int modelRow = Integer.valueOf(e.getActionCommand());
            String foreignKeysTable = (String) tblProcesses.getModel().getValueAt(modelRow, 0);
            if (foreignKeysTable == null || "".equals(foreignKeysTable)) {
                JOptionPane.showMessageDialog(null, "Table is Empty", "Empty Table", JOptionPane.ERROR_MESSAGE);
            } else {

            }
        }

    };
    final SQLiteGetProcesses sp = new SQLiteGetProcesses();
    sp.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            switch (event.getPropertyName()) {
            case "progress":
                System.out.println("Fetching data from db");
                break;
            case "state":
                switch ((SwingWorker.StateValue) event.getNewValue()) {
                case DONE:
                    try {
                        model = sp.get();
                        tblProcesses.setModel(model);
                        tblProcesses.getColumnModel().getColumn(0).setMaxWidth(300);
                        //hide irrelevant columns
                        tblProcesses.getColumnModel().getColumn(2).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(2).setMaxWidth(0);
                        tblProcesses.getColumnModel().getColumn(3).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(3).setMaxWidth(0);
                        tblProcesses.getColumnModel().getColumn(4).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(4).setMaxWidth(0);
                        tblProcesses.getColumnModel().getColumn(5).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(5).setMaxWidth(0);
                        tblProcesses.getColumnModel().getColumn(6).setMinWidth(0);
                        tblProcesses.getColumnModel().getColumn(6).setMaxWidth(0);

                        ButtonColumn buttonColumn = new ButtonColumn(tblProcesses, processDelete, 7, "Delete");
                    } catch (final CancellationException ex) {
                        Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (ExecutionException ex) {
                        Logger.getLogger(SavedProcessesDataMover.class.getName()).log(Level.SEVERE, null, ex);
                    }

                    break;
                }
                break;
            }
        }

    });
    sp.execute();

    tblProcesses.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                JTable target = (JTable) e.getSource();
                int rowIndex = target.getSelectedRow();
                String selectQry = (String) target.getModel().getValueAt(rowIndex, 2);
                String destinationTable = (String) target.getModel().getValueAt(rowIndex, 3);
                String truncateFirst = (String) target.getModel().getValueAt(rowIndex, 4);
                String destinationColumns = (String) target.getModel().getValueAt(rowIndex, 5);
                String columnsToBeMapped = (String) target.getModel().getValueAt(rowIndex, 6);
                lblUpdateText.setText("<html><b color='red'>Moving Data</b></html>");
                dbProgressBar.setIndeterminate(true);
                new DBUpdater(selectQry, destinationTable, truncateFirst, destinationColumns, columnsToBeMapped)
                        .execute();
            }
        }

        @Override
        public void mousePressed(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void mouseEntered(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

        @Override
        public void mouseExited(MouseEvent e) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
    });

}

From source file:ca.sqlpower.architect.swingui.ProfileGraphPanel.java

/**
 * Switches the graph to show the value distribution for the given column.
 * /*w w w. j a v  a 2 s  .  c  o m*/
 * @param cr
 *            The profile result to display. Must not be null.
 */
public void displayProfile(final ColumnProfileResult cr) {
    this.columnProfileResult = cr;
    displayArea.removeAll();
    if (cr.getException() != null) {
        displayInvalidProfile(cr);
        displayArea.add(invalidResultsPanel);
    } else {
        displayValidProfile(cr);
        displayArea.add(validResultsPanel);
    }

    if (notesField != null) {
        if (notesFieldListener != null) {
            notesField.getDocument().removeDocumentListener(notesFieldListener);
            notesFieldListener.cancel();
        }
        columnProfileResult.removeSPListener(notesListener);
        notesField.setText(cr.getNotes());
        notesListener = new AbstractSPListener() {
            @Override
            public void propertyChanged(PropertyChangeEvent evt) {
                if ("notes".equals(evt.getPropertyName())) {
                    if (!evt.getNewValue().equals(notesField.getText())) {
                        notesField.setText((String) evt.getNewValue());
                    }
                }
            }
        };
        cr.addSPListener(notesListener);
        notesFieldListener = new TimedDocumentListener(cr.getProfiledObject().getName(), 2500) {
            @Override
            public void textChanged() {
                final String notesText = notesField.getText();
                profilePanel.getProfileManager().getRunnableDispatcher().runInForeground(new Runnable() {
                    @Override
                    public void run() {
                        cr.setNotes(notesText);
                    }
                });
            }
        };
        notesField.getDocument().addDocumentListener(notesFieldListener);
    }

    displayArea.revalidate();
    displayArea.repaint();
}

From source file:fi.elfcloud.client.dialog.UploadDialog.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    int value;/*from  w w w  .  j  a  va 2 s .  c o  m*/
    if ("totalNumBytesRead" == evt.getPropertyName()) { //$NON-NLS-1$
        task.progress += (Long) evt.getNewValue() - (Long) evt.getOldValue();
        value = (int) ((task.progress.doubleValue() / task.totalLength.doubleValue()) * 100);
        progressBar.setValue(value);
        setTitle(Messages.getString("UploadDialog.window_title_uploading_1") + task.filesSent //$NON-NLS-1$
                + Messages.getString("UploadDialog.window_title_uploading_2") + task.fileCount + " - " //$NON-NLS-1$//$NON-NLS-2$
                + Integer.toString(value) + "%"); //$NON-NLS-1$
    }
    if ("progress" == evt.getPropertyName()) { //$NON-NLS-1$
        int progress = (Integer) evt.getNewValue();
        progressBar.setValue(progress);
        setTitle(Messages.getString("UploadDialog.window_title_uploading_1") + task.filesSent //$NON-NLS-1$
                + Messages.getString("UploadDialog.window_title_uploading_2") + task.fileCount + " - " //$NON-NLS-1$//$NON-NLS-2$
                + Integer.toString(progress) + "%"); //$NON-NLS-1$
    }
}

From source file:ec.ui.view.RevisionSaSeriesView.java

/**
 * Constructs a new view/*from   w ww  . j  ava2s .  co  m*/
 */
public RevisionSaSeriesView() {
    setLayout(new BorderLayout());

    sRenderer = new XYLineAndShapeRenderer();
    sRenderer.setBaseShapesVisible(false);
    //sRenderer.setSeriesStroke(1, new BasicStroke(0.75f, 1, 1, 1.0f, new float[]{2f, 3f}, 0.0f));
    sRenderer.setBasePaint(themeSupport.getLineColor(ColorScheme.KnownColor.RED));

    revRenderer = new XYLineAndShapeRenderer(false, true);

    mainChart = createMainChart();

    chartpanel_ = new JChartPanel(ChartFactory.createLineChart(null, null, null, null, PlotOrientation.VERTICAL,
            false, false, false));

    documentpanel_ = ComponentFactory.getDefault().newHtmlView();

    JSplitPane splitpane = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, chartpanel_,
            NbComponents.newJScrollPane(documentpanel_));
    splitpane.setDividerLocation(0.5);
    splitpane.setResizeWeight(.5);

    popup = new ChartPopup(null, false);

    chartpanel_.addChartMouseListener(new ChartMouseListener() {
        @Override
        public void chartMouseClicked(ChartMouseEvent e) {
            if (lastIndexSelected != -1) {
                revRenderer.setSeriesShapesFilled(lastIndexSelected, false);
            }
            if (e.getEntity() != null) {
                if (e.getEntity() instanceof XYItemEntity) {
                    XYItemEntity item = (XYItemEntity) e.getEntity();
                    if (item.getDataset().equals(mainChart.getXYPlot().getDataset(REV_INDEX))) {
                        int i = item.getSeriesIndex();

                        revRenderer.setSeriesShape(i, new Ellipse2D.Double(-3, -3, 6, 6));
                        revRenderer.setSeriesShapesFilled(i, true);
                        revRenderer.setSeriesPaint(i, themeSupport.getLineColor(ColorScheme.KnownColor.BLUE));

                        lastIndexSelected = i;

                        showRevisionPopup(e);
                    }
                }
            }
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent cme) {
        }
    });

    chartpanel_.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(JChartPanel.ZOOM_SELECTION_CHANGED)) {
                showSelectionPopup((Rectangle2D) evt.getNewValue());
            }
        }
    });

    this.add(splitpane, BorderLayout.CENTER);
    splitpane.setResizeWeight(0.5);

    onColorSchemeChange();
}