Example usage for javax.swing JList isVisible

List of usage examples for javax.swing JList isVisible

Introduction

In this page you can find the example usage for javax.swing JList isVisible.

Prototype

@Transient
public boolean isVisible() 

Source Link

Document

Determines whether this component should be visible when its parent is visible.

Usage

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

protected void updateUIAfterAddOrMap(final FieldQRI fieldQRI, final QueryFieldPanel qfp, final boolean loading,
        final boolean isAdd, final boolean isSchemaMapping) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            if (currentInx > -1) {
                if (isAdd) {
                    queryFieldsPanel.add(qfp);
                    queryFieldsPanel.validate();
                }//from w ww .  jav  a2  s .c  om
                if (fieldQRI instanceof RelQRI) {
                    BaseQRI qri = fieldQRI.getTable();
                    for (JList lb : listBoxList) {
                        if (lb.isVisible()) {
                            if (((DefaultListModel) lb.getModel()).contains(qri)) {
                                lb.repaint();
                            }
                        }
                    }
                } else {
                    listBoxList.get(currentInx).repaint();
                }

                updateAddBtnState();
                selectQFP(qfp);
                updateSmushBtn();
                queryFieldsPanel.repaint();
                if (!loading) {
                    setSaveBtnEnabled(canSave(isSchemaMapping));
                    updateSearchBtn();
                }
                //Sorry, but a new context can't be selected if any fields are selected from the current context.
                tableList.setEnabled(queryFieldItems.size() == 0);
                if (fieldQRI instanceof TreeLevelQRI && distinctChk.isSelected() && countOnly) {
                    countOnly = false;
                    countOnlyChk.setSelected(false);
                    UIRegistry.displayLocalizedStatusBarText("QB_NO_COUNT_WITH_DISTINCT_WITH_TREELEVEL");
                } else {
                    UIRegistry.displayStatusBarText(null);
                }
            }
        }
    });
}

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

/**
 * Removes it from the List./*  w w  w. j a v a2 s  .  c  om*/
 * 
 * @param qfp QueryFieldPanel to be removed
 */
public void removeQueryFieldItem(final QueryFieldPanel qfp) {
    //refreshQuery();
    if (query.getReports().size() > 0) {
        CustomDialog cd = new CustomDialog((Frame) UIRegistry.getTopWindow(),
                UIRegistry.getResourceString("REP_CONFIRM_DELETE_TITLE"), true, CustomDialog.OKCANCELHELP,
                new QBReportInfoPanel(query,
                        UIRegistry.getResourceString("QB_USED_BY_REP_FLD_DELETE_CONFIRM")));
        cd.setHelpContext("QBFieldRemovedAndReports");
        UIHelper.centerAndShow(cd);
        cd.dispose();
        if (cd.isCancelled()) {
            return;
        }
    }
    if (qfp.getFieldQRI() != null) {
        qfp.getFieldQRI().setIsInUse(false);
    }
    if (qfp.getQueryField() != null) {
        //query.removeReference(qfp.getQueryField(), "fields");
        removeFieldFromQuery(qfp.getQueryField());
        if (qfp.getItemMapping() != null) {
            removeSchemaItemMapping(qfp.getItemMapping());
        }
    }
    final FieldQRI qfpqri = qfp.getFieldQRI();
    queryFieldItems.remove(qfp);
    //XXX field label qualification issues for schema maps??
    qualifyFieldLabels();

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            if (selectedQFP == qfp) {
                selectQFP(null);
            }
            queryFieldsPanel.getLayout().removeLayoutComponent(qfp);
            queryFieldsPanel.remove(qfp);
            queryFieldsPanel.validate();
            updateAddBtnState();

            // Sorry, but a new context can't be selected if any fields
            // are selected from the current context.
            tableList.setEnabled(queryFieldItems.size() == 0);

            try {
                BaseQRI qri = qfpqri instanceof RelQRI ? qfpqri.getTable() : qfpqri;
                //BaseQRI qri = qfp.getFieldQRI(); 
                boolean done = false;
                for (JList lb : listBoxList) {
                    if (lb.isVisible()) {
                        for (int i = 0; i < ((DefaultListModel) lb.getModel()).getSize(); i++) {
                            BaseQRI qriI = (BaseQRI) ((DefaultListModel) lb.getModel()).getElementAt(i);
                            if (qriI != null) {
                                boolean match = qriI == qri;
                                if (!match) {
                                    match = buildFieldQRI(qri).getStringId()
                                            .equals(buildFieldQRI(qriI).getStringId());
                                }
                                if (match) {
                                    qriI.setIsInUse(false);
                                    lb.repaint();
                                    done = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (done) {
                        break;
                    }
                }
            } catch (Exception ex) {
                UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(QueryBldrPane.class, ex);
                log.error(ex);
            }
            queryFieldsPanel.repaint();
            setSaveBtnEnabled(thereAreItems() && canSave());
            updateSearchBtn();
            updateSmushBtn();
            UIRegistry.displayStatusBarText(null);
        }
    });
}