Java Code Examples for info.clearthought.layout.TableLayout#FILL

The following examples show how to use info.clearthought.layout.TableLayout#FILL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AttributeOrderEditPanel.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
private JComponent createUpDown() {

        TableLayout layout = new TableLayout(new double[]{TableLayout.FILL},
                new double[]{TableLayout.FILL, 5, TableLayout.FILL});

        JPanel panel = new JPanel(layout);

        JButton upButton = new JButton(up);
        upButton.setFocusable(false);
        JButton downButton = new JButton(down);
        downButton.setFocusable(false);

        panel.add(upButton, "0,0");
        panel.add(downButton, "0,2");

        JPanel p = new JPanel(new FlowLayout());
        p.add(panel);
        return p;
    }
 
Example 2
Source File: OpenFinDesktopDemo.java    From java-example with MIT License 6 votes vote down vote up
private JPanel layoutAppDescriptionPanel() {
    JPanel panel = new JPanel();
    double size[][] = {{TableLayout.FILL, 100}, {20, 20, 20, 20, 20, 20, 20}};
    panel.setLayout(new TableLayout(size));
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createBevelBorder(2), "Application Settings"));

    panel.add(uuidLabel = new JLabel(), "0, 0, 0, 0");
    panel.add(nameLabel = new JLabel(), "0, 1, 0, 1");
    panel.add(versionLabel = new JLabel(), "0, 2, 0, 2");
    panel.add(urlLabel = new JLabel(), "0, 3, 0, 3");

    panel.add(resizeLabel = new JLabel(), "1, 1, 1, 1");
    panel.add(frameLabel = new JLabel(), "1, 2, 1, 2");
    panel.add(autoShowLabel = new JLabel(), "1, 3, 1, 3");

    return panel;
}
 
Example 3
Source File: ChartSourceSelectPanel.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
private Component createSourceTypePanel() {
    double[][] size = {
            {5, TableLayout.MINIMUM, TableLayout.FILL,
                    TableLayout.MINIMUM, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5}};

    TableLayout layout = new TableLayout(size);

    layout.setHGap(5);
    layout.setVGap(5);

    JPanel panel = new JPanel(layout);

    panel.add(new JLabel(ChartResourceManager.getString("SourceType")),
            "1,1");
    panel.add(sourceType, "2,1");
    panel.add(new JLabel(ChartResourceManager
            .getString("SourceType.tableAttribute")), "3,1");
    panel.add(tableAttribute, "4,1");
    return panel;
}
 
Example 4
Source File: CreateOrEditElementListDialog.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
private void init() {
    double[][] size = {
            {DIV_SPACE, TableLayout.MINIMUM, DIV_SPACE, TableLayout.FILL,
                    DIV_SPACE}, {DIV_SPACE, TableLayout.FILL, DIV_SPACE}};

    JPanel panel = new JPanel(new TableLayout(size));

    panel.add(
            new JLabel(GlobalResourcesManager.getString("ElementListName")),
            "1, 1");

    panel.add(nameField, "3, 1");

    Attribute attribute = getAttribute();
    if (attribute != null)
        nameField.setText(attribute.getName());

    JPanel main = new JPanel(new BorderLayout());
    main.add(panel, BorderLayout.NORTH);

    AttributePlugin attributePlugin = framework
            .findAttributePlugin(getAttributeType());

    editor = (ElementListPreferenciesEditor) attributePlugin
            .getAttributePreferenciesEditor();
    JPanel panel2 = new JPanel(new BorderLayout());
    panel2.add(editor.createComponent(getAttribute(), engine, rules),
            BorderLayout.CENTER);
    main.add(panel2, BorderLayout.CENTER);
    setMainPane(main);
}
 
Example 5
Source File: WindowEmbedDemo.java    From java-example with MIT License 5 votes vote down vote up
private JPanel layoutCenterPanel() {
    JPanel panel = new JPanel();
    double size[][] = {{TableLayout.FILL}, {120, TableLayout.FILL}};
    panel.setLayout(new TableLayout(size));
    panel.add(layoutActionButtonPanel(), "0,0,0,0");
    panel.add(layoutEmbedPanel(), "0, 1, 0, 1");
    return panel;
}
 
Example 6
Source File: OpenFinDesktopDemo.java    From java-example with MIT License 5 votes vote down vote up
private JPanel layoutCenterPanel() {
    JPanel panel = new JPanel();
    double size[][] = {{TableLayout.FILL}, {150, 150, TableLayout.FILL}};
    panel.setLayout(new TableLayout(size));

    panel.add(layoutAppDescriptionPanel(), "0,0,0,0");

    panel.add(layoutWindowControlPanel(), "0,1,0,1");
    panel.add(layoutStatusPanel(), "0,2,0,2");

    return panel;
}
 
Example 7
Source File: EditUserDialog.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
public EditUserDialog(JDialog dialog, User user, AdminPanelPlugin plugin) {
    super(dialog, true);
    this.user = user;
    this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    if (user == null) {
        setTitle(plugin.getString("UserDialog.Create"));
        this.user = new User();
    } else {
        setTitle(plugin.getString("UserDialog.Edit"));
        login.setText(user.getLogin());
        name.setText(user.getName());
        password.setText(user.getPassword());
        login.setEnabled(false);
    }

    double[][] size = {
            {5, TableLayout.FILL, 5, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5, TableLayout.FILL, 5,
                    TableLayout.FILL, 5}};

    TableLayout layout = new TableLayout(size);
    JPanel contentPane = new JPanel(layout);

    contentPane.add(new JLabel(plugin.getString("UserDialog.Login")),
            "1, 1");
    contentPane.add(login, "3, 1");
    contentPane
            .add(new JLabel(plugin.getString("UserDialog.Name")), "1, 3");
    contentPane.add(name, "3, 3");
    contentPane.add(new JLabel(plugin.getString("UserDialog.Password")),
            "1, 5");
    contentPane.add(password, "3, 5");

    this.setMainPane(contentPane);
    this.pack();
    this.setMinimumSize(getSize());
    this.setLocationRelativeTo(null);
    Options.loadOptions(this);
}
 
Example 8
Source File: OpenFinDockingDemo.java    From java-example with MIT License 5 votes vote down vote up
private JPanel layoutCenterPanel() {
    JPanel panel = new JPanel();
    double size[][] = {{TableLayout.FILL}, {150, 150, TableLayout.FILL}};
    panel.setLayout(new TableLayout(size));

    return panel;
}
 
Example 9
Source File: DockingDemo2.java    From java-example with MIT License 5 votes vote down vote up
private JPanel layoutCenterPanel() {
    JPanel panel = new JPanel();
    double size[][] = {{TableLayout.FILL}, {150, 150, TableLayout.FILL}};
    panel.setLayout(new TableLayout(size));

    return panel;
}
 
Example 10
Source File: OpenFinDesktopDemo.java    From java-example with MIT License 5 votes vote down vote up
private JPanel layoutLeftPanel() {
    JPanel panel = new JPanel();
    double size[][] = {{TableLayout.FILL}, {160, 30, TableLayout.FILL}};
    panel.setLayout(new TableLayout(size));

    panel.add(layoutActionButtonPanel(), "0,0,0,0");

    JLabel label = new JLabel(" Active Applications");
    panel.add(label, "0,1,0,1");

    this.appOptionsList = new ArrayList<ApplicationOptions>();
    this.applicationList = new HashMap<String, Application>();
    this.activeApplications = new JList(new DefaultListModel());
    this.activeApplications.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    this.activeApplications.setBorder(BorderFactory.createLineBorder(Color.GRAY, 2));
    this.activeApplications.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent listSelectionEvent) {
            int selected = activeApplications.getSelectedIndex();
            if (selected >= 0) {
                descApplication(appOptionsList.get(selected));
            }
        }
    });
    panel.add(this.activeApplications, "0,2,0,2");

    return panel;
}
 
Example 11
Source File: CreateBaseFunctionDialog.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
public CreateBaseFunctionDialog(JFrame frame, Engine engine,
                                AccessRules rules) {
    super(frame, true);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    this.engine = engine;
    this.rules = rules;
    this.setTitle(GlobalResourcesManager.getString("CreateFunction"));
    double[][] size = {{5, TableLayout.MINIMUM, 5, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5}};
    JPanel panel = new JPanel(new TableLayout(size));

    panel.add(new JLabel(ResourceLoader.getString("name")), "1,1");

    field.setPreferredSize(new Dimension(220,
            field.getPreferredSize().height));

    panel.add(field, "3,1");

    ButtonGroup bg = new ButtonGroup();
    bg.add(idef0);
    bg.add(dfd);
    bg.add(dfds);

    JPanel jPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));

    idef0.setSelected(true);
    jPanel.add(idef0);
    jPanel.add(dfd);
    jPanel.add(dfds);

    JPanel jPanel2 = new JPanel(new BorderLayout());

    jPanel2.add(panel, BorderLayout.CENTER);
    jPanel2.add(jPanel, BorderLayout.SOUTH);

    this.setMainPane(jPanel2);
    setMinSizePack();
    centerDialog();
    this.setResizable(false);
}
 
Example 12
Source File: OpenFinDesktopDemo.java    From java-example with MIT License 5 votes vote down vote up
private JPanel layoutActionButtonPanel() {
    JPanel buttonPanel = new JPanel();

    JPanel topPanel = new JPanel();
    double size[][] = {{0.5, 0.5}, {30}};
    topPanel.setLayout(new TableLayout(size));
    topPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createBevelBorder(2), "Desktop"));

    launch = new JButton("Start");
    launch.setActionCommand("start");
    close = new JButton("Close");
    close.setActionCommand("close");
    topPanel.add(launch, "0,0,0,0");
    topPanel.add(close, "1,0,1,0");

    size = new double[][]{{TableLayout.FILL}, {60, 30, 30, 30}};
    buttonPanel.setLayout(new TableLayout(size));

    createApplication = new JButton("Create Application");
    createApplication.setActionCommand("create-application");

    createNotification = new JButton("Create Notification");
    createNotification.setActionCommand("create-notification");

    close.addActionListener(this);
    launch.addActionListener(this);
    createApplication.addActionListener(this);
    createNotification.addActionListener(this);

    buttonPanel.add(topPanel, "0,0");
    buttonPanel.add(createApplication, "0,1");
    buttonPanel.add(createNotification, "0,2");
    return buttonPanel;
}
 
Example 13
Source File: OpenFinDockingDemo.java    From java-example with MIT License 5 votes vote down vote up
private JPanel layoutLeftPanel() {
    JPanel panel = new JPanel();
    double size[][] = {{410}, {120, 30, TableLayout.FILL}};
    panel.setLayout(new TableLayout(size));
    panel.add(layoutActionButtonPanel(), "0,0,0,0");
    panel.add(layoutDockStatus(), "0,1,0,1");
    panel.add(layoutStatusPanel(), "0, 2, 0, 2");
    return panel;
}
 
Example 14
Source File: PieChartSetupEditor.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
@Override
public JComponent createComponent(GUIFramework framework, Element element) {
    JComponent component = super.createComponent(framework, element);
    final ChartSource source = getChartSource();
    initAttributes(framework.getEngine());
    key.setSelectedItem(source.getAttributeProperty(PIE_ATTRIBUTE_KEY));
    value.setSelectedItem(source.getAttributeProperty(PIE_ATTRIBUTE_VALUE));

    double[][] size = {
            {5, TableLayout.MINIMUM, TableLayout.FILL,
                    TableLayout.MINIMUM, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5}};

    TableLayout layout = new TableLayout(size);

    layout.setHGap(5);
    layout.setVGap(5);

    JPanel panel = new JPanel(layout);

    panel.add(new JLabel(ChartResourceManager.getString("Chart.key")),
            "1,1");
    panel.add(key, "2,1");
    panel.add(new JLabel(ChartResourceManager.getString("Chart.value")),
            "3,1");
    panel.add(value, "4,1");

    JPanel panel2 = new JPanel(new BorderLayout());

    panel2.add(component, BorderLayout.CENTER);
    panel2.add(panel, BorderLayout.SOUTH);

    return panel2;
}
 
Example 15
Source File: JBondQueryFeatureDialog.java    From openchemlib-js with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void init(Component parent, ExtendedMolecule mol, int bond) {
mMol = mol;
mBond = bond;

JPanel p1 = new JPanel();
      double[][] size = { {8, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, 8},
                          {8, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
						TableLayout.PREFERRED, TableLayout.PREFERRED, 8,
						TableLayout.PREFERRED, 8, TableLayout.PREFERRED, 8, TableLayout.PREFERRED, 16,
						TableLayout.PREFERRED, 4, TableLayout.PREFERRED, 4, TableLayout.PREFERRED, 16} };
      p1.setLayout(new TableLayout(size));

mCBSingle = new JCheckBox("Single");
p1.add(mCBSingle,"1,1,3,1");

mCBDouble = new JCheckBox("Double");
p1.add(mCBDouble,"1,2,3,2");

mCBTriple = new JCheckBox("Triple");
p1.add(mCBTriple,"1,3,3,3");

mCBDelocalized = new JCheckBox("Delocalized");
p1.add(mCBDelocalized,"1,4,3,4");

mCBMetalLigand = new JCheckBox("Coordinate (0-order)");
p1.add(mCBMetalLigand,"1,5,3,5");

mComboBoxRing = new JComboBox();
mComboBoxRing.addItem("any ring state");
mComboBoxRing.addItem("is not in a ring");
mComboBoxRing.addItem("is any ring bond");
mComboBoxRing.addItem("is non-aromatic ring bond");
mComboBoxRing.addItem("is aromatic bond");
mComboBoxRing.addActionListener(this);
p1.add(mComboBoxRing,"1,7,3,7");

mComboBoxRingSize = new JComboBox();
mComboBoxRingSize.addItem("any ring size");
mComboBoxRingSize.addItem("is in 3-membered ring");
mComboBoxRingSize.addItem("is in 4-membered ring");
mComboBoxRingSize.addItem("is in 5-membered ring");
mComboBoxRingSize.addItem("is in 6-membered ring");
mComboBoxRingSize.addItem("is in 7-membered ring");
p1.add(mComboBoxRingSize, "1,9,3,9");

mCBMatchStereo = new JCheckBox("Match Stereo Configuration", (mol.getBondQueryFeatures(bond) & Molecule.cBondQFMatchStereo) != 0);
mCBMatchStereo.addActionListener(this);
p1.add(mCBMatchStereo, "1,11,3,11");

mCBIsBridge = new JCheckBox("Is atom bridge between");
      mCBIsBridge.addActionListener(this);
      p1.add(mCBIsBridge,"1,13,3,13");

      mComboBoxMinAtoms = new JComboBox();
      int itemCount = (1 << Molecule.cBondQFBridgeMinBits);
      for (int i=0; i<itemCount; i++)
          mComboBoxMinAtoms.addItem(""+i);
      p1.add(mComboBoxMinAtoms,"2,15");
      p1.add(new JLabel(" and"),"3,15");
      mComboBoxMinAtoms.addActionListener(this);

      mComboBoxMaxAtoms = new JComboBox();
      populateComboBoxMaxAtoms(0);
      p1.add(mComboBoxMaxAtoms,"2,17");
      p1.add(new JLabel(" atoms"),"3,17");

JPanel bp = new JPanel();
      bp.setBorder(BorderFactory.createEmptyBorder(12, 8, 8, 8));
      bp.setLayout(new BorderLayout());
      JPanel ibp = new JPanel();
      ibp.setLayout(new GridLayout(1, 6, 8, 0));
      JButton bcancel = new JButton("Cancel");
      bcancel.addActionListener(this);
      ibp.add(bcancel);
      JButton bok = new JButton("OK");
      bok.addActionListener(this);
      ibp.add(bok);
      bp.add(ibp, BorderLayout.EAST);

getContentPane().add(p1,BorderLayout.CENTER);
getContentPane().add(bp,BorderLayout.SOUTH);
getRootPane().setDefaultButton(bok);

      mMol.ensureHelperArrays(Molecule.cHelperRings);
      setInitialStates();

      pack();
      setLocationRelativeTo(parent);
      setVisible(true);
}
 
Example 16
Source File: CreateChartDialog.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
public CreateChartDialog(GUIFramework framework, ChartsView chartsView) {
    super(framework.getMainFrame(), true);

    setTitle(ChartResourceManager.getString("Action.CreateChart"));
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    this.framework = framework;
    this.chartsView = chartsView;

    chartFramework = ChartGUIFramework.getFramework(framework);
    for (ChartPlugin chartPlugin : chartFramework.getChartPlugins()) {
        types.addItem(chartPlugin);
    }

    double[][] size = {
            {5, TableLayout.MINIMUM, TableLayout.FILL,
                    TableLayout.MINIMUM, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5}};

    TableLayout layout = new TableLayout(size);
    layout.setHGap(5);
    layout.setVGap(5);

    JPanel top = new JPanel(layout);

    top.add(new JLabel(ChartResourceManager.getString("Chart.type")),
            "1, 1");
    top.add(types, "2, 1");
    top.add(new JLabel(ChartResourceManager.getString("Chart.name")),
            "3, 1");
    top.add(name, "4, 1");

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(top, BorderLayout.NORTH);
    panel.add(centerPanel, BorderLayout.CENTER);
    setPlugin((ChartPlugin) types.getSelectedItem());
    types.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            setPlugin((ChartPlugin) types.getSelectedItem());
        }
    });
    setMinimumSize(new Dimension(600, 420));
    setMainPane(panel);
    pack();
    centerDialog();
    Options.loadOptions(this);
}
 
Example 17
Source File: ChartPreferencesDialog.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
public ChartPreferencesDialog(GUIFramework framework, Row chart) {
    super(framework.getMainFrame(), true);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setTitle(ChartResourceManager.getString("Action.ChartPreferences"));
    this.framework = framework;
    this.chart = chart;
    name.setText(chart.getName());

    Engine engine = framework.getEngine();
    ChartSource chartSource = new ChartSource(engine);
    chartSource.load(engine.getInputStream(getPreferencesPath(chart
            .getElement(), StandardAttributesPlugin
            .getAttributeNameAttribute(engine))));
    ChartGUIFramework chartFramework = ChartGUIFramework
            .getFramework(framework);
    chartPlugin = chartFramework.getChartPlugin(chartSource.getChartType());
    editor = chartPlugin.createChartSetupEditor();

    double[][] size = {{5, TableLayout.MINIMUM, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5}};

    TableLayout layout = new TableLayout(size);
    layout.setHGap(5);
    layout.setVGap(5);

    JPanel top = new JPanel(layout);

    top.add(new JLabel(ChartResourceManager.getString("Chart.name")),
            "1, 1");
    top.add(name, "2, 1");

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(top, BorderLayout.NORTH);

    panel.add(editor.createComponent(framework, chart.getElement()),
            BorderLayout.CENTER);

    setMainPane(panel);
    setMinimumSize(new Dimension(600, 420));
    pack();
    centerDialog();
    Options.loadOptions(this);
}
 
Example 18
Source File: BarChartSetupEditor.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public JComponent createComponent(GUIFramework framework, Element element) {
    JComponent component = super.createComponent(framework, element);

    initAttributes(framework.getEngine());

    ChartSource source = getChartSource();

    key.setSelectedItem(source.getAttributeProperty(BAR_ATTRIBUTE_KEY));

    double[][] size = {
            {5, TableLayout.MINIMUM, TableLayout.FILL,
                    TableLayout.MINIMUM, TableLayout.FILL, 5},
            {5, TableLayout.FILL, TableLayout.FILL, TableLayout.FILL, 5}};

    TableLayout layout = new TableLayout(size);

    layout.setHGap(5);
    layout.setVGap(5);

    JPanel panel = new JPanel(layout);

    panel.add(new JLabel(ChartResourceManager
            .getString("Label.categoryAxis")), "1,1");
    panel.add(categoryAxis, "2,1");
    panel.add(
            new JLabel(ChartResourceManager.getString("Label.valueAxis")),
            "3,1");
    panel.add(valueAxis, "4,1");

    panel.add(new JLabel(ChartResourceManager.getString("Chart.key")),
            "1,2");
    panel.add(key, "2,2");

    panel.add(new JLabel(ChartResourceManager.getString("Orientation")),
            "3,2");
    panel.add(orientation, "4,2");

    panel.add(new JLabel(ChartResourceManager.getString("Chart.values")),
            "1,3,3,3");

    attributesSelectPanel = new AttributesSelectPanel(framework, source
            .getPropertyAttributes(BAR_ATTRIBUTE_VALUE_PREFIX));

    attributesSelectPanel.setPreferredSize(new Dimension(300, 150));

    JPanel panel3 = new JPanel(new BorderLayout());

    panel3.add(panel, BorderLayout.CENTER);

    panel3.add(attributesSelectPanel, BorderLayout.SOUTH);

    categoryAxis.setText(source.getProperty(BAR_CATEGORY_AXIS_LABEL));
    valueAxis.setText(source.getProperty(BAR_VALUE_AXIS_LABEL));

    String o = source.getProperty(BAR_ORIENTATION);

    if (BAR_ORIENTATION_HORIZONTAL.equals(o))
        orientation.setSelectedIndex(1);

    JPanel panel2 = new JPanel(new BorderLayout());
    panel2.add(component, BorderLayout.CENTER);
    panel2.add(panel3, BorderLayout.SOUTH);

    return panel2;
}
 
Example 19
Source File: DFDObjectDialog.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
protected Component createFirstTab(JTabbedPane pane) {
    double[][] size = {{5, TableLayout.MINIMUM, 5, TableLayout.FILL, 5},
            {5, TableLayout.MINIMUM, 5, TableLayout.MINIMUM}};

    JPanel panel = new JPanel(new BorderLayout());
    JPanel c = new JPanel(new TableLayout(size));
    c.add(new JLabel("row:"), "1,1");
    c.add(qualifier, "3,1");

    c.add(new JLabel("element:"), "1,3");
    c.add(element, "3,3");
    panel.add(c, BorderLayout.NORTH);

    JPanel jPanel = new JPanel(new BorderLayout());

    JPanel jPanel2 = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    JButton button = new JButton("set_dfd_object");

    jPanel2.add(button);

    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SelectRowDialog dialog = new SelectRowDialog(
                    DFDObjectDialog.this) {

            };
            dialog.setSelectType(SelectType.RADIO);
            dialog.init(framework, dataPlugin, framework.getAccessRules());
            List<Row> list = dialog.showModal();
            if ((list != null) && (list.size() > 0)) {
                setLink(list.get(0));
            }
        }
    });

    jPanel.add(jPanel2, BorderLayout.NORTH);

    panel.add(jPanel, BorderLayout.CENTER);
    return panel;
}
 
Example 20
Source File: ElementListPreferenciesEditor.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public JComponent createComponent(Attribute attribute, Engine engine,
                                  AccessRules accessRules) {
    JPanel basePanel = new JPanel(new BorderLayout());

    double[][] size = {
            {5, TableLayout.FILL, 5},
            {5, TableLayout.FILL, 5, TableLayout.FILL, 5,
                    TableLayout.FILL, 5, TableLayout.FILL, 5,
                    TableLayout.FILL, 5}};
    JPanel panel = new JPanel(new TableLayout(size));
    panel.add(
            new JLabel(GlobalResourcesManager
                    .getString("ElementList.Qualifier1")), "1, 1");
    panel.add(box1, "1, 3");

    panel.add(
            new JLabel(GlobalResourcesManager
                    .getString("ElementList.Qualifier2")), "1, 5");
    panel.add(box2, "1, 7");

    panel.add(
            new JLabel(GlobalResourcesManager
                    .getString("ElementList.Variants")), "1, 9");

    for (Qualifier qualifier : engine.getQualifiers()) {
        if (accessRules.canUpdateQualifier(qualifier.getId())) {
            box1.addItem(qualifier);
            box2.addItem(qualifier);
        }
    }
    if (attribute != null) {
        ElementListPropertyPersistent p = (ElementListPropertyPersistent) engine
                .getAttribute(null, attribute);
        box1.setSelectedItem(engine.getQualifier(p.getQualifier1()));
        box2.setSelectedItem(engine.getQualifier(p.getQualifier2()));
        box1.setEnabled(false);
        box2.setEnabled(false);

        if (p.getConnectionTypes() != null)
            variantsArea.setText(p.getConnectionTypes());
    }

    basePanel.add(panel, BorderLayout.NORTH);

    basePanel.add(new JScrollPane(variantsArea), BorderLayout.CENTER);

    return basePanel;
}