Beispiel #1
0
  public void release() {
    for (EditorView<T> view : views) {
      view.release();
      view.removePropertyChangeListener(this);
    }

    views.clear();

    inputTabs.removeChangeListener(inputTabsChangeListener);
    inputTabs.removeAll();

    inspectorPanel.release();
    document.release();
  }
Beispiel #2
0
  public Editor(T document) {
    super(new BorderLayout());
    this.document = document;

    setBackground(Color.LIGHT_GRAY);
    inputTabs = new JTabbedPane(JTabbedPane.LEFT, JTabbedPane.SCROLL_TAB_LAYOUT);
    inputTabs.setUI(new VerticalTabbedPaneUI());

    inputTabs.setFont(inputTabs.getFont().deriveFont(8));
    inputTabsChangeListener = new InputTabsChangeListener();
    inputTabs.addChangeListener(inputTabsChangeListener);

    inspectorPanel = JInspectorPanelFactory.build(inputTabs);
    add(inspectorPanel.getComponent(), BorderLayout.CENTER);
  }
Beispiel #3
0
 public void selectView(String viewId) {
   for (int c = 0; c < views.size(); c++) {
     if (views.get(c).getViewId().equals(viewId)) {
       inputTabs.setSelectedIndex(c);
       return;
     }
   }
 }
Beispiel #4
0
  public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals(EditorView.TITLE_PROPERTY)) {
      int ix = views.indexOf(evt.getSource());
      if (ix == -1) return;

      inputTabs.setTitleAt(ix, (String) evt.getNewValue());
    }
  }
Beispiel #5
0
  public void addEditorView(EditorView<T> editorView) {
    views.add(editorView);

    inputTabs.addTab(
        null,
        new VTextIcon(inputTabs, editorView.getTitle(), VTextIcon.ROTATE_LEFT),
        editorView.getComponent());

    editorView.addPropertyChangeListener(this);
    editorView.addLocationListener(this);

    editorView.setDocument(document);
  }
Beispiel #6
0
 public void selectView(int viewIndex) {
   inputTabs.setSelectedIndex(viewIndex);
 }