forms-1.0.7

16:35:54.189 INFO  jd.cli.Main - Decompiling forms-1.0.7.jar
package com.jgoodies.forms.builder;

import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.CellConstraints.Alignment;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;
import java.awt.Component;
import java.awt.ComponentOrientation;
import java.awt.Container;

public abstract class AbstractFormBuilder
{
  private final Container container;
  private final FormLayout layout;
  private CellConstraints currentCellConstraints;
  private boolean leftToRight;
  
  public AbstractFormBuilder(FormLayout layout, Container container)
  {
    if (layout == null) {
      throw new NullPointerException("The layout must not be null.");
    }
    if (container == null) {
      throw new NullPointerException("The layout container must not be null.");
    }
    this.container = container;
    this.layout = layout;
    
    container.setLayout(layout);
    currentCellConstraints = new CellConstraints();
    ComponentOrientation orientation = container.getComponentOrientation();
    leftToRight = ((orientation.isLeftToRight()) || (!orientation.isHorizontal()));
  }
  
  /**
   * @deprecated
   */
  public AbstractFormBuilder(Container container, FormLayout layout)
  {
    this(layout, container);
  }
  
  public final Container getContainer()
  {
    return container;
  }
  
  public final FormLayout getLayout()
  {
    return layout;
  }
  
  public final int getColumnCount()
  {
    return getLayout().getColumnCount();
  }
  
  public final int getRowCount()
  {
    return getLayout().getRowCount();
  }
  
  public final boolean isLeftToRight()
  {
    return leftToRight;
  }
  
  public final void setLeftToRight(boolean b)
  {
    leftToRight = b;
  }
  
  public final int getColumn()
  {
    return currentCellConstraints.gridX;
  }
  
  public final void setColumn(int column)
  {
    currentCellConstraints.gridX = column;
  }
  
  public final int getRow()
  {
    return currentCellConstraints.gridY;
  }
  
  public final void setRow(int row)
  {
    currentCellConstraints.gridY = row;
  }
  
  public final void setColumnSpan(int columnSpan)
  {
    currentCellConstraints.gridWidth = columnSpan;
  }
  
  public final void setRowSpan(int rowSpan)
  {
    currentCellConstraints.gridHeight = rowSpan;
  }
  
  public final void setOrigin(int column, int row)
  {
    setColumn(column);
    setRow(row);
  }
  
  public final void setExtent(int columnSpan, int rowSpan)
  {
    setColumnSpan(columnSpan);
    setRowSpan(rowSpan);
  }
  
  public final void setBounds(int column, int row, int columnSpan, int rowSpan)
  {
    setColumn(column);
    setRow(row);
    setColumnSpan(columnSpan);
    setRowSpan(rowSpan);
  }
  
  public final void nextColumn()
  {
    nextColumn(1);
  }
  
  public final void nextColumn(int columns)
  {
    currentCellConstraints.gridX += columns * getColumnIncrementSign();
  }
  
  public final void nextRow()
  {
    nextRow(1);
  }
  
  public final void nextRow(int rows)
  {
    currentCellConstraints.gridY += rows;
  }
  
  public final void nextLine()
  {
    nextLine(1);
  }
  
  public final void nextLine(int lines)
  {
    nextRow(lines);
    setColumn(getLeadingColumn());
  }
  
  public final void setHAlignment(CellConstraints.Alignment alignment)
  {
    currentCellConstraints.hAlign = alignment;
  }
  
  public final void setVAlignment(CellConstraints.Alignment alignment)
  {
    currentCellConstraints.vAlign = alignment;
  }
  
  public final void setAlignment(CellConstraints.Alignment hAlign, CellConstraints.Alignment vAlign)
  {
    setHAlignment(hAlign);
    setVAlignment(vAlign);
  }
  
  public final void appendColumn(ColumnSpec columnSpec)
  {
    getLayout().appendColumn(columnSpec);
  }
  
  public final void appendColumn(String encodedColumnSpec)
  {
    appendColumn(new ColumnSpec(encodedColumnSpec));
  }
  
  public final void appendGlueColumn()
  {
    appendColumn(FormFactory.GLUE_COLSPEC);
  }
  
  public final void appendLabelComponentsGapColumn()
  {
    appendColumn(FormFactory.LABEL_COMPONENT_GAP_COLSPEC);
  }
  
  public final void appendRelatedComponentsGapColumn()
  {
    appendColumn(FormFactory.RELATED_GAP_COLSPEC);
  }
  
  public final void appendUnrelatedComponentsGapColumn()
  {
    appendColumn(FormFactory.UNRELATED_GAP_COLSPEC);
  }
  
  public final void appendRow(RowSpec rowSpec)
  {
    getLayout().appendRow(rowSpec);
  }
  
  public final void appendRow(String encodedRowSpec)
  {
    appendRow(new RowSpec(encodedRowSpec));
  }
  
  public final void appendGlueRow()
  {
    appendRow(FormFactory.GLUE_ROWSPEC);
  }
  
  public final void appendRelatedComponentsGapRow()
  {
    appendRow(FormFactory.RELATED_GAP_ROWSPEC);
  }
  
  public final void appendUnrelatedComponentsGapRow()
  {
    appendRow(FormFactory.UNRELATED_GAP_ROWSPEC);
  }
  
  public final void appendParagraphGapRow()
  {
    appendRow(FormFactory.PARAGRAPH_GAP_ROWSPEC);
  }
  
  public final Component add(Component component, CellConstraints cellConstraints)
  {
    container.add(component, cellConstraints);
    return component;
  }
  
  public final Component add(Component component, String encodedCellConstraints)
  {
    container.add(component, new CellConstraints(encodedCellConstraints));
    return component;
  }
  
  public final Component add(Component component)
  {
    add(component, currentCellConstraints);
    return component;
  }
  
  protected final CellConstraints cellConstraints()
  {
    return currentCellConstraints;
  }
  
  protected int getLeadingColumn()
  {
    return isLeftToRight() ? 1 : getColumnCount();
  }
  
  protected final int getColumnIncrementSign()
  {
    return isLeftToRight() ? 1 : -1;
  }
  
  protected final CellConstraints createLeftAdjustedConstraints(int columnSpan)
  {
    int firstColumn = isLeftToRight() ? getColumn() : getColumn() + 1 - columnSpan;
    
    return new CellConstraints(firstColumn, getRow(), columnSpan, cellConstraintsgridHeight);
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.builder.AbstractFormBuilder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.builder;

import com.jgoodies.forms.factories.Borders;
import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.ConstantSize;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;
import com.jgoodies.forms.util.LayoutStyle;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel;

public final class ButtonBarBuilder
  extends PanelBuilder
{
  private static final ColumnSpec[] COL_SPECS = new ColumnSpec[0];
  private static final RowSpec[] ROW_SPECS = { new RowSpec("center:pref") };
  private static final String NARROW_KEY = "jgoodies.isNarrow";
  private boolean leftToRight;
  
  public ButtonBarBuilder()
  {
    this(new JPanel(null));
  }
  
  public ButtonBarBuilder(JPanel panel)
  {
    super(new FormLayout(COL_SPECS, ROW_SPECS), panel);
    leftToRight = LayoutStyle.getCurrent().isLeftToRightButtonOrder();
  }
  
  public static ButtonBarBuilder createLeftToRightBuilder()
  {
    ButtonBarBuilder builder = new ButtonBarBuilder();
    builder.setLeftToRightButtonOrder(true);
    return builder;
  }
  
  public boolean isLeftToRightButtonOrder()
  {
    return leftToRight;
  }
  
  public void setLeftToRightButtonOrder(boolean newButtonOrder)
  {
    leftToRight = newButtonOrder;
  }
  
  public void setDefaultButtonBarGapBorder()
  {
    getPanel().setBorder(Borders.BUTTON_BAR_GAP_BORDER);
  }
  
  public void addGriddedButtons(JButton[] buttons)
  {
    int length = buttons.length;
    for (int i = 0; i < length; i++)
    {
      int index = leftToRight ? i : length - 1 - i;
      addGridded(buttons[index]);
      if (i < buttons.length - 1) {
        addRelatedGap();
      }
    }
  }
  
  public void addGriddedGrowingButtons(JButton[] buttons)
  {
    int length = buttons.length;
    for (int i = 0; i < length; i++)
    {
      int index = leftToRight ? i : length - 1 - i;
      addGriddedGrowing(buttons[index]);
      if (i < buttons.length - 1) {
        addRelatedGap();
      }
    }
  }
  
  public void addFixed(JComponent component)
  {
    getLayout().appendColumn(FormFactory.PREF_COLSPEC);
    add(component);
    nextColumn();
  }
  
  public void addFixedNarrow(JComponent component)
  {
    component.putClientProperty("jgoodies.isNarrow", Boolean.TRUE);
    addFixed(component);
  }
  
  public void addGridded(JComponent component)
  {
    getLayout().appendColumn(FormFactory.BUTTON_COLSPEC);
    getLayout().addGroupedColumn(getColumn());
    component.putClientProperty("jgoodies.isNarrow", Boolean.TRUE);
    add(component);
    nextColumn();
  }
  
  public void addGriddedGrowing(JComponent component)
  {
    getLayout().appendColumn(FormFactory.GROWING_BUTTON_COLSPEC);
    getLayout().addGroupedColumn(getColumn());
    component.putClientProperty("jgoodies.isNarrow", Boolean.TRUE);
    add(component);
    nextColumn();
  }
  
  public void addGlue()
  {
    appendGlueColumn();
    nextColumn();
  }
  
  public void addRelatedGap()
  {
    appendRelatedComponentsGapColumn();
    nextColumn();
  }
  
  public void addUnrelatedGap()
  {
    appendUnrelatedComponentsGapColumn();
    nextColumn();
  }
  
  public void addStrut(ConstantSize size)
  {
    getLayout().appendColumn(new ColumnSpec(ColumnSpec.LEFT, size, 0.0D));
    
    nextColumn();
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.builder.ButtonBarBuilder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.builder;

import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.ConstantSize;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel;

public final class ButtonStackBuilder
  extends PanelBuilder
{
  private static final ColumnSpec[] COL_SPECS = { FormFactory.BUTTON_COLSPEC };
  private static final RowSpec[] ROW_SPECS = new RowSpec[0];
  private static final String NARROW_KEY = "jgoodies.isNarrow";
  
  public ButtonStackBuilder()
  {
    this(new JPanel(null));
  }
  
  public ButtonStackBuilder(JPanel panel)
  {
    super(new FormLayout(COL_SPECS, ROW_SPECS), panel);
  }
  
  public void addButtons(JButton[] buttons)
  {
    for (int i = 0; i < buttons.length; i++)
    {
      addGridded(buttons[i]);
      if (i < buttons.length - 1) {
        addRelatedGap();
      }
    }
  }
  
  public void addFixed(JComponent component)
  {
    getLayout().appendRow(FormFactory.PREF_ROWSPEC);
    add(component);
    nextRow();
  }
  
  public void addGridded(JComponent component)
  {
    getLayout().appendRow(FormFactory.PREF_ROWSPEC);
    getLayout().addGroupedRow(getRow());
    component.putClientProperty("jgoodies.isNarrow", Boolean.TRUE);
    add(component);
    nextRow();
  }
  
  public void addGlue()
  {
    appendGlueRow();
    nextRow();
  }
  
  public void addRelatedGap()
  {
    appendRelatedComponentsGapRow();
    nextRow();
  }
  
  public void addUnrelatedGap()
  {
    appendUnrelatedComponentsGapRow();
    nextRow();
  }
  
  public void addStrut(ConstantSize size)
  {
    getLayout().appendRow(new RowSpec(RowSpec.TOP, size, 0.0D));
    
    nextRow();
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.builder.ButtonStackBuilder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.builder;

import com.jgoodies.forms.factories.ComponentFactory;
import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.ConstantSize;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;
import java.awt.Component;
import java.util.ResourceBundle;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;

public final class DefaultFormBuilder
  extends I15dPanelBuilder
{
  private RowSpec lineGapSpec = FormFactory.LINE_GAP_ROWSPEC;
  private RowSpec paragraphGapSpec = FormFactory.PARAGRAPH_GAP_ROWSPEC;
  private int leadingColumnOffset = 0;
  private boolean rowGroupingEnabled = false;
  
  public DefaultFormBuilder(FormLayout layout)
  {
    this(new JPanel(null), layout);
  }
  
  public DefaultFormBuilder(FormLayout layout, JPanel panel)
  {
    this(panel, layout, null);
  }
  
  public DefaultFormBuilder(FormLayout layout, ResourceBundle bundle)
  {
    this(new JPanel(null), layout, bundle);
  }
  
  public DefaultFormBuilder(FormLayout layout, ResourceBundle bundle, JPanel panel)
  {
    super(layout, bundle, panel);
  }
  
  /**
   * @deprecated
   */
  public DefaultFormBuilder(JPanel panel, FormLayout layout)
  {
    this(layout, null, panel);
  }
  
  /**
   * @deprecated
   */
  public DefaultFormBuilder(JPanel panel, FormLayout layout, ResourceBundle bundle)
  {
    super(layout, bundle, panel);
  }
  
  public RowSpec getLineGapSpec()
  {
    return lineGapSpec;
  }
  
  public void setLineGapSize(ConstantSize lineGapSize)
  {
    RowSpec rowSpec = FormFactory.createGapRowSpec(lineGapSize);
    lineGapSpec = rowSpec;
  }
  
  public void setParagraphGapSize(ConstantSize paragraphGapSize)
  {
    RowSpec rowSpec = FormFactory.createGapRowSpec(paragraphGapSize);
    paragraphGapSpec = rowSpec;
  }
  
  public int getLeadingColumnOffset()
  {
    return leadingColumnOffset;
  }
  
  public void setLeadingColumnOffset(int columnOffset)
  {
    leadingColumnOffset = columnOffset;
  }
  
  public boolean isRowGroupingEnabled()
  {
    return rowGroupingEnabled;
  }
  
  public void setRowGroupingEnabled(boolean enabled)
  {
    rowGroupingEnabled = enabled;
  }
  
  public void append(Component component)
  {
    append(component, 1);
  }
  
  public void append(Component component, int columnSpan)
  {
    ensureCursorColumnInGrid();
    ensureHasGapRow(lineGapSpec);
    ensureHasComponentLine();
    
    add(component, createLeftAdjustedConstraints(columnSpan));
    nextColumn(columnSpan + 1);
  }
  
  public void append(Component c1, Component c2)
  {
    append(c1);
    append(c2);
  }
  
  public void append(Component c1, Component c2, Component c3)
  {
    append(c1);
    append(c2);
    append(c3);
  }
  
  public JLabel append(String textWithMnemonic)
  {
    JLabel label = getComponentFactory().createLabel(textWithMnemonic);
    append(label);
    return label;
  }
  
  public JLabel append(String textWithMnemonic, Component component)
  {
    return append(textWithMnemonic, component, 1);
  }
  
  public JLabel append(String textWithMnemonic, Component c, boolean nextLine)
  {
    JLabel label = append(textWithMnemonic, c);
    if (nextLine) {
      nextLine();
    }
    return label;
  }
  
  public JLabel append(String textWithMnemonic, Component c, int columnSpan)
  {
    JLabel label = append(textWithMnemonic);
    label.setLabelFor(c);
    append(c, columnSpan);
    return label;
  }
  
  public JLabel append(String textWithMnemonic, Component c1, Component c2)
  {
    JLabel label = append(textWithMnemonic, c1);
    append(c2);
    return label;
  }
  
  public JLabel append(String textWithMnemonic, Component c1, Component c2, int colSpan)
  {
    JLabel label = append(textWithMnemonic, c1);
    append(c2, colSpan);
    return label;
  }
  
  public JLabel append(String textWithMnemonic, Component c1, Component c2, Component c3)
  {
    JLabel label = append(textWithMnemonic, c1, c2);
    append(c3);
    return label;
  }
  
  public JLabel append(String textWithMnemonic, Component c1, Component c2, Component c3, Component c4)
  {
    JLabel label = append(textWithMnemonic, c1, c2, c3);
    append(c4);
    return label;
  }
  
  public JLabel appendI15d(String resourceKey)
  {
    return append(getI15dString(resourceKey));
  }
  
  public JLabel appendI15d(String resourceKey, Component component)
  {
    return append(getI15dString(resourceKey), component, 1);
  }
  
  public JLabel appendI15d(String resourceKey, Component component, boolean nextLine)
  {
    return append(getI15dString(resourceKey), component, nextLine);
  }
  
  public JLabel appendI15d(String resourceKey, Component c, int columnSpan)
  {
    return append(getI15dString(resourceKey), c, columnSpan);
  }
  
  public JLabel appendI15d(String resourceKey, Component c1, Component c2)
  {
    return append(getI15dString(resourceKey), c1, c2);
  }
  
  public JLabel appendI15d(String resourceKey, Component c1, Component c2, int colSpan)
  {
    return append(getI15dString(resourceKey), c1, c2, colSpan);
  }
  
  public JLabel appendI15d(String resourceKey, Component c1, Component c2, Component c3)
  {
    return append(getI15dString(resourceKey), c1, c2, c3);
  }
  
  public JLabel appendI15d(String resourceKey, Component c1, Component c2, Component c3, Component c4)
  {
    return append(getI15dString(resourceKey), c1, c2, c3, c4);
  }
  
  public JLabel appendTitle(String textWithMnemonic)
  {
    JLabel titleLabel = getComponentFactory().createTitle(textWithMnemonic);
    append(titleLabel);
    return titleLabel;
  }
  
  public JLabel appendI15dTitle(String resourceKey)
  {
    return appendTitle(getI15dString(resourceKey));
  }
  
  public JComponent appendSeparator()
  {
    return appendSeparator("");
  }
  
  public JComponent appendSeparator(String text)
  {
    ensureCursorColumnInGrid();
    ensureHasGapRow(paragraphGapSpec);
    ensureHasComponentLine();
    
    setColumn(super.getLeadingColumn());
    int columnSpan = getColumnCount();
    setColumnSpan(getColumnCount());
    JComponent titledSeparator = addSeparator(text);
    setColumnSpan(1);
    nextColumn(columnSpan);
    return titledSeparator;
  }
  
  public JComponent appendI15dSeparator(String resourceKey)
  {
    return appendSeparator(getI15dString(resourceKey));
  }
  
  protected int getLeadingColumn()
  {
    int column = super.getLeadingColumn();
    return column + getLeadingColumnOffset() * getColumnIncrementSign();
  }
  
  private void ensureCursorColumnInGrid()
  {
    if (((isLeftToRight()) && (getColumn() > getColumnCount())) || ((!isLeftToRight()) && (getColumn() < 1))) {
      nextLine();
    }
  }
  
  private void ensureHasGapRow(RowSpec gapRowSpec)
  {
    if ((getRow() == 1) || (getRow() <= getRowCount())) {
      return;
    }
    if (getRow() <= getRowCount())
    {
      RowSpec rowSpec = getCursorRowSpec();
      if (rowSpec == gapRowSpec) {
        return;
      }
    }
    appendRow(gapRowSpec);
    nextLine();
  }
  
  private void ensureHasComponentLine()
  {
    if (getRow() <= getRowCount()) {
      return;
    }
    appendRow(FormFactory.PREF_ROWSPEC);
    if (isRowGroupingEnabled()) {
      getLayout().addGroupedRow(getRow());
    }
  }
  
  private RowSpec getCursorRowSpec()
  {
    return getLayout().getRowSpec(getRow());
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.builder.DefaultFormBuilder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.builder;

import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import java.awt.Component;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class I15dPanelBuilder
  extends PanelBuilder
{
  private final ResourceBundle bundle;
  
  public I15dPanelBuilder(FormLayout layout, ResourceBundle bundle)
  {
    this(new JPanel(null), layout, bundle);
  }
  
  public I15dPanelBuilder(FormLayout layout, ResourceBundle bundle, JPanel panel)
  {
    super(layout, panel);
    this.bundle = bundle;
  }
  
  /**
   * @deprecated
   */
  public I15dPanelBuilder(JPanel panel, FormLayout layout, ResourceBundle bundle)
  {
    this(layout, bundle, panel);
  }
  
  public final JLabel addI15dLabel(String resourceKey, CellConstraints constraints)
  {
    return addLabel(getI15dString(resourceKey), constraints);
  }
  
  public final JLabel addI15dLabel(String resourceKey, String encodedConstraints)
  {
    return addI15dLabel(resourceKey, new CellConstraints(encodedConstraints));
  }
  
  public final JLabel addI15dLabel(String resourceKey, CellConstraints labelConstraints, Component component, CellConstraints componentConstraints)
  {
    return addLabel(getI15dString(resourceKey), labelConstraints, component, componentConstraints);
  }
  
  public final JComponent addI15dSeparator(String resourceKey, CellConstraints constraints)
  {
    return addSeparator(getI15dString(resourceKey), constraints);
  }
  
  public final JComponent addI15dSeparator(String resourceKey, String encodedConstraints)
  {
    return addI15dSeparator(resourceKey, new CellConstraints(encodedConstraints));
  }
  
  public final JLabel addI15dTitle(String resourceKey, CellConstraints constraints)
  {
    return addTitle(getI15dString(resourceKey), constraints);
  }
  
  public final JLabel add15dTitle(String resourceKey, String encodedConstraints)
  {
    return addI15dTitle(resourceKey, new CellConstraints(encodedConstraints));
  }
  
  protected String getI15dString(String resourceKey)
  {
    if (bundle == null) {
      throw new IllegalStateException("You must specify a ResourceBundle before using the internationalization support.");
    }
    try
    {
      return bundle.getString(resourceKey);
    }
    catch (MissingResourceException mre) {}
    return resourceKey;
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.builder.I15dPanelBuilder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.builder;

import com.jgoodies.forms.factories.Borders;
import com.jgoodies.forms.factories.ComponentFactory;
import com.jgoodies.forms.factories.DefaultComponentFactory;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.Border;

public class PanelBuilder
  extends AbstractFormBuilder
{
  private ComponentFactory componentFactory;
  
  public PanelBuilder(FormLayout layout)
  {
    this(layout, new JPanel(null));
  }
  
  public PanelBuilder(FormLayout layout, JPanel panel)
  {
    super(layout, panel);
  }
  
  /**
   * @deprecated
   */
  public PanelBuilder(JPanel panel, FormLayout layout)
  {
    super(layout, panel);
  }
  
  public final JPanel getPanel()
  {
    return (JPanel)getContainer();
  }
  
  public final void setBorder(Border border)
  {
    getPanel().setBorder(border);
  }
  
  public final void setDefaultDialogBorder()
  {
    setBorder(Borders.DIALOG_BORDER);
  }
  
  public final JLabel addLabel(String textWithMnemonic)
  {
    return addLabel(textWithMnemonic, cellConstraints());
  }
  
  public final JLabel addLabel(String textWithMnemonic, CellConstraints constraints)
  {
    JLabel label = getComponentFactory().createLabel(textWithMnemonic);
    add(label, constraints);
    return label;
  }
  
  public final JLabel addLabel(String textWithMnemonic, String encodedConstraints)
  {
    return addLabel(textWithMnemonic, new CellConstraints(encodedConstraints));
  }
  
  public final JLabel add(JLabel label, CellConstraints labelConstraints, Component component, CellConstraints componentConstraints)
  {
    if (labelConstraints == componentConstraints) {
      throw new IllegalArgumentException("You must provide two CellConstraints instances, one for the label and one for the component.\nConsider using #clone(). See the JavaDocs for details.");
    }
    add(label, labelConstraints);
    add(component, componentConstraints);
    label.setLabelFor(component);
    return label;
  }
  
  public final JLabel addLabel(String textWithMnemonic, CellConstraints labelConstraints, Component component, CellConstraints componentConstraints)
  {
    if (labelConstraints == componentConstraints) {
      throw new IllegalArgumentException("You must provide two CellConstraints instances, one for the label and one for the component.\nConsider using #clone(). See the JavaDocs for details.");
    }
    JLabel label = addLabel(textWithMnemonic, labelConstraints);
    add(component, componentConstraints);
    label.setLabelFor(component);
    return label;
  }
  
  public final JLabel addTitle(String textWithMnemonic)
  {
    return addTitle(textWithMnemonic, cellConstraints());
  }
  
  public final JLabel addTitle(String textWithMnemonic, CellConstraints constraints)
  {
    JLabel titleLabel = getComponentFactory().createTitle(textWithMnemonic);
    add(titleLabel, constraints);
    return titleLabel;
  }
  
  public final JLabel addTitle(String textWithMnemonic, String encodedConstraints)
  {
    return addTitle(textWithMnemonic, new CellConstraints(encodedConstraints));
  }
  
  public final JComponent addSeparator(String textWithMnemonic)
  {
    return addSeparator(textWithMnemonic, getLayout().getColumnCount());
  }
  
  public final JComponent addSeparator(String textWithMnemonic, CellConstraints constraints)
  {
    int titleAlignment = isLeftToRight() ? 2 : 4;
    
    JComponent titledSeparator = getComponentFactory().createSeparator(textWithMnemonic, titleAlignment);
    
    add(titledSeparator, constraints);
    return titledSeparator;
  }
  
  public final JComponent addSeparator(String textWithMnemonic, String encodedConstraints)
  {
    return addSeparator(textWithMnemonic, new CellConstraints(encodedConstraints));
  }
  
  public final JComponent addSeparator(String textWithMnemonic, int columnSpan)
  {
    return addSeparator(textWithMnemonic, createLeftAdjustedConstraints(columnSpan));
  }
  
  public final ComponentFactory getComponentFactory()
  {
    if (componentFactory == null) {
      componentFactory = DefaultComponentFactory.getInstance();
    }
    return componentFactory;
  }
  
  public final void setComponentFactory(ComponentFactory newFactory)
  {
    componentFactory = newFactory;
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.builder.PanelBuilder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.debug;

import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.FormLayout.LayoutInfo;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;

public class FormDebugPanel
  extends JPanel
{
  private static final Color DEFAULT_GRID_COLOR = Color.red;
  private boolean paintInBackground;
  private boolean paintDiagonals;
  private Color gridColor = DEFAULT_GRID_COLOR;
  
  public FormDebugPanel()
  {
    this(null);
  }
  
  public FormDebugPanel(FormLayout layout)
  {
    this(layout, false, false);
  }
  
  public FormDebugPanel(boolean paintInBackground, boolean paintDiagonals)
  {
    this(null, paintInBackground, paintDiagonals);
  }
  
  public FormDebugPanel(FormLayout layout, boolean paintInBackground, boolean paintDiagonals)
  {
    super(layout);
    setPaintInBackground(paintInBackground);
    setPaintDiagonals(paintDiagonals);
    setGridColor(DEFAULT_GRID_COLOR);
  }
  
  public void setPaintInBackground(boolean b)
  {
    paintInBackground = b;
  }
  
  public void setPaintDiagonals(boolean b)
  {
    paintDiagonals = b;
  }
  
  public void setGridColor(Color color)
  {
    gridColor = color;
  }
  
  protected void paintComponent(Graphics g)
  {
    super.paintComponent(g);
    if (paintInBackground) {
      paintGrid(g);
    }
  }
  
  public void paint(Graphics g)
  {
    super.paint(g);
    if (!paintInBackground) {
      paintGrid(g);
    }
  }
  
  private void paintGrid(Graphics g)
  {
    if (!(getLayout() instanceof FormLayout)) {
      return;
    }
    FormLayout.LayoutInfo layoutInfo = FormDebugUtils.getLayoutInfo(this);
    int left = layoutInfo.getX();
    int top = layoutInfo.getY();
    int width = layoutInfo.getWidth();
    int height = layoutInfo.getHeight();
    
    g.setColor(gridColor);
    for (int col = 0; col < columnOrigins.length; col++) {
      g.fillRect(columnOrigins[col], top, 1, height);
    }
    for (int row = 0; row < rowOrigins.length; row++) {
      g.fillRect(left, rowOrigins[row], width, 1);
    }
    if (paintDiagonals)
    {
      g.drawLine(left, top, left + width, top + height);
      g.drawLine(left, top + height, left + width, top);
    }
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.debug.FormDebugPanel
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.debug;

import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.FormLayout.LayoutInfo;
import com.jgoodies.forms.layout.RowSpec;
import java.awt.Component;
import java.awt.Container;
import java.io.PrintStream;
import javax.swing.JLabel;

public final class FormDebugUtils
{
  public static void dumpAll(Container container)
  {
    if (!(container.getLayout() instanceof FormLayout))
    {
      System.out.println("The container's layout is not a FormLayout.");
      return;
    }
    FormLayout layout = (FormLayout)container.getLayout();
    dumpColumnSpecs(layout);
    dumpRowSpecs(layout);
    System.out.println();
    dumpColumnGroups(layout);
    dumpRowGroups(layout);
    System.out.println();
    dumpConstraints(container);
    dumpGridBounds(container);
  }
  
  public static void dumpColumnSpecs(FormLayout layout)
  {
    System.out.print("COLUMN SPECS:");
    for (int col = 1; col <= layout.getColumnCount(); col++)
    {
      ColumnSpec colSpec = layout.getColumnSpec(col);
      System.out.print(colSpec.toShortString());
      if (col < layout.getColumnCount()) {
        System.out.print(", ");
      }
    }
    System.out.println();
  }
  
  public static void dumpRowSpecs(FormLayout layout)
  {
    System.out.print("ROW SPECS:   ");
    for (int row = 1; row <= layout.getRowCount(); row++)
    {
      RowSpec rowSpec = layout.getRowSpec(row);
      System.out.print(rowSpec.toShortString());
      if (row < layout.getRowCount()) {
        System.out.print(", ");
      }
    }
    System.out.println();
  }
  
  public static void dumpColumnGroups(FormLayout layout)
  {
    dumpGroups("COLUMN GROUPS: ", layout.getColumnGroups());
  }
  
  public static void dumpRowGroups(FormLayout layout)
  {
    dumpGroups("ROW GROUPS:    ", layout.getRowGroups());
  }
  
  public static void dumpGridBounds(Container container)
  {
    System.out.println("GRID BOUNDS");
    dumpGridBounds(getLayoutInfo(container));
  }
  
  public static void dumpGridBounds(FormLayout.LayoutInfo layoutInfo)
  {
    System.out.print("COLUMN ORIGINS: ");
    for (int col = 0; col < columnOrigins.length; col++) {
      System.out.print(columnOrigins[col] + " ");
    }
    System.out.println();
    
    System.out.print("ROW ORIGINS:    ");
    for (int row = 0; row < rowOrigins.length; row++) {
      System.out.print(rowOrigins[row] + " ");
    }
    System.out.println();
  }
  
  public static void dumpConstraints(Container container)
  {
    System.out.println("COMPONENT CONSTRAINTS");
    if (!(container.getLayout() instanceof FormLayout))
    {
      System.out.println("The container's layout is not a FormLayout.");
      return;
    }
    FormLayout layout = (FormLayout)container.getLayout();
    int childCount = container.getComponentCount();
    for (int i = 0; i < childCount; i++)
    {
      Component child = container.getComponent(i);
      CellConstraints cc = layout.getConstraints(child);
      String ccString = cc == null ? "no constraints" : cc.toShortString(layout);
      
      System.out.print(ccString);
      System.out.print("; ");
      String childType = child.getClass().getName();
      System.out.print(childType);
      if ((child instanceof JLabel))
      {
        JLabel label = (JLabel)child;
        System.out.print("      \"" + label.getText() + "\"");
      }
      if (child.getName() != null)
      {
        System.out.print("; name=");
        System.out.print(child.getName());
      }
      System.out.println();
    }
    System.out.println();
  }
  
  private static void dumpGroups(String title, int[][] allGroups)
  {
    System.out.print(title + " {");
    for (int group = 0; group < allGroups.length; group++)
    {
      int[] groupIndices = allGroups[group];
      System.out.print(" {");
      for (int i = 0; i < groupIndices.length; i++)
      {
        System.out.print(groupIndices[i]);
        if (i < groupIndices.length - 1) {
          System.out.print(", ");
        }
      }
      System.out.print("} ");
      if (group < allGroups.length - 1) {
        System.out.print(", ");
      }
    }
    System.out.println("}");
  }
  
  public static FormLayout.LayoutInfo getLayoutInfo(Container container)
  {
    if (!(container.getLayout() instanceof FormLayout)) {
      throw new IllegalArgumentException("The container must use an instance of FormLayout.");
    }
    FormLayout layout = (FormLayout)container.getLayout();
    return layout.getLayoutInfo(container);
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.debug.FormDebugUtils
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.factories;

class Borders$1 {}

/* Location:
 * Qualified Name:     com.jgoodies.forms.factories.Borders.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.factories;

import com.jgoodies.forms.layout.ConstantSize;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import javax.swing.border.Border;

public final class Borders$EmptyBorder
  implements Border
{
  private final ConstantSize top;
  private final ConstantSize left;
  private final ConstantSize bottom;
  private final ConstantSize right;
  
  Borders$EmptyBorder(ConstantSize x0, ConstantSize x1, ConstantSize x2, ConstantSize x3, Borders.1 x4)
  {
    this(x0, x1, x2, x3);
  }
  
  private Borders$EmptyBorder(ConstantSize top, ConstantSize left, ConstantSize bottom, ConstantSize right)
  {
    this.top = top;
    this.left = left;
    this.bottom = bottom;
    this.right = right;
  }
  
  public ConstantSize top()
  {
    return top;
  }
  
  public ConstantSize left()
  {
    return left;
  }
  
  public ConstantSize bottom()
  {
    return bottom;
  }
  
  public ConstantSize right()
  {
    return right;
  }
  
  public Insets getBorderInsets(Component c)
  {
    return new Insets(top.getPixelSize(c), left.getPixelSize(c), bottom.getPixelSize(c), right.getPixelSize(c));
  }
  
  public boolean isBorderOpaque()
  {
    return false;
  }
  
  public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {}
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.factories.Borders.EmptyBorder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.factories;

import com.jgoodies.forms.layout.ConstantSize;
import com.jgoodies.forms.layout.Sizes;
import com.jgoodies.forms.util.LayoutStyle;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import java.util.StringTokenizer;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;

public final class Borders
{
  public static final Border EMPTY_BORDER = new EmptyBorder(0, 0, 0, 0);
  public static final Border DLU2_BORDER = createEmptyBorder(Sizes.DLUY2, Sizes.DLUX2, Sizes.DLUY2, Sizes.DLUX2);
  public static final Border DLU4_BORDER = createEmptyBorder(Sizes.DLUY4, Sizes.DLUX4, Sizes.DLUY4, Sizes.DLUX4);
  public static final Border DLU7_BORDER = createEmptyBorder(Sizes.DLUY7, Sizes.DLUX7, Sizes.DLUY7, Sizes.DLUX7);
  public static final Border DLU14_BORDER = createEmptyBorder(Sizes.DLUY14, Sizes.DLUX14, Sizes.DLUY14, Sizes.DLUX14);
  public static final Border BUTTON_BAR_GAP_BORDER = createEmptyBorder(LayoutStyle.getCurrent().getButtonBarPad(), Sizes.dluX(0), Sizes.dluY(0), Sizes.dluX(0));
  public static final Border DIALOG_BORDER = createEmptyBorder(LayoutStyle.getCurrent().getDialogMarginY(), LayoutStyle.getCurrent().getDialogMarginX(), LayoutStyle.getCurrent().getDialogMarginY(), LayoutStyle.getCurrent().getDialogMarginX());
  public static final Border TABBED_DIALOG_BORDER = createEmptyBorder(LayoutStyle.getCurrent().getTabbedDialogMarginY(), LayoutStyle.getCurrent().getTabbedDialogMarginX(), LayoutStyle.getCurrent().getTabbedDialogMarginY(), LayoutStyle.getCurrent().getTabbedDialogMarginX());
  
  public static Border createEmptyBorder(ConstantSize top, ConstantSize left, ConstantSize bottom, ConstantSize right)
  {
    return new EmptyBorder(top, left, bottom, right, null);
  }
  
  public static Border createEmptyBorder(String encodedSizes)
  {
    StringTokenizer tokenizer = new StringTokenizer(encodedSizes, ", ");
    int tokenCount = tokenizer.countTokens();
    if (tokenCount != 4) {
      throw new IllegalArgumentException("The border requires 4 sizes, but '" + encodedSizes + "' has " + tokenCount + ".");
    }
    ConstantSize top = Sizes.constant(tokenizer.nextToken(), false);
    ConstantSize left = Sizes.constant(tokenizer.nextToken(), true);
    ConstantSize bottom = Sizes.constant(tokenizer.nextToken(), false);
    ConstantSize right = Sizes.constant(tokenizer.nextToken(), true);
    return createEmptyBorder(top, left, bottom, right);
  }
  
  public static final class EmptyBorder
    implements Border
  {
    private final ConstantSize top;
    private final ConstantSize left;
    private final ConstantSize bottom;
    private final ConstantSize right;
    
    EmptyBorder(ConstantSize x0, ConstantSize x1, ConstantSize x2, ConstantSize x3, Borders.1 x4)
    {
      this(x0, x1, x2, x3);
    }
    
    private EmptyBorder(ConstantSize top, ConstantSize left, ConstantSize bottom, ConstantSize right)
    {
      this.top = top;
      this.left = left;
      this.bottom = bottom;
      this.right = right;
    }
    
    public ConstantSize top()
    {
      return top;
    }
    
    public ConstantSize left()
    {
      return left;
    }
    
    public ConstantSize bottom()
    {
      return bottom;
    }
    
    public ConstantSize right()
    {
      return right;
    }
    
    public Insets getBorderInsets(Component c)
    {
      return new Insets(top.getPixelSize(c), left.getPixelSize(c), bottom.getPixelSize(c), right.getPixelSize(c));
    }
    
    public boolean isBorderOpaque()
    {
      return false;
    }
    
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {}
  }
}

/* Location:
 * Qualified Name:     com.jgoodies.forms.factories.Borders
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package com.jgoodies.forms.factories;

import com.jgoodies.forms.builder.ButtonBarBuilder;
import javax.swing.JButton;
import javax.swing.JPanel;

public final class ButtonBarFactory
{
  public static JPanel buildLeftAlignedBar(JButton button1)
  {
    return buildLeftAlignedBar(new JButton[] { button1 });
  }
  
  public static JPanel buildLeftAlignedBar(JButton button1, JButton button2)
  {
    return buildLeftAlignedBar(new JButton[] { button1, button2 }, true);
  }
  
  public static JPanel buildLeftAlignedBar(JButton button1, JButton button2, JButton button3)
  {
    return buildLeftAlignedBar(new JButton[] { button1, button2, button3 }, true);
  }
  
  public static JPanel buildLeftAlignedBar(JButton button1, JButton button2, JButton button3, JButton button4)
  {
    return buildLeftAlignedBar(new JButton[] { button1, button2, button3, button4 }, true);
  }
  
  public static JPanel buildLeftAlignedBar(JButton 
1 2 3 4 5

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd