use of com.jgoodies.forms.builder.DefaultFormBuilder in project cayenne by apache.
the class DbEntityTab method initView.
private void initView() {
toolBar = new JToolBar();
toolBar.setBorder(BorderFactory.createEmptyBorder());
toolBar.setFloatable(false);
ActionManager actionManager = Application.getInstance().getActionManager();
toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton(1));
toolBar.add(actionManager.getAction(CreateRelationshipAction.class).buildButton(3));
toolBar.addSeparator();
toolBar.add(actionManager.getAction(CreateObjEntityFromDbAction.class).buildButton(1));
toolBar.add(actionManager.getAction(DbEntitySyncAction.class).buildButton(2));
toolBar.add(actionManager.getAction(DbEntityCounterpartAction.class).buildButton(3));
toolBar.addSeparator();
toolBar.add(actionManager.getAction(ShowGraphEntityAction.class).buildButton());
// create widgets
name = new TextAdapter(new JTextField()) {
protected void updateModel(String text) {
setEntityName(text);
}
};
catalogLabel = new JLabel("Catalog:");
catalog = new TextAdapter(new JTextField()) {
protected void updateModel(String text) throws ValidationException {
setCatalog(text);
}
};
schemaLabel = new JLabel("Schema:");
schema = new TextAdapter(new JTextField()) {
protected void updateModel(String text) throws ValidationException {
setSchema(text);
}
};
qualifier = new TextAdapter(new JTextField()) {
protected void updateModel(String qualifier) {
setQualifier(qualifier);
}
};
comment = new TextAdapter(new JTextField()) {
@Override
protected void updateModel(String text) throws ValidationException {
setComment(text);
}
};
pkGeneratorType = new JComboBox<>();
pkGeneratorType.setEditable(false);
pkGeneratorType.setModel(new DefaultComboBoxModel<>(PK_GENERATOR_TYPES));
pkGeneratorDetailLayout = new CardLayout();
pkGeneratorDetail = new JPanel(pkGeneratorDetailLayout);
pkGeneratorDetail.add(new PKDefaultGeneratorPanel(mediator), PK_DEFAULT_GENERATOR);
pkGeneratorDetail.add(new PKDBGeneratorPanel(mediator), PK_DB_GENERATOR);
pkGeneratorDetail.add(new PKCustomSequenceGeneratorPanel(mediator), PK_CUSTOM_SEQUENCE_GENERATOR);
// assemble
FormLayout layout = new FormLayout("right:pref, 3dlu, fill:200dlu", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.appendSeparator("DbEntity Configuration");
builder.append("DbEntity Name:", name.getComponent());
builder.append(catalogLabel, catalog.getComponent());
builder.append(schemaLabel, schema.getComponent());
builder.append("Qualifier:", qualifier.getComponent());
builder.append("Comment:", comment.getComponent());
builder.appendSeparator("Primary Key");
builder.append("PK Generation Strategy:", pkGeneratorType);
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
mainPanel.add(builder.getPanel(), BorderLayout.NORTH);
mainPanel.add(pkGeneratorDetail, BorderLayout.CENTER);
setLayout(new BorderLayout());
add(toolBar, BorderLayout.NORTH);
add(mainPanel, BorderLayout.CENTER);
}
use of com.jgoodies.forms.builder.DefaultFormBuilder in project cayenne by apache.
the class PKDBGeneratorPanel method initView.
private void initView() {
attributes = new JComboBox();
attributes.setEditable(false);
attributes.setRenderer(new AttributeRenderer());
DefaultFormBuilder builder = new DefaultFormBuilder(new FormLayout("right:70dlu, 3dlu, fill:200dlu", ""));
builder.setDefaultDialogBorder();
builder.append("Auto Incremented:", attributes);
setLayout(new BorderLayout());
add(builder.getPanel(), BorderLayout.CENTER);
}
use of com.jgoodies.forms.builder.DefaultFormBuilder in project cayenne by apache.
the class PanelFactory method createForm.
/**
* Create panel with aligned labels on the right and fields on the left.
*/
public static JPanel createForm(String title, Component[] leftComponents, Component[] rightComponents) {
if (leftComponents.length != rightComponents.length) {
throw new IllegalArgumentException("Arrays must be the same size, instead got " + leftComponents.length + "and " + rightComponents.length);
}
int numRows = leftComponents.length;
if (numRows == 0) {
throw new IllegalArgumentException("Zero components.");
}
FormLayout layout = new FormLayout("right:100, 3dlu, left:300", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
if (title != null) {
builder.appendSeparator(title);
}
for (int i = 0; i < numRows; i++) {
builder.append(leftComponents[i], rightComponents[i]);
builder.nextLine();
}
return builder.getPanel();
}
use of com.jgoodies.forms.builder.DefaultFormBuilder in project jgnash by ccavanaugh.
the class InvestmentRegisterPanel method createTopPanel.
private JPanel createTopPanel() {
FormLayout layout = new FormLayout("45dlu:g, 8dlu, d, 4dlu, d, 8dlu, d, 4dlu, right:d, 8dlu, d, 4dlu, right:d", "");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.append(accountPath);
builder.append(rb.getString("Label.Balance"), accountBalance);
builder.append(rb.getString("Label.MarketValue"), marketValue);
builder.append(rb.getString("Label.CashBalance"), cashBalance);
return builder.getPanel();
}
use of com.jgoodies.forms.builder.DefaultFormBuilder in project jgnash by ccavanaugh.
the class FeesDialog method layoutMainPanel.
private void layoutMainPanel() {
initComponents();
FormLayout layout = new FormLayout("d:g", "80dlu:g");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.border(Borders.DIALOG);
builder.append(new JScrollPane(table));
// build the button bar
ButtonBarBuilder bbb = new ButtonBarBuilder();
bbb.addButton(newButton, deleteButton);
bbb.addUnrelatedGap();
bbb.addGlue();
bbb.addButton(deleteAllButton);
builder.append(bbb.getPanel());
builder.append(debitPanel);
builder.nextLine();
builder.appendUnrelatedComponentsGapRow();
builder.nextLine();
builder.append(StaticUIMethods.buildOKCancelBar(okButton, cancelButton));
getContentPane().add(builder.getPanel(), BorderLayout.CENTER);
}
Aggregations