Package DisplayProject

Examples of DisplayProject.GridCell


        Container parent,
        int penColor,
        int row,
        String text) {
      TextGraphic jl = newTextGraphic(text);
      GridCell cell = GridCell.get(jl);
      cell.setCellGravity(gravity);
      cell.setRow(row-1);
      cell.setColumn(column-1);

      Parent.set(jl, parent);
      ColourChange.setForeground(jl, penColor);
      return jl;
    }
View Full Code Here


        TopMargin action = ActionMgr.getAction(comp, TopMargin.class);
        if (action != null) {
            return action.margin;
        }
        // TF:20/8/07:Adapted to use new GridField static methods
        GridCell gbc = GridField.getConstraints(comp);
        return UIutils.pixelsToMils(gbc.getTopMargin());
    }
View Full Code Here

        int row,
        int widthPolicy ) {
      DataField df = newDataField();
      df.setColumns(maxCharacters);
      df.setMinimumSize(new Dimension(minWidthInPixels, df.getMinimumSize().height));
      GridCell cell = GridCell.get(df);
      cell.setCellGravity(gravity);
      cell.setRow(row-1);
      cell.setColumn(column-1);
      Parent.set(df, parent);
      return df;
    }
View Full Code Here

        Insets i = ((WindowFormLayout)pChild.getLayout()).getLayoutInsets(pChild);
        pChild.setLayout(new PanelLayoutManager(true));
        ((Panel)pChild).setInsets(i);
       
        // TF:28/04/2008:These rules only seem to apply if the size policy of the form has not been explicitly set
        GridCell existingCell = GridCell.getExisting(pChild);
        Container c = ((JComponent)pCurrentParent).getTopLevelAncestor();
        if (existingCell == null) {
          // The child must have been on a window. If the old window was resizable, the
          // default layout policy = SP_EXPLICIT and a default size of 4000x3000 mils
          // which is 384x288 pixels. If the window was not resizable the default size
          // policy is Natural. In both cases, the location is (0, 0) after compensating for insets
          if (c instanceof JFrame && (!((JFrame)c).isUndecorated()) && ((JFrame)c).isResizable()) {
              GridField.getConstraints(pChild).setWidthPolicy(Constants.SP_EXPLICIT);
              GridField.getConstraints(pChild).setHeightPolicy(Constants.SP_EXPLICIT);
              pChild.setSize(384, 288);
          }
          else {
              GridField.getConstraints(pChild).setWidthPolicy(Constants.SP_NATURAL);
              GridField.getConstraints(pChild).setHeightPolicy(Constants.SP_NATURAL);
          }
        }
        else {
          if (existingCell.getWidthPolicy() == Constants.SP_TO_PARENT || existingCell.getHeightPolicy() == Constants.SP_TO_PARENT) {
            pChild.setMinimumSize(null);
            pChild.setPreferredSize(null);
            pChild.setSize(0, 0);
          }
        }
View Full Code Here

    public BottomMargin(Component pComponent, int value) {
        super(pComponent);
        this.margin = value;
    }
    public void performAction() {
        GridCell gbc = null;
        if (this._component != null) {
            gbc = GridField.getConstraints((JComponent)this._component);
            gbc.setBottomMargin(UIutils.milsToPixels(margin));
        }
    }
View Full Code Here

    public static int get(JComponent comp){
        BottomMargin action = ActionMgr.getAction(comp, BottomMargin.class);
        if (action != null) {
            return action.margin;
        }
        GridCell gbc = GridField.getConstraints((JComponent)comp);
        return UIutils.pixelsToMils(gbc.getBottomMargin());
    }
View Full Code Here

   
    public void performAction() {
      // TF:11/05/2009:Changed this to rely on the layout managers
      Set<Container> containersToValidate = new HashSet<Container>();
      JComponent thisComponent = (JComponent)this._component;
      GridCell cell = GridCell.get(thisComponent);
     
      // First, remove this component from it's old chain, if there is one.
      JComponent currentPartner = LayoutManagerHelper.getHeightPartner(thisComponent);
      if (currentPartner != null) {
        if (currentPartner == this.partner) {
          // do nothing
          return;
        }
        else {
          JComponent lastInChain = null;
          for (JComponent comp = currentPartner; comp != null && comp != thisComponent; comp = LayoutManagerHelper.getHeightPartner(comp)) {
            lastInChain = comp;
            // Also add the parent of the component to the containers needing laying out
            Container parent = comp.getParent();
            if (parent != null) {
              containersToValidate.add(parent);
            }
          }
          if (lastInChain != null) {
            // We need to set the partner of the last in the chain to the current partner, skipping this component
            LayoutManagerHelper.setHeightPartner(lastInChain, currentPartner);
          }
        }
      }
     
      // We now need to run around the partnership chain, possibly inserting this element in the chain,
      // setting all the size policies to TO_PARTNER and marking all the containers to be validated
      cell.setHeightPolicy(Constants.SP_TO_PARTNER);
      LayoutManagerHelper.setHeightPartner(thisComponent, this.partner);
    JComponent lastInChain = null;
    for (JComponent comp = this.partner; comp != null && comp != thisComponent; comp = LayoutManagerHelper.getHeightPartner(comp)) {
      lastInChain = comp;
      // Also add the parent of the component to the containers needing laying out
View Full Code Here

        d.width = width + 1;
        d.height = (fm.getHeight() + fm.getDescent()) * Math.max(1, getLineCount());

        // Now apply the margins onto the size if needed
        Insets i = getInsets();
        GridCell cell = GridCell.get(this);
        switch (cell.getWidthPolicy()) {
            case Constants.SP_TO_PARENT:
                d.width += i.left + i.right;
                d.width = Math.max(d.width, getWidth());
                break;
            case Constants.SP_EXPLICIT:
                d.width = getWidth();
                break;
            case Constants.SP_NATURAL:
            case Constants.SP_TO_PARTNER:
            default:
                d.width += i.left + i.right;
                break;
        }
        switch (cell.getHeightPolicy()) {
            case Constants.SP_TO_PARENT:
                d.height += i.top + i.bottom;
                d.height = Math.max(d.height, getHeight());
                break;
            case Constants.SP_EXPLICIT:
                d.height = getHeight();
                break;
            case Constants.SP_NATURAL:
            case Constants.SP_TO_PARTNER:
            default:
                d.height += i.top + i.bottom;
                break;
        }

        // Cater for a frame.  CraigM 03/01/2008.
        if (FrameWeight.get(this) > 0) {
          // TF:06/08/2008:If we're explicitly set then we don't adjust the size.
          int size = FrameWeight.get(this);
          if (cell.getWidthPolicy() != Constants.SP_EXPLICIT) {
            d.height += size;
          }
          if (cell.getHeightPolicy() != Constants.SP_EXPLICIT) {
            d.width += size;
          }
        }
        return d;
    }
View Full Code Here

                stdProperties.add(new TableData("  minimumSize", c.isMinimumSizeSet() ? showDimension(c.getMinimumSize()): "<html><i>Not set</i></html>"));
                stdProperties.add(new TableData("  maximumSize", c.isMaximumSizeSet() ? showDimension(c.getMaximumSize()): "<html><i>Not set</i></html>"));
                stdProperties.add(new TableData("  preferredSize", c.isPreferredSizeSet() ? showDimension(c.getPreferredSize()): "<html><i>Not set</i></html>"));
                if (c instanceof JComponent) {
                    JComponent comp = (JComponent)c;
                    GridCell cell = GridCell.get(comp);
                    stdProperties.add(new TableData("<html><b>Layout Info</b></html>", ""));
                    stdProperties.add(new TableData("  cell", "[row="+ cell.getRow()+",column="+cell.getColumn()+"]"));
                    stdProperties.add(new TableData("  widthPolicy", cell.sizePolicyToString(cell.getWidthPolicy())));
                    if (cell.getWidthPolicy() == Constants.SP_TO_PARTNER) {
                      JComponent comp1 = LayoutManagerHelper.getWidthPartner(comp);
                      for (int i = 1; comp1 != null && comp1 != comp; i++) {
                            stdProperties.add(new TableData("      ["+i+"]", "  " + comp1.toString()));
                            comp1 = LayoutManagerHelper.getWidthPartner(comp1);
                      }
                    }
                    else if (cell.getWidthPolicy() == Constants.SP_TO_MATRIX_PARTNER && comp instanceof GridField) {
                      GridField partner = ((GridField)comp).getWidthMatrixPartner();
                      for (int i = 1; partner != null && partner != comp; i++) {
                            stdProperties.add(new TableData("      ["+i+"]", "  " + partner.toString()));
                            partner = partner.getWidthMatrixPartner();
                      }
                    }
                    stdProperties.add(new TableData("  heightPolicy", cell.sizePolicyToString(cell.getHeightPolicy())));
                    if (cell.getHeightPolicy() == Constants.SP_TO_PARTNER) {
                      JComponent comp1 = LayoutManagerHelper.getHeightPartner(comp);
                      for (int i = 1; comp1 != null && comp1 != comp; i++) {
                            stdProperties.add(new TableData("      ["+i+"]", "  " + comp1.toString()));
                            comp1 = LayoutManagerHelper.getHeightPartner(comp1);
                      }
                    }
                    else if (cell.getHeightPolicy() == Constants.SP_TO_MATRIX_PARTNER && comp instanceof GridField) {
                      GridField partner = ((GridField)comp).getHeightMatrixPartner();
                      for (int i = 1; partner != null && partner != comp; i++) {
                            stdProperties.add(new TableData("      ["+i+"]", "  " + partner.toString()));
                            partner = partner.getHeightMatrixPartner();
                      }
                    }
                    stdProperties.add(new TableData("  gravity", cell.gravityAsString()));
                    stdProperties.add(new TableData("  margins", "[t="+cell.getTopMargin()+
                                                                ",l="+cell.getLeftMargin()+
                                                                ",b="+cell.getBottomMargin()+
                                                                ",r="+cell.getRightMargin()+"]"))
                    if (comp.getParent() instanceof GridField) {
                        GridField gf = (GridField)comp.getParent();
                        stdProperties.add(new TableData("  rowWeight", ""+gf.getRowJustifyWeight(cell.getRow())));
                        stdProperties.add(new TableData("  columnWeight", ""+gf.getColumnJustifyWeight(cell.getColumn())));
                    }
                    if (comp instanceof GridField) {
                        StringBuilder buffer = new StringBuilder(50);
                        GridField gf = (GridField)comp;
                        int[] rowWeights = gf.getRowJustifyWeight();
View Full Code Here

    }

    public Component getTableCellRendererComponent(JTable table, Object data, boolean arg2, boolean arg3, int arg4, int arg5) {
        if ((data != null)&&(data instanceof ImageData)) {
            // TF:08/03/2009:Added the following code to make the renderer clone all the properties properly.
            GridCell origCell = GridCell.get(originalPic);
            GridCell clonedCell = GridCell.get(clonedPic);
            clonedCell.setBottomMargin(origCell.getBottomMargin());
            clonedCell.setTopMargin(origCell.getTopMargin());
            clonedCell.setLeftMargin(origCell.getLeftMargin());
            clonedCell.setRightMargin(origCell.getRightMargin());
            clonedCell.setCellGravity(origCell.getCellGravity());
            clonedCell.setHeightPolicy(origCell.getHeightPolicy());
            clonedCell.setWidthPolicy(origCell.getWidthPolicy());

//            clonedPic.setSize(originalPic.getSize());
//          clonedPic.setMinimumSize(originalPic.getMinimumSize());
//          clonedPic.setPreferredSize(originalPic.getPreferredSize());
//          clonedPic.setFrameColor(originalPic.getFrameColor());
View Full Code Here

TOP

Related Classes of DisplayProject.GridCell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.