List of usage examples for com.jgoodies.forms.builder DefaultFormBuilder append
public JLabel append(String textWithMnemonic, Component c1, Component c2)
From source file:ca.sqlpower.architect.swingui.RelationshipEditPanel.java
License:Open Source License
public RelationshipEditPanel(Relationship r) { relationshipLine = r;/*from w ww. j av a 2 s . c om*/ this.color = relationshipLine.getForegroundColor(); FormLayout layout = new FormLayout("pref, 4dlu, pref:grow, 4dlu, pref, 4dlu, pref:grow, 4dlu, pref"); //$NON-NLS-1$ layout.setColumnGroups(new int[][] { { 3, 7 } }); DefaultFormBuilder fb = new DefaultFormBuilder(layout, logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel()); fb.append(Messages.getString("RelationshipEditPanel.name"), relationshipName = new JTextField(), 7); //$NON-NLS-1$ fb.nextLine(); fb.append(Messages.getString("RelationshipEditPanel.lineColour"), //$NON-NLS-1$ relationLineColor = new JComboBox(Relationship.SUGGESTED_COLOURS)); ColorCellRenderer renderer = new ColorCellRenderer(40, 20); relationLineColor.setRenderer(renderer); if (!containsColor(Relationship.SUGGESTED_COLOURS, color)) { relationLineColor.addItem(color); relationLineColor.setSelectedItem(color); } fb.append(new JButton(customColour)); fb.nextLine(); fb.append(Messages.getString("RelationshipEditPanel.pkLabel"), pkLabelTextField = new JTextField()); fb.append(Messages.getString("RelationshipEditPanel.fkLabel"), fkLabelTextField = new JTextField()); JButton swapButton = new JButton(swapLabelText); swapButton.setIcon( SPSUtils.createIcon("arrow_refresh", "Swap Labels", ArchitectSwingSessionContext.ICON_SIZE)); swapButton.setToolTipText("Swap Label Texts"); fb.append(swapButton); fb.nextLine(); identifyingGroup = new ButtonGroup(); fb.append(Messages.getString("RelationshipEditPanel.type"), //$NON-NLS-1$ identifyingButton = new JRadioButton(Messages.getString("RelationshipEditPanel.identifying")), 7); //$NON-NLS-1$ identifyingGroup.add(identifyingButton); fb.append("", //$NON-NLS-1$ nonIdentifyingButton = new JRadioButton(Messages.getString("RelationshipEditPanel.nonIdentifying")), //$NON-NLS-1$ 7); identifyingGroup.add(nonIdentifyingButton); fb.nextLine(); fb.appendUnrelatedComponentsGapRow(); pkTypeGroup = new ButtonGroup(); fkTypeGroup = new ButtonGroup(); fb.nextLine(); fb.append(Messages.getString("RelationshipEditPanel.cardinality"), //$NON-NLS-1$ pkTableName = new JLabel("PK Table: Unknown")); //$NON-NLS-1$ fb.append("", fkTableName = new JLabel("FK Table: Unknown")); //$NON-NLS-1$ //$NON-NLS-2$ fb.nextLine(); fb.append("", pkTypeZeroToMany = new JRadioButton(Messages.getString("RelationshipEditPanel.zeroOrMore"))); //$NON-NLS-1$ //$NON-NLS-2$ pkTypeGroup.add(pkTypeZeroToMany); fb.append("", fkTypeZeroToMany = new JRadioButton(Messages.getString("RelationshipEditPanel.zeroOrMore"))); //$NON-NLS-1$ //$NON-NLS-2$ fkTypeGroup.add(fkTypeZeroToMany); fb.nextLine(); fb.append("", pkTypeOneToMany = new JRadioButton(Messages.getString("RelationshipEditPanel.oneOrMore"))); //$NON-NLS-1$ //$NON-NLS-2$ pkTypeGroup.add(pkTypeOneToMany); fb.append("", fkTypeOneToMany = new JRadioButton(Messages.getString("RelationshipEditPanel.oneOrMore"))); //$NON-NLS-1$ //$NON-NLS-2$ fkTypeGroup.add(fkTypeOneToMany); fb.nextLine(); fb.append("", pkTypeZeroOne = new JRadioButton(Messages.getString("RelationshipEditPanel.zeroOrOne"))); //$NON-NLS-1$ //$NON-NLS-2$ pkTypeGroup.add(pkTypeZeroOne); fb.append("", fkTypeZeroOne = new JRadioButton(Messages.getString("RelationshipEditPanel.zeroOrOne"))); //$NON-NLS-1$ //$NON-NLS-2$ fkTypeGroup.add(fkTypeZeroOne); fb.nextLine(); fb.append("", pkTypeOne = new JRadioButton(Messages.getString("RelationshipEditPanel.exactlyOne"))); //$NON-NLS-1$ //$NON-NLS-2$ pkTypeGroup.add(pkTypeOne); fb.nextLine(); fb.appendUnrelatedComponentsGapRow(); fb.nextLine(); deferrabilityGroup = new ButtonGroup(); fb.append(Messages.getString("RelationshipEditPanel.deferrability"), //$NON-NLS-1$ notDeferrable = new JRadioButton(Messages.getString("RelationshipEditPanel.notDeferrable")), 7); //$NON-NLS-1$ deferrabilityGroup.add(notDeferrable); fb.append("", //$NON-NLS-1$ initiallyDeferred = new JRadioButton(Messages.getString("RelationshipEditPanel.initiallyDeferred")), //$NON-NLS-1$ 7); deferrabilityGroup.add(initiallyDeferred); fb.append("", initiallyImmediate = new JRadioButton( //$NON-NLS-1$ Messages.getString("RelationshipEditPanel.initiallyImmediate")), 7); //$NON-NLS-1$ deferrabilityGroup.add(initiallyImmediate); fb.nextLine(); fb.appendUnrelatedComponentsGapRow(); updateRuleGroup = new ButtonGroup(); deleteRuleGroup = new ButtonGroup(); fb.nextLine(); fb.append(Messages.getString("RelationshipEditPanel.updateRule"), //$NON-NLS-1$ updateCascade = new JRadioButton(Messages.getString("RelationshipEditPanel.cascade"))); //$NON-NLS-1$ updateRuleGroup.add(updateCascade); fb.append(Messages.getString("RelationshipEditPanel.deleteRule"), //$NON-NLS-1$ deleteCascade = new JRadioButton(Messages.getString("RelationshipEditPanel.cascade"))); //$NON-NLS-1$ deleteRuleGroup.add(deleteCascade); fb.nextLine(); fb.append("", updateRestrict = new JRadioButton(Messages.getString("RelationshipEditPanel.restrict"))); //$NON-NLS-1$ //$NON-NLS-2$ updateRuleGroup.add(updateRestrict); fb.append("", deleteRestrict = new JRadioButton(Messages.getString("RelationshipEditPanel.restrict"))); //$NON-NLS-1$ //$NON-NLS-2$ deleteRuleGroup.add(deleteRestrict); fb.nextLine(); fb.append("", updateNoAction = new JRadioButton(Messages.getString("RelationshipEditPanel.noAction"))); //$NON-NLS-1$ //$NON-NLS-2$ updateRuleGroup.add(updateNoAction); fb.append("", deleteNoAction = new JRadioButton(Messages.getString("RelationshipEditPanel.noAction"))); //$NON-NLS-1$ //$NON-NLS-2$ deleteRuleGroup.add(deleteNoAction); fb.nextLine(); fb.append("", updateSetNull = new JRadioButton(Messages.getString("RelationshipEditPanel.setNull"))); //$NON-NLS-1$ //$NON-NLS-2$ updateRuleGroup.add(updateSetNull); fb.append("", deleteSetNull = new JRadioButton(Messages.getString("RelationshipEditPanel.setNull"))); //$NON-NLS-1$ //$NON-NLS-2$ deleteRuleGroup.add(deleteSetNull); fb.nextLine(); fb.append("", updateSetDefault = new JRadioButton(Messages.getString("RelationshipEditPanel.setDefault"))); //$NON-NLS-1$ //$NON-NLS-2$ updateRuleGroup.add(updateSetDefault); fb.append("", deleteSetDefault = new JRadioButton(Messages.getString("RelationshipEditPanel.setDefault"))); //$NON-NLS-1$ //$NON-NLS-2$ deleteRuleGroup.add(deleteSetDefault); fb.nextLine(); setRelationship(r.getModel()); //TODO Doesn't work! relationshipName.selectAll(); fb.setDefaultDialogBorder(); panel = fb.getPanel(); }
From source file:ca.sqlpower.swingui.LabelEditorPanel.java
License:Open Source License
public LabelEditorPanel(SPLabel label, boolean variables) { this.label = label; panel = new JPanel(); final DefaultFormBuilder fb = new DefaultFormBuilder( new FormLayout("pref, 4dlu, pref, 4dlu, pref, 4dlu, pref, 4dlu, 100dlu:grow"), panel); fb.getLayout().setColumnGroups(new int[][] { { 1, 5 }, { 3, 7 } }); textArea = new JTextPane(); textArea.setText(label.getText());/*w w w. j a v a 2s .c o m*/ JButton variableButton = null; if (variables) { VariableLabel.insertLabels(getVariablesHelper(), textArea.getDocument(), textArea); Action insertVariableAction = new InsertVariableAction("Variables", getVariablesHelper(), null, new VariableInserter() { public void insert(String variable) { try { VariableLabel.insertLabel( variable.replaceFirst("\\$", "").replaceFirst("\\{", "").replaceFirst("\\}", ""), getVariablesHelper(), textArea.getDocument(), textArea.getCaretPosition(), textArea); } catch (BadLocationException e) { throw new IllegalStateException(e); } } }, textArea); variableButton = new JButton("Variables"); variableButton.setAction(insertVariableAction); // Maps CTRL+SPACE to insert variable textArea.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, InputEvent.CTRL_MASK), "insertVariable"); textArea.getActionMap().put("insertVariable", insertVariableAction); } ButtonGroup hAlignmentGroup = new ButtonGroup(); leftAlign = new JToggleButton(AlignmentIcons.LEFT_ALIGN_ICON, label.getHorizontalAlignment() == HorizontalAlignment.LEFT); hAlignmentGroup.add(leftAlign); centreAlign = new JToggleButton(AlignmentIcons.CENTRE_ALIGN_ICON, label.getHorizontalAlignment() == HorizontalAlignment.CENTER); hAlignmentGroup.add(centreAlign); rightAlign = new JToggleButton(AlignmentIcons.RIGHT_ALIGN_ICON, label.getHorizontalAlignment() == HorizontalAlignment.RIGHT); hAlignmentGroup.add(rightAlign); ButtonGroup vAlignmentGroup = new ButtonGroup(); topAlign = new JToggleButton(AlignmentIcons.TOP_ALIGN_ICON, label.getVerticalAlignment() == VerticalAlignment.TOP); vAlignmentGroup.add(topAlign); middleAlign = new JToggleButton(AlignmentIcons.MIDDLE_ALIGN_ICON, label.getVerticalAlignment() == VerticalAlignment.MIDDLE); vAlignmentGroup.add(middleAlign); bottomAlign = new JToggleButton(AlignmentIcons.BOTTOM_ALIGN_ICON, label.getVerticalAlignment() == VerticalAlignment.BOTTOM); vAlignmentGroup.add(bottomAlign); Box alignmentBox = Box.createHorizontalBox(); alignmentBox.add(leftAlign); alignmentBox.add(centreAlign); alignmentBox.add(rightAlign); alignmentBox.add(Box.createHorizontalStrut(5)); alignmentBox.add(topAlign); alignmentBox.add(middleAlign); alignmentBox.add(bottomAlign); if (variables) { alignmentBox.add(Box.createHorizontalGlue()); alignmentBox.add(variableButton); } fb.append("Alignment", alignmentBox, 7); fb.appendRelatedComponentsGapRow(); fb.appendRow("pref"); fb.nextLine(2); bgColor = new JComboBox(ColourScheme.BACKGROUND_COLOURS); fb.append("Label Colour", bgColor); ColorCellRenderer renderer = new ColorCellRenderer(40, 20); bgColor.setRenderer(renderer); bgColor.setSelectedItem(label.getBackgroundColour()); if (label.getBackgroundColour() == null) { bgColor.setSelectedIndex(0); } bgColor.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { bgIsNull.setSelected(false); } }); bgIsNull = new JCheckBox("Transparent", label.getBackgroundColour() == null); fb.append(bgIsNull); fb.appendRelatedComponentsGapRow(); fb.appendRow("pref"); fb.nextLine(2); fgColor = new JComboBox(ColourScheme.FOREGROUND_COLOURS); fb.append("Text Colour", fgColor); fgColor.setRenderer(renderer); fgColor.setSelectedItem(label.getForegroundColour()); fb.appendRelatedComponentsGapRow(); fb.appendRow("pref"); fb.nextLine(2); bdColor = new JComboBox(ColourScheme.FOREGROUND_COLOURS); fb.append("Border Colour", bdColor); bdColor.setRenderer(renderer); bdColor.setSelectedItem(label.getBorderColour()); if (label.getBorderColour() == null) { bdColor.setSelectedIndex(0); } bdColor.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { borderIsNull.setSelected(false); } }); borderIsNull = new JCheckBox("No Border", label.getBorderColour() == null); fb.append(borderIsNull); fb.appendRelatedComponentsGapRow(); fb.appendRow("fill:90dlu:grow"); fb.nextLine(2); textArea.setFont(label.getFont()); JLabel textLabel = fb.append("Text", new JScrollPane(textArea), 7); textLabel.setVerticalTextPosition(JLabel.TOP); fb.appendRow("pref"); fb.nextLine(); fontSelector = getFontSelector(); if (fontSelector != null) { logger.debug("FontSelector got passed Font " + label.getFont()); fontSelector.setShowingPreview(false); fontSelector.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { logger.debug("Changing font to: " + fontSelector.getSelectedFont()); textArea.setFont(fontSelector.getSelectedFont()); } }); fb.append("Font", fontSelector.getPanel(), 5); } }
From source file:com.lyndir.lhunath.opal.gui.template.shade.AbstractUi.java
License:Apache License
private JComponent getSettingsPane() { FormLayout layout = new FormLayout( "20dlu:g(3), r:p, 5dlu, f:100dlu:g(2), 10dlu, r:p, 5dlu, f:100dlu:g(2), 5dlu, l:20dlu:g(4)"); //$NON-NLS-1$ DefaultFormBuilder builder = new DefaultFormBuilder(layout, new ScrollPanel()); builder.setBorder(Borders.DLU4_BORDER); builder.setLeadingColumnOffset(1);// ww w .j a v a 2s . c o m builder.appendSeparator(Locale.explain("ui.appearance")); //$NON-NLS-1$ builder.append(Locale.explain("ui.theme"), new ToolTip(Locale.explain("ui.themeTitle") //$NON-NLS-1$ //$NON-NLS-2$ + Locale.explain("ui.themeTip"), themesPanel = new JPanel()), 5); //$NON-NLS-1$ for (MyTheme theme : MyTheme.values()) themesPanel.add(theme.getButton()); themesPanel.setOpaque(false); builder.nextLine(); builder.append(Locale.explain("ui.systray"), new ToolTip(Locale.explain("ui.systrayTitle") //$NON-NLS-1$ //$NON-NLS-2$ + Locale.explain("ui.systrayTip"), //$NON-NLS-1$ systrayButton = new JCheckBox(Locale.explain("ui.enable")))); //$NON-NLS-1$ builder.append(Locale.explain("ui.ontop"), new ToolTip(Locale.explain("ui.ontopTitle") //$NON-NLS-1$ //$NON-NLS-2$ + Locale.explain("ui.ontopTip"), //$NON-NLS-1$ alwaysOnTop = new JCheckBox(Locale.explain("ui.enable")))); //$NON-NLS-1$ builder.nextLine(); builder.append(Locale.explain("ui.startmini"), new ToolTip(Locale.explain("ui.startminiTitle") //$NON-NLS-1$ //$NON-NLS-2$ + Locale.explain("ui.startminiTip"), //$NON-NLS-1$ startMini = new JCheckBox(Locale.explain("ui.enable")))); //$NON-NLS-1$ builder.append(Locale.explain("ui.verbose"), new ToolTip(Locale.explain("ui.verboseTitle") //$NON-NLS-1$ //$NON-NLS-2$ + Locale.explain("ui.verboseTip"), //$NON-NLS-1$ verboseLogs = new JCheckBox(Locale.explain("ui.enable")))); //$NON-NLS-1$ builder.nextLine(); appendCustomSettings(builder); for (Plugin plugin : plugins) { builder.appendSeparator(plugin.getName()); plugin.buildSettings(builder); } systrayButton.addActionListener(this); alwaysOnTop.addActionListener(this); startMini.addActionListener(this); verboseLogs.addActionListener(this); systrayButton.setOpaque(false); alwaysOnTop.setOpaque(false); startMini.setOpaque(false); verboseLogs.setOpaque(false); JScrollPane pane = new JScrollPane(builder.getPanel()); pane.setBorder(Borders.EMPTY_BORDER); builder.getPanel().setOpaque(false); pane.getViewport().setOpaque(false); pane.setOpaque(false); return pane; }
From source file:com.projity.dialog.assignment.AssignmentDialog.java
License:Common Public License
public JComponent createContentPanel() { // Separating the component initialization and configuration // from the layout code makes both parts easier to read. initControls();//from w w w . j av a 2 s .com FormLayout layout = new FormLayout("p, 1dlu, default ,3dlu, default", // cols //$NON-NLS-1$ "p, 3dlu," + (Environment.getStandAlone() ? "" : "p, 3dlu,") + "fill:200dlu:grow"); // rows //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ // 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(); // task names span whole dialog builder.add(taskNames, cc.xyw(builder.getColumn(), builder.getRow(), builder.getColumnCount())); builder.nextLine(2); if (!Environment.getStandAlone()) { if (!Environment.isExternal()) builder.add(getTeamOrAllLabel(), cc.xyw(builder.getColumn(), builder.getRow(), builder.getColumnCount())); builder.nextLine(2); } // builder.append(projectName); // builder.nextLine(2); builder.append(spreadSheetPane, createEditorsButtons(), createButtons()); return builder.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. * //from w w w.jav a2 s .c o m * @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:de.atomfrede.tools.evalutation.tools.plot.ui.wizard.pages.DatasetInputPanel.java
License:Open Source License
void addContent() { setLayout(new BorderLayout()); FormLayout layout = new FormLayout( "left:pref, 4dlu, left:pref, 4dlu, fill:pref:grow, 4dlu, left:pref, 4dlu, fill:pref:grow"); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder();//from w w w.j a v a 2 s. co m TitledBorder title; Border raisedBevel = BorderFactory.createRaisedBevelBorder(); title = BorderFactory.createTitledBorder(raisedBevel, "Dataset"); builder.append("Name", getDatasetNameTextField(), 3); builder.append("Column", getDatasetCombobox()); builder.nextLine(); builder.append("Color", getColorLabel(), 3); builder.append(getColorChooseButton()); builder.nextLine(); builder.append(getEnableAutoscaleCheckbox()); builder.append("Minimum", getMinimumSpinner()); builder.append("Maximum", getMaximumSpinner()); builder.append(ButtonBarFactory.buildRightAlignedBar(getDeleteDatasetButton()), 9); add(builder.getPanel(), BorderLayout.CENTER); setBorder(title); datasetNameTextField.setText(datasetCombobox.getSelectedItem().toString()); }
From source file:de.blinkenlights.bmix.util.ImageToBML.java
License:Open Source License
public void createAndShowGUI() { prefs = Preferences.userNodeForPackage(ImageToBML.class); //Create and set up the main window. mainFrame.setTitle("Image Sequence to BML"); mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { prefs.putInt("frameX", mainFrame.getX()); prefs.putInt("frameY", mainFrame.getY()); //prefs.putInt("frameWidth", mainFrame.getWidth()); //prefs.putInt("frameHeight", mainFrame.getHeight()); try { prefs.flush();/* w w w . j a va 2s. c om*/ } catch (BackingStoreException e1) { e1.printStackTrace(); } System.exit(0); } }); pngDirChoose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(new File(pngDir.getText())); chooser.setDialogTitle("Select Image Directory"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int choice = chooser.showOpenDialog(mainFrame); if (choice == JFileChooser.CANCEL_OPTION) { System.out.println("User Canceled"); } else { pngDir.setText(chooser.getSelectedFile().getAbsolutePath()); } } }); outFileChoose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Select Output Filename"); int choice = chooser.showSaveDialog(mainFrame); if (choice == JFileChooser.CANCEL_OPTION) { System.out.println("User Canceled"); } else { String chosenFile = chooser.getSelectedFile().getAbsolutePath(); if (!chosenFile.endsWith(".bml")) { chosenFile = chosenFile.concat(".bml"); } outFile.setText(chosenFile); } } }); startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (gzipCheckBox.isSelected()) { if (!outFile.getText().endsWith(".bml.gz")) { int ans = JOptionPane.showConfirmDialog(null, "<html>Filename should end with \"<b>.bml.gz</b>\". Continue?", "Compatibility Suggestion", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (ans == JOptionPane.CANCEL_OPTION) { return; } } } else { if (!outFile.getText().endsWith(".bml")) { int ans = JOptionPane.showConfirmDialog(null, "<html>Filename should end with \"<b>.bml</b>\". Continue?", "Compatibility Suggestion", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (ans == JOptionPane.CANCEL_OPTION) { return; } } } File out = new File(outFile.getText()); if (out.exists()) { int ans = JOptionPane.showConfirmDialog(null, "" + out.getName() + " exists. Overwrite?", "Save Over Existing File", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (ans == JOptionPane.CANCEL_OPTION) { return; } } Map<String, String> headerData = new HashMap<String, String>(); headerData.put("author", authorField.getText()); headerData.put("description", descriptionField.getText()); headerData.put("title", titleField.getText()); headerData.put("email", emailField.getText()); headerData.put("url", urlField.getText()); task = new ConvertTask(new File(pngDir.getText()), out, new Dimension(Integer.parseInt(xSizeField.getText()), Integer.parseInt(ySizeField.getText())), 4, headerData, gzipCheckBox.isSelected()); task.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName().equals("progress")) { progress.setValue((Integer) event.getNewValue()); } } }); task.execute(); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (task != null) { task.cancel(true); } } }); gzipCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (gzipCheckBox.isSelected()) { if (!outFile.getText().endsWith(".gz")) { outFile.setText(outFile.getText().concat(".gz")); } } else { if (outFile.getText().endsWith(".gz")) { outFile.setText(outFile.getText().substring(0, outFile.getText().length() - 3)); } } } }); FormLayout mainLayout = new FormLayout("pref, 4dlu, 120dlu:grow, 4dlu, min", ""); pngDir.setText(prefs.get("pngDir", System.getProperty("user.home"))); pngDir.getDocument().addDocumentListener(inputVerifier); outFile.setText(prefs.get("outFile", System.getProperty("user.home") + System.getProperty("file.separator") + "movie.bml")); outFile.getDocument().addDocumentListener(inputVerifier); xSizeField.setText(prefs.get("xSize", "18")); xSizeField.getDocument().addDocumentListener(inputVerifier); ySizeField.setText(prefs.get("ySize", "8")); ySizeField.getDocument().addDocumentListener(inputVerifier); frameRateField.setValue(prefs.getInt("fps", 15)); frameRateField.getModel().addChangeListener(inputVerifier); titleField.setText(prefs.get("title", "")); titleField.getDocument().addDocumentListener(inputVerifier); descriptionField.setText(prefs.get("description", "")); descriptionField.getDocument().addDocumentListener(inputVerifier); authorField.setText(prefs.get("author", System.getProperty("user.name"))); authorField.getDocument().addDocumentListener(inputVerifier); emailField.setText(prefs.get("email", "")); emailField.getDocument().addDocumentListener(inputVerifier); urlField.setText(prefs.get("url", "")); urlField.getDocument().addDocumentListener(inputVerifier); gzipCheckBox.setSelected(prefs.getBoolean("gzip", false)); gzipCheckBox.getModel().addChangeListener(inputVerifier); cancelButton.setEnabled(false); progress.setStringPainted(true); DefaultFormBuilder mainBuilder = new DefaultFormBuilder(mainLayout); mainBuilder.setDefaultDialogBorder(); mainBuilder.appendSeparator("Movie Parameters"); mainBuilder.nextLine(); mainBuilder.append("Source Directory", pngDir, pngDirChoose); mainBuilder.nextLine(); mainBuilder.append("Animation Width", xSizeField); mainBuilder.nextLine(); mainBuilder.append("Animation Height", ySizeField); mainBuilder.nextLine(); mainBuilder.append("Animation FPS", frameRateField); mainBuilder.nextLine(); mainBuilder.append("Output File", outFile, outFileChoose); mainBuilder.nextLine(); mainBuilder.append("GZip Compression", gzipCheckBox); mainBuilder.nextLine(); mainBuilder.appendUnrelatedComponentsGapRow(); mainBuilder.nextLine(); mainBuilder.appendSeparator("Movie Information (optional)"); mainBuilder.nextLine(); mainBuilder.append("Title", titleField); mainBuilder.nextLine(); mainBuilder.append("Description", descriptionField); mainBuilder.nextLine(); mainBuilder.append("Author", authorField); mainBuilder.nextLine(); mainBuilder.append("Email", emailField); mainBuilder.nextLine(); mainBuilder.append("URL", urlField); mainBuilder.nextLine(); mainBuilder.appendUnrelatedComponentsGapRow(); mainBuilder.nextLine(); mainBuilder.append(ButtonBarFactory.buildOKCancelBar(startButton, cancelButton), 5); mainBuilder.nextLine(); mainBuilder.appendUnrelatedComponentsGapRow(); mainBuilder.nextLine(); mainBuilder.append(progress, 5); mainBuilder.nextLine(); mainBuilder.append(statusLine, 5); mainBuilder.nextLine(); mainFrame.getContentPane().add(mainBuilder.getPanel()); mainFrame.pack(); int x = prefs.getInt("frameX", 20); int y = prefs.getInt("frameY", 20); int width = mainFrame.getPreferredSize().width; int height = mainFrame.getPreferredSize().height; mainFrame.setBounds(x, y, width, height); mainFrame.setVisible(true); inputVerifier.verifyAndSave(); }
From source file:de.dfki.dmas.owls2wsdl.gui.ConfigurationFrame.java
License:Open Source License
private JPanel buildSubPanel4ApplicationConfigs(boolean debugmode) { FormLayout layout = new FormLayout("10dlu, right:pref, 10px, fill:pref:grow, 5px, pref"); DefaultFormBuilder builder = null; if (debugmode) builder = new DefaultFormBuilder(layout, new FormDebugPanel()); else//ww w. ja v a2s . c o m builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.setLeadingColumnOffset(1); builder.appendSeparator("Application Properties"); builder.append("Application path", this.applPathField, this.applPathBrowseButton); builder.append("Export directory", this.exportDirectoryField, this.exportDirectoryBrowseButton); builder.append("Log file", this.logPathField, 3); builder.append("Persistent datatype directory", this.persistentDatatypeDirectoryField, 3); builder.append("Project directory", this.persistentProjectDirectoryField, 3); builder.append("Persistence", this.persistentDatatypeCheckBox, 3); builder.append("JConsole", this.jconsoleCheckBox, 3); // builder.append("", this.buildRelativePathCheckBox, 1); builder.appendSeparator("Language"); JPanel langPanel = new JPanel(); langPanel.add(this.deLangButton); langPanel.add(this.enLangButton); builder.setHAlignment(CellConstraints.LEFT); builder.append("", langPanel, 3); builder.appendSeparator("Look and Feel"); JPanel lfPanel = new JPanel(); lfPanel.add(this.plasticLfButton); lfPanel.add(this.windowsLfButton); lfPanel.add(this.motifLfButton); builder.setHAlignment(CellConstraints.LEFT); builder.append("", lfPanel, 3); if (debugmode) FormDebugUtils.dumpAll(builder.getPanel()); return builder.getPanel(); }
From source file:de.dfki.dmas.owls2wsdl.gui.ConfigurationFrame.java
License:Open Source License
private JPanel buildSubPanel4XsdGenerationConfigs(boolean debugmode) { FormLayout layout = new FormLayout("10dlu, right:pref, 10px, fill:pref:grow"); DefaultFormBuilder builder = null; if (debugmode) builder = new DefaultFormBuilder(layout, new FormDebugPanel()); else/*from w w w. ja va2s. c o m*/ builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.setLeadingColumnOffset(1); builder.appendSeparator("General Properties"); builder.append("Default inheritance depth", this.defaultElementDepthField, 1); builder.append("Pattern Usage", this.shortButton, 1); builder.append("", this.hierarchyButton, 1); builder.append("Enhance WSDL Matchmaking", this.addMetaTypesCheckBox, 1); builder.append("Enhance WSDL Matchmaking", this.addAnnotationCheckBox, 1); builder.appendSeparator("Project Properties (saved in project)"); builder.append("Use this depth to add elements", this.projectElementDepthField, 1); builder.append("Inherit XSD Type from", this.xsdTypeInheritanceBehaviour, 1); builder.append("Default XSD Type", this.projectDefaultXsdTypeField, 1); if (debugmode) FormDebugUtils.dumpAll(builder.getPanel()); return builder.getPanel(); }
From source file:de.dfki.dmas.owls2wsdl.gui.ConfigurationFrame.java
License:Open Source License
private JPanel buildExportSettingsTab(boolean debugmode) { FormLayout layout = new FormLayout("10dlu, right:pref, 10px, fill:pref:grow"); DefaultFormBuilder builder = null; if (debugmode) builder = new DefaultFormBuilder(layout, new FormDebugPanel()); else// ww w. ja va 2 s . co m builder = new DefaultFormBuilder(layout); builder.setDefaultDialogBorder(); builder.setLeadingColumnOffset(1); builder.appendSeparator("Namespace setting for WSDL Builder"); builder.append("Change Namespace (tns)", this.autoNamespaceBaseSelectButton, 1); builder.append("", this.newNamespaceBaseSelectButton, 1); builder.append("New Namespace base_path", this.wsdlNamespaceField, 1); // builder.append("Axis service path", this.axisServicePathField, 1); builder.appendSeparator("XML Base setting for OWL-S Builder (Re-Engineering)"); builder.append("Change XML Base", this.autoOWLSBaseSelectButton, 1); builder.append("", this.newOWLSBaseSelectButton, 1); builder.append("New XML base_path", this.owlsBaseField, 1); builder.appendSeparator("Grounding setting for OWL-S Builder (Re-Engineering)"); builder.append("Set grounding path", this.autoWsdldocPathSelectButton, 1); builder.append("", this.setWsdlDocPathSelectButton, 1); builder.append("New grounding path", this.wsdldocPathField, 1); if (debugmode) FormDebugUtils.dumpAll(builder.getPanel()); return builder.getPanel(); }