Exemplo n.º 1
0
  /** @param value Either AlgebraView.MODE_DEPDENCY or AlgebraView.MODE_TYPE */
  public void setTreeMode(SortMode value) {
    if (getTreeMode().equals(value)) {
      return;
    }

    clearView();

    this.treeMode = value;
    initModel();

    kernel.notifyAddAll(this);
    setLabels();
  }
Exemplo n.º 2
0
  /** Creates new AlgebraView */
  public AlgebraView(AlgebraController algCtrl) {

    AbstractApplication.debug("XXX creating Algebra View XXX", 1);

    app = algCtrl.getApplication();
    kernel = algCtrl.getKernel();
    algCtrl.setView(this);
    this.algebraController = algCtrl;
    // this is the default value
    treeMode = SortMode.DEPENDENCY;

    // cell renderer (tooltips) and editor
    ToolTipManager.sharedInstance().registerComponent(this);

    // EDITOR
    setEditable(true);
    initTreeCellRendererEditor();

    // add listener
    addMouseListener(algCtrl);
    addMouseMotionListener(algCtrl);

    // add small border
    setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 0));

    // initializes the tree model
    model = new DefaultTreeModel(null);
    initModel();
    setModel(model);

    setLargeModel(true);
    setLabels();

    // tree's options
    setRootVisible(false);
    // show lines from parent to children
    putClientProperty("JTree.lineStyle", "Angled");
    setInvokesStopCellEditing(true);
    setScrollsOnExpand(true);
    setRowHeight(-1); // to enable flexible height of cells

    setToggleClickCount(1);

    // enable drag n drop
    algCtrl.enableDnD();

    // attachView();
  }