// Add dummy labels with a vertical weight of 1 at top and bottom of iconPanel
// to keep iconComponent and rotationButtonsPanel in the middle
// when grid bag fill constraint is BOTH for iconPanel.
// If this constraint is set to HORIZONTAL only, iconPanel location may be lower
// and may not be the first panel treated by the focus traversal algorithm
iconPanel.add(new JLabel(), new GridBagConstraints(
0, 0, 1, 1, 0, 1, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
iconPanel.add(this.iconComponent, new GridBagConstraints(
0, 1, 1, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0));
if (this.controller.isPropertyEditable(FurnitureController.Property.MODEL_ROTATION)) {
JPanel rotationButtonsPanel = new JPanel(new GridBagLayout()) {
@Override
public void applyComponentOrientation(ComponentOrientation o) {
// Ignore panel orientation to ensure left button is always at left of panel
}
};
rotationButtonsPanel.add(this.turnUpButton, new GridBagConstraints(
1, 0, 1, 1, 0, 0, GridBagConstraints.SOUTH,
GridBagConstraints.NONE, new Insets(0, 0, 2, 0), 0, 0));
rotationButtonsPanel.add(this.turnLeftButton, new GridBagConstraints(
0, 1, 1, 1, 0, 0, GridBagConstraints.EAST,
GridBagConstraints.NONE, new Insets(0, 0, 2, 2), 0, 0));
rotationButtonsPanel.add(this.turnRightButton, new GridBagConstraints(
2, 1, 1, 1, 1, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 2, 2, 0), 0, 0));
rotationButtonsPanel.add(this.turnDownButton, new GridBagConstraints(
1, 2, 1, 1, 0, 0, GridBagConstraints.NORTH,
GridBagConstraints.NONE, new Insets(0, 0, 2, 0), 0, 0));
iconPanel.add(rotationButtonsPanel, new GridBagConstraints(
0, 2, 1, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
}
iconPanel.add(new JLabel(), new GridBagConstraints(
0, 3, 1, 1, 0, 1, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
add(iconPanel, new GridBagConstraints(
0, 0, 1, 15, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 0, 15), 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.ID)) {
add(this.idLabel, new GridBagConstraints(
1, 0, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.idTextField, new GridBagConstraints(
2, 0, 3, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, componentInsets, 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.NAME)) {
add(this.nameLabel, new GridBagConstraints(
1, 1, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.nameTextField, new GridBagConstraints(
2, 1, 3, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, componentInsets, 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.DESCRIPTION)) {
add(this.descriptionLabel, new GridBagConstraints(
1, 2, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.descriptionTextField, new GridBagConstraints(
2, 2, 3, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, componentInsets, 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.CREATOR)) {
add(this.creatorLabel, new GridBagConstraints(
1, 3, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.creatorTextField, new GridBagConstraints(
2, 3, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 10), 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.CATEGORY)) {
add(this.categoryLabel, new GridBagConstraints(
3, 3, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.categoryComboBox, new GridBagConstraints(
4, 3, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, componentInsets, 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.PRICE)) {
add(this.priceLabel, new GridBagConstraints(
1, 4, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.priceSpinner, new GridBagConstraints(
2, 4, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 10), -10, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.VALUE_ADDED_TAX_PERCENTAGE)) {
add(this.valueAddedTaxPercentageLabel, new GridBagConstraints(
3, 4, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.valueAddedTaxPercentageSpinner, new GridBagConstraints(
4, 4, 2, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.NONE, componentInsets, 10, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.WIDTH)) {
add(this.widthLabel, new GridBagConstraints(
1, 5, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.widthSpinner, new GridBagConstraints(
2, 5, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 10), -10, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.DEPTH)) {
add(this.depthLabel, new GridBagConstraints(
3, 5, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.depthSpinner, new GridBagConstraints(
4, 5, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, componentInsets, -10, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.HEIGHT)) {
add(this.heightLabel, new GridBagConstraints(
1, 6, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.heightSpinner, new GridBagConstraints(
2, 6, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 10), -10, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.ELEVATION)) {
add(this.elevationLabel, new GridBagConstraints(
3, 6, 1, 1, 0, 0, labelAlignment,
GridBagConstraints.NONE, labelInsets, 0, 0));
add(this.elevationSpinner, new GridBagConstraints(
4, 6, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, componentInsets, -10, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.PROPORTIONAL)) {
JPanel multiplySizePanel = new JPanel();
multiplySizePanel.add(this.enlargeTenTimesButton);
multiplySizePanel.add(this.reduceTenTimesButton);
multiplySizePanel.add(this.enlargeInchTimesButton);
add(multiplySizePanel, new GridBagConstraints(
1, 7, 3, 1, 0, 0, GridBagConstraints.CENTER,
GridBagConstraints.NONE, componentInsets, 0, 0));
add(this.keepProportionsCheckBox, new GridBagConstraints(
4, 7, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.HORIZONTAL, componentInsets, 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.BACK_FACE_SHOWN)) {
add(this.backFaceShownCheckBox, new GridBagConstraints(
2, 8, 2, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.NONE, componentInsets, 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.DOOR_OR_WINDOW)) {
add(this.doorOrWindowCheckBox, new GridBagConstraints(
4, 8, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.NONE, componentInsets, 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.MOVABLE)) {
add(this.movableCheckBox, new GridBagConstraints(
2, 9, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.NONE, componentInsets, 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.DEFORMABLE)) {
add(this.deformableCheckBox, new GridBagConstraints(
3, 9, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.NONE, componentInsets, 0, 0));
}
if (this.controller.isPropertyEditable(FurnitureController.Property.RESIZABLE)) {
add(this.resizableCheckBox, new GridBagConstraints(
4, 9, 1, 1, 0, 0, GridBagConstraints.LINE_START,
GridBagConstraints.NONE, componentInsets, 0, 0));
}
}