in modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjAttributeInfoDialogView.java [78:204]
public ObjAttributeInfoDialogView() {
// create widgets
this.cancelButton = new JButton("Cancel");
this.saveButton = new JButton("Done");
this.selectPathButton = new JButton("Select path");
this.attributeName = new JTextField(25);
this.currentPathLabel = new JLabel();
this.sourceEntityLabel = new JLabel();
this.typeComboBox = Application.getWidgetFactory().createComboBox(ModelerUtil.getRegisteredTypeNames(), false);
AutoCompletion.enable(typeComboBox, false, true);
typeComboBox.getRenderer();
this.usedForLockingCheckBox = new JCheckBox();
this.lazyCheckBox = new JCheckBox();
this.commentField = new JTextField();
overrideAttributeTable = new CayenneTable();
tablePreferences = new TableColumnPreferences(getClass(), "overrideAttributeTable");
getRootPane().setDefaultButton(saveButton);
saveButton.setEnabled(false);
cancelButton.setEnabled(true);
selectPathButton.setEnabled(false);
setTitle("ObjAttribute Inspector");
setLayout(new BorderLayout());
CellConstraints cc = new CellConstraints();
final PanelBuilder builder = new PanelBuilder(
new FormLayout(
"right:max(50dlu;pref), 3dlu, 200dlu, 15dlu, right:max(30dlu;pref), 3dlu, 200dlu",
"p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 6dlu, p, 6dlu, p, 3dlu, fill:p:grow"));
builder.setDefaultDialogBorder();
builder.addSeparator("ObjAttribute Information", cc.xywh(1, 1, 7, 1));
builder.addLabel("Entity:", cc.xy(1, 3));
builder.add(sourceEntityLabel, cc.xywh(3, 3, 1, 1));
builder.addLabel("Attribute Name:", cc.xy(1, 5));
builder.add(attributeName, cc.xywh(3, 5, 1, 1));
builder.addLabel("Current Db Path:", cc.xy(1, 7));
builder.add(currentPathLabel, cc.xywh(3, 7, 5, 1));
builder.addLabel("Java Type:", cc.xy(1, 9));
builder.add(typeComboBox, cc.xywh(3, 9, 1, 1));
builder.addLabel("Used for locking:", cc.xy(1, 11));
builder.add(usedForLockingCheckBox, cc.xywh(3, 11, 1, 1));
builder.addLabel("Lazy loading:", cc.xy(1, 13));
builder.add(lazyCheckBox, cc.xywh(3, 13, 1, 1));
builder.addLabel("Comment:", cc.xy(1, 15));
builder.add(commentField, cc.xywh(3, 15, 1, 1));
builder.addSeparator("Mapping to DbAttributes", cc.xywh(1, 17, 7, 1));
typeManagerPane = new JPanel();
typeManagerPane.setLayout(new CardLayout());
final FormLayout fL = new FormLayout(
"493dlu ",
"p, 3dlu, fill:min(128dlu;pref):grow");
// panel for Flattened attribute
final PanelBuilder builderPathPane = new PanelBuilder(fL);
JPanel buttonsPane = new JPanel(new FlowLayout(FlowLayout.LEADING));
buttonsPane.add(selectPathButton);
builderPathPane.add(buttonsPane, cc.xywh(1, 1, 1, 1));
pathBrowser = new ObjAttributePathBrowser(selectPathButton, saveButton);
pathBrowser.setPreferredColumnSize(BROWSER_CELL_DIM);
pathBrowser.setDefaultRenderer();
builderPathPane.add(new JScrollPane(
pathBrowser,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), cc.xywh(1, 3, 1, 1));
// panel for embeddable attribute
final FormLayout fLEmb = new FormLayout(
"493dlu ",
"fill:min(140dlu;pref):grow");
final PanelBuilder embeddablePane = new PanelBuilder(fLEmb);
embeddablePane.add(new JScrollPane(overrideAttributeTable,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),
cc.xywh(1, 1, 1, 1));
typeManagerPane.add(builderPathPane.getPanel(), FLATTENED_PANEL);
typeManagerPane.add(embeddablePane.getPanel(), EMBEDDABLE_PANEL);
builder.add(typeManagerPane, cc.xywh(1, 19, 7, 1));
add(builder.getPanel(), BorderLayout.CENTER);
this.addComponentListener(new ComponentListener() {
int height;
public void componentHidden(ComponentEvent e) {
}
public void componentMoved(ComponentEvent e) {
}
public void componentResized(ComponentEvent e) {
int delta = e.getComponent().getHeight() - height;
if (delta < 0) {
fL.setRowSpec(3, RowSpec.decode("fill:min(10dlu;pref):grow"));
fLEmb.setRowSpec(1, RowSpec.decode("fill:min(10dlu;pref):grow"));
}
}
public void componentShown(ComponentEvent e) {
height = e.getComponent().getHeight();
}
});
JButton[] buttons = {cancelButton, saveButton};
add(PanelFactory.createButtonPanel(buttons), BorderLayout.SOUTH);
}