Example usage for javax.swing.event ChangeEvent ChangeEvent

List of usage examples for javax.swing.event ChangeEvent ChangeEvent

Introduction

In this page you can find the example usage for javax.swing.event ChangeEvent ChangeEvent.

Prototype

public ChangeEvent(Object source) 

Source Link

Document

Constructs a ChangeEvent object.

Usage

From source file:edu.ku.brc.af.ui.weblink.WebLinkButton.java

public void dataChanged(final String name, final Component comp, final DataChangeNotifier dcn) {
    validateState();/*from www  .  j a v a2s .  co m*/

    isChanged = true;
    notifyChangeListeners(new ChangeEvent(this));

    String text = textField.getText();
    if (((dataObj instanceof String && StringUtils.isEmpty((String) dataObj)) || dataObj == null)
            && text != null) {
        launchBtn.setEnabled(true);

    } else if (dataObj != null && text != null) {
        if (launchBtn != null) {
            if (text.length() == 0) {
                launchBtn.setEnabled(false);
                dataObj = null;
            } else if (!launchBtn.isEnabled() && text.length() > 0) {
                launchBtn.setEnabled(true);
            }
        }
    }

    dataObj = text;

    setToolTips();
}

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

public void setAutoNumberEnabled(boolean turnOn) {
    if (formatter.isIncrementer() && cardPanel != null && isAutoFmtOn != turnOn) {
        cardLayout.show(cardPanel, turnOn ? "view" : "edit");

        isAutoFmtOn = turnOn;/*w  ww.j a  v  a  2  s  .  c om*/
        setChanged(true);
        if (changeListener != null) {
            changeListener.stateChanged(new ChangeEvent(this));
        }
    } else {
        isAutoFmtOn = turnOn;
    }
}

From source file:edu.ku.brc.specify.plugins.latlon.LatLonUI.java

/**
 * @param latStr1// w w w . j  av a2  s .c  om
 * @param lonStr1
 * @param latStr2
 * @param lonStr2
 */
public void setLatLon(final String latStr1, final String lonStr1, final String latStr2, final String lonStr2) {
    // NOTE: Every other panel has point 1 or point 2
    if (currentInx > -1) {
        srcLatLon1.first = latStr1;
        srcLatLon1.second = lonStr1;

        srcLatLon2.first = latStr2;
        srcLatLon2.second = lonStr2;

        // Correct the format if it is wrong
        FORMAT checkFmt = latStr1 != null ? geoRefCnv.getLatLonFormat(latStr1)
                : panels[currentInx].getDefaultFormat();
        //log.debug("srcFormat: "+srcFormat+" <-  checkFmt: "+checkFmt);
        if (checkFmt != srcFormat) {
            srcFormat = checkFmt;
        }

        panels[currentInx * 2].set(srcFormat, latStr1, lonStr1);
        panels[(currentInx * 2) + 1].set(srcFormat, latStr2, lonStr2);

        stateChanged(new ChangeEvent(this));
    }
}

From source file:edu.ku.brc.specify.dbsupport.cleanuptools.GeoCleanupFuzzySearch.java

/**
* @param earthId/* w w  w  .ja  va2 s .  c o m*/
* @param cl
*/
public void startIndexingProcessAsync(final int earthId, final ProgressFrame frame, final ChangeListener cl) {
    this.frame = frame;

    centerAndShow(frame);

    SwingWorker<Boolean, Boolean> worker = new SwingWorker<Boolean, Boolean>() {
        boolean isOK = true;

        @Override
        protected Boolean doInBackground() throws Exception {
            setProgressDesc("Build Geography Names cross-reference..."); // I18N
            stCntXRef = new StateCountryContXRef(readConn);
            isOK = stCntXRef.build();
            if (isOK) {
                setProgressDesc("Creating searchable index..."); // I18N
                isOK = buildLuceneIndex(earthId);
            }
            return isOK;
        }

        @Override
        protected void done() {
            super.done();

            // NOTE: need to check here that everything built OK
            cl.stateChanged(new ChangeEvent((Boolean) isOK));
        }
    };
    worker.execute();
}

From source file:edu.ku.brc.specify.plugins.ipadexporter.iPadDBExporterPlugin.java

/**
 * /*from   ww w. j a  va2s .  c  o m*/
 */
private void processDB() {
    try {
        loadAndPushResourceBundle(RESOURCE_NAME);

        int totalColObjRecords = BasicSQLUtils.getCountAsInt("SELECT COUNT(*) FROM collectionobject");
        if (totalColObjRecords > maxRequiredRecs - 1) {
            double ratio = 510.0 / 720.0;
            int width = 1024;
            int height = (int) ((width * ratio) + 0.5);
            if (iPadDBExporterObj == null) {
                iPadDBExporterObj = new iPadDBExporter(iPadCloud, "isite.db", width, height);
            }

            writeSimpleGlassPaneMsg(getResourceString("EXPORTING"), 24);

            AppContextMgr ac = AppContextMgr.getInstance();
            if (ac != null) {
                Collection coll = AppContextMgr.getInstance().getClassObject(Collection.class);
                Discipline disp = AppContextMgr.getInstance().getClassObject(Discipline.class);
                Division div = AppContextMgr.getInstance().getClassObject(Division.class);
                TaxonTreeDef taxDef = disp.getTaxonTreeDef();
                GeographyTreeDef geoDef = disp.getGeographyTreeDef();
                LithoStratTreeDef lithoDef = disp.getLithoStratTreeDef();
                GeologicTimePeriodTreeDef gtpDef = disp.getGeologicTimePeriodTreeDef();

                iPadDBExporterObj.initialize();

                iPadDBExporterObj.createMappings(coll.getId(), disp.getId(), div.getId(), taxDef.getId(),
                        geoDef.getId(), lithoDef.getId(), gtpDef.getId());

                exportBtn.setEnabled(false);

                ChangeListener cl = new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent e) {
                        popResourceBundle();

                        clearSimpleGlassPaneMsg();
                        exportBtn.setEnabled(true);
                        enableRemoveDatasetBtn();
                    }
                };

                if (!iPadDBExporterObj.createSQLiteDatabase(null, cl)) {
                    cl.stateChanged(new ChangeEvent(this));
                }
            }
        } else {
            showLocalizedError("ERR_TOO_FEW", maxRequiredRecs);
            popResourceBundle();
        }

    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:de.tor.tribes.ui.views.DSWorkbenchDoItYourselfAttackPlaner.java

public boolean deleteSelection(boolean pAsk) {
    List<Attack> selectedAttacks = getSelectedAttacks();

    if (pAsk) {//from ww  w . j a  va  2s .  c  o  m
        String message = ((selectedAttacks.size() == 1) ? "Angriff " : (selectedAttacks.size() + " Angriffe "))
                + "wirklich lschen?";
        if (selectedAttacks.isEmpty() || JOptionPaneHelper.showQuestionConfirmBox(this, message,
                "Angriffe lschen", "Nein", "Ja") != JOptionPane.YES_OPTION) {
            return false;
        }
    }

    jAttackTable.editingCanceled(new ChangeEvent(this));
    AttackManager.getSingleton().removeElements(AttackManager.MANUAL_ATTACK_PLAN, selectedAttacks);
    ((DoItYourselfAttackTableModel) jAttackTable.getModel()).fireTableDataChanged();
    showSuccess(selectedAttacks.size() + " Angriff(e) gelscht");
    return true;
}

From source file:org.nuclos.client.ui.collect.Chart.java

/**
 * fires a <code>ChangeEvent</code> whenever the model of this <code>Chart</code> changes.
 *//*from   www . ja va  2  s.c  o m*/
public synchronized void fireStateChanged() {
    if (layer == null || (layer != null && !((LockableUI) layer.getUI()).isLocked())) {
        final ChangeEvent ev = new ChangeEvent(this);
        for (ChangeListener changelistener : lstchangelistener) {
            changelistener.stateChanged(ev);
        }
    }
}

From source file:org.apache.jmeter.reporters.MailerModel.java

public void notifyChangeListeners() {
    if (changeListener != null) {
        changeListener.stateChanged(new ChangeEvent(this));
    }/* w ww  .j  a v a2  s.  co m*/
}

From source file:org.dc.file.search.ui.DashboardForm.java

protected void fireEditingStopped() {
    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == CellEditorListener.class) {
            // Lazily create the event:
            if (Objects.isNull(changeEvent)) {
                changeEvent = new ChangeEvent(this);
            }//from  ww w. j ava  2 s .com
            ((CellEditorListener) listeners[i + 1]).editingStopped(changeEvent);
        }
    }
}

From source file:org.dc.file.search.ui.DashboardForm.java

protected void fireEditingCanceled() {
    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == CellEditorListener.class) {
            // Lazily create the event:
            if (Objects.isNull(changeEvent)) {
                changeEvent = new ChangeEvent(this);
            }/*from  w ww.  j  ava 2s  .c o m*/
            ((CellEditorListener) listeners[i + 1]).editingCanceled(changeEvent);
        }
    }
}