コード例 #1
0
  /**
   * Reacts to property change events 'editorClosing', 'closeFrame', and 'name'.
   *
   * @param e the property change event.
   */
  public void propertyChange(PropertyChangeEvent e) {

    // Handles the removal of editor frames from desktop
    String name = e.getPropertyName();

    if ("editorClosing".equals(name)) {

      // find NewValue in String array, and remove
      for (int n = 0; n < sessionNodeKeys.size(); n++) {
        if (e.getNewValue().equals((sessionNodeKeys.get(n)))) {
          sessionNodeKeys.remove(n);
        }
      }
    } else if ("closeFrame".equals(e.getPropertyName())) {
      if (getFramesMap().containsKey(e.getSource())) {
        Object frameObject = getFramesMap().get(e.getSource());
        JInternalFrame frame = (JInternalFrame) frameObject;
        frame.setVisible(false);
        frame.dispose();
      }
    } else if ("name".equals(e.getPropertyName())) {
      if (getFramesMap().containsKey(e.getSource())) {
        Object frameObject = getFramesMap().get(e.getSource());
        JInternalFrame frame = (JInternalFrame) frameObject;
        String _name = (String) (e.getNewValue());
        frame.setTitle(_name);
        setMainTitle(_name);
      }
    }
  }
コード例 #2
0
ファイル: IrisVisualizer.java プロジェクト: jbudynk/iris
 public void disposeCurrentFrame() {
   if (currentFrame != null) {
     lastLocation = currentFrame.getLocation();
     currentFrame.setVisible(false);
     currentFrame.dispose();
     currentFrame = null;
   }
 }
コード例 #3
0
  public void closeEmptySessions() {
    JInternalFrame[] frames = desktopPane.getAllFramesInLayer(0);

    for (JInternalFrame frame : frames) {
      Object o = frame.getContentPane().getComponents()[0];

      if (o instanceof SessionEditor) {
        SessionEditor sessionEditor = (SessionEditor) o;
        SessionEditorWorkbench workbench = sessionEditor.getSessionWorkbench();
        Graph graph = workbench.getGraph();
        if (graph.getNumNodes() == 0) {
          frame.dispose();
        }
      }
    }
  }