Exemple #1
0
    public void layoutContainer(Container target) {
      /*
       * Algorithm is as follows: - the "left-hand" components take 33% of
       * horizontal space - scrollPane takes the remaining space
       */
      synchronized (target.getTreeLock()) {
        if (pane == null || spane == null) return;
        Dimension dim = target.getSize();
        if (dim.height < 20) return;

        spane.setBounds(new Rectangle(0, 0, dim.width, dim.height));
        // Dimension dim0 = new Dimension(dim.width-2, dim.height-2);
        // pane.setPreferredSize(dim0);
        // JViewport viewPort = spane.getViewport();
        // viewPort.setViewSize(dim0);
        // paramsLayout.setReferenceSize(dim0.width, dim0.height);
      }
    }
Exemple #2
0
 public void layoutContainer(Container target) {
   synchronized (target.getTreeLock()) {
     cont = target;
     if (zList == null) return;
     if (zList.size() < 1) return;
     if (rotated) {
       rotateLayout();
       return;
     }
     Dimension pSize = target.getSize();
     int x, x1;
     int y, y1;
     int n, k, i;
     int ox, oy, ow;
     int pw = pSize.width - 12;
     int ph = pSize.height - 12;
     float fw, fh;
     float rx, ry, rd;
     boolean multiZone = false;
     boolean marvin = false;
     SmsSample obj;
     Vector<SmsSample> oList;
     GrkZone zone;
     fw = 0;
     fh = 0;
     zone = zList.elementAt(0);
     if (zone.trayType == GRK49 || zone.trayType == GRK97) marvin = true;
     if (zList.size() == 1) { // one zone only
       // zone = (GrkZone) zList.elementAt(0);
       x = 0;
       y = 0;
       fw = zone.newWidth;
       fh = zone.newHeight;
       if (marvin) {
         ph = ph - 34;
         pw = pw - 20;
       }
     } else {
       multiZone = true;
       ph = ph - 14;
       if (marvin) {
         ph = ph - 14;
         pw = pw - 14;
       }
       for (n = 0; n < zList.size(); n++) {
         zone = zList.elementAt(n);
         rx = zone.orgx + zone.newWidth;
         if (rx > fw) fw = rx;
         rx = zone.orgy + zone.newHeight;
         if (rx > fh) fh = rx;
       }
     }
     rx = (float) pw / fw;
     ry = (float) ph / fh;
     scaleDir = 0;
     rd = 0;
     if (rx > ry) {
       rd = (rx - ry) / rx;
       rx = ry;
       scaleDir = 1;
     } else if (rx < ry) {
       rd = (ry - rx) / ry;
       scaleDir = 2;
     }
     if (rd < 0.1) scaleDir = 0;
     x1 = (int) (fw * rx);
     x1 = (pw - x1) / 2 + 6;
     y1 = (int) (fh * rx);
     y1 = (ph - y1) / 2 + 6;
     if (multiZone || marvin) {
       y1 += 14;
       if (marvin) x1 += 14;
     }
     for (n = 0; n < zList.size(); n++) {
       zone = zList.elementAt(n);
       oList = zone.getSampleList();
       if (multiZone) {
         x = x1 + (int) (zone.orgx * rx);
         y = y1 + (int) (zone.orgy * rx);
       } else {
         x = x1;
         y = y1;
       }
       zone.locX = x;
       zone.locY = y;
       zone.locX2 = x + (int) (zone.newWidth * rx);
       zone.locY2 = y + (int) (zone.newHeight * rx);
       i = (int) (zone.newDiam * rx);
       if (i < 4) i = 4;
       zone.minWidth = i;
       zone.ratio = rx;
       k = oList.size();
       for (i = 0; i < k; i++) {
         obj = oList.elementAt(i);
         // obj.locX = x + (int) (obj.orgx * rx);
         // obj.locY = y + (int) (obj.orgy * rx);
         // obj.width = (int) (obj.newDiam * rx);
         ox = x + (int) (obj.orgx * rx);
         oy = y + (int) (obj.orgy * rx);
         ow = (int) (obj.newDiam * rx);
         obj.setBounds(ox, oy, ow, ow);
       }
     }
   }
 }