示例#1
0
    @Override
    public java.awt.Dimension preferredLayoutSize(java.awt.Container parent) {
      synchronized (parent.getTreeLock()) {
        org.lgna.croquet.CardOwnerComposite cardOwner =
            (org.lgna.croquet.CardOwnerComposite) getComposite();

        int widthMax = 0;
        int heightMax = 0;

        for (org.lgna.croquet.Composite<?> card : cardOwner.getCards()) {
          if (cardOwner.isCardAccountedForInPreferredSizeCalculation(card)) {
            java.awt.Component awtChild = card.getRootComponent().getAwtComponent();
            java.awt.Dimension awtChildPreferredSize = awtChild.getPreferredSize();
            widthMax = Math.max(widthMax, awtChildPreferredSize.width);
            heightMax = Math.max(heightMax, awtChildPreferredSize.height);
          }
        }
        java.awt.Insets insets = parent.getInsets();
        int hgap = this.getHgap();
        int vgap = this.getVgap();
        return new java.awt.Dimension(
            hgap + insets.left + widthMax + insets.right + hgap,
            vgap + insets.top + heightMax + insets.bottom + vgap);
      }
    }
示例#2
0
 public void removeComposite(org.lgna.croquet.Composite<?> composite) {
   assert composite != null : this;
   synchronized (this.getTreeLock()) {
     this.internalRemoveComponent(composite.getRootComponent());
   }
 }