Exemplo n.º 1
0
 private Rectangle layoutRects() {
   int limit = helpers.size();
   int visiCount = 0;
   int maxHeight = 50;
   int maxWidth = 50;
   int nextVisibleCol = Integer.MAX_VALUE;
   for (int i = 0; i < limit; i++) {
     TDHelper thisHelper = helpers.elementAt(i);
     if (thisHelper.indentation > nextVisibleCol) {
       thisHelper.drawRect = null;
       continue;
     }
     if (thisHelper.subsVisible) {
       nextVisibleCol = Integer.MAX_VALUE;
     } else {
       nextVisibleCol = thisHelper.indentation;
     }
     thisHelper.layoutRect(visiCount, thisHelper.indentation, auxData);
     visiCount++;
     maxWidth = Math.max(maxWidth, thisHelper.drawRect.x + thisHelper.drawRect.width);
     maxHeight = Math.max(maxHeight, thisHelper.drawRect.y + thisHelper.drawRect.height);
   }
   Rectangle rtnVal =
       new Rectangle(maxWidth + TDHelper.rowPixelBase, maxHeight + TDHelper.colPixelBase);
   this.setSize(Math.max(500, rtnVal.width), Math.max(500, rtnVal.height));
   return rtnVal;
 }
Exemplo n.º 2
0
 void processClick(int x, int y) {
   int idx = findHelperAt(x, y);
   if (idx < 0) return;
   TDHelper h = helpers.elementAt(idx);
   h.subsVisible = !h.subsVisible;
   layoutRects();
   repaint();
 }
Exemplo n.º 3
0
 private static void createHelperStruct2(
     TreeDisplayable tgt, Vector<TDHelper> helpers, int indent, Object auxData) {
   TDHelper helper = new TDHelper(null, indent, true, doWindow);
   if (doWindow) helper.layoutRect(helpers.size(), indent, auxData);
   helpers.addElement(helper);
   if (tgt == null) return;
   for (int subobjCount = 0; ; subobjCount++) {
     try {
       TreeDisplayable subobj = tgt.getDrawTreeSubobj(subobjCount);
       if (subobj != null && subobj.nodeIsList()) {
         createHelperStruct2(subobj, helpers, indent + 1, auxData);
       } else {
         createHelperStruct(subobj, helpers, indent + 1, auxData);
       }
     } catch (TreeDrawException x) {
       break;
     }
   }
 }