Example usage for javax.swing ScrollPaneConstants VERTICAL_SCROLLBAR_AS_NEEDED

List of usage examples for javax.swing ScrollPaneConstants VERTICAL_SCROLLBAR_AS_NEEDED

Introduction

In this page you can find the example usage for javax.swing ScrollPaneConstants VERTICAL_SCROLLBAR_AS_NEEDED.

Prototype

int VERTICAL_SCROLLBAR_AS_NEEDED

To view the source code for javax.swing ScrollPaneConstants VERTICAL_SCROLLBAR_AS_NEEDED.

Click Source Link

Document

Used to set the vertical scroll bar policy so that vertical scrollbars are displayed only when needed.

Usage

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

/**
 * Creates a JTextArea for display purposes only.
 * @param cellField FormCellField info/*from  w w w.  j  a va 2s .  com*/
 * @return the control
 */
public static JScrollPane changeTextAreaForDisplay(final JTextArea ta) {
    Insets insets = ta.getBorder().getBorderInsets(ta);
    ta.setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.bottom));
    ta.setForeground(Color.BLACK);
    ta.setEditable(false);
    ta.setBackground(viewFieldColor.getColor());
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);

    JScrollPane scrollPane = new JScrollPane(ta);
    insets = scrollPane.getBorder().getBorderInsets(scrollPane);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane
            .setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.bottom));

    return scrollPane;
}

From source file:edu.ku.brc.specify.tasks.subpane.qb.QueryBldrPane.java

/**
 * create the query builder UI.//from  ww w .ja v a 2  s .com
 */
protected void createUI() {
    removeAll();

    JMenuItem saveItem = new JMenuItem(UIRegistry.getResourceString("QB_SAVE"));
    Action saveActionListener = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (saveQuery(false)) {
                try {
                    String selId = null;
                    if (selectedQFP != null && selectedQFP.getQueryField() != null) {
                        selId = selectedQFP.getQueryField().getStringId();
                    }
                    final String selectedFldId = selId;
                    setupUI(true);
                    SwingUtilities.invokeLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            if (selectedFldId != null) {
                                for (QueryFieldPanel qfp : queryFieldItems) {
                                    if (qfp.getQueryField() != null
                                            && selectedFldId.equals(qfp.getQueryField().getStringId())) {
                                        selectQFP(qfp);
                                        return;
                                    }
                                }
                                selectQFP(queryFieldItems.get(0));
                            }
                        }

                    });
                } catch (Exception ex) {

                }
                setSaveBtnEnabled(false);
            }
        }
    };
    saveItem.addActionListener(saveActionListener);

    JMenuItem saveAsItem = new JMenuItem(UIRegistry.getResourceString("QB_SAVE_AS"));
    Action saveAsActionListener = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (saveQuery(true)) {
                setSaveBtnEnabled(false);
            }
        }
    };
    saveAsItem.addActionListener(saveAsActionListener);
    JComponent[] itemSample = { saveItem, saveAsItem };
    saveBtn = new DropDownButton(UIRegistry.getResourceString("QB_SAVE"), null, 1,
            java.util.Arrays.asList(itemSample));
    saveBtn.addActionListener(saveActionListener);
    String ACTION_KEY = "SAVE";
    KeyStroke ctrlS = KeyStroke.getKeyStroke(KeyEvent.VK_S,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    InputMap inputMap = saveBtn.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(ctrlS, ACTION_KEY);
    ActionMap actionMap = saveBtn.getActionMap();
    actionMap.put(ACTION_KEY, saveActionListener);
    ACTION_KEY = "SAVE_AS";
    KeyStroke ctrlA = KeyStroke.getKeyStroke(KeyEvent.VK_A,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
    inputMap.put(ctrlA, ACTION_KEY);
    actionMap.put(ACTION_KEY, saveAsActionListener);
    saveBtn.setActionMap(actionMap);

    UIHelper.setControlSize(saveBtn);
    //saveBtn.setOverrideBorder(true, BasicBorders.getButtonBorder());

    listBoxPanel = new JPanel(new HorzLayoutManager(2, 2));

    Vector<TableQRI> list = new Vector<TableQRI>();
    for (int k = 0; k < tableTree.getKids(); k++) {
        list.add(tableTree.getKid(k).getTableQRI());
    }

    Collections.sort(list);
    DefaultListModel model = new DefaultListModel();
    for (TableQRI qri : list) {
        model.addElement(qri);
    }

    tableList = new JList(model);
    QryListRenderer qr = new QryListRenderer(IconManager.IconSize.Std16);
    qr.setDisplayKidIndicator(false);
    tableList.setCellRenderer(qr);

    JScrollPane spt = new JScrollPane(tableList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    Dimension pSize = spt.getPreferredSize();
    pSize.height = 200;
    spt.setPreferredSize(pSize);

    JPanel topPanel = new JPanel(new BorderLayout());

    scrollPane = new JScrollPane(listBoxPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    tableList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                int inx = tableList.getSelectedIndex();
                if (inx > -1) {
                    fillNextList(tableList);
                } else {
                    listBoxPanel.removeAll();
                }
            }
        }
    });

    addBtn = new JButton(IconManager.getImage("PlusSign", IconManager.IconSize.Std16));
    addBtn.setEnabled(false);
    addBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            BaseQRI qri = (BaseQRI) listBoxList.get(currentInx).getSelectedValue();
            if (qri.isInUse) {
                return;
            }

            try {
                FieldQRI fieldQRI = buildFieldQRI(qri);
                if (fieldQRI == null) {
                    throw new Exception("null FieldQRI");
                }
                SpQueryField qf = new SpQueryField();
                qf.initialize();
                qf.setFieldName(fieldQRI.getFieldName());
                qf.setStringId(fieldQRI.getStringId());
                query.addReference(qf, "fields");

                if (!isExportMapping) {
                    addQueryFieldItem(fieldQRI, qf, false);
                } else {
                    addNewMapping(fieldQRI, qf, null, false);
                }
            } catch (Exception ex) {
                log.error(ex);
                UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(QueryBldrPane.class, ex);
                return;
            }
        }
    });

    contextPanel = new JPanel(new BorderLayout());
    contextPanel.add(createLabel("Search Context", SwingConstants.CENTER), BorderLayout.NORTH); // I18N
    contextPanel.add(spt, BorderLayout.CENTER);
    contextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));

    JPanel schemaPanel = new JPanel(new BorderLayout());
    schemaPanel.add(scrollPane, BorderLayout.CENTER);

    topPanel.add(contextPanel, BorderLayout.WEST);
    topPanel.add(schemaPanel, BorderLayout.CENTER);
    add(topPanel, BorderLayout.NORTH);

    queryFieldsPanel = new JPanel();
    queryFieldsPanel.setLayout(new NavBoxLayoutManager(0, 2));
    queryFieldsScroll = new JScrollPane(queryFieldsPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    queryFieldsScroll.setBorder(null);
    add(queryFieldsScroll);

    //if (!isExportMapping)
    //{
    final JPanel mover = buildMoverPanel(false);
    add(mover, BorderLayout.EAST);
    // }

    String searchLbl = schemaMapping == null ? getResourceString("QB_SEARCH")
            : getResourceString("QB_EXPORT_PREVIEW");
    searchBtn = createButton(searchLbl);
    searchBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            //               int m = ae.getModifiers();
            //               boolean ors = (m & ActionEvent.ALT_MASK) > 0 && (m & ActionEvent.CTRL_MASK) > 0 && (m & ActionEvent.SHIFT_MASK) > 0;
            //               if (ors)
            //               {
            //                  System.out.println("Disjunctional conjoinment desire gesture detected");
            //               }
            //               doSearch(ors);
            doSearch(false);
        }
    });
    distinctChk = createCheckBox(UIRegistry.getResourceString("QB_DISTINCT"));
    distinctChk.setVisible(schemaMapping == null);
    if (schemaMapping == null) {
        distinctChk.setSelected(false);
        distinctChk.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                new SwingWorker() {

                    /* (non-Javadoc)
                     * @see edu.ku.brc.helpers.SwingWorker#construct()
                     */
                    @Override
                    public Object construct() {
                        if (distinctChk.isSelected()) {
                            UsageTracker.incrUsageCount("QB.DistinctOn");
                        } else {
                            UsageTracker.incrUsageCount("QB.DistinctOff");
                        }
                        if ((isTreeLevelSelected() || isAggFieldSelected()) && countOnly
                                && distinctChk.isSelected()) {
                            countOnlyChk.setSelected(false);
                            countOnly = false;
                        }
                        query.setCountOnly(countOnly);
                        query.setSelectDistinct(distinctChk.isSelected());
                        setSaveBtnEnabled(thereAreItems());
                        return null;
                    }
                }.start();
            }
        });
    }
    countOnlyChk = createCheckBox(UIRegistry.getResourceString("QB_COUNT_ONLY"));
    countOnlyChk.setSelected(false);
    countOnlyChk.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            new SwingWorker() {

                /* (non-Javadoc)
                 * @see edu.ku.brc.helpers.SwingWorker#construct()
                 */
                @Override
                public Object construct() {
                    //Don't allow change while query is running.
                    if (runningResults.get() == null) {
                        countOnly = !countOnly;
                        if (countOnly) {
                            UsageTracker.incrUsageCount("QB.CountOnlyOn");
                        } else {
                            UsageTracker.incrUsageCount("QB.CountOnlyOff");
                        }
                        if ((isTreeLevelSelected() || isAggFieldSelected()) && countOnly
                                && (distinctChk.isSelected() || searchSynonymyChk.isSelected())) {
                            distinctChk.setSelected(false);
                            searchSynonymyChk.setSelected(false);
                        }
                    } else {
                        //This might be awkward and/or klunky...
                        countOnlyChk.setSelected(countOnly);
                    }
                    query.setCountOnly(countOnly);
                    query.setSelectDistinct(distinctChk.isSelected());
                    setSaveBtnEnabled(thereAreItems());
                    return null;
                }
            }.start();
        }
    });

    searchSynonymyChk = createCheckBox(UIRegistry.getResourceString("QB_SRCH_SYNONYMS"));
    searchSynonymyChk.setSelected(searchSynonymy);
    searchSynonymyChk.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            new SwingWorker() {

                /* (non-Javadoc)
                 * @see edu.ku.brc.helpers.SwingWorker#construct()
                 */
                @Override
                public Object construct() {
                    searchSynonymy = !searchSynonymy;
                    if (!searchSynonymy) {
                        UsageTracker.incrUsageCount("QB.SearchSynonymyOff");
                    } else {
                        UsageTracker.incrUsageCount("QB.SearchSynonymyOn");
                    }
                    if (isTreeLevelSelected() && countOnly && searchSynonymyChk.isSelected()) {
                        countOnlyChk.setSelected(false);
                        countOnly = false;
                    }
                    query.setSearchSynonymy(searchSynonymy);
                    setSaveBtnEnabled(thereAreItems());
                    return null;
                }
            }.start();
        }
    });

    smushedChk = createCheckBox(UIRegistry.getResourceString("QB_SMUSH_RESULTS"));
    smushedChk.setVisible(isSmushableContext());
    if (isSmushableContext()) {
        smushedChk.setSelected(smushed);
        smushedChk.setToolTipText(
                String.format(UIRegistry.getResourceString("QB_SMUSH_RESULTS_HINT"), getCatalogNumberTitle()));
        smushedChk.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                new SwingWorker() {

                    /*
                     * (non-Javadoc)
                     * 
                     * @see edu.ku.brc.helpers.SwingWorker#construct()
                     */
                    @Override
                    public Object construct() {
                        smushed = !smushed;
                        if (!smushed) {
                            UsageTracker.incrUsageCount("QB.SmushedOff");
                        } else {
                            UsageTracker.incrUsageCount("QB.SmushedOn");
                        }
                        query.setSmushed(smushed);
                        setSaveBtnEnabled(thereAreItems());
                        return null;
                    }
                }.start();
            }
        });
    }

    PanelBuilder outer = new PanelBuilder(
            new FormLayout("p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 6dlu, p", "p"));

    CellConstraints cc = new CellConstraints();
    outer.add(smushedChk, cc.xy(1, 1));
    outer.add(searchSynonymyChk, cc.xy(3, 1));
    outer.add(distinctChk, cc.xy(5, 1));
    outer.add(countOnlyChk, cc.xy(7, 1));
    outer.add(searchBtn, cc.xy(9, 1));
    outer.add(saveBtn, cc.xy(11, 1));

    JPanel bottom = new JPanel(new BorderLayout());
    bottom.add(outer.getPanel(), BorderLayout.EAST);

    JButton helpBtn = UIHelper.createHelpIconButton(getHelpBtnContext());
    bottom.add(helpBtn, BorderLayout.WEST);
    add(bottom, BorderLayout.SOUTH);

    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
}

From source file:de.rub.nds.burp.espresso.gui.attacker.saml.UIDTDAttack.java

private void initEditorsAndListener() {
    firstEditor = new JTextArea();
    firstEditor.setEditable(false);//from w  ww . j a v  a2 s  .c o m
    firstEditor.getDocument().addDocumentListener(new DocumentListener() {
        private void notify(DocumentEvent de) {
            if (autoModifyCheckbox.isSelected()) {
                notifyAllTabs(new SamlCodeEvent(this, firstEditor.getText()));
                Logging.getInstance().log(getClass(), "Notify all tabs.", Logging.DEBUG);
            }
        }

        @Override
        public void insertUpdate(DocumentEvent de) {
            notify(de);
        }

        @Override
        public void removeUpdate(DocumentEvent de) {
            notify(de);
        }

        @Override
        public void changedUpdate(DocumentEvent de) {
            notify(de);
        }
    });
    secondEditor = new JTextArea();
    secondEditor.setEditable(false);
    firstScrollPane = new JScrollPane(firstEditor, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    firstScrollPane.setPreferredSize(new Dimension(100, 280));
    secondScrollPane = new JScrollPane(secondEditor, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    secondScrollPane.setPreferredSize(new Dimension(100, 280));
    // Set listener
    TextfieldListener textfieldListener = new TextfieldListener();
    attackeListenerTextField.getDocument().addDocumentListener(textfieldListener);
    helperURLTextField.getDocument().addDocumentListener(textfieldListener);
    targetFileTextField.getDocument().addDocumentListener(textfieldListener);
    SysPubRadioButtonGroupListener radioButtonGroupListener = new SysPubRadioButtonGroupListener();
    publicRadioButton.addActionListener(radioButtonGroupListener);
    systemRadioButton.addActionListener(radioButtonGroupListener);
    EncodingRadioButtonGroupListener encodingRadioButtonGroupListener = new EncodingRadioButtonGroupListener();
    utf7RadioButton.addActionListener(encodingRadioButtonGroupListener);
    utf7RadioButton.setActionCommand(EncodingType.UTF_7.getEncoding());
    utf8RadioButton.addActionListener(encodingRadioButtonGroupListener);
    utf8RadioButton.setActionCommand(EncodingType.UTF_8.getEncoding());
    utf16RadioButton.addActionListener(encodingRadioButtonGroupListener);
    utf16RadioButton.setActionCommand(EncodingType.UTF_16.getEncoding());
    // Set dtd vectors sorted by name
    dtdComboBox.setModel(new DefaultComboBoxModel(dtdNames.toArray()));
    dtdComboBox.setRenderer(new BasicComboBoxRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            JComponent comp = (JComponent) super.getListCellRendererComponent(list, value, index, isSelected,
                    cellHasFocus);
            if (-1 < index && null != value && null != dtdDescriptions) {
                descriptionTextArea.setText(dtdDescriptions.get(index));
            }
            return comp;
        }
    });
    dtdComboBox.setSelectedIndex(0);
}

From source file:edu.ku.brc.af.ui.forms.TableViewObj.java

/**
 * Build the table now that we have all the information we need for the columns.
 *///from w w  w  .  ja v  a  2s .c o m
protected void buildTable() {
    // Now Build the JTable
    model = new ColTableModel();
    table = new JTable(model);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setRowSelectionAllowed(true);
    table.setColumnSelectionAllowed(false);
    table.setFocusable(false);
    //table.setPreferredScrollableViewportSize(new Dimension(200,table.getRowHeight()*6));

    configColumns();

    //table.setCellSelectionEnabled(false);

    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                ListSelectionModel lsm = (ListSelectionModel) e.getSource();
                updateUI(!lsm.isSelectionEmpty());
            }
        }
    });

    table.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(java.awt.event.MouseEvent e) {
            if (e.getClickCount() == 2) {
                int index = table.getSelectedRow();
                editRow(index, false);
            }
        }
    });

    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setHorizontalAlignment(SwingConstants.CENTER);

    /*
             
    // This is BROKEN!
    table.setCellSelectionEnabled(true);
            
    for (int i=0;i<model.getColumnCount();i++) 
    {
    TableColumn column = table.getColumn(model.getColumnName(i));
            
    //log.info(model.getColumnName(i));
    //column.setCellRenderer(renderer);
            
    ColumnInfo columnInfo = columnList.get(i);
    Component  comp       = columnInfo.getComp();
            
    //column.setCellEditor(new DefaultCellEditor(new JTextField()));
    if (comp instanceof GetSetValueIFace)
    {
        column.setCellEditor(new MyTableCellEditor(columnInfo));
                
    } else if (comp instanceof JTextField)
    {
        column.setCellEditor(new DefaultCellEditor((JTextField)comp));
                
    } else
    {
        log.error("Couldn't figure out DefaultCellEditor for comp ["+comp.getClass().getSimpleName()+"]");
    }
    }
    */

    tableScroller = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    orderablePanel = new JPanel(new BorderLayout());
    orderablePanel.add(tableScroller, BorderLayout.CENTER);

    mainComp.add(orderablePanel, BorderLayout.CENTER);

    initColumnSizes(table);
}

From source file:it.imtech.metadata.MetaUtility.java

/**
 * Metodo adibito alla creazione dinamica ricorsiva dell'interfaccia dei
 * metadati/*from w w w.  ja  va2 s. c  o  m*/
 *
 * @param submetadatas Map contente i metadati e i sottolivelli di metadati
 * @param vocabularies Map contenente i dati contenuti nel file xml
 * vocabulary.xml
 * @param parent Jpanel nel quale devono venir inseriti i metadati
 * @param level Livello corrente
 */
public void create_metadata_view(Map<Object, Metadata> submetadatas, JPanel parent, int level,
        final String panelname) throws Exception {
    ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader);
    int lenght = submetadatas.size();
    int labelwidth = 220;
    int i = 0;
    JButton addcontribute = null;

    for (Map.Entry<Object, Metadata> kv : submetadatas.entrySet()) {
        ArrayList<Component> tabobjects = new ArrayList<Component>();

        if (kv.getValue().MID == 17 || kv.getValue().MID == 23 || kv.getValue().MID == 18
                || kv.getValue().MID == 137) {
            continue;
        }

        //Crea un jpanel nuovo e fa appen su parent
        JPanel innerPanel = new JPanel(new MigLayout("fillx, insets 1 1 1 1"));
        innerPanel.setName("pannello" + level + i);

        i++;
        String datatype = kv.getValue().datatype.toString();

        if (kv.getValue().MID == 45) {
            JPanel choice = new JPanel(new MigLayout());

            JComboBox combo = addClassificationChoice(choice, kv.getValue().sequence, panelname);

            JLabel labelc = new JLabel();
            labelc.setText(Utility.getBundleString("selectclassif", bundle));
            labelc.setPreferredSize(new Dimension(100, 20));

            choice.add(labelc);

            findLastClassification(panelname);
            if (last_classification != 0 && classificationRemoveButton == null) {
                logger.info("Removing last clasification");
                classificationRemoveButton = new JButton("-");

                classificationRemoveButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent event) {
                        BookImporter.getInstance().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                        removeClassificationToMetadata(panelname);
                        BookImporter.getInstance().refreshMetadataTab(false, panelname);
                        findLastClassification(panelname); //update last_classification
                        BookImporter.getInstance().setCursor(null);
                    }
                });
                if (Integer.parseInt(kv.getValue().sequence) == last_classification) {
                    choice.add(classificationRemoveButton, "wrap, width :50:");
                }
            }

            if (classificationAddButton == null) {
                logger.info("Adding a new classification");
                choice.add(combo, "width 100:600:600");

                classificationAddButton = new JButton("+");

                classificationAddButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent event) {
                        BookImporter.getInstance().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                        addClassificationToMetadata(panelname);
                        BookImporter.getInstance().refreshMetadataTab(false, panelname);
                        BookImporter.getInstance().setCursor(null);
                    }
                });

                choice.add(classificationAddButton, "width :50:");
            } else {
                //choice.add(combo, "wrap,width 100:700:700");
                choice.add(combo, "width 100:700:700");
                if (Integer.parseInt(kv.getValue().sequence) == last_classification) {
                    choice.add(classificationRemoveButton, "wrap, width :50");
                }
            }
            parent.add(choice, "wrap,width 100:700:700");
            classificationMID = kv.getValue().MID;

            innerPanel.setName(panelname + "---ImPannelloClassif---" + kv.getValue().sequence);
            try {

                addClassification(innerPanel, classificationMID, kv.getValue().sequence, panelname);
            } catch (Exception ex) {
                logger.error("Errore nell'aggiunta delle classificazioni");
            }
            parent.add(innerPanel, "wrap, growx");
            BookImporter.policy.addIndexedComponent(combo);

            continue;
        }

        if (datatype.equals("Node")) {
            JLabel label = new JLabel();
            label.setText(kv.getValue().description);
            label.setPreferredSize(new Dimension(100, 20));

            int size = 16 - (level * 2);
            Font myFont = new Font("MS Sans Serif", Font.PLAIN, size);
            label.setFont(myFont);

            if (Integer.toString(kv.getValue().MID).equals("11")) {
                JPanel temppanel = new JPanel(new MigLayout());

                //update last_contribute
                findLastContribute(panelname);

                if (last_contribute != 0 && removeContribute == null) {
                    logger.info("Removing last contribute");
                    removeContribute = new JButton("-");

                    removeContribute.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent event) {
                            BookImporter.getInstance()
                                    .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                            removeContributorToMetadata(panelname);
                            BookImporter.getInstance().refreshMetadataTab(false, panelname);
                            BookImporter.getInstance().setCursor(null);
                        }
                    });

                    if (!kv.getValue().sequence.equals("")) {
                        if (Integer.parseInt(kv.getValue().sequence) == last_contribute) {
                            innerPanel.add(removeContribute, "width :50:");
                        }
                    }
                }

                if (addcontribute == null) {
                    logger.info("Adding a new contribute");
                    addcontribute = new JButton("+");

                    addcontribute.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent event) {
                            BookImporter.getInstance()
                                    .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                            addContributorToMetadata(panelname);
                            BookImporter.getInstance().refreshMetadataTab(false, panelname);
                            BookImporter.getInstance().setCursor(null);
                        }
                    });

                    temppanel.add(label, " width :200:");
                    temppanel.add(addcontribute, "width :50:");
                    innerPanel.add(temppanel, "wrap, growx");
                } else {
                    temppanel.add(label, " width :200:");
                    findLastContribute(panelname);
                    if (!kv.getValue().sequence.equals("")) {
                        if (Integer.parseInt(kv.getValue().sequence) == last_contribute) {
                            temppanel.add(removeContribute, "width :50:");
                        }
                    }
                    innerPanel.add(temppanel, "wrap, growx");
                }
            } else if (Integer.toString(kv.getValue().MID).equals("115")) {
                logger.info("Devo gestire una provenience!");
            }
        } else {
            String title = "";

            if (kv.getValue().mandatory.equals("Y") || kv.getValue().MID == 14 || kv.getValue().MID == 15) {
                title = kv.getValue().description + " *";
            } else {
                title = kv.getValue().description;
            }

            innerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title,
                    TitledBorder.LEFT, TitledBorder.TOP));

            if (datatype.equals("Vocabulary")) {
                TreeMap<String, String> entryCombo = new TreeMap<String, String>();
                int index = 0;
                String selected = null;

                if (!Integer.toString(kv.getValue().MID).equals("8"))
                    entryCombo.put(Utility.getBundleString("comboselect", bundle),
                            Utility.getBundleString("comboselect", bundle));

                for (Map.Entry<String, TreeMap<String, VocEntry>> vc : vocabularies.entrySet()) {
                    String tempmid = Integer.toString(kv.getValue().MID);

                    if (Integer.toString(kv.getValue().MID_parent).equals("11")
                            || Integer.toString(kv.getValue().MID_parent).equals("13")) {
                        String[] testmid = tempmid.split("---");
                        tempmid = testmid[0];
                    }

                    if (vc.getKey().equals(tempmid)) {
                        TreeMap<String, VocEntry> iEntry = vc.getValue();

                        for (Map.Entry<String, VocEntry> ivc : iEntry.entrySet()) {
                            entryCombo.put(ivc.getValue().description, ivc.getValue().ID);
                            if (kv.getValue().value != null) {
                                if (kv.getValue().value.equals(ivc.getValue().ID)) {
                                    selected = ivc.getValue().ID;
                                }
                            }
                            index++;
                        }
                    }
                }

                final ComboMapImpl model = new ComboMapImpl();
                model.setVocabularyCombo(true);
                model.putAll(entryCombo);

                final JComboBox voc = new javax.swing.JComboBox(model);
                model.specialRenderCombo(voc);

                if (Integer.toString(kv.getValue().MID_parent).equals("11")
                        || Integer.toString(kv.getValue().MID_parent).equals("13")) {
                    voc.setName("MID_" + Integer.toString(kv.getValue().MID) + "---" + kv.getValue().sequence);
                } else {
                    voc.setName("MID_" + Integer.toString(kv.getValue().MID));
                }

                if (Integer.toString(kv.getValue().MID).equals("8") && selected == null)
                    selected = "44";

                selected = (selected == null) ? Utility.getBundleString("comboselect", bundle) : selected;

                for (int k = 0; k < voc.getItemCount(); k++) {
                    Map.Entry<String, String> el = (Map.Entry<String, String>) voc.getItemAt(k);
                    if (el.getValue().equals(selected))
                        voc.setSelectedIndex(k);
                }

                voc.setPreferredSize(new Dimension(150, 30));
                innerPanel.add(voc, "wrap, width :400:");
                tabobjects.add(voc);
            } else if (datatype.equals("CharacterString") || datatype.equals("GPS")) {
                final JTextArea textField = new javax.swing.JTextArea();

                if (Integer.toString(kv.getValue().MID_parent).equals("11")
                        || Integer.toString(kv.getValue().MID_parent).equals("13")) {
                    textField.setName(
                            "MID_" + Integer.toString(kv.getValue().MID) + "---" + kv.getValue().sequence);
                } else {
                    textField.setName("MID_" + Integer.toString(kv.getValue().MID));
                }

                textField.setPreferredSize(new Dimension(230, 0));
                textField.setText(kv.getValue().value);
                textField.setLineWrap(true);
                textField.setWrapStyleWord(true);

                innerPanel.add(textField, "wrap, width :300:");

                textField.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode() == KeyEvent.VK_TAB) {
                            if (e.getModifiers() > 0) {
                                textField.transferFocusBackward();
                            } else {
                                textField.transferFocus();
                            }
                            e.consume();
                        }
                    }
                });

                tabobjects.add(textField);
            } else if (datatype.equals("LangString")) {
                JScrollPane inner_scroll = new javax.swing.JScrollPane();
                inner_scroll.setHorizontalScrollBarPolicy(
                        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
                inner_scroll.setVerticalScrollBarPolicy(
                        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
                inner_scroll.setPreferredSize(new Dimension(240, 80));
                inner_scroll.setName("langStringScroll");
                final JTextArea jTextArea1 = new javax.swing.JTextArea();
                jTextArea1.setName("MID_" + Integer.toString(kv.getValue().MID));
                jTextArea1.setText(kv.getValue().value);

                jTextArea1.setSize(new Dimension(350, 70));
                jTextArea1.setLineWrap(true);
                jTextArea1.setWrapStyleWord(true);

                inner_scroll.setViewportView(jTextArea1);
                innerPanel.add(inner_scroll, "width :300:");

                //Add combo language box
                JComboBox voc = getComboLangBox(kv.getValue().language);
                voc.setName("MID_" + Integer.toString(kv.getValue().MID) + "_lang");

                voc.setPreferredSize(new Dimension(200, 20));
                innerPanel.add(voc, "wrap, width :300:");

                jTextArea1.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode() == KeyEvent.VK_TAB) {
                            if (e.getModifiers() > 0) {
                                jTextArea1.transferFocusBackward();
                            } else {
                                jTextArea1.transferFocus();
                            }
                            e.consume();
                        }
                    }
                });
                tabobjects.add(jTextArea1);
                tabobjects.add(voc);
            } else if (datatype.equals("Language")) {
                final JComboBox voc = getComboLangBox(kv.getValue().value);
                voc.setName("MID_" + Integer.toString(kv.getValue().MID));

                voc.setPreferredSize(new Dimension(150, 20));
                voc.setBounds(5, 5, 150, 20);
                innerPanel.add(voc, "wrap, width :500:");

                //BookImporter.policy.addIndexedComponent(voc);
                tabobjects.add(voc);

            } else if (datatype.equals("Boolean")) {
                int selected = 0;
                TreeMap bin = new TreeMap<String, String>();
                bin.put("yes", Utility.getBundleString("voc1", bundle));
                bin.put("no", Utility.getBundleString("voc2", bundle));

                if (kv.getValue().value == null) {
                    switch (kv.getValue().MID) {
                    case 35:
                        selected = 0;
                        break;
                    case 36:
                        selected = 1;
                        break;
                    }
                } else if (kv.getValue().value.equals("yes")) {
                    selected = 1;
                } else {
                    selected = 0;
                }

                final ComboMapImpl model = new ComboMapImpl();
                model.putAll(bin);

                final JComboBox voc = new javax.swing.JComboBox(model);
                model.specialRenderCombo(voc);

                voc.setName("MID_" + Integer.toString(kv.getValue().MID));
                voc.setSelectedIndex(selected);

                voc.setPreferredSize(new Dimension(150, 20));
                voc.setBounds(5, 5, 150, 20);
                innerPanel.add(voc, "wrap, width :300:");
                //BookImporter.policy.addIndexedComponent(voc);
                tabobjects.add(voc);
            } else if (datatype.equals("License")) {
                String selectedIndex = null;
                int vindex = 0;
                int defaultIndex = 0;

                TreeMap<String, String> entryCombo = new TreeMap<String, String>();

                for (Map.Entry<String, TreeMap<String, VocEntry>> vc : vocabularies.entrySet()) {
                    if (vc.getKey().equals(Integer.toString(kv.getValue().MID))) {
                        TreeMap<String, VocEntry> iEntry = vc.getValue();

                        for (Map.Entry<String, VocEntry> ivc : iEntry.entrySet()) {
                            entryCombo.put(ivc.getValue().description, ivc.getValue().ID);

                            if (ivc.getValue().ID.equals("1"))
                                defaultIndex = vindex;

                            if (kv.getValue().value != null) {
                                if (ivc.getValue().ID.equals(kv.getValue().value)) {
                                    selectedIndex = Integer.toString(vindex);
                                }
                            }
                            vindex++;
                        }
                    }
                }

                if (selectedIndex == null)
                    selectedIndex = Integer.toString(defaultIndex);

                ComboMapImpl model = new ComboMapImpl();
                model.putAll(entryCombo);
                model.setVocabularyCombo(true);

                JComboBox voc = new javax.swing.JComboBox(model);
                model.specialRenderCombo(voc);

                voc.setName("MID_" + Integer.toString(kv.getValue().MID));
                voc.setSelectedIndex(Integer.parseInt(selectedIndex));
                voc.setPreferredSize(new Dimension(150, 20));

                voc.setBounds(5, 5, 150, 20);
                innerPanel.add(voc, "wrap, width :500:");
                //BookImporter.policy.addIndexedComponent(voc);
                tabobjects.add(voc);
            } else if (datatype.equals("DateTime")) {
                //final JXDatePicker datePicker = new JXDatePicker();
                JDateChooser datePicker = new JDateChooser();
                datePicker.setName("MID_" + Integer.toString(kv.getValue().MID));

                JPanel test = new JPanel(new MigLayout());
                JLabel lbefore = new JLabel(Utility.getBundleString("beforechristlabel", bundle));
                JCheckBox beforechrist = new JCheckBox();
                beforechrist.setName("MID_" + Integer.toString(kv.getValue().MID) + "_check");

                if (kv.getValue().value != null) {
                    try {
                        if (kv.getValue().value.charAt(0) == '-') {
                            beforechrist.setSelected(true);
                        }

                        Date date1 = new Date();
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                        if (kv.getValue().value.charAt(0) == '-') {
                            date1 = sdf.parse(adjustDate(kv.getValue().value));
                        } else {
                            date1 = sdf.parse(kv.getValue().value);
                        }
                        datePicker.setDate(date1);
                    } catch (Exception e) {
                        //Console.WriteLine("ERROR import date:" + ex.Message);
                    }
                }

                test.add(datePicker, "width :200:");
                test.add(lbefore, "gapleft 30");
                test.add(beforechrist, "wrap");

                innerPanel.add(test, "wrap");
            }
        }

        //Recursive call
        create_metadata_view(kv.getValue().submetadatas, innerPanel, level + 1, panelname);

        if (kv.getValue().editable.equals("Y")
                || (datatype.equals("Node") && kv.getValue().hidden.equals("0"))) {
            parent.add(innerPanel, "wrap, growx");

            for (Component tabobject : tabobjects) {
                BookImporter.policy.addIndexedComponent(tabobject);
            }
        }
    }
}

From source file:edu.ku.brc.af.ui.forms.FormViewObj.java

/**
 * Sets the component into the object/*w ww  .j av a  2 s . c o  m*/
 * @param formComp the UI component that represents this viewable
 */
public void setFormComp(final JComponent formComp) {
    // Remove existing component
    if (this.formComp != null) {
        mainComp.remove(this.formComp);
    }

    // add new component
    if (MultiView.isOptionOn(options, MultiView.NO_SCROLLBARS)) {
        if (ViewFactory.isFormTransparent()) {
            formComp.setOpaque(false);
        }
        this.mainComp.add(formComp, BorderLayout.CENTER);
        this.formComp = formComp;

    } else {
        JScrollPane scrollPane = new JScrollPane(formComp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPane.getVerticalScrollBar().setUnitIncrement(10);

        scrollPane.setBorder(null);
        this.mainComp.add(scrollPane, BorderLayout.CENTER);
        this.formComp = scrollPane;

        if (ViewFactory.isFormTransparent()) {
            scrollPane.setOpaque(false);
            scrollPane.getViewport().setOpaque(false);
        }
    }

    if (businessRules != null && !hasInitBR) {
        businessRules.initialize(this);
        hasInitBR = true;
    }

    // This is needed to make the form layout correctly
    //XXX I hate that I have to do this
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            //mainComp.invalidate();
            //mainComp.validate();
            //mainComp.doLayout();
            UIRegistry.forceTopFrameRepaint();
        }
    });
}

From source file:edu.ku.brc.af.ui.forms.persist.ViewLoader.java

/**
 * Di//from   w w w . java  2s.  c o  m
 */
public static void displayFieldVerInfo() {
    if (verifyDlg != null) {
        verifyDlg.setVisible(false);
        verifyDlg.dispose();
        verifyDlg = null;
    }

    System.err.println("------------- "
            + (instance.fldVerTableModel != null ? instance.fldVerTableModel.getRowCount() : "null"));

    if (instance.fldVerTableModel != null && instance.fldVerTableModel.getRowCount() > 0) {
        JLabel lbl = UIHelper.createLabel(
                "<html><i>(Some of fields are special buttons or labal names. Review them to make sure you have not <br>mis-named any of the fields you are working with.)");

        final JTable table = new JTable(instance.fldVerTableModel);
        UIHelper.calcColumnWidths(table);

        CellConstraints cc = new CellConstraints();
        JScrollPane sp = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g", "f:p:g,4px,p"));
        pb.add(sp, cc.xy(1, 1));
        pb.add(lbl, cc.xy(1, 3));
        pb.setDefaultDialogBorder();

        verifyDlg = new CustomFrame(
                "Field Names on Form, but not in Database : " + instance.fldVerTableModel.getRowCount(),
                CustomFrame.OK_BTN, pb.getPanel()) {
            @Override
            protected void okButtonPressed() {
                super.okButtonPressed();

                table.setModel(new DefaultTableModel());

                dispose();

                verifyDlg = null;
            }
        };
        verifyDlg.setOkLabel(getResourceString("CLOSE"));
        verifyDlg.createUI();
        verifyDlg.setVisible(true);
    }
}

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

protected boolean createItem(final DBTableInfo parentTableInfo, final DBTableChildIFace childInfo,
        final MultiView parent, final ViewDefIFace viewDef, final FormValidator validator,
        final ViewBuilderIFace viewBldObj, final AltViewIFace.CreationMode mode,
        final HashMap<String, JLabel> labelsForHash, final Object currDataObj, final FormCellIFace cell,
        final boolean isEditOnCreateOnly, final int rowInx, final BuildInfoStruct bi) {
    bi.compToAdd = null;/* ww w .java  2  s.  c o  m*/
    bi.compToReg = null;
    bi.doAddToValidator = true;
    bi.doRegControl = true;

    DBRelationshipInfo relInfo = childInfo instanceof DBRelationshipInfo ? (DBRelationshipInfo) childInfo
            : null;

    if (isEditOnCreateOnly) {
        EditViewCompSwitcherPanel evcsp = new EditViewCompSwitcherPanel(cell);
        bi.compToAdd = evcsp;
        bi.compToReg = evcsp;

        if (validator != null) {
            //DataChangeNotifier dcn = validator.createDataChangeNotifer(cell.getIdent(), evcsp, null);
            DataChangeNotifier dcn = validator.hookupComponent(evcsp, cell.getIdent(), UIValidator.Type.Changed,
                    null, false);
            evcsp.setDataChangeNotifier(dcn);
        }

    } else if (cell.getType() == FormCellIFace.CellType.label) {
        FormCellLabel cellLabel = (FormCellLabel) cell;

        String lblStr = cellLabel.getLabel();
        if (cellLabel.isRecordObj()) {
            JComponent riComp = viewBldObj.createRecordIndentifier(lblStr, cellLabel.getIcon());
            bi.compToAdd = riComp;

        } else {
            String lStr = "  ";
            int align = SwingConstants.RIGHT;
            boolean useColon = StringUtils.isNotEmpty(cellLabel.getLabelFor());

            if (lblStr.equals("##")) {
                //lStr = "  ";
                bi.isDerivedLabel = true;
                cellLabel.setDerived(true);

            } else {
                String alignProp = cellLabel.getProperty("align");
                if (StringUtils.isNotEmpty(alignProp)) {
                    if (alignProp.equals("left")) {
                        align = SwingConstants.LEFT;

                    } else if (alignProp.equals("center")) {
                        align = SwingConstants.CENTER;

                    } else {
                        align = SwingConstants.RIGHT;
                    }
                } else if (useColon) {
                    align = SwingConstants.RIGHT;
                } else {
                    align = SwingConstants.LEFT;
                }

                if (isNotEmpty(lblStr)) {
                    if (useColon) {
                        lStr = lblStr + ":";
                    } else {
                        lStr = lblStr;
                    }
                } else {
                    lStr = "  ";
                }
            }

            if (lStr.indexOf(LF) > -1) {
                lStr = "<html>" + StringUtils.replace(lStr, LF, "<br>") + "</html>";
            }
            JLabel lbl = createLabel(lStr, align);
            String colorStr = cellLabel.getProperty("fg");
            if (StringUtils.isNotEmpty(colorStr)) {
                lbl.setForeground(UIHelper.parseRGB(colorStr));
            }
            labelsForHash.put(cellLabel.getLabelFor(), lbl);
            bi.compToAdd = lbl;
            viewBldObj.addLabel(cellLabel, lbl);
        }

        bi.doAddToValidator = false;
        bi.doRegControl = false;

    } else if (cell.getType() == FormCellIFace.CellType.field) {
        FormCellField cellField = (FormCellField) cell;

        bi.isRequired = bi.isRequired || cellField.isRequired()
                || (childInfo != null && childInfo.isRequired());

        DBFieldInfo fieldInfo = childInfo instanceof DBFieldInfo ? (DBFieldInfo) childInfo : null;
        if (fieldInfo != null && fieldInfo.isHidden()) {
            FormDevHelper.appendLocalizedFormDevError("ViewFactory.FORM_FIELD_HIDDEN", cellField.getIdent(),
                    cellField.getName(), viewDef.getName());
        } else {

            if (fieldInfo != null && fieldInfo.isHidden()) {
                FormDevHelper.appendLocalizedFormDevError("ViewFactory.FORM_REL_HIDDEN", cellField.getIdent(),
                        cellField.getName(), viewDef.getName());
            }
        }

        FormCellField.FieldType uiType = cellField.getUiType();

        // Check to see if there is a PickList and get it if there is
        PickListDBAdapterIFace adapter = null;

        String pickListName = cellField.getPickListName();
        if (childInfo != null && StringUtils.isEmpty(pickListName) && fieldInfo != null) {
            pickListName = fieldInfo.getPickListName();
        }

        if (isNotEmpty(pickListName)) {
            adapter = PickListDBAdapterFactory.getInstance().create(pickListName, false);

            if (adapter == null || adapter.getPickList() == null) {
                FormDevHelper.appendFormDevError("PickList Adapter [" + pickListName + "] cannot be null!");
                return false;
            }
        }

        /*if (uiType == FormCellFieldIFace.FieldType.text)
        {
        String weblink = cellField.getProperty("weblink");
        if (StringUtils.isNotEmpty(weblink))
        {
            String name = cellField.getProperty("name");
            if (StringUtils.isNotEmpty(name) && name.equals("WebLink"))
            {
                uiType
            }
        }
        }*/

        // The Default Display for combox is dsptextfield, except when there is a TableBased PickList
        // At the time we set the display we don't want to go get the picklist to find out. So we do it
        // here after we have the picklist and actually set the change into the cellField
        // because it uses the value to determine whether to convert the value into a text string 
        // before setting it.
        if (mode == AltViewIFace.CreationMode.VIEW) {
            if (uiType == FormCellFieldIFace.FieldType.combobox
                    && cellField.getDspUIType() != FormCellFieldIFace.FieldType.textpl) {
                if (adapter != null)// && adapter.isTabledBased())
                {
                    uiType = FormCellFieldIFace.FieldType.textpl;
                    cellField.setDspUIType(uiType);

                } else {
                    uiType = cellField.getDspUIType();
                }
            } else {
                uiType = cellField.getDspUIType();
            }
        } else if (uiType == FormCellField.FieldType.querycbx) {
            if (AppContextMgr.isSecurityOn()) {
                DBTableInfo tblInfo = childInfo != null
                        ? DBTableIdMgr.getInstance()
                                .getByShortClassName(childInfo.getDataClass().getSimpleName())
                        : null;
                if (tblInfo != null) {
                    PermissionSettings perm = tblInfo.getPermissions();
                    if (perm != null) {
                        //PermissionSettings.dumpPermissions("QCBX: "+tblInfo.getShortClassName(), perm.getOptions());
                        if (perm.isViewOnly() || !perm.canView()) {
                            uiType = FormCellField.FieldType.textfieldinfo;
                        }
                    }
                }
            }
        }

        Class<?> fieldClass = childInfo != null ? childInfo.getDataClass() : null;
        String uiFormatName = cellField.getUIFieldFormatterName();

        if (mode == AltViewIFace.CreationMode.EDIT && uiType == FormCellField.FieldType.text
                && fieldClass != null) {
            if (fieldClass == String.class && fieldInfo != null) {
                // check whether there's a formatter defined for this field in the schema
                if (fieldInfo.getFormatter() != null) {
                    uiFormatName = fieldInfo.getFormatter().getName();
                    uiType = FormCellField.FieldType.formattedtext;
                }
            } else if (fieldClass == Integer.class || fieldClass == Long.class || fieldClass == Short.class
                    || fieldClass == Byte.class || fieldClass == Double.class || fieldClass == Float.class
                    || fieldClass == BigDecimal.class) {
                //log.debug(cellField.getName()+"  is being changed to NUMERIC");
                uiType = FormCellField.FieldType.formattedtext;
                uiFormatName = "Numeric" + fieldClass.getSimpleName();
            }
        }

        // Create the UI Component

        boolean isReq = cellField.isRequired() || (fieldInfo != null && fieldInfo.isRequired())
                || (relInfo != null && relInfo.isRequired());
        cellField.setRequired(isReq);

        switch (uiType) {
        case text:

            bi.compToAdd = createTextField(validator, cellField, fieldInfo, isReq, adapter);
            bi.doAddToValidator = validator == null; // might already added to validator
            break;

        case formattedtext: {
            Class<?> tableClass = null;
            try {
                tableClass = Class.forName(viewDef.getClassName());
            } catch (Exception ex) {
            }

            JComponent tfStart = createFormattedTextField(validator, cellField, tableClass,
                    fieldInfo != null ? fieldInfo.getLength() : 0, uiFormatName,
                    mode == AltViewIFace.CreationMode.VIEW, isReq,
                    cellField.getPropertyAsBoolean("alledit", false));
            bi.compToAdd = tfStart;
            if (cellField.getPropertyAsBoolean("series", false)) {
                JComponent tfEnd = createFormattedTextField(validator, cellField, tableClass,
                        fieldInfo != null ? fieldInfo.getLength() : 0, uiFormatName,
                        mode == AltViewIFace.CreationMode.VIEW, isReq,
                        cellField.getPropertyAsBoolean("alledit", false));

                // Make sure we register it like a plugin not a regular control
                SeriesProcCatNumPlugin plugin = new SeriesProcCatNumPlugin((ValFormattedTextFieldIFace) tfStart,
                        (ValFormattedTextFieldIFace) tfEnd);
                bi.compToAdd = plugin.getUIComponent();
                viewBldObj.registerPlugin(cell, plugin);
                bi.doRegControl = false;
            }
            bi.doAddToValidator = validator == null; // might already added to validator
            break;
        }
        case label:
            JLabel label = createLabel("", SwingConstants.LEFT);
            bi.compToAdd = label;
            break;

        case dsptextfield:
            if (StringUtils.isEmpty(cellField.getPickListName())) {
                JTextField text = UIHelper.createTextField(cellField.getTxtCols());
                changeTextFieldUIForDisplay(text, cellField.getPropertyAsBoolean("transparent", false));
                bi.compToAdd = text;
            } else {
                bi.compToAdd = createTextField(validator, cellField, fieldInfo, isReq, adapter);
                bi.doAddToValidator = validator == null; // might already added to validator
            }
            break;

        case textfieldinfo:
            bi.compToAdd = createTextFieldWithInfo(cellField, parent);
            break;

        case image:
            bi.compToAdd = createImageDisplay(cellField, mode, validator);
            bi.doAddToValidator = (validator != null);
            break;

        case url:
            BrowserLauncherBtn blb = new BrowserLauncherBtn(cellField.getProperty("title"));
            bi.compToAdd = blb;
            bi.doAddToValidator = false;

            break;

        case combobox:
            bi.compToAdd = createValComboBox(validator, cellField, adapter, isReq);
            bi.doAddToValidator = validator != null; // might already added to validator
            break;

        case checkbox: {
            String lblStr = cellField.getLabel();
            if (lblStr.equals("##")) {
                bi.isDerivedLabel = true;
                cellField.setDerived(true);
            }
            ValCheckBox checkbox = new ValCheckBox(lblStr, isReq,
                    cellField.isReadOnly() || mode == AltViewIFace.CreationMode.VIEW);
            if (validator != null) {
                DataChangeNotifier dcn = validator.createDataChangeNotifer(cellField.getIdent(), checkbox,
                        validator.createValidator(checkbox, UIValidator.Type.Changed));
                checkbox.addActionListener(dcn);
                checkbox.addItemListener(dcn);
            }
            bi.compToAdd = checkbox;
            break;
        }

        case tristate: {
            String lblStr = cellField.getLabel();
            if (lblStr.equals("##")) {
                bi.isDerivedLabel = true;
                cellField.setDerived(true);
            }
            ValTristateCheckBox tristateCB = new ValTristateCheckBox(lblStr, isReq,
                    cellField.isReadOnly() || mode == AltViewIFace.CreationMode.VIEW);
            if (validator != null) {
                DataChangeNotifier dcn = validator.createDataChangeNotifer(cellField.getIdent(), tristateCB,
                        null);
                tristateCB.addActionListener(dcn);
            }
            bi.compToAdd = tristateCB;
            break;
        }

        case spinner: {
            String minStr = cellField.getProperty("min");
            int min = StringUtils.isNotEmpty(minStr) ? Integer.parseInt(minStr) : 0;

            String maxStr = cellField.getProperty("max");
            int max = StringUtils.isNotEmpty(maxStr) ? Integer.parseInt(maxStr) : 0;

            ValSpinner spinner = new ValSpinner(min, max, isReq,
                    cellField.isReadOnly() || mode == AltViewIFace.CreationMode.VIEW);
            if (validator != null) {
                DataChangeNotifier dcn = validator.createDataChangeNotifer(cellField.getIdent(), spinner,
                        validator.createValidator(spinner, UIValidator.Type.Changed));
                spinner.addChangeListener(dcn);
            }
            bi.compToAdd = spinner;
            break;
        }

        case password:
            bi.compToAdd = createPasswordField(validator, cellField, isReq);
            bi.doAddToValidator = validator == null; // might already added to validator
            break;

        case dsptextarea:
            bi.compToAdd = createDisplayTextArea(cellField);
            break;

        case textarea: {
            JTextArea ta = createTextArea(validator, cellField, isReq, fieldInfo);
            JScrollPane scrollPane = new JScrollPane(ta);
            scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            scrollPane.setVerticalScrollBarPolicy(
                    UIHelper.isMacOS() ? ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
                            : ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
            ta.setLineWrap(true);
            ta.setWrapStyleWord(true);

            bi.doAddToValidator = validator == null; // might already added to validator
            bi.compToReg = ta;
            bi.compToAdd = scrollPane;
            break;
        }

        case textareabrief: {
            String title = "";
            DBTableInfo ti = DBTableIdMgr.getInstance().getByClassName(viewDef.getClassName());
            if (ti != null) {
                DBFieldInfo fi = ti.getFieldByName(cellField.getName());
                if (fi != null) {
                    title = fi.getTitle();
                }
            }

            ValTextAreaBrief txBrief = createTextAreaBrief(validator, cellField, isReq, fieldInfo);
            txBrief.setTitle(title);

            bi.doAddToValidator = validator == null; // might already added to validator
            bi.compToReg = txBrief;
            bi.compToAdd = txBrief.getUIComponent();
            break;
        }

        case browse: {
            JTextField textField = createTextField(validator, cellField, null, isReq, null);
            if (textField instanceof ValTextField) {
                ValBrowseBtnPanel bbp = new ValBrowseBtnPanel((ValTextField) textField,
                        cellField.getPropertyAsBoolean("dirsonly", false),
                        cellField.getPropertyAsBoolean("forinput", true));
                String fileFilter = cellField.getProperty("filefilter");
                String fileFilterDesc = cellField.getProperty("filefilterdesc");
                String defaultExtension = cellField.getProperty("defaultExtension");
                if (fileFilter != null && fileFilterDesc != null) {
                    bbp.setUseNativeFileDlg(false);
                    bbp.setFileFilter(new FileNameExtensionFilter(fileFilterDesc, fileFilter));
                    bbp.setDefaultExtension(defaultExtension);
                    //bbp.setNativeDlgFilter(new FileNameExtensionFilter(fileFilterDesc, fileFilter));
                }
                bi.compToAdd = bbp;

            } else {
                BrowseBtnPanel bbp = new BrowseBtnPanel(textField,
                        cellField.getPropertyAsBoolean("dirsonly", false),
                        cellField.getPropertyAsBoolean("forinput", true));
                bi.compToAdd = bbp;
            }
            break;
        }

        case querycbx: {
            ValComboBoxFromQuery cbx = createQueryComboBox(validator, cellField, isReq,
                    cellField.getPropertyAsBoolean("adjustquery", true));
            cbx.setMultiView(parent);
            cbx.setFrameTitle(cellField.getProperty("title"));

            bi.compToAdd = cbx;
            bi.doAddToValidator = validator == null; // might already added to validator
            break;
        }

        case list: {
            JList list = createList(validator, cellField, isReq);

            JScrollPane scrollPane = new JScrollPane(list);
            scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            scrollPane.setVerticalScrollBarPolicy(
                    UIHelper.isMacOS() ? ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
                            : ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

            bi.doAddToValidator = validator == null;
            bi.compToReg = list;
            bi.compToAdd = scrollPane;
            break;
        }

        case colorchooser: {
            ColorChooser colorChooser = new ColorChooser(Color.BLACK);
            if (validator != null) {
                DataChangeNotifier dcn = validator.createDataChangeNotifer(cellField.getName(), colorChooser,
                        null);
                colorChooser.addPropertyChangeListener("setValue", dcn);
            }
            //setControlSize(colorChooser);
            bi.compToAdd = colorChooser;

            break;
        }

        case button:
            JButton btn = createFormButton(cellField, cellField.getProperty("title"));
            bi.compToAdd = btn;
            break;

        case progress:
            bi.compToAdd = createProgressBar(0, 100);
            break;

        case plugin:
            UIPluginable uip = createPlugin(parent, validator, cellField,
                    mode == AltViewIFace.CreationMode.VIEW, isReq);
            if (uip != null) {
                bi.compToAdd = uip.getUIComponent();
                viewBldObj.registerPlugin(cell, uip);
            } else {
                bi.compToAdd = new JPanel();
                log.error("Couldn't create UIPlugin [" + cellField.getName() + "] ID:" + cellField.getIdent());
            }
            bi.doRegControl = false;
            break;

        case textpl:
            JTextField txt = new TextFieldFromPickListTable(adapter, cellField.getTxtCols());
            changeTextFieldUIForDisplay(txt, cellField.getPropertyAsBoolean("transparent", false));
            bi.compToAdd = txt;
            break;

        default:
            FormDevHelper.appendFormDevError("Don't recognize uitype=[" + uiType + "]");

        } // switch

    } else if (cell.getType() == FormCellIFace.CellType.separator) {
        // still have compToAdd = null;
        FormCellSeparatorIFace fcs = (FormCellSeparatorIFace) cell;
        String collapsableName = fcs.getCollapseCompName();

        String label = fcs.getLabel();
        if (StringUtils.isEmpty(label) || label.equals("##")) {
            String className = fcs.getProperty("forclass");
            if (StringUtils.isNotEmpty(className)) {
                DBTableInfo ti = DBTableIdMgr.getInstance().getByShortClassName(className);
                if (ti != null) {
                    label = ti.getTitle();
                }
            }
        }
        Component sep = viewBldObj.createSeparator(label);
        if (isNotEmpty(collapsableName)) {
            CollapsableSeparator collapseSep = new CollapsableSeparator(sep, false, null);
            if (bi.collapseSepHash == null) {
                bi.collapseSepHash = new HashMap<CollapsableSeparator, String>();
            }
            bi.collapseSepHash.put(collapseSep, collapsableName);
            sep = collapseSep;

        }
        bi.doRegControl = cell.getName().length() > 0;
        bi.compToAdd = (JComponent) sep;
        bi.doRegControl = StringUtils.isNotEmpty(cell.getIdent());
        bi.doAddToValidator = false;

    } else if (cell.getType() == FormCellIFace.CellType.command) {
        FormCellCommand cellCmd = (FormCellCommand) cell;
        JButton btn = createFormButton(cell, cellCmd.getLabel());
        if (cellCmd.getCommandType().length() > 0) {
            btn.addActionListener(new CommandActionWrapper(
                    new CommandAction(cellCmd.getCommandType(), cellCmd.getAction(), "")));
        }
        bi.doAddToValidator = false;
        bi.compToAdd = btn;

    } else if (cell.getType() == FormCellIFace.CellType.iconview) {
        FormCellSubView cellSubView = (FormCellSubView) cell;

        String subViewName = cellSubView.getViewName();

        ViewIFace subView = AppContextMgr.getInstance().getView(cellSubView.getViewSetName(), subViewName);
        if (subView != null) {
            if (parent != null) {
                int options = MultiView.VIEW_SWITCHER
                        | (MultiView.isOptionOn(parent.getCreateOptions(), MultiView.IS_NEW_OBJECT)
                                ? MultiView.IS_NEW_OBJECT
                                : MultiView.NO_OPTIONS);

                options |= cellSubView.getPropertyAsBoolean("nosep", false) ? MultiView.DONT_USE_EMBEDDED_SEP
                        : 0;
                options |= cellSubView.getPropertyAsBoolean("nosepmorebtn", false)
                        ? MultiView.NO_MORE_BTN_FOR_SEP
                        : 0;

                MultiView multiView = new MultiView(parent, cellSubView.getName(), subView,
                        parent.getCreateWithMode(), options, null);
                parent.addChildMV(multiView);
                multiView.setClassToCreate(getClassToCreate(parent, cell));

                log.debug("[" + cell.getType() + "] [" + cell.getName() + "] col: " + bi.colInx + " row: "
                        + rowInx + " colspan: " + cell.getColspan() + " rowspan: " + cell.getRowspan());
                viewBldObj.addSubView(cellSubView, multiView, bi.colInx, rowInx, cellSubView.getColspan(), 1);
                viewBldObj.closeSubView(cellSubView);
                bi.curMaxRow = rowInx;
                bi.colInx += cell.getColspan() + 1;
            } else {
                log.error("buildFormView - parent is NULL for subview [" + subViewName + "]");
            }

        } else {
            log.error("buildFormView - Could find subview's with ViewSet[" + cellSubView.getViewSetName()
                    + "] ViewName[" + subViewName + "]");
        }
        // still have compToAdd = null;
        bi.colInx += 2;

    } else if (cell.getType() == FormCellIFace.CellType.subview) {
        FormCellSubView cellSubView = (FormCellSubView) cell;
        String subViewName = cellSubView.getViewName();
        ViewIFace subView = AppContextMgr.getInstance().getView(cellSubView.getViewSetName(), subViewName);

        if (subView != null) {
            // Check to see this view should be "flatten" meaning we are creating a grid from a form
            if (!viewBldObj.shouldFlatten()) {
                if (parent != null) {
                    ViewIFace parentView = parent.getView();
                    Properties props = cellSubView.getProperties();

                    boolean isSingle = cellSubView.isSingleValueFromSet();
                    boolean isACollection = false;

                    try {
                        Class<?> cls = Class.forName(parentView.getClassName());
                        Field fld = getFieldFromDotNotation(cellSubView, cls);
                        if (fld != null) {
                            isACollection = Collection.class.isAssignableFrom(fld.getType());
                        } else {
                            log.error("Couldn't find field [" + cellSubView.getName() + "] in class ["
                                    + parentView.getClassName() + "]");
                        }
                    } catch (Exception ex) {
                        log.error("Couldn't find field [" + cellSubView.getName() + "] in class ["
                                + parentView.getClassName() + "]");
                        edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ViewFactory.class, ex);
                    }

                    if (isSingle) {
                        isACollection = true;
                    }

                    boolean useNoScrollbars = UIHelper.getProperty(props, "noscrollbars", false);
                    //Assume RecsetController will always be handled correctly for one-to-one
                    boolean hideResultSetController = relInfo == null ? false
                            : relInfo.getType().equals(DBRelationshipInfo.RelationshipType.ZeroOrOne);
                    /*XXX bug #9497: boolean canEdit = true;
                    boolean addAddBtn = isEditOnCreateOnly && relInfo != null;
                    if (AppContextMgr.isSecurityOn()) {
                    DBTableInfo tblInfo = childInfo != null ? DBTableIdMgr.getInstance().getByShortClassName(childInfo.getDataClass().getSimpleName()) : null;
                    if (tblInfo != null) {
                        PermissionSettings perm = tblInfo.getPermissions();
                        if (perm != null) {
                            //XXX whoa. What about view perms???
                           //if (perm.isViewOnly() || !perm.canView()) {
                            if (!perm.canModify()) {
                               canEdit = false;
                            }
                        }
                    }
                    }*/

                    int options = (isACollection && !isSingle ? MultiView.RESULTSET_CONTROLLER
                            : MultiView.IS_SINGLE_OBJ)
                            | MultiView.VIEW_SWITCHER
                            | (MultiView.isOptionOn(parent.getCreateOptions(), MultiView.IS_NEW_OBJECT)
                                    ? MultiView.IS_NEW_OBJECT
                                    : MultiView.NO_OPTIONS)
                            |
                            /* XXX bug #9497:(mode == AltViewIFace.CreationMode.EDIT && canEdit ? MultiView.IS_EDITTING : MultiView.NO_OPTIONS) |
                            (useNoScrollbars ? MultiView.NO_SCROLLBARS : MultiView.NO_OPTIONS)
                            //| (addAddBtn ? MultiView.INCLUDE_ADD_BTN : MultiView.NO_OPTIONS)
                            ; */

                            (mode == AltViewIFace.CreationMode.EDIT ? MultiView.IS_EDITTING
                                    : MultiView.NO_OPTIONS)
                            | (useNoScrollbars ? MultiView.NO_SCROLLBARS : MultiView.NO_OPTIONS)
                            | (hideResultSetController ? MultiView.HIDE_RESULTSET_CONTROLLER
                                    : MultiView.NO_OPTIONS);
                    //MultiView.printCreateOptions("HERE", options);

                    options |= cellSubView.getPropertyAsBoolean("nosep", false)
                            ? MultiView.DONT_USE_EMBEDDED_SEP
                            : 0;
                    options |= cellSubView.getPropertyAsBoolean("nosepmorebtn", false)
                            ? MultiView.NO_MORE_BTN_FOR_SEP
                            : 0;
                    options |= cellSubView.getPropertyAsBoolean("collapse", false)
                            ? MultiView.COLLAPSE_SEPARATOR
                            : 0;

                    if (!(isACollection && !isSingle)) {
                        options &= ~MultiView.ADD_SEARCH_BTN;
                    } else {
                        options |= cellSubView.getPropertyAsBoolean("addsearch", false)
                                ? MultiView.ADD_SEARCH_BTN
                                : 0;
                    }

                    //MultiView.printCreateOptions("_______________________________", parent.getCreateOptions());
                    //MultiView.printCreateOptions("_______________________________", options);
                    boolean useBtn = UIHelper.getProperty(props, "btn", false);
                    if (useBtn) {
                        SubViewBtn.DATA_TYPE dataType;
                        if (isSingle) {
                            dataType = SubViewBtn.DATA_TYPE.IS_SINGLESET_ITEM;

                        } else if (isACollection) {
                            dataType = SubViewBtn.DATA_TYPE.IS_SET;
                        } else {
                            dataType = cellSubView.getName().equals("this") ? SubViewBtn.DATA_TYPE.IS_THIS
                                    : SubViewBtn.DATA_TYPE.IS_SET;
                        }

                        SubViewBtn subViewBtn = getInstance().createSubViewBtn(parent, cellSubView, subView,
                                dataType, options, props, getClassToCreate(parent, cell), mode);
                        subViewBtn.setHelpContext(props.getProperty("hc", null));

                        bi.doAddToValidator = false;
                        bi.compToAdd = subViewBtn;

                        String visProp = cell.getProperty("visible");
                        if (StringUtils.isNotEmpty(visProp) && visProp.equalsIgnoreCase("false")
                                && bi.compToAdd != null) {
                            bi.compToAdd.setVisible(false);
                        }

                        try {
                            addControl(validator, viewBldObj, rowInx, cell, bi);

                        } catch (java.lang.IndexOutOfBoundsException ex) {
                            String msg = "Error adding control type: `" + cell.getType() + "` id: `"
                                    + cell.getIdent() + "` name: `" + cell.getName() + "` on row: " + rowInx
                                    + " column: " + bi.colInx + "\n" + ex.getMessage();
                            UIRegistry.showError(msg);
                            return false;
                        }

                        bi.doRegControl = false;
                        bi.compToAdd = null;

                    } else {

                        Color bgColor = getBackgroundColor(props, parent.getBackground());

                        //log.debug(cellSubView.getName()+"  "+UIHelper.getProperty(props, "addsearch", false));
                        if (UIHelper.getProperty(props, "addsearch", false)) {
                            options |= MultiView.ADD_SEARCH_BTN;
                        }

                        if (UIHelper.getProperty(props, "addadd", false)) {
                            options |= MultiView.INCLUDE_ADD_BTN;
                        }

                        //MultiView.printCreateOptions("SUBVIEW", options);
                        MultiView multiView = new MultiView(parent, cellSubView.getName(), subView,
                                parent.getCreateWithMode(), cellSubView.getDefaultAltViewType(), options,
                                bgColor, cellSubView);
                        multiView.setClassToCreate(getClassToCreate(parent, cell));
                        setBorder(multiView, cellSubView.getProperties());

                        parent.addChildMV(multiView);

                        //log.debug("["+cell.getType()+"] ["+cell.getName()+"] col: "+bi.colInx+" row: "+rowInx+" colspan: "+cell.getColspan()+" rowspan: "+cell.getRowspan());
                        viewBldObj.addSubView(cellSubView, multiView, bi.colInx, rowInx,
                                cellSubView.getColspan(), 1);
                        viewBldObj.closeSubView(cellSubView);

                        Viewable viewable = multiView.getCurrentView();
                        if (viewable != null) {
                            if (viewable instanceof TableViewObj) {
                                ((TableViewObj) viewable).setVisibleRowCount(cellSubView.getTableRows());
                            }
                            if (viewable.getValidator() != null && childInfo != null) {
                                viewable.getValidator().setRequired(childInfo.isRequired());
                            }
                        }
                        bi.colInx += cell.getColspan() + 1;
                    }
                    bi.curMaxRow = rowInx;

                    //if (hasColor)
                    //{
                    //    setMVBackground(multiView, multiView.getBackground());
                    //}

                } else {
                    log.error("buildFormView - parent is NULL for subview [" + subViewName + "]");
                    bi.colInx += 2;
                }
            } else {
                //log.debug("["+cell.getType()+"] ["+cell.getName()+"] col: "+bi.colInx+" row: "+rowInx+" colspan: "+cell.getColspan()+" rowspan: "+cell.getRowspan());
                viewBldObj.addSubView(cellSubView, parent, bi.colInx, rowInx, cellSubView.getColspan(), 1);

                AltViewIFace altView = subView.getDefaultAltView();
                DBTableInfo sbTableInfo = DBTableIdMgr.getInstance().getByClassName(subView.getClassName());
                ViewDefIFace altsViewDef = (ViewDefIFace) altView.getViewDef();

                if (altsViewDef instanceof FormViewDefIFace) {
                    FormViewDefIFace fvd = (FormViewDefIFace) altsViewDef;
                    processRows(sbTableInfo, parent, viewDef, validator, viewBldObj, altView.getMode(),
                            labelsForHash, currDataObj, fvd.getRows());

                } else if (altsViewDef == null) {
                    // This error is bad enough to have it's own dialog
                    String msg = String.format("The Altview '%s' has a null ViewDef!", altView.getName());
                    FormDevHelper.appendFormDevError(msg);
                    UIRegistry.showError(msg);
                }

                viewBldObj.closeSubView(cellSubView);
                bi.colInx += cell.getColspan() + 1;
            }

        } else {
            log.error("buildFormView - Could find subview's with ViewSet[" + cellSubView.getViewSetName()
                    + "] ViewName[" + subViewName + "]");
        }
        // still have compToAdd = null;

    } else if (cell.getType() == FormCellIFace.CellType.statusbar) {
        bi.compToAdd = new JStatusBar();
        bi.doRegControl = true;
        bi.doAddToValidator = false;

    } else if (cell.getType() == FormCellIFace.CellType.panel) {
        bi.doRegControl = false;
        bi.doAddToValidator = false;

        cell.setIgnoreSetGet(true);

        FormCellPanel cellPanel = (FormCellPanel) cell;
        PanelViewable.PanelType panelType = PanelViewable.getType(cellPanel.getPanelType());

        if (panelType == PanelViewable.PanelType.Panel) {
            PanelViewable panelViewable = new PanelViewable(viewBldObj, cellPanel);

            processRows(parentTableInfo, parent, viewDef, validator, panelViewable, mode, labelsForHash,
                    currDataObj, cellPanel.getRows());

            panelViewable.setVisible(cellPanel.getPropertyAsBoolean("visible", true));

            setBorder(panelViewable, cellPanel.getProperties());
            if (parent != null) {
                Color bgColor = getBackgroundColor(cellPanel.getProperties(), parent.getBackground());
                if (bgColor != null && bgColor != parent.getBackground()) {
                    panelViewable.setOpaque(true);
                    panelViewable.setBackground(bgColor);
                }
            }

            bi.compToAdd = panelViewable;
            bi.doRegControl = true;
            bi.compToReg = panelViewable;

        } else if (panelType == PanelViewable.PanelType.ButtonBar) {
            bi.compToAdd = PanelViewable.buildButtonBar(processRows(viewBldObj, cellPanel.getRows()));

        } else {
            FormDevHelper.appendFormDevError("Panel Type is not implemented.");
            return false;
        }
    }

    String visProp = cell.getProperty("visible");
    if (StringUtils.isNotEmpty(visProp) && visProp.equalsIgnoreCase("false") && bi.compToAdd != null) {
        bi.compToAdd.setVisible(false);
    }

    return true;
}

From source file:it.imtech.metadata.MetaUtility.java

/**
 * Aggiunge il pannello delle classificazioni all'interfaccia dei metadati
 *
 * @param innerPanel Pannello sul quale aggiungere i metadati
 * @param kv Valori dei metadati/*from   w  w  w  . j  av  a2s .  c  o  m*/
 */
private void addClassification(JPanel innerPanel, Integer kv, final String sequence, final String panelname)
        throws Exception {
    try {
        ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE,
                Globals.loader);

        DefaultMutableTreeNode hierarchy = new DefaultMutableTreeNode("root");
        selected = null;
        String selectedPath = "";

        String link = selectedClassificationList.get(panelname + "---" + sequence);

        recursiveOefosTreeviewBuild(hierarchy, oefos.get(link), sequence, panelname);
        DefaultTreeModel model = new DefaultTreeModel(hierarchy);

        final JTree tree = new JTree(model);
        tree.setRootVisible(false);

        if (selected != null) {
            TreePath selpath = new TreePath(selected.getPath());
            tree.setSelectionPath(selpath);

            Object[] nodes = selpath.getPath();

            for (int i = 1; i < nodes.length; i++) {
                selectedPath += nodes[i].toString();
                selectedPath += (i != nodes.length - 1) ? "/" : "";
            }
        }

        tree.setName("MID_" + Integer.toString(kv) + "---" + sequence);
        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

        tree.addTreeSelectionListener(new TreeSelectionListener() {

            public void valueChanged(TreeSelectionEvent e) {
                try {
                    setOEFOS(tree, sequence, panelname);
                } catch (Exception ex) {
                    logger.error(ex.getMessage());
                }
            }
        });

        javax.swing.JScrollPane tree_scroller = new javax.swing.JScrollPane();
        tree_scroller
                .setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        tree_scroller.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        tree_scroller.setViewportView(tree);
        tree_scroller.setBorder(null);

        innerPanel.add(tree_scroller, "wrap, width 100:800:800");

        JPanel iPanel = new JPanel(new MigLayout());
        iPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
                Utility.getBundleString("choose2", bundle), TitledBorder.LEFT, TitledBorder.TOP));
        JLabel label = new JLabel();
        label.setName("classification_path" + "---" + sequence);
        label.setText(selectedPath);
        iPanel.add(label, "wrap, growx, height 30:30:30");

        innerPanel.add(iPanel, "wrap, width 100:800:800");

        findLastClassification(panelname);

    } catch (Exception ex) {
        logger.error(ex.getMessage());
        throw new Exception("Exception in addClassification: " + ex.getStackTrace() + "\n");
    }
}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * Creates a JScrollPane with the Vertical SrcollBar hint to be platform specific.
 * @param content the component inside the ScrollPane
 * @param makeHorzAsNeeded set the horizontal to be as needed
 * @return the ScrollPane/*w ww. j  ava  2 s.c  o  m*/
 */
public static JScrollPane createScrollPane(final JComponent content, final boolean makeHorzAsNeeded) {
    return new JScrollPane(content,
            isMacOS() && !isMacOS_10_8_X() ? ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
                    : ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            makeHorzAsNeeded ? ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
                    : ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}