Example usage for com.jgoodies.forms.builder PanelBuilder setBorder

List of usage examples for com.jgoodies.forms.builder PanelBuilder setBorder

Introduction

In this page you can find the example usage for com.jgoodies.forms.builder PanelBuilder setBorder.

Prototype

@Deprecated
public void setBorder(Border border) 

Source Link

Document

Sets the panel's border.

Usage

From source file:ambit2.ui.table.BrowserModeNavigator.java

License:Open Source License

public JComponent buildPanel(final IBrowserMode browserMode) {

    StringBuffer blayout = new StringBuffer();
    BrowserMode[] values = IBrowserMode.BrowserMode.values();
    button = new JToggleButton[values.length];

    ButtonGroup group = new ButtonGroup();
    boolean first = true;
    ActionListener listener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            browserMode.setBrowserMode(BrowserMode.valueOf(e.getActionCommand()));

        }/*from   ww w . j a va  2 s  .  c o m*/
    };
    for (int i = 0; i < values.length; i++) {
        BrowserMode mode = values[i];
        ImageIcon icon = mode.getIcon(false);
        String title = mode.getTitle();
        if (icon != null)
            title = "";
        button[i] = new JToggleButton(title, icon);
        //button[i].setBorder();
        button[i].addActionListener(listener);
        button[i].setActionCommand(mode.toString());
        button[i].setToolTipText(mode.getTooltip());
        button[i].setFocusable(false);
        button[i].setSelectedIcon(mode.getIcon(true));
        button[i].setFocusable(false);
        group.add(button[i]);
        button[i].setSelected(mode.equals(browserMode.getBrowserMode()));
        if (!first)
            blayout.append(",1dlu,");

        blayout.append("pref");
        first = false;

    }
    blayout.append(",8dlu,pref,1dlu,pref");
    zoomIn = new JButton(new AbstractAmbitAction("Zoom in", "images/zoom_in.png", "Increase cell size") {
        /**
          * 
          */
        private static final long serialVersionUID = -7230604413152102914L;

        public void actionPerformed(ActionEvent e) {
            //browserMode.zoom(browserMode.getBrowserMode().getCellSize(0,0).getHeight()*1.1);
            browserMode.zoom(1.1, 1.1);
        }
    });
    zoomIn.setFocusable(false);
    zoomOut = new JButton(new AbstractAmbitAction("Zoom out", "images/zoom_out.png", "Decrease cell size") {

        /**
          * 
          */
        private static final long serialVersionUID = 332852452089868875L;

        public void actionPerformed(ActionEvent e) {
            //browserMode.zoom(browserMode.getBrowserMode().getCellSize(0,0).getHeight()*0.9);
            browserMode.zoom(0.9, 0.9);
        }
    });
    zoomOut.setFocusable(false);
    FormLayout layout = new FormLayout(blayout.toString(), "pref");
    PanelBuilder panel = new PanelBuilder(layout);
    panel.setBorder(null);
    CellConstraints cc = new CellConstraints();
    for (int i = 0; i < values.length; i++) {
        panel.add(button[i], cc.xy(i * 2 + 1, 1));

    }
    //panel.add(new JToolBar.Separator(),cc.xy((values.length)*2+1,1));
    panel.add(zoomIn, cc.xy((values.length) * 2 + 1, 1));
    panel.add(zoomOut, cc.xy((values.length) * 2 + 3, 1));
    return panel.getPanel();
}

From source file:ca.dsrg.mirador.ui.MatchPanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 *///  ww w .j ava  2 s.c  o m
private JPanel assembleControlPanel() {
    // Instantiate the components.
    JPanel master_pnl = assembleControlMasterPanel();
    match_btn_ = new JButton("Match");
    unmatch_btn_ = new JButton("Unmatch");

    // Set visual and behavioral aspects of the components.
    match_btn_.setMnemonic(KeyEvent.VK_M);
    match_btn_.setToolTipText("Pair the selected tree elements.");
    unmatch_btn_.setMnemonic(KeyEvent.VK_U);
    unmatch_btn_.setToolTipText("Unpair the selected tree elements.");

    // Set panel layout and constraints.
    String col_spec = "$rgap, pref, $rgap";
    String row_spec = "pref, $ugap, pref, 4dlu, pref";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.DLU2_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(master_pnl, cc.rcw(1, 1, 3));
    builder.add(match_btn_, cc.rc(3, 2));
    builder.add(unmatch_btn_, cc.rc(5, 2));

    return builder.getPanel();
}

From source file:ca.dsrg.mirador.ui.MatchPanel.java

/**
 * Instantiate the GUI's components, and populate its containers.
 *//*from   w w w  .  ja va  2  s. co m*/
private void assembleGui() {
    // Assemble the constituent panels.
    weight_pnl_ = assembleWeightPanel();
    JPanel option_pnl = assembleOptionPanel();
    JPanel view_pnl = assembleViewPanel();

    // Set panel layout and constraints.
    String col_spec = "pref:grow";
    String row_spec = "pref, $ugap, pref, $ugap, fill:pref:grow";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout, this);
    builder.setBorder(Borders.TABBED_DIALOG_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(weight_pnl_, cc.rc(1, 1));
    builder.add(option_pnl, cc.rc(3, 1));
    builder.add(view_pnl, cc.rc(5, 1));
}

From source file:ca.dsrg.mirador.ui.MatchPanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 *//*w  ww. j  a  v  a  2  s .com*/
private JPanel assembleOptionPanel() {
    // Instantiate the components.
    JComponent separator = DefaultComponentFactory.getInstance().createSeparator("Set Model Matching Options",
            SwingConstants.CENTER);
    strategy_pnl_ = assembleOptionStrategyPanel();

    sync_cbx_ = new JCheckBox();
    InvocationParser parser = Mirador.getParser();
    float weight = new Float(
            (parser.optionValue("match_threshold") != null) ? parser.optionValue("match_threshold") : "0.0");
    limit_spn_ = new JSpinner(new SpinnerNumberModel(0, 0, 1, weight));
    limit_btn_ = new JButton("Show");
    limit_spn_.setEditor(new JSpinner.NumberEditor(limit_spn_, "0.00"));

    // Set visual and behavioral aspects of the components.
    sync_cbx_.setMnemonic(KeyEvent.VK_Y);
    sync_cbx_.setToolTipText("Check so selected element's match in opposite tree is also selected.");
    limit_spn_.setToolTipText("Set similarity limit at which elements will be automatically matched.");
    limit_btn_.setToolTipText("Highlight elements that will matched for the specified threshold.");

    // Set panel layout and constraints.
    String col_spec = "pref, $rgap, pref, fill:$ugap:grow, pref, $rgap," + "pref, $ugap, pref";
    String row_spec = "pref, $rgap, pref, $rgap, pref";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(separator, cc.rcw(1, 1, 9));
    builder.add(strategy_pnl_, cc.rcw(3, 1, 9));
    builder.add(sync_cbx_, cc.rc(5, 1));
    builder.addLabel("S&ynchronize tree node selections", cc.rc(5, 3));
    builder.add(limit_spn_, cc.rc(5, 5));
    builder.addLabel("Matching similarity threshold", cc.rc(5, 7));
    builder.add(limit_btn_, cc.rc(5, 9));

    return builder.getPanel();
}

From source file:ca.dsrg.mirador.ui.MatchPanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 *///  w w  w. ja va  2  s  . co  m
private JPanel assembleViewPanel() {
    // Instantiate the components.
    JComponent separator = DefaultComponentFactory.getInstance().createSeparator("Alter Model Element Matches",
            SwingConstants.CENTER);

    JPanel control_pnl = assembleControlPanel();

    view_lf_tree_ = new JTree();
    view_lf_scl_ = new JScrollPane(view_lf_tree_);
    view_lf_tbl_ = new JTable();
    table_lf_scl_ = new JScrollPane(view_lf_tbl_);
    view_lf_spl_ = new JSplitPane(JSplitPane.VERTICAL_SPLIT, view_lf_scl_, table_lf_scl_);

    view_rt_tree_ = new JTree();
    view_rt_scl_ = new JScrollPane(view_rt_tree_);
    view_rt_tbl_ = new JTable();
    table_rt_scl_ = new JScrollPane(view_rt_tbl_);
    view_rt_spl_ = new JSplitPane(JSplitPane.VERTICAL_SPLIT, view_rt_scl_, table_rt_scl_);

    // Set visual and behavioral aspects of the components.
    DefaultTreeSelectionModel mode = new DefaultTreeSelectionModel();
    mode.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    view_lf_tree_.setSelectionModel(mode);
    view_lf_tree_.setToolTipText("Select an element to highlight its match"
            + "in the right tree, and show its details the table below.");

    mode = new DefaultTreeSelectionModel();
    mode.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    view_rt_tree_.setSelectionModel(mode);
    view_rt_tree_.setToolTipText("Select an element to highlight its match"
            + "in the left tree, and show its details the table below.");

    ToolTipManager.sharedInstance().registerComponent(view_lf_tree_);
    ToolTipManager.sharedInstance().registerComponent(view_rt_tree_);

    view_lf_tbl_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    view_lf_tbl_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    view_lf_tbl_.setRowSelectionAllowed(true);
    view_lf_tbl_.setToolTipText("Select a candidate to highlight its" + " potential match in the right tree.");

    view_rt_tbl_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    view_rt_tbl_.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    view_rt_tbl_.setRowSelectionAllowed(true);
    view_rt_tbl_.setToolTipText("Select a candidate to highlight its" + " potential match in the left tree.");

    view_lf_spl_.setPreferredSize(view_lf_spl_.getMaximumSize());
    view_lf_spl_.setOneTouchExpandable(true);
    view_lf_spl_.setResizeWeight(0.7);

    view_rt_spl_.setPreferredSize(view_rt_spl_.getMaximumSize());
    view_rt_spl_.setOneTouchExpandable(true);
    view_rt_spl_.setResizeWeight(0.7);

    // Set panel layout and constraints.
    String col_spec = "center:160dlu:grow, pref, center:160dlu:grow";
    String row_spec = "pref, $rgap, pref, $rgap, fill:MIN(180dlu;pref):grow";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(separator, cc.rcw(1, 1, 3));
    builder.addLabel("Left model elements", cc.rc(3, 1));
    builder.add(view_lf_spl_, cc.rc(5, 1));
    builder.add(control_pnl, cc.rc(5, 2));
    builder.addLabel("Right model elements", cc.rc(3, 3));
    builder.add(view_rt_spl_, cc.rc(5, 3));

    return builder.getPanel();
}

From source file:ca.dsrg.mirador.ui.MatchPanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 *//* w  w  w  . ja  va 2 s  .  co  m*/
private JPanel assembleWeightPanel() {
    // Instantiate the components.
    JComponent separator = DefaultComponentFactory.getInstance()
            .createSeparator("Set Relative Weights for Matching Strategies", SwingConstants.CENTER);

    update_btn_ = new JButton("Update");

    // Set visual and behavioral aspects of the components.
    update_btn_.setMnemonic(KeyEvent.VK_U);
    update_btn_.setToolTipText("Force similarity calculation using specified"
            + " weights, and redisplay new values in detail tables.");

    // Set panel layout and constraints.
    String col_spec = "pref:grow, $ugap, pref:grow, $ugap, pref:grow, $ugap,"
            + "pref:grow, $ugap, pref:grow, $ugap, pref:grow, $ugap,"
            + "pref:grow, $ugap, pref:grow, $ugap, pref";
    String row_spec = "pref, $rgap, pref, $rgap, pref";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder;

    int sz;
    int col;

    if (weight_pnl_ == null) {
        builder = new PanelBuilder(layout);
        sz = MAX_STRATEGIES;
        col = 1;
    } else {
        weight_pnl_.removeAll();
        builder = new PanelBuilder(layout, weight_pnl_);
        sz = strategies_.size();
        col = 17 - (sz - 1) * 2;
    }
    builder.setBorder(Borders.EMPTY_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(separator, cc.rcw(1, 1, 17));
    for (int i = 1; i < sz; ++i) {
        if (weight_pnl_ == null) {
            builder.addLabel("a Strategy", cc.rcw(3, col, 2));
            builder.add(new JSpinner(), cc.rc(5, col));
        } else {
            builder.addLabel(strategies_.get(i).getLabel(), cc.rcw(3, col, 2));
            builder.add(strategies_.get(i).getSpinner(), cc.rc(5, col));
        }
        col += 2;
    }
    builder.add(update_btn_, cc.rc(5, col));

    return builder.getPanel();
}

From source file:ca.dsrg.mirador.ui.MergePanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 *///ww  w .  j a  v  a2s .  c  o  m
private JPanel assembleApplyPanel() {
    // Instantiate the components.
    JComponent table_sep = DefaultComponentFactory.getInstance()
            .createSeparator("Apply Desired Changes and Resolve Conflicts", SwingConstants.CENTER);

    apply_tbl_ = new JTable();
    apply_scl_ = new JScrollPane(apply_tbl_);
    JPanel control_pnl = assembleControlPanel();

    // Set visual and behavioral aspects of the components.
    apply_tbl_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    apply_tbl_.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
    apply_tbl_.setRowSelectionAllowed(true);
    apply_tbl_.setToolTipText("Select a change...");

    ToolTipManager.sharedInstance().registerComponent(apply_tbl_);

    // Set panel layout and constraints.
    String col_spec = "pref:grow, $ugap, pref";
    String row_spec = "pref, $rgap, fill:MIN(86dlu;pref):grow";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(table_sep, cc.rcw(1, 1, 3));
    builder.add(apply_scl_, cc.rc(3, 1));
    builder.add(control_pnl, cc.rc(3, 3));

    return builder.getPanel();
}

From source file:ca.dsrg.mirador.ui.MergePanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 *///from  ww  w.j a  v  a2 s .co m
private JPanel assembleControlPanel() {
    // Instantiate the components.
    accept_btn_ = new JButton("Accept");
    reject_btn_ = new JButton("Reject");
    left_btn_ = new JButton("Left");
    right_btn_ = new JButton("Right");
    apply_btn_ = new JButton("Apply");
    undo_btn_ = new JButton("Undo");

    // Set visual and behavioral aspects of the components.
    accept_btn_.setMnemonic(KeyEvent.VK_C);
    accept_btn_.setToolTipText("Apply...");

    reject_btn_.setMnemonic(KeyEvent.VK_J);
    reject_btn_.setToolTipText("Apply...");

    left_btn_.setMnemonic(KeyEvent.VK_L);
    left_btn_.setToolTipText("Apply...");

    right_btn_.setMnemonic(KeyEvent.VK_R);
    right_btn_.setToolTipText("Apply...");

    apply_btn_.setMnemonic(KeyEvent.VK_A);
    apply_btn_.setToolTipText("Apply...");

    undo_btn_.setMnemonic(KeyEvent.VK_U);
    undo_btn_.setToolTipText("Apply...");

    // Set panel layout and constraints.
    String col_spec = "pref, $rgap, pref";
    String row_spec = "$ugap, pref, 5dlu, pref, 5dlu, pref, $ugap";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(accept_btn_, cc.rc(2, 1));
    builder.add(reject_btn_, cc.rc(2, 3));
    builder.add(left_btn_, cc.rc(4, 1));
    builder.add(right_btn_, cc.rc(4, 3));
    builder.add(apply_btn_, cc.rc(6, 1));
    builder.add(undo_btn_, cc.rc(6, 3));

    return builder.getPanel();
}

From source file:ca.dsrg.mirador.ui.MergePanel.java

/**
 * Instantiate the GUI's components, and populate its containers.
 *///  w  ww .  j a va  2s. com
private void assembleGui() {
    // Instantiate the components.
    JComponent tree_sep = DefaultComponentFactory.getInstance()
            .createSeparator("Build Merged Model from Common Ancestor", SwingConstants.CENTER);

    view_tree_ = new JTree();
    view_scl_ = new JScrollPane(view_tree_);

    JPanel apply_pnl = assembleApplyPanel();
    view_spl_ = new JSplitPane(JSplitPane.VERTICAL_SPLIT, view_scl_, apply_pnl);

    // Set visual and behavioral aspects of the components.
    DefaultTreeSelectionModel mode = new DefaultTreeSelectionModel();
    mode.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    view_tree_.setSelectionModel(mode);
    view_tree_.setToolTipText("Select an element to...");

    ToolTipManager.sharedInstance().registerComponent(view_tree_);

    //??    view_spl_.setPreferredSize(view_spl_.getMaximumSize());
    view_spl_.setOneTouchExpandable(true);
    view_spl_.setResizeWeight(0.7);

    // Set panel layout and constraints.
    String col_spec = "pref:grow";
    String row_spec = "pref, $rgap, fill:pref:grow";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout, this);
    builder.setBorder(Borders.TABBED_DIALOG_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(tree_sep, cc.rc(1, 1));
    builder.add(view_spl_, cc.rc(3, 1));
}

From source file:ca.dsrg.mirador.ui.ModelPanel.java

/**                                                                     DOCDO: Provide method overview.
 *
 */// w w w.j  av a  2 s  .  c o m
private JPanel assembleDecisionPanel() {
    // Instantiate the components.
    JComponent match_sep = DefaultComponentFactory.getInstance().createSeparator("Input Element Matching File",
            SwingConstants.CENTER);

    previous_cbx_ = new JCheckBox("Load previous element matching file");
    previous_file_txt_ = new JTextField();
    previous_dir_btn_ = new JButton(Constants.FILE_OPENED_IMG);

    JComponent table_sep = DefaultComponentFactory.getInstance()
            .createSeparator("Input Decision Table Definition Files", SwingConstants.CENTER);

    match_cbx_ = new JCheckBox("Load element matching table definition");
    match_file_txt_ = new JTextField();
    match_dir_btn_ = new JButton(Constants.FILE_OPENED_IMG);

    before_cbx_ = new JCheckBox("Load before predicate table definition");
    before_file_txt_ = new JTextField();
    before_dir_btn_ = new JButton(Constants.FILE_OPENED_IMG);

    resolve_cbx_ = new JCheckBox("Load conflict resolution table definition");
    resolve_file_txt_ = new JTextField();
    resolve_dir_btn_ = new JButton(Constants.FILE_OPENED_IMG);

    // Set visual and behavioral aspects of the components.
    previous_cbx_.setMnemonic(KeyEvent.VK_P);
    previous_cbx_.setToolTipText("Check to load previously saved model element matches. (no affect)");
    //??    previous_file_txt_.getDocument().putProperty("name", "previous_file");
    previous_file_txt_.setToolTipText("File path to previous element matching file.");
    previous_dir_btn_.setToolTipText("Browse for previous element matching file.");

    match_cbx_.setMnemonic(KeyEvent.VK_T);
    match_cbx_.setToolTipText("Check to load element match table definition.");
    //??    match_file_txt_.getDocument().putProperty("name", "match_file");
    match_file_txt_.setToolTipText("File path to element match table definition.");
    match_dir_btn_.setToolTipText("Browse for element match table definition.");

    before_cbx_.setMnemonic(KeyEvent.VK_F);
    before_cbx_.setToolTipText("Check to load conflict detection table definition.");
    //??    before_file_txt_.getDocument().putProperty("name", "before_file");
    before_file_txt_.setToolTipText("File path to conflict detection table definition.");
    before_dir_btn_.setToolTipText("Browse for conflict detection table definition.");

    resolve_cbx_.setMnemonic(KeyEvent.VK_S);
    resolve_cbx_.setToolTipText("Check to load conflict resolution table definition.");
    //??    resolve_file_txt_.getDocument().putProperty("name", "resolve_file");
    resolve_file_txt_.setToolTipText("File path to conflict resolution table definition.");
    resolve_dir_btn_.setToolTipText("Browse for conflict resolution table definition.");

    // Set panel layout and constraints.
    String col_spec = "pref, $rgap, MAX(90dlu;pref), MIN(70dlu;pref):grow, " + "$rgap, pref, pref:grow";
    String row_spec = "0dlu , pref, " + "$ugap, MIN(13dlu;pref), " + "8dlu , pref, "
            + " $ugap, MIN(13dlu;pref), $rgap, MIN(13dlu;pref), " + "$rgap, MIN(13dlu;pref)";
    FormLayout layout = new FormLayout(col_spec, row_spec);

    // Initialize builder of the panel with the layout and a border.
    PanelBuilder builder = new PanelBuilder(layout);
    builder.setBorder(Borders.EMPTY_BORDER);

    // Add components to the panel.
    CellConstraints cc = new CellConstraints();
    builder.add(match_sep, cc.rcw(2, 1, 7));
    builder.add(previous_cbx_, cc.rc(4, 1));
    builder.add(previous_file_txt_, cc.rcw(4, 3, 2));
    builder.add(previous_dir_btn_, cc.rc(4, 6));

    builder.add(table_sep, cc.rcw(6, 1, 7));
    builder.add(match_cbx_, cc.rc(8, 1));
    builder.add(match_file_txt_, cc.rcw(8, 3, 2));
    builder.add(match_dir_btn_, cc.rc(8, 6));
    builder.add(before_cbx_, cc.rc(10, 1));
    builder.add(before_file_txt_, cc.rcw(10, 3, 2));
    builder.add(before_dir_btn_, cc.rc(10, 6));
    builder.add(resolve_cbx_, cc.rc(12, 1));
    builder.add(resolve_file_txt_, cc.rcw(12, 3, 2));
    builder.add(resolve_dir_btn_, cc.rc(12, 6));

    return builder.getPanel();
}