List of usage examples for com.jgoodies.forms.layout FormLayout FormLayout
public FormLayout(ColumnSpec[] colSpecs, RowSpec[] rowSpecs)
From source file:ca.sqlpower.matchmaker.swingui.munge.StringSubstitutionMungeComponent.java
License:Open Source License
@Override protected JPanel buildUI() { StringSubstitutionMungeStep step = (StringSubstitutionMungeStep) getStep(); useRegex = new JCheckBox("Use Regular Expressions"); useRegex.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { StringSubstitutionMungeStep step = (StringSubstitutionMungeStep) getStep(); step.setRegex(useRegex.isSelected()); }//from w w w . j a v a 2s . co m }); useRegex.setSelected(step.isRegex()); caseSensitive = new JCheckBox("Case Sensitive"); caseSensitive.setSelected(step.isCaseSensitive()); caseSensitive.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { StringSubstitutionMungeStep temp = (StringSubstitutionMungeStep) getStep(); temp.setCaseSensitive(caseSensitive.isSelected()); } }); from = new JTextField(step.getFrom()); from.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent e) { doStuff(); } public void removeUpdate(DocumentEvent e) { doStuff(); } public void changedUpdate(DocumentEvent e) { doStuff(); } private void doStuff() { StringSubstitutionMungeStep step = (StringSubstitutionMungeStep) getStep(); step.setFrom(from.getText()); } }); to = new JTextField(step.getTo()); to.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent e) { doStuff(); } public void removeUpdate(DocumentEvent e) { doStuff(); } public void changedUpdate(DocumentEvent e) { doStuff(); } private void doStuff() { StringSubstitutionMungeStep step = (StringSubstitutionMungeStep) getStep(); step.setTo(to.getText()); } }); RegexValidator validator = new RegexValidator(); getHandler().addValidateObject(from, useRegex, validator, true, ""); FormLayout layout = new FormLayout("4dlu,pref,4dlu,fill:pref:grow,4dlu", // columns "4dlu,pref,4dlu,pref,4dlu,pref,4dlu"); // rows CellConstraints cc = new CellConstraints(); JPanel content = new JPanel(layout); content.add(new JLabel("From:"), cc.xy(2, 2)); content.add(from, cc.xy(4, 2)); content.add(new JLabel("To:"), cc.xy(2, 4)); content.add(to, cc.xy(4, 4)); JPanel bottom = new JPanel(new GridLayout(2, 1)); bottom.add(useRegex); bottom.add(caseSensitive); content.add(bottom, cc.xyw(2, 6, 3, "c,f")); return content; }
From source file:ca.sqlpower.matchmaker.swingui.munge.StringToDateMungeComponent.java
License:Open Source License
@Override protected JPanel buildUI() { JPanel content = new JPanel(new FormLayout("4dlu,pref,4dlu,pref,4dlu", "4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu")); final StringToDateMungeStep temp = (StringToDateMungeStep) getStep(); /**/* w w w . j ava 2s .com*/ * Gets the lists of formats from the step and converts them into arrays * so that it's easier to make the combo boxes. */ final String[] dateFormats = StringToDateMungeStep.DATE_FORMATS.toArray(new String[] {}); final String[] timeFormats = StringToDateMungeStep.TIME_FORMATS.toArray(new String[] {}); final String[] outputFormats = StringToDateMungeStep.OUTPUT_FORMATS.toArray(new String[] {}); SimpleDateFormat sdf = new SimpleDateFormat(temp.getInputFormat()); sample = new JTextField(sdf.format(StringToDateMungeComponent.SAMPLE_DATE)); sample.setEditable(false); ignoreError = new JCheckBox("Continue on Error"); ignoreError.setSelected(((StringToDateMungeStep) getStep()).isIgnoreError()); ignoreError.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { StringToDateMungeStep temp = (StringToDateMungeStep) getStep(); temp.setIgnoreError(ignoreError.isSelected()); } }); dateFormat = new JComboBox(dateFormats); dateFormat.setSelectedItem(temp.getDateFormat()); dateFormat.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { temp.setDateFormat((String) e.getItem()); inputFormat.setText(temp.getInputFormat()); } }); timeFormat = new JComboBox(timeFormats); timeFormat.setSelectedItem(temp.getTimeFormat()); timeFormat.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { temp.setTimeFormat((String) e.getItem()); inputFormat.setText(temp.getInputFormat()); } }); inputFormat = new JTextField(temp.getInputFormat()); inputFormat.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent e) { doStuff(); } public void removeUpdate(DocumentEvent e) { doStuff(); } public void changedUpdate(DocumentEvent e) { doStuff(); } private void doStuff() { temp.setInputFormat(inputFormat.getText()); if (getHandler().getWorstValidationStatus().getStatus() == Status.OK) { SimpleDateFormat sdf = new SimpleDateFormat(temp.getInputFormat()); sample.setText(sdf.format(StringToDateMungeComponent.SAMPLE_DATE)); } } }); getHandler().addValidateObject(inputFormat, new DateFormatPatternValidator()); outputFormat = new JComboBox(outputFormats); outputFormat.setSelectedItem(temp.getOutputFormat()); outputFormat.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { temp.setOutputFormat((String) e.getItem()); } }); CellConstraints cc = new CellConstraints(); int row = 2; content.add(new JLabel("Example: "), cc.xy(2, row)); content.add(sample, cc.xy(4, row)); row += 2; content.add(new JLabel("Date Format: "), cc.xy(2, row)); content.add(dateFormat, cc.xy(4, row)); row += 2; content.add(new JLabel("Time Format: "), cc.xy(2, row)); content.add(timeFormat, cc.xy(4, row)); row += 2; content.add(new JLabel("Input Format: "), cc.xy(2, row)); content.add(inputFormat, cc.xy(4, row)); row += 2; content.add(new JLabel("Output Format: "), cc.xy(2, row)); content.add(outputFormat, cc.xy(4, row)); row += 2; content.add(ignoreError, cc.xyw(2, row, 3, "c,c")); return content; }
From source file:ca.sqlpower.matchmaker.swingui.munge.SubstringByWordMungeComponent.java
License:Open Source License
@Override protected JPanel buildUI() { SubstringByWordMungeStep step = (SubstringByWordMungeStep) getStep(); useRegex = new JCheckBox("Use Regular Expressions"); useRegex.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SubstringByWordMungeStep step = (SubstringByWordMungeStep) getStep(); step.setRegex(useRegex.isSelected()); }//w w w . j a v a 2s.c om }); useRegex.setSelected(step.isRegex()); caseSensitive = new JCheckBox("Case Sensitive"); caseSensitive.setSelected(step.isCaseSensitive()); caseSensitive.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SubstringByWordMungeStep step = (SubstringByWordMungeStep) getStep(); step.setCaseSensitive(caseSensitive.isSelected()); } }); delimiter = new JTextField(step.getDelimiter()); delimiter.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent e) { doStuff(); } public void removeUpdate(DocumentEvent e) { doStuff(); } public void changedUpdate(DocumentEvent e) { doStuff(); } private void doStuff() { SubstringByWordMungeStep step = (SubstringByWordMungeStep) getStep(); step.setDelimiter(delimiter.getText()); } }); RegexValidator validator = new RegexValidator(); getHandler().addValidateObject(delimiter, useRegex, validator, true, ""); resultDelimiter = new JTextField(step.getResultDelim()); resultDelimiter.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent e) { doStuff(); } public void removeUpdate(DocumentEvent e) { doStuff(); } public void changedUpdate(DocumentEvent e) { doStuff(); } private void doStuff() { SubstringByWordMungeStep step = (SubstringByWordMungeStep) getStep(); step.setResultDelim(resultDelimiter.getText()); } }); int beginIndex = step.getBegIndex(); SpinnerNumberModel beginNumberModel = new SpinnerNumberModel(beginIndex, 0, Integer.MAX_VALUE, 1); begin = new JSpinner(beginNumberModel); begin.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { SubstringByWordMungeStep step = (SubstringByWordMungeStep) getStep(); step.setBegIndex((Integer) begin.getValue()); } }); int endIndex = step.getEndIndex(); SpinnerNumberModel endNumberModel = new SpinnerNumberModel(endIndex, 0, Integer.MAX_VALUE, 1); end = new JSpinner(endNumberModel); end.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { SubstringByWordMungeStep step = (SubstringByWordMungeStep) getStep(); step.setEndIndex((Integer) end.getValue()); } }); FormLayout layout = new FormLayout("4dlu,pref,4dlu,fill:pref:grow,4dlu", // columns "4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu"); // rows CellConstraints cc = new CellConstraints(); JPanel content = new JPanel(layout); content.add(new JLabel("Begin Index:"), cc.xy(2, 2)); content.add(begin, cc.xy(4, 2)); content.add(new JLabel("End Index:"), cc.xy(2, 4)); content.add(end, cc.xy(4, 4)); content.add(new JLabel("Delimiter:"), cc.xy(2, 6)); content.add(delimiter, cc.xy(4, 6)); content.add(new JLabel("Result Delim:"), cc.xy(2, 8)); content.add(resultDelimiter, cc.xy(4, 8)); JPanel bottom = new JPanel(new GridLayout(2, 1)); bottom.add(useRegex); bottom.add(caseSensitive); content.add(bottom, cc.xyw(2, 10, 3, "c,f")); return content; }
From source file:ca.sqlpower.matchmaker.swingui.munge.SubstringMungeComponent.java
License:Open Source License
@Override protected JPanel buildUI() { SubstringMungeStep step = (SubstringMungeStep) getStep(); if (step == null) throw new NullPointerException("Null step!"); int beginIndex = step.getBegIndex(); SpinnerNumberModel beginNumberModel = new SpinnerNumberModel(beginIndex, 0, Integer.MAX_VALUE, 1); begin = new JSpinner(beginNumberModel); begin.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { SubstringMungeStep step = (SubstringMungeStep) getStep(); step.setBegIndex((Integer) begin.getValue()); }/*from w w w . j ava 2s.co m*/ }); int endIndex = step.getEndIndex(); SpinnerNumberModel endNumberModel = new SpinnerNumberModel(endIndex, 0, Integer.MAX_VALUE, 1); end = new JSpinner(endNumberModel); end.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { SubstringMungeStep step = (SubstringMungeStep) getStep(); step.setEndIndex((Integer) end.getValue()); } }); FormLayout layout = new FormLayout("4dlu,pref,4dlu,fill:pref:grow,4dlu", // columns "4dlu,pref,4dlu,pref,4dlu"); // rows CellConstraints cc = new CellConstraints(); JPanel content = new JPanel(layout); content.add(new JLabel("Begin Index:"), cc.xy(2, 2)); content.add(begin, cc.xy(4, 2)); content.add(new JLabel("End Index:"), cc.xy(2, 4)); content.add(end, cc.xy(4, 4)); return content; }
From source file:ca.sqlpower.matchmaker.swingui.MungeProcessEditor.java
License:Open Source License
private void buildUI() throws SQLObjectException { panel = new JPanel(new BorderLayout()); FormLayout layout = new FormLayout("4dlu,pref,4dlu,fill:pref:grow,4dlu,pref,4dlu,pref,4dlu", // columns "4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu"); // rows CellConstraints cc = new CellConstraints(); JPanel subPanel = new JPanel(layout); subPanel.add(status, cc.xyw(2, 2, 7)); subPanel.add(new JLabel("Process Name: "), cc.xy(2, 4)); subPanel.add(name, cc.xy(4, 4));//from www .j av a 2 s .c om subPanel.add(new JLabel("Description: "), cc.xy(2, 6)); subPanel.add(desc, cc.xy(4, 6)); subPanel.add(new JLabel("Colour: "), cc.xy(6, 6)); ColorCellRenderer renderer = new ColorCellRenderer(85, 50); color.setRenderer(renderer); subPanel.add(color, cc.xy(8, 6)); subPanel.add(new JButton(saveAction), cc.xy(2, 8)); subPanel.add(mungePen.getEnablePreviewCheckBox(), cc.xy(4, 8)); subPanel.add(new JButton(customColour), cc.xy(8, 8)); panel.add(subPanel, BorderLayout.NORTH); JToolBar t = new JToolBar(); MungeStepLibrary msl = new MungeStepLibrary(mungePen, ((SwingSessionContext) swingSession.getContext()).getStepMap()); t.setBackground(Color.WHITE); t.setLayout(new BorderLayout()); t.add(msl.getHideShowButton(), BorderLayout.NORTH); t.add(new JScrollPane(msl.getList()), BorderLayout.CENTER); t.setBorder(BorderFactory.createRaisedBevelBorder()); t.setFloatable(false); panel.add(new JScrollPane(mungePen), BorderLayout.CENTER); panel.add(t, BorderLayout.EAST); }
From source file:ca.sqlpower.matchmaker.swingui.MungeProcessGroupEditor.java
License:Open Source License
private void buildUI() { FormLayout layout = new FormLayout( "4dlu,46dlu,4dlu,fill:min(pref;" + 3 * (new JComboBox().getMinimumSize().width) + "px):grow,4dlu,pref,4dlu", // columns "10dlu,pref,4dlu,pref,4dlu,fill:40dlu:grow,4dlu,pref,10dlu"); // rows // 1 2 3 4 5 6 7 8 9 10 11 PanelBuilder pb;/*from w ww. j a va2s . com*/ JPanel p = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); pb = new PanelBuilder(layout, p); CellConstraints cc = new CellConstraints(); int row = 2; pb.add(status, cc.xy(4, row)); row += 2; pb.add(new JLabel("Transformations:"), cc.xy(4, row, "l,t")); row += 2; scrollPane = new JScrollPane(mungeProcessTable); pb.add(scrollPane, cc.xy(4, row, "f,f")); ButtonStackBuilder bsb = new ButtonStackBuilder(); bsb.addGridded(new JButton(moveUp)); bsb.addRelatedGap(); bsb.addGridded(new JButton(moveDown)); pb.add(bsb.getPanel(), cc.xy(6, row, "c,c")); ButtonBarBuilder bbb = new ButtonBarBuilder(); //new actions for delete and save should be extracted and be put into its own file. bbb.addGridded(new JButton(new NewMungeProcessAction(swingSession, project))); bbb.addRelatedGap(); bbb.addGridded(new JButton(deleteAction)); row += 2; pb.add(bbb.getPanel(), cc.xy(4, row, "c,c")); moveDown.setEnabled(false); moveUp.setEnabled(false); panel = pb.getPanel(); }
From source file:ca.sqlpower.matchmaker.swingui.NewTableMergeRuleChooserPane.java
License:Open Source License
private JPanel buildUI() { FormLayout layout = new FormLayout( "10dlu,pref,4dlu,fill:max(pref;" + 5 * new JComboBox().getMinimumSize().getWidth() + "px):grow,10dlu", "10dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,10dlu"); //1 2 3 4 5 6 7 8 9 CellConstraints cc = new CellConstraints(); JPanel p = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); PanelBuilder pb = new PanelBuilder(layout, p); int row = 2;// w ww. j a v a 2 s . c om pb.add(status, cc.xyw(2, row, 3, "f,f")); row += 2; pb.add(new JLabel("Catalog:"), cc.xy(2, row)); pb.add(chooser.getCatalogComboBox(), cc.xy(4, row)); row += 2; pb.add(new JLabel("Schema:"), cc.xy(2, row)); pb.add(chooser.getSchemaComboBox(), cc.xy(4, row)); row += 2; pb.add(new JLabel("Table:"), cc.xy(2, row)); pb.add(chooser.getTableComboBox(), cc.xy(4, row)); row += 2; pb.add(new JLabel("Index:"), cc.xy(2, row)); pb.add(chooser.getUniqueKeyComboBox(), cc.xy(4, row)); row += 2; pb.add(new JLabel("Parent Table:"), cc.xy(2, row)); pb.add(parentMergeRule, cc.xy(4, row)); return pb.getPanel(); }
From source file:ca.sqlpower.matchmaker.swingui.ProjectEditor.java
License:Open Source License
private JPanel buildUI() { projectName.setName("Project Name"); sourceChooser = new SQLObjectChooser(swingSession, swingSession.getFrame()); resultChooser = new SQLObjectChooser(swingSession, swingSession.getFrame()); sourceChooser.getTableComboBox().setName("Source Table"); resultChooser.getCatalogComboBox().setName("Result " + resultChooser.getCatalogTerm().getText()); resultChooser.getSchemaComboBox().setName("Result " + resultChooser.getSchemaTerm().getText()); resultTableName.setName("Result Table"); sourceChooser.getCatalogComboBox().setRenderer(new SQLObjectComboBoxCellRenderer()); sourceChooser.getSchemaComboBox().setRenderer(new SQLObjectComboBoxCellRenderer()); sourceChooser.getTableComboBox().setRenderer(new SQLObjectComboBoxCellRenderer()); resultChooser.getCatalogComboBox().setRenderer(new SQLObjectComboBoxCellRenderer()); resultChooser.getSchemaComboBox().setRenderer(new SQLObjectComboBoxCellRenderer()); filterPanel = new FilterComponents(swingSession.getFrame()); JButton saveProject = new JButton(saveAction); JButton cancelProject = new JButton(cancelAction); JButton createIndexButton = new JButton(createIndexAction); FormLayout layout = new FormLayout( "4dlu,pref,4dlu,fill:min(pref;" + new JComboBox().getMinimumSize().width + "px):grow, 4dlu,pref,4dlu", // columns "10dlu,pref,4dlu,pref,4dlu,pref,4dlu,40dlu,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref, 4dlu,32dlu,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,4dlu,pref,10dlu"); // rows PanelBuilder pb;/* w w w .ja v a 2 s.co m*/ JPanel p = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); pb = new PanelBuilder(layout, p); CellConstraints cc = new CellConstraints(); int row = 2; pb.add(status, cc.xy(4, row)); row += 2; pb.add(new JLabel("Project Name:"), cc.xy(2, row, "r,c")); pb.add(projectName, cc.xy(4, row)); row += 2; pb.add(new JLabel("Folder:"), cc.xy(2, row, "r,c")); pb.add(folderComboBox, cc.xy(4, row)); row += 2; desc.setWrapStyleWord(true); desc.setLineWrap(true); pb.add(new JLabel("Description:"), cc.xy(2, row, "r,t")); pb.add(new JScrollPane(desc), cc.xy(4, row, "f,f")); row += 2; pb.add(new JLabel("Type:"), cc.xy(2, row, "r,c")); pb.add(projectType, cc.xy(4, row)); projectType.setEditable(false); row += 2; pb.add(new JLabel("Data Source:"), cc.xy(2, row, "r,c")); pb.add(sourceChooser.getDataSourceComboBox(), cc.xy(4, row)); pb.add(new JButton(showConnectionManagerAction), cc.xy(6, row)); row += 2; pb.addTitle("Source Table", cc.xy(2, row)); row += 2; pb.add(sourceChooser.getCatalogTerm(), cc.xy(2, row, "r,c")); pb.add(sourceChooser.getCatalogComboBox(), cc.xy(4, row)); row += 2; pb.add(sourceChooser.getSchemaTerm(), cc.xy(2, row, "r,c")); pb.add(sourceChooser.getSchemaComboBox(), cc.xy(4, row)); row += 2; pb.add(new JLabel("Table Name:"), cc.xy(2, row, "r,c")); pb.add(sourceChooser.getTableComboBox(), cc.xy(4, row)); row += 2; pb.add(new JLabel("Unique Index:"), cc.xy(2, row, "r,t")); pb.add(indexComboBox, cc.xy(4, row, "f,f")); pb.add(createIndexButton, cc.xy(6, row, "f,f")); row += 2; pb.add(new JLabel("Filter:"), cc.xy(2, row, "r,t")); pb.add(new JScrollPane(filterPanel.getFilterTextArea()), cc.xy(4, row, "f,f")); pb.add(filterPanel.getEditButton(), cc.xy(6, row)); row += 2; if (project.getType() != ProjectMode.CLEANSE) { pb.addTitle("Output Table", cc.xy(2, row)); row += 2; pb.add(resultChooser.getCatalogTerm(), cc.xy(2, row, "r,c")); pb.add(resultChooser.getCatalogComboBox(), cc.xy(4, row)); row += 2; pb.add(resultChooser.getSchemaTerm(), cc.xy(2, row, "r,c")); pb.add(resultChooser.getSchemaComboBox(), cc.xy(4, row)); row += 2; pb.add(new JLabel("Table Name:"), cc.xy(2, row, "r,c")); pb.add(resultTableName, cc.xy(4, row)); row += 2; } final List<PlFolder> folders = swingSession.getCurrentFolderParent().getChildren(PlFolder.class); folderComboBox.setModel(new DefaultComboBoxModel(folders.toArray())); folderComboBox.setRenderer(new MatchMakerObjectComboBoxCellRenderer()); // We don't want the save button to take up the whole column width // so we wrap it in a JPanel with a FlowLayout. If there is a better // way, please fix this. JPanel savePanel = new JPanel(new FlowLayout()); savePanel.add(saveProject); savePanel.add(cancelProject); pb.add(savePanel, cc.xy(4, row)); 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.//w w w. j a v a 2 s . c o 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:ca.sqlpower.matchmaker.swingui.TranslateGroupsEditor.java
License:Open Source License
private JPanel buildUI() { FormLayout layout = new FormLayout( "4dlu,46dlu,4dlu,fill:min(pref;" + 3 * (new JComboBox().getMinimumSize().width) + "px):grow,4dlu,50dlu", // columns "10dlu,pref,4dlu,pref,4dlu,fill:40dlu:grow,4dlu,pref,10dlu"); // rows // 1 2 3 4 5 6 7 8 9 10 11 PanelBuilder pb;//from w w w. j ava2s .co m JPanel p = logger.isDebugEnabled() ? new FormDebugPanel(layout) : new JPanel(layout); pb = new PanelBuilder(layout, p); CellConstraints cc = new CellConstraints(); int row = 2; pb.add(status, cc.xy(4, row)); row += 2; pb.add(new JLabel("Translation Groups:"), cc.xy(4, row, "l,t")); row += 2; translateGroupsScrollPane = new JScrollPane(translateGroupsTable); pb.add(translateGroupsScrollPane, cc.xy(4, row, "f,f")); ButtonBarBuilder bbb = new ButtonBarBuilder(); //this needs to be cleaned bbb.addGridded(new JButton(new AbstractAction("Get Online List") { public void actionPerformed(ActionEvent e) { int opt = JOptionPane.showConfirmDialog(swingSession.getFrame(), "Download Online list?\n" + "The list can be viewed at: http://spreadsheets.google.com/pub?key=" + TRANSLATE_WORDS_SPREADSHEET_KEY, "Download Online List", JOptionPane.YES_NO_OPTION); if (opt == JOptionPane.YES_OPTION) { for (MatchMakerTranslateGroup mmtg : translateGroups) { if (mmtg.getName().equals("SQLPower Translate Words")) { if (JOptionPane.showConfirmDialog(swingSession.getFrame(), "You already have a translation group named, SQLPower Translate Words, would you like to rebuild it?", "Update Translate Words", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) { return; } else { translateGroupsTableModel.removeGroup(translateGroups.indexOf(mmtg)); break; } } } try { MatchMakerTranslateGroup mmtg = getOnlineTranslateGroup(); swingSession.setCurrentEditorComponent(new TranslateWordsEditor(swingSession, mmtg)); } catch (Exception ex) { SPSUtils.showExceptionDialogNoReport(swingSession.getFrame(), "Could not generate online list", ex); } } } })); //new actions for delete and save should be extracted and be put into its own file. bbb.addGridded(new JButton(new NewTranslateGroupAction(swingSession))); bbb.addRelatedGap(); bbb.addGridded(new JButton(deleteGroupAction)); row += 2; pb.add(bbb.getPanel(), cc.xy(4, row, "c,c")); return pb.getPanel(); }