List of usage examples for com.jgoodies.forms.layout CellConstraints xywh
public CellConstraints xywh(int col, int row, int colSpan, int rowSpan)
Examples:
cc.xywh(1, 3, 2, 1); cc.xywh(1, 3, 7, 3);
From source file:org.apache.cayenne.modeler.dialog.objentity.ObjAttributeInfoDialogView.java
License:Apache License
public ObjAttributeInfoDialogView(final ProjectController mediator) { this.mediator = mediator; // 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);/*w ww . j av a 2s .c o m*/ AutoCompletion.enable(typeComboBox, false, true); typeComboBox.getRenderer(); 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, 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("Type:", cc.xy(1, 9)); builder.add(typeComboBox, cc.xywh(3, 9, 1, 1)); builder.addSeparator("Mapping to DbAttributes", cc.xywh(1, 11, 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, 13, 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); typeComboBox.addActionListener(e -> { boolean isType = false; String[] typeNames = ModelerUtil.getRegisteredTypeNames(); for (String typeName : typeNames) { if (typeComboBox.getSelectedItem() == null || typeName.equals(typeComboBox.getSelectedItem().toString())) { isType = true; } } if (isType || !mediator.getEmbeddableNamesInCurrentDataDomain() .contains((String) typeComboBox.getSelectedItem())) { ((CardLayout) typeManagerPane.getLayout()).show(typeManagerPane, FLATTENED_PANEL); } else { ((CardLayout) typeManagerPane.getLayout()).show(typeManagerPane, EMBEDDABLE_PANEL); getCurrentPathLabel().setText(""); } }); }
From source file:org.apache.cayenne.modeler.dialog.objentity.ObjRelationshipInfoView.java
License:Apache License
public ObjRelationshipInfoView(final ProjectController mediator) { super(Application.getFrame()); this.mediator = mediator; this.widgetFactory = new DefaultWidgetFactory(); this.cancelButton = new JButton("Cancel"); this.saveButton = new JButton("Done"); this.newRelButton = new JButton("New DbRelationship"); this.selectPathButton = new JButton("Select Path"); this.relationshipName = new JTextField(25); this.currentPathLabel = new JLabel(); this.sourceEntityLabel = new JLabel(); cancelButton.setEnabled(true);// w w w . j a va 2 s. co m getRootPane().setDefaultButton(saveButton); saveButton.setEnabled(true); newRelButton.setEnabled(true); collectionTypeCombo = widgetFactory.createComboBox(); collectionTypeCombo.setVisible(true); this.targetCombo = widgetFactory.createComboBox(); targetCombo.setVisible(true); this.mapKeysCombo = widgetFactory.createComboBox(); mapKeysCombo.setVisible(true); pathBrowser = new ObjRelationshipPathBrowser(); pathBrowser.setPreferredColumnSize(BROWSER_CELL_DIM); pathBrowser.setDefaultRenderer(); setTitle("ObjRelationship Inspector"); setLayout(new BorderLayout()); CellConstraints cc = new CellConstraints(); PanelBuilder builder = new PanelBuilder(new FormLayout( "right:max(50dlu;pref), 3dlu, fill:min(150dlu;pref), 3dlu, 300dlu, 3dlu, fill:min(120dlu;pref)", "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, top:14dlu, 3dlu, top:p:grow")); builder.setDefaultDialogBorder(); builder.addSeparator("ObjRelationship Information", cc.xywh(1, 1, 5, 1)); builder.addLabel("Source Entity:", cc.xy(1, 3)); builder.add(sourceEntityLabel, cc.xywh(3, 3, 1, 1)); builder.addLabel("Target Entity:", cc.xy(1, 5)); builder.add(targetCombo, cc.xywh(3, 5, 1, 1)); builder.addLabel("Relationship Name:", cc.xy(1, 7)); builder.add(relationshipName, cc.xywh(3, 7, 1, 1)); builder.addLabel("Current Db Path:", cc.xy(1, 9)); builder.add(currentPathLabel, cc.xywh(3, 9, 5, 1)); collectionTypeLabel = builder.addLabel("Collection Type:", cc.xy(1, 11)); builder.add(collectionTypeCombo, cc.xywh(3, 11, 1, 1)); mapKeysLabel = builder.addLabel("Map Key:", cc.xy(1, 13)); builder.add(mapKeysCombo, cc.xywh(3, 13, 1, 1)); builder.addSeparator("Mapping to DbRelationships", cc.xywh(1, 15, 5, 1)); JPanel buttonsPane = new JPanel(new FlowLayout(FlowLayout.LEADING)); buttonsPane.add(selectPathButton); buttonsPane.add(newRelButton); builder.add(buttonsPane, cc.xywh(1, 17, 5, 1)); builder.add(new JScrollPane(pathBrowser, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), cc.xywh(1, 19, 5, 3)); add(builder.getPanel(), BorderLayout.CENTER); JButton[] buttons = { cancelButton, saveButton }; add(PanelFactory.createButtonPanel(buttons), BorderLayout.SOUTH); }
From source file:org.apache.cayenne.modeler.dialog.pref.GeneralPreferencesView.java
License:Apache License
public GeneralPreferencesView() { this.encodingSelector = new EncodingSelectorView(); this.encodingSelectorLabel = new JLabel("File Encoding:"); this.autoLoadProjectBox = new JCheckBox("Automatically Load Last Opened Project"); this.deletePromptBox = new JCheckBox("Always Delete Items Without Prompt"); FormLayout layout = new FormLayout("right:pref, 3dlu, 30dlu, 3dlu, fill:70dlu", "p, 3dlu, p, 12dlu, p, 30dlu, p, 12dlu, p, 3dlu, p, fill:40dlu:grow"); CellConstraints cc = new CellConstraints(); PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder();//from w w w . j av a2s . co m builder.addSeparator("General Preferences", cc.xyw(1, 1, 5)); builder.add(encodingSelectorLabel, cc.xy(1, 5)); builder.add(encodingSelector, cc.xywh(3, 5, 3, 3)); builder.add(autoLoadProjectBox, cc.xy(1, 7, CellConstraints.LEFT, CellConstraints.DEFAULT)); builder.addSeparator("Editor Preferences", cc.xyw(1, 9, 5)); builder.add(deletePromptBox, cc.xy(1, 11, CellConstraints.LEFT, CellConstraints.DEFAULT)); this.setLayout(new BorderLayout()); this.add(builder.getPanel(), BorderLayout.CENTER); }
From source file:org.apache.cayenne.modeler.dialog.pref.TemplateCreatorView.java
License:Apache License
public TemplateCreatorView(JDialog parent) { super(parent, "New Template"); this.templateName = new JTextField(20); this.templateChooser = new FileChooser("Select Template File", true, false); templateChooser.setExistingOnly(true); templateChooser.setColumns(20);/*from www . j a va 2s . c om*/ this.okButton = new JButton("Create"); this.cancelButton = new JButton("Cancel"); // assemble CellConstraints cc = new CellConstraints(); PanelBuilder builder = new PanelBuilder( new FormLayout("right:pref, 3dlu, pref, 3dlu, pref:grow", "p, 3dlu, p")); builder.setDefaultDialogBorder(); builder.addLabel("Name:", cc.xy(1, 1)); builder.add(templateName, cc.xy(3, 1)); builder.addLabel("Template File:", cc.xy(1, 3)); builder.add(templateChooser, cc.xywh(3, 3, 3, 1)); getRootPane().setDefaultButton(okButton); JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT)); buttons.add(cancelButton); buttons.add(okButton); getContentPane().setLayout(new BorderLayout()); getContentPane().add(builder.getPanel(), BorderLayout.CENTER); getContentPane().add(buttons, BorderLayout.SOUTH); }
From source file:org.apache.cayenne.modeler.dialog.ResolveDbRelationshipDialog.java
License:Apache License
/** * Creates graphical components./*from www . java 2 s. c o m*/ */ private void initView() { // create widgets sourceName = new JLabel(); targetName = new JLabel(); name = new JTextField(25); reverseName = new JTextField(25); addButton = new JButton("Add"); addButton.setEnabled(this.editable); removeButton = new JButton("Remove"); removeButton.setEnabled(this.editable); saveButton = new JButton("Done"); cancelButton = new JButton("Cancel"); cancelButton.setEnabled(this.editable); table = new AttributeTable(); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tablePreferences = new TableColumnPreferences(getClass(), "dbentity/dbjoinTable"); getRootPane().setDefaultButton(saveButton); // assemble getContentPane().setLayout(new BorderLayout()); CellConstraints cc = new CellConstraints(); PanelBuilder builder = new PanelBuilder( new FormLayout("right:max(50dlu;pref), 3dlu, fill:min(150dlu;pref), 3dlu, fill:min(50dlu;pref)", "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 9dlu, p, 3dlu, top:14dlu, 3dlu, top:p:grow")); builder.setDefaultDialogBorder(); builder.addSeparator("DbRelationship Information", cc.xywh(1, 1, 5, 1)); builder.addLabel("Source Entity:", cc.xy(1, 3)); builder.add(sourceName, cc.xywh(3, 3, 1, 1)); builder.addLabel("Target Entity:", cc.xy(1, 5)); builder.add(targetName, cc.xywh(3, 5, 1, 1)); builder.addLabel("Relationship Name:", cc.xy(1, 7)); builder.add(name, cc.xywh(3, 7, 1, 1)); builder.addLabel("Reverse Relationship Name:", cc.xy(1, 9)); builder.add(reverseName, cc.xywh(3, 9, 1, 1)); builder.addSeparator("Joins", cc.xywh(1, 11, 5, 1)); builder.add(new JScrollPane(table), cc.xywh(1, 13, 3, 3, "fill, fill")); JPanel joinButtons = new JPanel(new FlowLayout(FlowLayout.LEADING)); joinButtons.add(addButton); joinButtons.add(removeButton); builder.add(joinButtons, cc.xywh(5, 13, 1, 3)); getContentPane().add(builder.getPanel(), BorderLayout.CENTER); JButton[] buttons = { cancelButton, saveButton }; getContentPane().add(PanelFactory.createButtonPanel(buttons), BorderLayout.SOUTH); }
From source file:org.apache.cayenne.modeler.editor.DataDomainView.java
License:Apache License
protected void initView() { // create widgets this.name = new TextAdapter(new JTextField()) { protected void updateModel(String text) { setDomainName(text);/*from w w w . j a v a2 s. com*/ } }; this.objectValidation = new JCayenneCheckBox(); this.sharedCache = new JCayenneCheckBox(); // assemble CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("right:pref, 3dlu, fill:50dlu, 3dlu, fill:47dlu, 3dlu, fill:100", "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); builder.addSeparator("DataDomain Configuration", cc.xywh(1, 1, 7, 1)); builder.addLabel("DataDomain Name:", cc.xy(1, 3)); builder.add(name.getComponent(), cc.xywh(3, 3, 5, 1)); builder.addLabel("Object Validation:", cc.xy(1, 5)); builder.add(objectValidation, cc.xy(3, 5)); builder.addLabel("Use Shared Cache:", cc.xy(1, 7)); builder.add(sharedCache, cc.xy(3, 7)); this.setLayout(new BorderLayout()); this.add(builder.getPanel(), BorderLayout.CENTER); }
From source file:org.apache.cayenne.modeler.editor.datanode.JDBCDataSourceView.java
License:Apache License
public JDBCDataSourceView() { driver = new JTextFieldUndoable(); url = new JTextFieldUndoable(); userName = new JTextFieldUndoable(); password = new JPasswordField(); minConnections = new JTextFieldUndoable(6); maxConnections = new JTextFieldUndoable(6); syncWithLocal = new JButton("Sync with Local"); syncWithLocal.setToolTipText("Update from local DataSource"); // assemble//from w ww . j a v a 2 s .com CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("right:80dlu, 3dlu, fill:50dlu, 3dlu, fill:74dlu, 3dlu, fill:70dlu", // Columns "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p"); // Rows PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); builder.addSeparator("JDBC Configuration", cc.xywh(1, 1, 7, 1)); builder.addLabel("JDBC Driver:", cc.xy(1, 3)); builder.add(driver, cc.xywh(3, 3, 5, 1)); builder.addLabel("DB URL:", cc.xy(1, 5)); builder.add(url, cc.xywh(3, 5, 5, 1)); builder.addLabel("Username:", cc.xy(1, 7)); builder.add(userName, cc.xywh(3, 7, 5, 1)); builder.addLabel("Password:", cc.xy(1, 9)); builder.add(password, cc.xywh(3, 9, 5, 1)); builder.addLabel("Min Connections:", cc.xy(1, 11)); builder.add(minConnections, cc.xy(3, 11)); builder.addLabel("Max Connections:", cc.xy(1, 13)); builder.add(maxConnections, cc.xy(3, 13)); builder.add(syncWithLocal, cc.xy(7, 15)); this.setLayout(new BorderLayout()); this.add(builder.getPanel(), BorderLayout.CENTER); }
From source file:org.apache.cayenne.modeler.editor.datanode.PasswordEncoderView.java
License:Apache License
public PasswordEncoderView() { this.passwordEncoder = Application.getWidgetFactory().createUndoableComboBox(); this.passwordLocation = Application.getWidgetFactory().createUndoableComboBox(); this.passwordSource = new JTextFieldUndoable(); this.passwordKey = new JTextFieldUndoable(); // init combo box choices passwordEncoder.setModel(new DefaultComboBoxModel(PasswordEncoding.standardEncoders)); passwordEncoder.setEditable(true);// w w w .ja v a 2s .c o m passwordLocation = Application.getWidgetFactory().createUndoableComboBox(); passwordLocation.setRenderer(new PasswordLocationRenderer()); DefaultComboBoxModel passwordLocationModel = new DefaultComboBoxModel(PASSWORD_LOCATIONS); passwordLocation.setModel(passwordLocationModel); CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("right:80dlu, 3dlu, fill:50dlu, 3dlu, fill:74dlu, 3dlu, fill:70dlu", // Columns "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p"); // Rows PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); builder.addSeparator("Encoder", cc.xywh(1, 1, 7, 1)); builder.addLabel("Password Encoder:", cc.xy(1, 11)); builder.add(passwordEncoder, cc.xywh(3, 11, 5, 1)); builder.addLabel("Password Encoder Key:", cc.xy(1, 13)); builder.add(passwordKey, cc.xywh(3, 13, 5, 1)); builder.addLabel("Note: Cayenne supplied encoders do not use a key.", cc.xywh(3, 15, 5, 1)); builder.addLabel("Password Location:", cc.xy(1, 17)); builder.add(passwordLocation, cc.xywh(3, 17, 5, 1)); passwordSourceLabel = builder.addLabel("Password Source:", cc.xy(1, 19)); builder.add(passwordSource, cc.xywh(3, 19, 5, 1)); this.setLayout(new BorderLayout()); this.add(builder.getPanel(), BorderLayout.CENTER); }
From source file:org.apache.cayenne.modeler.editor.EjbqlQueryMainTab.java
License:Apache License
private void initView() { // create widgets name = new TextAdapter(new JTextField()) { @Override//from w ww. ja v a 2 s .com protected void updateModel(String text) { setQueryName(text); } }; comment = new TextAdapter(new JTextField()) { @Override protected void updateModel(String text) { setQueryComment(text); } }; properties = new EjbqlQueryPropertiesPanel(mediator); // assemble CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout("right:max(80dlu;pref), 3dlu, fill:max(200dlu;pref)", "p, 3dlu, p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); builder.addSeparator("EJBQL Query Settings", cc.xywh(1, 1, 3, 1)); builder.addLabel("Query Name:", cc.xy(1, 3)); builder.add(name.getComponent(), cc.xy(3, 3)); builder.addLabel("Comment:", cc.xy(1, 5)); builder.add(comment.getComponent(), cc.xy(3, 5)); this.setLayout(new BorderLayout()); this.add(builder.getPanel(), BorderLayout.NORTH); this.add(properties, BorderLayout.CENTER); }
From source file:org.apache.cayenne.modeler.editor.EjbqlQueryPropertiesPanel.java
License:Apache License
protected PanelBuilder createPanelBuilder() { CellConstraints cc = new CellConstraints(); FormLayout layout = new FormLayout( "right:max(80dlu;pref), 3dlu, left:max(10dlu;pref), " + "3dlu, left:max(37dlu;pref), 3dlu, fill:max(147dlu;pref)", "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder();// w w w .ja v a 2 s. com builder.addSeparator("Select Properties", cc.xywh(1, 1, 7, 1)); builder.addLabel("Result Caching:", cc.xy(1, 3)); builder.add(cacheStrategy, cc.xywh(3, 3, 5, 1)); cacheGroupsLabel = builder.addLabel("Cache Group:", cc.xy(1, 7)); builder.add(cacheGroups.getComponent(), cc.xywh(3, 7, 5, 1)); builder.addLabel("Fetch Offset, Rows:", cc.xy(1, 9)); builder.add(fetchOffset.getComponent(), cc.xywh(3, 9, 3, 1)); builder.addLabel("Fetch Limit, Rows:", cc.xy(1, 11)); builder.add(fetchLimit.getComponent(), cc.xywh(3, 11, 3, 1)); builder.addLabel("Page Size:", cc.xy(1, 13)); builder.add(pageSize.getComponent(), cc.xywh(3, 13, 3, 1)); return builder; }