Example usage for com.jgoodies.forms.layout CellConstraints rc

List of usage examples for com.jgoodies.forms.layout CellConstraints rc

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints rc.

Prototype

public CellConstraints rc(int row, int col) 

Source Link

Document

Sets row and column origins; sets height and width to 1; uses the default alignments.

Examples:

 cc.rc(1, 1); cc.rc(3, 1); 

Usage

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

/**                                                                     DOCDO: Provide method overview.
 *
 *///from   ww w  . j  av a2 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  .j  a  va2 s  .c  om
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.
 *
 *///  ww  w . j a  v  a  2 s .c  om
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.
 *
 *//*from w w w  .  j a  v a  2  s.c om*/
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.j a  v  a2  s  .  c o 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.
 *
 *///from   w w  w.  j  a v a  2  s .  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   w  w  w  . j ava2 s  . c  o 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.
 *///from   w  ww  .  jav a  2 s. c  o m
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.
 *
 *///from www.  ja va  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();
}

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

/**                                                                     DOCDO: Provide method overview.
 *
 *///from www  . j ava 2s  . c  o m
private JPanel assembleModelPanel() {
    // Instantiate the components.
    JComponent file_sep = DefaultComponentFactory.getInstance().createSeparator("Input Model Versions",
            SwingConstants.CENTER);

    model_file_bs_txt_ = new JTextField();
    model_file_lf_txt_ = new JTextField();
    model_file_rt_txt_ = new JTextField();

    model_dir_bs_btn_ = new JButton(Constants.FILE_OPENED_IMG);
    model_dir_lf_btn_ = new JButton(Constants.FILE_OPENED_IMG);
    model_dir_rt_btn_ = new JButton(Constants.FILE_OPENED_IMG);

    // Set visual and behavioral aspects of the components.
    //model_file_bs_txt_.getDocument().putProperty("name", "common_file");
    model_file_bs_txt_.setToolTipText("File path to common model.");
    model_dir_bs_btn_.setToolTipText("Browse for common model.");

    //model_file_lf_txt_.getDocument().putProperty("name", "left_file");
    model_file_lf_txt_.setToolTipText("File path to left model.");
    model_dir_lf_btn_.setToolTipText("Browse for left model.");

    //model_file_rt_txt_.getDocument().putProperty("name", "right_file");
    model_file_rt_txt_.setToolTipText("File path to right model.");
    model_dir_rt_btn_.setToolTipText("Browse for right model.");

    // Set panel layout and constraints.
    String col_spec = "40dlu, right:pref, $rgap, MAX(155dlu;pref), "
            + "MIN(70dlu;pref):grow, $rgap, pref, pref:grow";
    String row_spec = "4dlu , 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(file_sep, cc.rcw(2, 1, 8));
    builder.addLabel("&Base model", cc.rc(4, 2));
    builder.add(model_file_bs_txt_, cc.rcw(4, 4, 2));
    builder.add(model_dir_bs_btn_, cc.rc(4, 7));
    builder.addLabel("&Left model", cc.rc(6, 2));
    builder.add(model_file_lf_txt_, cc.rcw(6, 4, 2));
    builder.add(model_dir_lf_btn_, cc.rc(6, 7));
    builder.addLabel("&Right model", cc.rc(8, 2));
    builder.add(model_file_rt_txt_, cc.rcw(8, 4, 2));
    builder.add(model_dir_rt_btn_, cc.rc(8, 7));

    return builder.getPanel();
}