List of usage examples for com.jgoodies.forms.layout CellConstraints xy
public CellConstraints xy(int col, int row, String encodedAlignments)
Examples:
cc.xy(1, 3, "left, bottom"); cc.xy(1, 3, "l, b"); cc.xy(1, 3, "center, fill"); cc.xy(1, 3, "c, f");
From source file:ca.sqlpower.matchmaker.swingui.engine.EngineSettingsPanel.java
License:Open Source License
/** * Builds the UI for this editor pane. This is broken into two parts, * the configuration and output. Configuration is done in this method * while the output section is handled by the EngineOutputPanel and * this method simply lays out the components that class provides. *//* ww w . j av a2s. c om*/ private JPanel buildUI() { logger.debug("We are building the UI of an engine settings panel."); if (type == EngineType.ADDRESS_CORRECTION_ENGINE) { expiryDatePane = new JEditorPane(); expiryDatePane.setEditable(false); final AddressDatabase addressDatabase; try { addressDatabase = new AddressDatabase( new File(swingSession.getContext().getAddressCorrectionDataPath())); expiryDate = addressDatabase.getExpiryDate(); expiryDatePane.setText(DateFormat.getDateInstance().format(expiryDate)); } catch (DatabaseException e1) { MMSUtils.showExceptionDialog(parentFrame, "An error occured while loading the Address Correction Data", e1); expiryDatePane.setText("Database missing, expiry date invalid"); } logger.debug("We are adding the listener"); swingSession.getContext().addPreferenceChangeListener(new PreferenceChangeListener() { public void preferenceChange(PreferenceChangeEvent evt) { if (MatchMakerSessionContext.ADDRESS_CORRECTION_DATA_PATH.equals(evt.getKey())) { logger.debug("The new database path is: " + evt.getNewValue()); final AddressDatabase addressDatabase; try { addressDatabase = new AddressDatabase(new File(evt.getNewValue())); expiryDate = addressDatabase.getExpiryDate(); expiryDatePane.setText(DateFormat.getDateInstance().format(expiryDate)); } catch (DatabaseException ex) { MMSUtils.showExceptionDialog(parentFrame, "An error occured while loading the Address Correction Data", ex); expiryDate = null; expiryDatePane.setText("Database missing, expiry date invalid"); } } } }); // handler listens to expiryDatePane so whenever the expiryDatePane's text has been changed, the below method will be called. handler.addValidateObject(expiryDatePane, new Validator() { public ValidateResult validate(Object contents) { if (expiryDate == null) { return ValidateResult.createValidateResult(Status.FAIL, "Address Correction Database is missing. Please reset your Address Correction Data Path in Preferences."); } if (Calendar.getInstance().getTime().after(expiryDate)) { return ValidateResult.createValidateResult(Status.WARN, "Address Correction Database is expired. The results of this engine run cannot be SERP valid."); } return ValidateResult.createValidateResult(Status.OK, ""); } }); } File logFile = engineSettings.getLog(); logFilePath = new JTextField(logFile.getAbsolutePath()); handler.addValidateObject(logFilePath, new FileNameValidator("Log")); browseLogFileAction = new BrowseFileAction(parentFrame, logFilePath); appendToLog = new JCheckBox("Append to old Log File?", engineSettings.getAppendToLog()); recordsToProcess = new JSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 100)); if (engineSettings.getProcessCount() != null) { recordsToProcess.setValue(engineSettings.getProcessCount()); } spinnerUpdateManager = new SpinnerUpdateManager(recordsToProcess, engineSettings, "processCount", handler, this, refreshButton); debugMode = new JCheckBox("Debug Mode (Changes will be rolled back)", engineSettings.getDebug()); updaters.add(new CheckBoxModelUpdater(debugMode, "debug")); engineSettings.addSPListener(updaters.get(updaters.size() - 1)); itemListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (((JCheckBox) e.getSource()).isSelected()) { if (type == EngineType.MATCH_ENGINE || type == EngineType.ADDRESS_CORRECTION_ENGINE) { clearMatchPool.setSelected(false); // I've currently disabled the clear match pool option because the match // in debug mode, changes should be rolled back, but if the clearing of the match // pool is rolled back but the engine thinks that it is cleared, it can cause // unique key violations when it tries to insert 'new' matches. But if the engine // is made aware of the rollback, then it would be as if clear match pool wasn't // selected in the first place, so I don't see the point in enabling it in debug mode clearMatchPool.setEnabled(false); } recordsToProcess.setValue(new Integer(1)); engine.setMessageLevel(Level.ALL); messageLevel.setSelectedItem(engine.getMessageLevel()); } else { if (type == EngineType.MATCH_ENGINE || type == EngineType.ADDRESS_CORRECTION_ENGINE) { clearMatchPool.setEnabled(true); } recordsToProcess.setValue(new Integer(0)); } engineSettings.setDebug(debugMode.isSelected()); } }; debugMode.addItemListener(itemListener); if (type == EngineType.MATCH_ENGINE || type == EngineType.ADDRESS_CORRECTION_ENGINE) { if (type == EngineType.MATCH_ENGINE) { clearMatchPool = new JCheckBox("Clear match pool", ((MungeSettings) engineSettings).isClearMatchPool()); } else { clearMatchPool = new JCheckBox("Clear address pool", ((MungeSettings) engineSettings).isClearMatchPool()); } itemListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { ((MungeSettings) engineSettings).setClearMatchPool(clearMatchPool.isSelected()); } }; clearMatchPool.addItemListener(itemListener); updaters.add(new CheckBoxModelUpdater(clearMatchPool, "clearMatchPool")); engineSettings.addSPListener(updaters.get(updaters.size() - 1)); if (debugMode.isSelected()) { clearMatchPool.setSelected(false); // See comment just above about why this is disabled clearMatchPool.setEnabled(false); } } if (engineSettings instanceof MungeSettings) { useBatchExecute = new JCheckBox("Batch execute SQL statments", ((MungeSettings) engineSettings).isUseBatchExecution()); itemListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { ((MungeSettings) engineSettings).setUseBatchExecution(useBatchExecute.isSelected()); } }; useBatchExecute.addItemListener(itemListener); updaters.add(new CheckBoxModelUpdater(useBatchExecute, "useBatchExecution")); engineSettings.addSPListener(updaters.get(updaters.size() - 1)); } if (type == EngineType.ADDRESS_CORRECTION_ENGINE) { autoWriteAutoValidatedAddresses = new JCheckBox("Immediately commit auto-corrected addresses", ((MungeSettings) engineSettings).isAutoWriteAutoValidatedAddresses()); itemListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { ((MungeSettings) engineSettings) .setAutoWriteAutoValidatedAddresses(autoWriteAutoValidatedAddresses.isSelected()); } }; autoWriteAutoValidatedAddresses.addItemListener(itemListener); updaters.add( new CheckBoxModelUpdater(autoWriteAutoValidatedAddresses, "autoWriteAutoValidatedAddresses")); engineSettings.addSPListener(updaters.get(updaters.size() - 1)); } messageLevel = new JComboBox(new Level[] { Level.OFF, Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG, Level.ALL }); messageLevel.setSelectedItem(engine.getMessageLevel()); messageLevel.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setText(value == null ? null : value.toString()); return this; } }); messageLevelActionListener = new AbstractAction() { public void actionPerformed(ActionEvent e) { Level sel = (Level) messageLevel.getSelectedItem(); engine.setMessageLevel(sel); } }; messageLevel.addActionListener(messageLevelActionListener); String rowSpecs; if (type == EngineType.ADDRESS_CORRECTION_ENGINE) { rowSpecs = ADDRESS_CORRECTION_ENGINE_PANEL_ROW_SPECS; } else if (type == EngineType.VALIDATED_ADDRESS_COMMITING_ENGINE) { rowSpecs = ADDRESS_COMMITTING_ENGINE_PANEL_ROW_SPECS; } else if (type == EngineType.MERGE_ENGINE) { rowSpecs = MERGE_ENGINE_PANEL_ROW_SPECS; } else if (type == EngineType.CLEANSE_ENGINE) { rowSpecs = CLEANSE_ENGINE_PANEL_ROW_SPECS; } else { rowSpecs = MATCH_ENGINE_PANEL_ROW_SPECS; } String columnSpecs = "4dlu,fill:pref,4dlu,pref,pref,40dlu,fill:pref:grow,pref,4dlu"; FormLayout layout = new FormLayout(columnSpecs, rowSpecs); PanelBuilder pb; JPanel p = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); pb = new PanelBuilder(layout, p); CellConstraints cc = new CellConstraints(); pb.add(status, cc.xyw(4, 2, 6, "l,c")); pb.add(refreshButton, cc.xy(6, 2, "l, c")); refreshButton.setVisible(false); int y = 4; pb.add(new JLabel("Log File:"), cc.xy(2, y, "r,f")); pb.add(logFilePath, cc.xyw(4, y, 4, "f,f")); pb.add(new JButton(browseLogFileAction), cc.xy(8, y, "l,f")); y += 2; pb.add(appendToLog, cc.xy(4, y, "l,t")); pb.add(new JButton(new ShowLogFileAction(logFilePath)), cc.xy(5, y, "r,t")); if (type == EngineType.MATCH_ENGINE || type == EngineType.CLEANSE_ENGINE) { y += 2; pb.add(new JLabel("Tranformations to run: "), cc.xy(2, y, "r,t")); final MungeProcessSelectionList selectionButton = new MungeProcessSelectionList(project) { @Override public boolean getValue(MungeProcess mp) { return mp.getActive(); } @Override public void setValue(MungeProcess mp, boolean value) { mp.setActive(value); } }; activeListener = new AbstractPoolingSPListener() { boolean isSelectionListUpdate = false; @Override protected void finalCommitImpl(TransactionEvent e) { if (isSelectionListUpdate) { selectionButton.checkModel(); } } @Override public void propertyChangeImpl(PropertyChangeEvent evt) { logger.debug("checking property with name " + evt.getPropertyName()); if (evt.getPropertyName().equals("active")) { isSelectionListUpdate = true; } else { isSelectionListUpdate = false; } } }; swingSession.getRootNode().addSPListener(activeListener); for (MungeProcess mp : project.getMungeProcesses()) { mp.addSPListener(activeListener); } newMungeProcessListener = new AbstractSPListener() { @Override public void childAdded(SPChildEvent e) { selectionButton.refreshList(); } @Override public void childRemoved(SPChildEvent e) { selectionButton.refreshList(); } }; project.addSPListener(newMungeProcessListener); pb.add(selectionButton, cc.xyw(4, y, 2, "l,c")); } y += 2; pb.add(new JLabel("# of records to process:"), cc.xy(2, y, "r,c")); pb.add(recordsToProcess, cc.xy(4, y, "l,c")); pb.add(new JLabel(" (Set to 0 to process all)"), cc.xy(5, y, "l, c")); if (type == EngineType.ADDRESS_CORRECTION_ENGINE) { pb.add(new JLabel("Address Filter Setting:"), cc.xy(7, y)); } if (engineSettings instanceof MungeSettings) { MungeSettings mungeSettings = (MungeSettings) engineSettings; y += 2; pb.add(useBatchExecute, cc.xyw(4, y, 2, "l,c")); if (type == EngineType.ADDRESS_CORRECTION_ENGINE) { final JLabel poolSettingLabel = new JLabel( mungeSettings.getPoolFilterSetting().getLongDescription()); SPListener poolFilterSettingChangeListener = new SPListener() { public void childAdded(SPChildEvent evt) { // no-op } public void childRemoved(SPChildEvent evt) { // no-op } public void propertyChanged(PropertyChangeEvent evt) { if (evt.getPropertyName() == "poolFilterSetting") { PoolFilterSetting newValue = (PoolFilterSetting) evt.getNewValue(); poolSettingLabel.setText(newValue.getLongDescription()); } } public void transactionStarted(TransactionEvent evt) { // no-op } public void transactionRollback(TransactionEvent evt) { // no-op } public void transactionEnded(TransactionEvent evt) { } }; mungeSettings.addSPListener(poolFilterSettingChangeListener); Font f = poolSettingLabel.getFont(); Font newFont = f.deriveFont(Font.ITALIC); poolSettingLabel.setFont(newFont); pb.add(poolSettingLabel, cc.xy(7, y)); } } if (type == EngineType.ADDRESS_CORRECTION_ENGINE) { y += 2; pb.add(autoWriteAutoValidatedAddresses, cc.xyw(4, y, 2, "l,c")); if (type == EngineType.ADDRESS_CORRECTION_ENGINE) { pb.add(new JLabel("Auto-correction Setting:"), cc.xy(7, y)); } } if (type == EngineType.MATCH_ENGINE || type == EngineType.ADDRESS_CORRECTION_ENGINE) { y += 2; pb.add(clearMatchPool, cc.xyw(4, y, 2, "l,c")); if (type == EngineType.ADDRESS_CORRECTION_ENGINE) { MungeSettings mungeSettings = (MungeSettings) engineSettings; final JLabel autoValidateSettingLabel = new JLabel( ((MungeSettings) engineSettings).getAutoValidateSetting().getLongDescription()); SPListener poolFilterSettingChangeListener = new SPListener() { public void childAdded(SPChildEvent evt) { // no-op } public void childRemoved(SPChildEvent evt) { // no-op } public void propertyChanged(PropertyChangeEvent evt) { if (evt.getPropertyName() == "autoValidateSetting") { AutoValidateSetting newValue = (AutoValidateSetting) evt.getNewValue(); autoValidateSettingLabel.setText(newValue.getLongDescription()); } } public void transactionStarted(TransactionEvent evt) { // no-op } public void transactionRollback(TransactionEvent evt) { // no-op } public void transactionEnded(TransactionEvent evt) { // no-op } }; mungeSettings.addSPListener(poolFilterSettingChangeListener); Font f = autoValidateSettingLabel.getFont(); Font newFont = f.deriveFont(Font.ITALIC); autoValidateSettingLabel.setFont(newFont); pb.add(autoValidateSettingLabel, cc.xy(7, y)); } } y += 2; pb.add(debugMode, cc.xyw(4, y, 2, "l,c")); if (type == EngineType.ADDRESS_CORRECTION_ENGINE) { final AddressValidationSettingsPanel avsp = new AddressValidationSettingsPanel( (MungeSettings) engineSettings); final JDialog validationSettingsDialog = DataEntryPanelBuilder.createDataEntryPanelDialog(avsp, swingSession.getFrame(), "Address Validation Settings", "OK", new Callable<Boolean>() { public Boolean call() throws Exception { boolean returnValue = avsp.applyChanges(); return returnValue; } }, new Callable<Boolean>() { public Boolean call() throws Exception { return true; } }); validationSettingsDialog.setLocationRelativeTo(pb.getPanel()); JButton addressValidationSettings = new JButton(new AbstractAction("Validation Settings...") { public void actionPerformed(ActionEvent e) { validationSettingsDialog.setVisible(true); } }); pb.add(addressValidationSettings, cc.xy(7, y, "l,c")); } y += 2; pb.add(new JLabel("Message Level:"), cc.xy(2, y, "r,t")); pb.add(messageLevel, cc.xy(4, y, "l,t")); abortButton = new JButton(new AbstractAction("Abort!") { public void actionPerformed(ActionEvent e) { engine.setCancelled(true); } }); abortButton.setEnabled(false); ButtonBarBuilder bbb = new ButtonBarBuilder(); bbb.addFixed(new JButton(new SaveAction())); bbb.addRelatedGap(); bbb.addFixed(new JButton(new ShowCommandAction(parentFrame, this, engine))); bbb.addRelatedGap(); bbb.addFixed(new JButton(runEngineAction)); bbb.addRelatedGap(); bbb.addFixed(abortButton); y += 2; pb.add(bbb.getPanel(), cc.xyw(2, y, 7, "r,c")); y += 2; pb.add(engineOutputPanel.getProgressBar(), cc.xyw(2, y, 7)); y += 2; pb.add(engineOutputPanel.getOutputComponent(), cc.xyw(2, y, 7)); y += 2; pb.add(engineOutputPanel.getButtonBar(), cc.xyw(2, y, 7)); refreshRunActionStatus(); return pb.getPanel(); }
From source file:ca.sqlpower.matchmaker.swingui.engine.ShowCommandAction.java
License:Open Source License
/** * Tells the editor to save its changes, then asks the engine for its command line. * Displays the resulting command line to the user in a pop-up dialog. *///from w w w. j av a 2 s. co m public void actionPerformed(ActionEvent e) { final String cmd = engine.createCommandLine(); final JDialog d = new JDialog(parent, "DQguru Engine Command Line"); FormLayout layout = new FormLayout("4dlu,fill:pref:grow,4dlu", // columns "4dlu,fill:pref:grow,4dlu,pref,4dlu"); // rows // 1 2 3 4 5 PanelBuilder pb; JPanel p = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); pb = new PanelBuilder(layout, p); CellConstraints cc = new CellConstraints(); final JTextArea cmdText = new JTextArea(15, 60); cmdText.setText(cmd); cmdText.setEditable(false); cmdText.setWrapStyleWord(true); cmdText.setLineWrap(true); pb.add(new JScrollPane(cmdText), cc.xy(2, 2, "f,f")); ButtonBarBuilder bbBuilder = new ButtonBarBuilder(); Action saveAsAction = new AbstractAction("Save As...") { public void actionPerformed(ActionEvent e) { SPSUtils.saveDocument(d, cmdText.getDocument(), (FileExtensionFilter) SPSUtils.BATCH_FILE_FILTER); } }; JButton saveAsButton = new JButton(saveAsAction); bbBuilder.addGridded(saveAsButton); bbBuilder.addRelatedGap(); JButton copyButton = new JButton(new AbstractAction("Copy to Clipboard") { public void actionPerformed(ActionEvent e) { StringSelection selection = new StringSelection(cmdText.getText()); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(selection, selection); } }); bbBuilder.addGridded(copyButton); bbBuilder.addRelatedGap(); bbBuilder.addGlue(); JButton cancelButton = new JButton(new AbstractAction() { public void actionPerformed(ActionEvent e) { d.setVisible(false); } }); cancelButton.setText("Close"); bbBuilder.addGridded(cancelButton); pb.add(bbBuilder.getPanel(), cc.xy(2, 4)); d.add(pb.getPanel()); SPSUtils.makeJDialogCancellable(d, null); d.pack(); d.setLocationRelativeTo(parent); d.setVisible(true); }
From source file:ca.sqlpower.matchmaker.swingui.FilterMakerDialog.java
License:Open Source License
public void buildUI() { FormLayout layout = new FormLayout( "4dlu,fill:min(70dlu;default), 4dlu, fill:150dlu:grow,4dlu, min(60dlu;default),4dlu", "10dlu,pref,4dlu,pref,4dlu,pref,4dlu,20dlu,4dlu,fill:60dlu:grow,10dlu,pref,10dlu"); CellConstraints cc = new CellConstraints(); PanelBuilder pb;// w w w. ja v a 2 s. com JPanel p = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); pb = new PanelBuilder(layout, p); columnName = new JComboBox(new ColumnComboBoxModel(projectSourceTable)); comparisonOperator = new JComboBox(); pasteButton = new JButton(pasteAction); andButton = new JButton(andAction); andButton.setSize(new Dimension(1, 1)); orButton = new JButton(orAction); orButton.setSize(new Dimension(1, 1)); notButton = new JButton(notAction); notButton.setSize(new Dimension(1, 1)); testButton = new JButton(testAction); clearButton = new JButton(clearAction); okButton = new JButton(okAction); cancelButton = new JButton(cancelAction); filterText = new JTextArea(); setFilterTextContent(returnText); pb.add(new JLabel("Duplicate1:"), cc.xy(2, 2, "l,c")); pb.add(columnName, cc.xy(4, 2, "f,c")); pb.add(new JLabel("Comparison Operator:"), cc.xy(2, 4, "l,c")); pb.add(comparisonOperator, cc.xy(4, 4)); pb.add(new JLabel("Duplicate2:"), cc.xy(2, 6, "l,c")); //If trueForTextArea is true, initiailize and use JTextField //if false, use a JComboBox and fill the dropdown with columns of the table if (trueForTextField) { conditionTextField = new JTextField(); pb.add(conditionTextField, cc.xy(4, 6)); } else { columnName2 = new JComboBox(new ColumnComboBoxModel(projectSourceTable)); pb.add(columnName2, cc.xy(4, 6)); } pb.add(pasteButton, cc.xy(6, 6, "r,c")); ButtonBarBuilder syntaxBar = new ButtonBarBuilder(); syntaxBar.addGridded(andButton); syntaxBar.addRelatedGap(); syntaxBar.addGridded(orButton); syntaxBar.addRelatedGap(); syntaxBar.addGridded(notButton); syntaxBar.addRelatedGap(); pb.add(syntaxBar.getPanel(), cc.xyw(2, 8, 3)); pb.add(new JTextAreaUndoWrapper(filterText), cc.xyw(2, 10, 5, "f,f")); ButtonBarBuilder bottomButtons = new ButtonBarBuilder(); bottomButtons.addGridded(testButton); bottomButtons.addRelatedGap(); bottomButtons.addGlue(); bottomButtons.addGridded(clearButton); bottomButtons.addRelatedGap(); bottomButtons.addGlue(); bottomButtons.addGridded(okButton); bottomButtons.addRelatedGap(); bottomButtons.addGlue(); bottomButtons.addGridded(cancelButton); bottomButtons.addRelatedGap(); bottomButtons.addGlue(); pb.add(bottomButtons.getPanel(), cc.xyw(2, 12, 5, "f,f")); setupOperatorDropdown(); getContentPane().add(pb.getPanel()); }
From source file:ca.sqlpower.matchmaker.swingui.FolderEditor.java
License:Open Source License
private void buildUI() { folderName.setName("Folder Name"); folderDesc.setName("Folder Description"); JButton saveButton = new JButton(saveAction); FormLayout layout = new FormLayout("4dlu,pref,4dlu,pref,4dlu,pref,4dlu", // columns "10dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,10dlu"); // rows // 1 2 3 4 5 6 7 8 9 PanelBuilder pb;//from ww w . jav a 2s . c o m JPanel p = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); pb = new PanelBuilder(layout, p); CellConstraints cc = new CellConstraints(); pb.add(status, cc.xy(4, 2, "l,c")); pb.add(refreshButton, cc.xy(6, 2, "l, c")); refreshButton.setVisible(false); pb.add(new JLabel("Folder Name:"), cc.xy(2, 4, "r,c")); pb.add(new JLabel("Description:"), cc.xy(2, 6, "r,c")); pb.add(folderName, cc.xy(4, 4, "l,c")); pb.add(new JScrollPane(folderDesc), cc.xy(4, 6, "l,c")); pb.add(saveButton, cc.xyw(2, 8, 3, "c,c")); panel = pb.getPanel(); }
From source file:ca.sqlpower.matchmaker.swingui.MatchValidationStatus.java
License:Open Source License
/** * Returns a panel that displays all the status information *///from w ww . ja va 2s. co m private JPanel buildUI() { RowSetModel rsm = null; try { rsm = new RowSetModel(getMatchStats()); MatchStatsTableModel tableModel = new MatchStatsTableModel(rsm); status.setModel(tableModel); SQLTable resultTable = project.getResultTable(); status.setName(DDLUtils.toQualifiedName(resultTable.getCatalogName(), resultTable.getSchemaName(), resultTable.getName())); } catch (SQLException e1) { MMSUtils.showExceptionDialog(getPanel(), "Unknown SQL Error", e1); } FormLayout layout = new FormLayout("10dlu,fill:pref:grow, 10dlu", // 1 2 3 "10dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,10dlu,fill:pref:grow,4dlu,pref,4dlu"); // 1 2 3 4 5 6 7 8 9 10 11 12 13 PanelBuilder pb; JPanel p = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); pb = new PanelBuilder(layout, p); CellConstraints cc = new CellConstraints(); pb.add(new JLabel("Project: " + project.getName()), cc.xy(2, 6, "l,c")); pb.add(new JScrollPane(status), cc.xy(2, 10)); JButton save = new JButton(new AbstractAction("Save") { public void actionPerformed(ActionEvent e) { new JTableExporter(getPanel(), status); } }); ButtonBarBuilder bb1 = new ButtonBarBuilder(); bb1.addRelatedGap(); bb1.addGridded(save); bb1.addRelatedGap(); pb.add(bb1.getPanel(), cc.xy(2, 12)); return pb.getPanel(); }
From source file:ca.sqlpower.matchmaker.swingui.ProjectInfoEditor.java
License:Open Source License
/** * Returns a panel that displays all of the audit information that we have * about the parent match./*from www. j a va 2s. co m*/ */ private JPanel buildUI() { DateFormat df = new DateFormatAllowsNull(); FormLayout layout = new FormLayout("4dlu,pref,4dlu,fill:pref:grow, 4dlu ", // columns "10dlu, pref,4dlu,pref,4dlu,pref,4dlu,pref, 12dlu, pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref, 12dlu, pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,10dlu"); // rows PanelBuilder pb; JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); pb = new PanelBuilder(layout, panel); CellConstraints cc = new CellConstraints(); pb.add(new JLabel("Project ID:"), cc.xy(2, 2, "r,c")); pb.add(new JLabel("Folder:"), cc.xy(2, 4, "r,c")); pb.add(new JLabel("Description:"), cc.xy(2, 6, "r,t")); pb.add(new JLabel("Type:"), cc.xy(2, 8, "r,c")); String folderName = null; if (project.getParent() != null) { folderName = project.getParent().getName(); } pb.add(new JLabel(project.getName()), cc.xy(4, 2)); pb.add(new JLabel(folderName), cc.xy(4, 4)); JTextArea descriptionText = new JTextArea(project.getMungeSettings().getDescription(), 3, 3); descriptionText.setEditable(false); pb.add(new JScrollPane(descriptionText), cc.xy(4, 6, "f,f")); pb.add(new JLabel(project.getType().toString()), cc.xy(4, 8)); pb.add(new JLabel("Logged on As:"), cc.xy(2, 10, "r,c")); pb.add(new JLabel("Last Updated Date:"), cc.xy(2, 12, "r,c")); pb.add(new JLabel("Last Updated User:"), cc.xy(2, 14, "r,c")); pb.add(new JLabel("Last Run Date:"), cc.xy(2, 16, "r,c")); pb.add(new JLabel(project.getName()), cc.xy(4, 10)); pb.add(new JLabel(df.format(project.getLastUpdateDate())), cc.xy(4, 12, "f,f")); pb.add(new JLabel(project.getLastUpdateAppUser()), cc.xy(4, 14)); pb.add(new JLabel(df.format(project.getMungeSettings().getLastRunDate())), cc.xy(4, 16, "f,f")); JLabel checkout = new JLabel("Checkout Information"); Font f = checkout.getFont(); f = f.deriveFont(Font.BOLD, f.getSize() + 2); checkout.setFont(f); pb.add(checkout, cc.xy(2, 20, "l,c")); pb.add(new JLabel("Checked out date:"), cc.xy(2, 22, "r,c")); pb.add(new JLabel("Checked out user:"), cc.xy(2, 24, "r,c")); pb.add(new JLabel("Checked out osuser:"), cc.xy(2, 26, "r,c")); return pb.getPanel(); }
From source file:com.projity.dialog.ProjectDialog.java
License:Common Public License
/** * Builds the panel. Initializes and configures components first, then * creates a FormLayout, configures the layout, creates a builder, sets a * border, and finally adds the components. * // w w w . j a v a 2 s. c om * @return the built panel */ public JComponent createContentPanel() { // Separating the component initialization and configuration // from the layout code makes both parts easier to read. initControls(); //TODO set minimum size FormLayout layout = new FormLayout("default, 3dlu, 220dlu, 3dlu, default:grow", // cols //$NON-NLS-1$ // with commented fields "p, 3dlu,p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 3dlu,p, 3dlu,p, 3dlu,p,3dlu,p 3dlu, p, 3dlu, fill:50dlu:grow"); // rows "p, 3dlu,p, 3dlu,p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, fill:50dlu:grow"); // rows //$NON-NLS-1$ // Create a builder that assists in adding components to the container. // Wrap the panel with a standardized border. DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.append(Messages.getString("ProjectDialog.ProjectName"), name, 3); //$NON-NLS-1$ builder.nextLine(2); builder.append(Messages.getString("ProjectDialog.Manager"), manager, 3); //$NON-NLS-1$ builder.nextLine(2); builder.append(dateLabel); builder.append(startDateChooser); builder.append(forward); builder.nextLine(2); if (!Environment.getStandAlone()) { builder.append(Messages.getString("ProjectDialog.ProjectTeam")); //$NON-NLS-1$ builder.add(accessControl, cc.xy(builder.getColumn(), builder.getRow(), "left,default")); //$NON-NLS-1$ } HelpUtil.addDocHelp(accessControl, "Project_Team"); // builder.nextLine(2); // builder.append("Project Status:",projectStatus); // builder.nextLine(2); // builder.append("Project Type:",projectType); // builder.nextLine(2); // builder.append("Expense Type:",expenseType); // builder.nextLine(2); // builder.append("Division:",division); // builder.nextLine(2); // builder.append("Group:",group); builder.nextLine(2); FieldComponentMap map = createMap(); Collection extraFields = FieldDictionary .extractExtraFields(FieldDictionary.getInstance().getProjectFields(), true); JComponent extra = createFieldsPanel(map, extraFields); if (extra != null) { builder.add(extra, cc.xyw(builder.getColumn(), builder.getRow(), 3)); } builder.nextLine(2); // builder.append("Shared resource Pool:", resourcePool); // builder.nextLine(2); builder.append(Messages.getString("ProjectDialog.Notes")); //$NON-NLS-1$ builder.nextLine(2); builder.add(new JScrollPane(notes), cc.xyw(builder.getColumn(), builder.getRow(), 5)); // allow spanning 3 cols return builder.getPanel(); }
From source file:com.projity.dialog.ResourceMappingDialog.java
License:Common Public License
public JComponent createFooterPanel() { FormLayout layout = new FormLayout("p,3dlu,p", // cols //$NON-NLS-1$ "p"); // rows //$NON-NLS-1$ DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder();/*w w w.j a v a2 s. c om*/ CellConstraints cc = new CellConstraints(); builder.append(accessControlLabel); //$NON-NLS-1$ builder.add(accessControl, cc.xy(builder.getColumn(), builder.getRow(), "left,default")); //$NON-NLS-1$ return builder.getPanel(); }
From source file:com.salas.bb.installation.wizard.LaunchPage.java
License:Open Source License
/** * Builds the panel.//www. j a v a 2 s .c o m */ private void build(JComponent buttonBar) { buttonBar.setBorder(Borders.createEmptyBorder("6dlu, 6dlu, 6dlu, 6dlu")); FormLayout layout = new FormLayout("15dlu, left:min:grow, 15dlu", "pref, 17dlu, min:grow, 2dlu, pref"); PanelBuilder builder = new PanelBuilder(layout, this); CellConstraints cc = new CellConstraints(); builder.add(buildHeader(), cc.xyw(1, 1, 3)); builder.add(buildTutorialPanel(), cc.xy(2, 3, "f, f")); builder.add(buttonBar, cc.xyw(1, 5, 3)); }
From source file:com.salas.bb.installation.wizard.StartingPointsPage.java
License:Open Source License
/** * Builds the panel.//from w w w . ja v a 2 s. c o m */ public void build(JComponent buttonBar) { buttonBar.setBorder(Borders.createEmptyBorder("6dlu, 6dlu, 6dlu, 6dlu")); FormLayout layout = new FormLayout("15dlu, pref:grow, 15dlu", "pref, 17dlu, pref:grow, 8dlu, pref"); PanelBuilder builder = new PanelBuilder(layout, this); CellConstraints cc = new CellConstraints(); builder.add(buildHeader(), cc.xyw(1, 1, 3)); builder.add(buildDataPage(), cc.xy(2, 3, "f, f")); builder.add(buttonBar, cc.xyw(1, 5, 3)); }