Example usage for javax.swing Timer Timer

List of usage examples for javax.swing Timer Timer

Introduction

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

Prototype

public Timer(int delay, ActionListener listener) 

Source Link

Document

Creates a Timer and initializes both the initial delay and between-event delay to delay milliseconds.

Usage

From source file:net.sourceforge.pmd.cpd.GUI.java

private Timer createTimer() {

    final long start = System.currentTimeMillis();

    Timer t = new Timer(1000, new ActionListener() {
        @Override//w w w . j  av  a 2 s  . com
        public void actionPerformed(ActionEvent e) {
            long now = System.currentTimeMillis();
            long elapsedMillis = now - start;
            long elapsedSeconds = elapsedMillis / 1000;
            long minutes = (long) Math.floor(elapsedSeconds / 60);
            long seconds = elapsedSeconds - (minutes * 60);
            timeField.setText(formatTime(minutes, seconds));
        }
    });
    return t;
}

From source file:nz.dataview.websyncclientgui.WebSYNCClientGUIView.java

public WebSYNCClientGUIView(SingleFrameApplication app) {
    super(app);/*  w  w  w . j a va  2s  . c om*/

    // do this before anything else...
    try {
        client = new WebSYNC();
    } catch (java.io.IOException e) {
        // nonono!
    }
    // stuff that needs initialising before the components initialise
    proxyEnabled = client.getProxyEnabled();

    initComponents();

    System.setProperty("java.rmi.server.hostname", "localhost");

    // status bar initialization - message timeout, idle icon and busy animation, etc
    ResourceMap resourceMap = getResourceMap();
    int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
    progressBar.setVisible(false);

    // connecting action tasks to status bar via TaskMonitor
    TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
    taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            String propertyName = evt.getPropertyName();
            if ("started".equals(propertyName)) {
                progressBar.setVisible(true);
                progressBar.setIndeterminate(true);
            } else if ("done".equals(propertyName)) {
                progressBar.setVisible(false);
                progressBar.setValue(0);
            } else if ("message".equals(propertyName)) {
            } else if ("progress".equals(propertyName)) {
                int value = (Integer) (evt.getNewValue());
                progressBar.setVisible(true);
                progressBar.setIndeterminate(false);
                progressBar.setValue(value);
            } else if ("icon".equals(propertyName)) {
            } else if ("largeIcon".equals(propertyName)) {
                Icon icon = (Icon) evt.getNewValue();
                //          if (mainTabbedPane.getSelectedIndex() == 0) {
                connectPanelCurrentStatusOverviewLabel.setIcon(icon);
                //          }
            } else if ("largeMessage".equals(propertyName)) {
                String text = (String) (evt.getNewValue());
                if (text != null/* && mainTabbedPane.getSelectedIndex() == 0*/) {
                    connectPanelCurrentStatusOverviewLabel.setText(text);
                }
            } else if ("detailMessage".equals(propertyName)) {
                String text = (String) (evt.getNewValue());
                if (text != null
                        && (jScrollPane1.getVerticalScrollBar() == null
                                || !jScrollPane1.getVerticalScrollBar().getValueIsAdjusting())
                        && (jScrollPane1.getHorizontalScrollBar() == null
                                || !jScrollPane1.getHorizontalScrollBar().getValueIsAdjusting())) {
                    connectPanelCurrentStatusDetailsLabel.setText(text);
                }
            } else if ("isRunning".equals(propertyName)) {
                isRunning = ((Boolean) evt.getNewValue()).booleanValue();
                ResourceMap map = getResourceMap();
                String keyName = "runButton.toolTipText";
                if (!isRunning && isUp) {
                    keyName = "runButton.okToolTipText";
                }
                testConnectionButton.setEnabled(isUp && !isRunning);
            } else if ("isUp".equals(propertyName)) {
                isUp = ((Boolean) evt.getNewValue()).booleanValue();
                ResourceMap map = getResourceMap();
                String keyName = "testConnectionButton.toolTipText";
                if (isUp) {
                    // service is reachable (doesn't mean its running)
                    keyName = "testConnectionButton.okToolTipText";
                }
                testConnectionButton.setEnabled(isUp && !isRunning);
                testConnectionButton.setToolTipText(map.getString(keyName, new Object[0]));
                //          viewLogTextPane.setEnabled(isUp);
            } else if ("testIcon".equals(propertyName)) {
                Icon icon = (Icon) evt.getNewValue();
                testConnectionResult.setIcon(icon);
            } else if ("testMessage".equals(propertyName)) {
                String text = (String) evt.getNewValue();
                testConnectionResult.setText(text);
            } else if ("testFinished".equals(propertyName)) {
                testConnectionButton.setEnabled(isUp && !isRunning);
            } else if ("badAlertMessage".equals(propertyName)) {
                String text = (String) evt.getNewValue();
                if (text != null) {
                    showErrorDialog("Error", text);
                    WebSYNCClientGUIApp app = WebSYNCClientGUIApp.getApplication();
                    LogWriter worker = app.logWriteService(isUp, text, "WARN");
                    app.getContext().getTaskService().execute(worker);
                }
            } else if ("okAlertMessage".equals(propertyName)) {
                String text = (String) evt.getNewValue();
                if (text != null) {
                    showNoticeDialog("Confirmation", text);
                    WebSYNCClientGUIApp app = WebSYNCClientGUIApp.getApplication();
                    LogWriter worker = app.logWriteService(isUp, text, "INFO");
                    app.getContext().getTaskService().execute(worker);
                }
            } else if ("log".equals(propertyName)) {
                String text = (String) evt.getNewValue();
                String orig = viewLogTextPane.getText();
                String log = (StringUtils.isEmpty(text)
                        && (orig.equals(VIEW_LOG_INITIAL) || orig.equals(VIEW_LOG_EMPTY))) ? VIEW_LOG_EMPTY
                                : text;
                if (log.length() > MAX_LOG_VIEW_SIZE) {
                    int start = log.length() - MAX_LOG_VIEW_SIZE;
                    int end = log.length();
                    log = log.substring(start, end);
                }
                viewLogTextPane.setText(log);
            }
        }
    });

    // custom code

    // NetBeans uses the Swing Application Framework
    // Information on this framework is available here:
    // https://appframework.dev.java.net/
    // http://jsourcery.com/api/java.net/appframework/0.21/application/SingleFrameApplication.html
    // http://weblogs.java.net/blog/joconner/archive/2007/06/swing_applicati_1.html
    // https://appframework.dev.java.net/intro/index.html
    // API docs: https://appframework.dev.java.net/nonav/javadoc/AppFramework-1.03/index.html

    // Note: any tweaking of the main frame eg the size etc,
    // should be done in the WebSYNCClientGUIApp.properties file
    // located in src/nz/dataview/websyncclientgui/resources/   
    // (seems overly complex for what I'm trying to achieve, but I guess its convenient)

    initialConfigDone = false;
    initConfig();
    if (!client.isProxyConfigured())
        detectProxy();

    viewLogTimer = new Timer(3000, this);
    viewLogTimer.start();

    /*mainTabbedPane.getModel().addChangeListener(
    new ChangeListener() {
    public void stateChanged(ChangeEvent e) {
    javax.swing.DefaultSingleSelectionModel root = (javax.swing.DefaultSingleSelectionModel)e.getSource();
    if (root.getSelectedIndex() == 2) {
    viewLogTimer.start();
    } else {
    viewLogTimer.stop();
    }
    }
    }
    );*/

    statusTimer = new Timer(3 * 1000, this);
    statusTimer.start();

    browseUploadDirButton.addActionListener(this);
}

From source file:nz.govt.natlib.ndha.manualdeposit.bulkupload.BulkUploadQueueManagement.java

private void checkJobQueue() {
    if (closeDownBulkUpload) {
        return;//from  w ww.  j  a v a  2  s  .  c om
    }
    LOG.debug("Start checkJobQueue");
    int noOfJobsQueryingCMS = 0;
    int noOfJobsNotQueriedCMS = 0;
    int noOfJobsQueryingDPS = 0;
    int noOfJobsNotQueriedDPS = 0;
    int noOfJobsNotQueued = 0;
    int noOfJobsToBeBatched = 0;

    // System.out.println("Start checkJobQueue");
    synchronized (bulkUploadItems) {
        for (BulkUploadItem item : bulkUploadItems) {
            if ((item.getJobState() != JobState.Batching) && (item.getJobState() != JobState.IndigoJobCreated)
                    && (!item.getJobState().isError())) {
                noOfJobsToBeBatched++;
            }
            switch (item.getJobState()) {
            case Requested:
                noOfJobsNotQueriedCMS++;
                break;
            case QueryingCMS:
                noOfJobsQueryingCMS++;
                break;
            case CMSIDRetrieved:
                if (checkDPS) {
                    noOfJobsNotQueriedDPS++;
                } else {
                    noOfJobsNotQueued++;
                }
                break;
            case QueryingDPS:
                noOfJobsQueryingDPS++;
                break;
            case ItemDoesNotExistInDPS:
                if (!checkDPS) {
                    item.setJobState(JobState.CMSIDRetrieved);
                } else {
                    noOfJobsNotQueued++;
                }
                break;
            case ItemExistsInDPS:
                if (!checkDPS) {
                    item.setJobState(JobState.CMSIDRetrieved);
                }
                break;
            case Batching:
                if ((item.getUploadJobState() != null)
                        && (item.getUploadJobState() != UploadJob.JobState.Batching)) {
                    item.setJobState(JobState.IndigoJobCreated);
                }
                break;
            default:
                break;
            }
        }
        if (bulkUploadIsRunning && noOfJobsToBeBatched == 0 && !bulkUploadParent.isLoadingFiles()) {
            bulkUploadIsRunning = false;
        }
        if (noOfJobsNotQueriedCMS > 0
                && noOfJobsQueryingCMS < applicationProperties.getApplicationData().getBulkQueryCount()) {
            int noQuerying = 0;
            for (BulkUploadItem item : bulkUploadItems) {
                if (item.getJobState() == JobState.Requested) {
                    item.retrieveCMSDetails();
                    noQuerying++;
                    if (noQuerying + noOfJobsQueryingCMS >= applicationProperties.getApplicationData()
                            .getBulkQueryCount()) {
                        break;
                    }
                }
            }
        }
        if (checkDPS && noOfJobsNotQueriedDPS > 0
                && noOfJobsQueryingDPS < applicationProperties.getApplicationData().getBulkQueryCount()) {
            for (BulkUploadItem item : bulkUploadItems) {
                if (item.getJobState() == JobState.CMSIDRetrieved) {
                    item.checkDPS();
                }
            }
        }
        if (bulkUploadIsRunning && noOfJobsNotQueued > 0) {
            for (BulkUploadItem item : bulkUploadItems) {
                if (((item.getJobState() == JobState.CMSIDRetrieved) && (!checkDPS))
                        || (item.getJobState() == JobState.ItemDoesNotExistInDPS)) {
                    // System.out.println("Need to batch " + item.getCMSID()
                    // + ": " + item.getJobState().description());
                    if (uploadJob == null) {
                        try {
                            uploadJob = item.createJob();
                        } catch (Exception ex) {
                            LOG.error("Error creating job", ex);
                            // Should be safe to swallow this error as it
                            // would
                            // normally be handled before now.
                        }
                    } else {
                        // System.out.println("Add job " + item.getCMSID());
                        try {
                            item.addToJob(uploadJob);
                        } catch (JobQueueException jex) {
                            LOG.error("Error adding job", jex);
                            // Again, should be safe to swallow this error
                            // as it would
                            // normally be handled before now.
                        }
                    }
                    noOfJobsToBeBatched--;
                    if ((uploadJob.getJobDetail().size() >= userGroup.getBulkBatchSize())
                            || ((noOfJobsToBeBatched == 0) && (!bulkUploadParent.isLoadingFiles()))) {
                        uploadJob.prepareJobToRun();
                        theManualDepositParent.addJob(uploadJob);
                        uploadJob = null;
                    }
                }
            }
        }
    }
    if (theBulkUploadItemsTable != null) {
        theBulkUploadItemsTable.repaint();
    }
    bulkUploadParent.checkButtons();
    Action checkJobQueueAction = new AbstractAction() {
        private static final long serialVersionUID = 5562669711772031634L;

        public void actionPerformed(ActionEvent e) {
            Timer t = (Timer) e.getSource();
            t.stop();
            checkJobQueue();
        }
    };
    new Timer(applicationProperties.getApplicationData().getJobQueueRefreshInterval(), checkJobQueueAction)
            .start();
    LOG.debug("End checkJobQueue");
    // System.out.println("End checkJobQueue");
}

From source file:nz.govt.natlib.ndha.manualdeposit.CMSSearchResults.java

@SuppressWarnings("serial")
private void formWindowOpened(java.awt.event.WindowEvent evt) { // NOPMD
    try {//w  ww.j a v a  2 s.  c om
        theFormControl = new FormControl(this, theSettingsPath);
    } catch (Exception ex) {
        LOG.error("Error loading form parameters", ex);
    }
    if (theFormControl != null) {
        final Action updateDividersAction = new AbstractAction() {
            public void actionPerformed(final ActionEvent e) {
                Timer t = (Timer) e.getSource();
                t.stop();
                splitMain.setDividerLocation(theFormControl.getExtra(SPLIT_NAME, 320));
                splitMain.repaint();
                for (int i = 0; i < tblResults.getColumnModel().getColumnCount(); i++) {
                    TableColumn col = tblResults.getColumnModel().getColumn(i);
                    String colName = "Col" + i;
                    int width = theFormControl.getExtra(colName, 150);
                    col.setPreferredWidth(width);
                    col.setWidth(width);
                }
            }
        };
        new Timer(200, updateDividersAction).start();
    }
    thePresenter.showResults();
}

From source file:nz.govt.natlib.ndha.manualdeposit.dialogs.About.java

@SuppressWarnings("serial")
private void formComponentResized(java.awt.event.ComponentEvent evt) {
    paintImage();//ww w.  j av a  2s .  c  o m
    Action updateDividersAction = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            Timer t = (Timer) e.getSource();
            t.stop();
            paintImage();
            repaint();
        }
    };
    new Timer(200, updateDividersAction).start();
}

From source file:nz.govt.natlib.ndha.manualdeposit.jobmanagement.JobQueueManagement.java

private void checkJobQueue() {
    LOG.debug("Start checkJobQueue");
    boolean itemsMoved = checkAndMoveJobs(jobQueueRunning) || checkAndMoveJobs(jobQueuePending)
            || checkAndMoveJobs(jobQueueFailed) || checkAndMoveJobs(jobQueueDeposited)
            || checkAndMoveJobs(jobQueueInPermanent) || checkAndMoveJobs(jobQueueAwaitingCleanup);
    while ((!jobQueuePending.isEmpty())
            && (jobQueueRunning.size() < theAppProperties.getApplicationData().getMaximumJobsRunning())) {
        UploadJob job;//from   w w w  .ja  v  a2  s.  co  m
        // need to take either the first or last depending on whether the
        // queue is sorted Asc or Desc
        int jobNumber;
        if (personalSettings.isSortPendingAscending()) {
            jobNumber = 0;
        } else {
            jobNumber = jobQueuePending.size() - 1;
        }
        job = jobQueuePending.get(jobNumber);
        while (job.isCreatingCopy() && jobNumber >= 0 && jobNumber < jobQueuePending.size()) {
            if (personalSettings.isSortPendingAscending()) {
                jobNumber++;
            } else {
                jobNumber--;
            }
            if (jobNumber >= 0 && jobNumber < jobQueuePending.size()) {
                job = jobQueuePending.get(jobNumber);
            }
        }
        if (job.isCreatingCopy()) {
            break;
        }
        if (job.lock()) {
            jobQueuePending.remove(job);
            jobQueueRunning.add(job);
            itemsMoved = true;
            Thread t = new Thread(job);
            t.start();
            job.unlock();
        } else {
            LOG.debug("Couldn't lock job " + job.getJobDetail().get(0).getEntityName());
            try {
                Thread.sleep(100);
            } catch (Exception ex) {
            }
        }
    }
    if (itemsMoved) {
        refreshJobQueue();
    }
    if (theJobQueuePendingTable != null) {
        theJobQueuePendingTable.repaint();
    }
    if (theJobQueueRunningTable != null) {
        theJobQueueRunningTable.repaint();
    }
    if (theJobQueueFailedTable != null) {
        theJobQueueFailedTable.repaint();
    }
    if (theJobQueueDepositedTable != null) {
        theJobQueueDepositedTable.repaint();
    }
    if (theJobQueueInPermanentTable != null) {
        theJobQueueInPermanentTable.repaint();
    }
    final Action checkJobQueueAction = new AbstractAction() {
        private static final long serialVersionUID = 5562669711772031634L;

        public void actionPerformed(final ActionEvent e) {
            Timer t = (Timer) e.getSource();
            t.stop();
            checkJobQueue();
        }
    };
    new Timer(theAppProperties.getApplicationData().getJobQueueRefreshInterval(), checkJobQueueAction).start();
    LOG.debug("End checkJobQueue");
}

From source file:nz.govt.natlib.ndha.manualdeposit.jobmanagement.JobQueueManagement.java

private void checkSipStatus() {
    LOG.debug("Start checkSipStatus");
    for (int i = jobQueueDeposited.size() - 1; i >= 0; i--) {
        final UploadJob job = jobQueueDeposited.get(i);
        job.checkSipStatus();//from  w  ww . jav a2s.com
    }
    for (int i = jobQueueAwaitingCleanup.size() - 1; i >= 0; i--) {
        final UploadJob job = jobQueueAwaitingCleanup.get(i);
        job.checkForCleanup();
    }
    final Action checkSipStatusAction = new AbstractAction() {
        private static final long serialVersionUID = -8315654343127184873L;

        public void actionPerformed(final ActionEvent e) {
            Timer t = (Timer) e.getSource();
            t.stop();
            checkSipStatus();
        }
    };
    new Timer(theAppProperties.getApplicationData().getSipStatusRefreshInterval(), checkSipStatusAction)
            .start();
    LOG.debug("End checkSipStatus");
}

From source file:nz.govt.natlib.ndha.manualdeposit.jobmanagement.UploadJob.java

private void checkDigestStatus() {
    printDebugInfo("Check digest status");
    if (theDigest == null) {
        return;/* w  w w. j  a va  2  s  .  c  om*/
    }
    if (theDigest.getFinished()) {
        isCopyFinished = true;
        boolean allSucceeded = true;
        StringBuilder errorMessage = new StringBuilder();
        errorMessage.append("The following files were not copied successfully:");
        for (ChecksumDigest.FileStatus status : theDigest.getFileStatii()) {
            if (!status.getFileCopyIsIdentical()) {
                allSucceeded = false;
                errorMessage.append("\n");
                errorMessage.append(status.getFSO().getFullPath());
            }
        }
        if (allSucceeded) {
            for (ChecksumDigest.FileStatus status : theDigest.getFileStatii()) {
                FileSystemObject fso = status.getFSO();
                fso.setFile(fso.getDestinationFile());
            }
        } else {
            for (FileStatus status : theDigest.getFileStatii()) {
                File parent = status.getFSO().getDestinationFile().getParentFile();
                LOG.debug("Deleting file " + status.getFSO().getDestinationFile().getAbsolutePath());
                status.getFSO().getDestinationFile().delete();
                FileUtils.deleteEmptyDirectoryRecursive(parent);
            }
        }

        if (theJobState == JobState.Requested) {
            theJobState = JobState.Pending;
        }
        saveJob(false);
        if (allSucceeded) {
            for (ChecksumDigest.FileStatus status : theDigest.getFileStatii()) {
                if (status.getFileCopyIsIdentical()) {
                    FileSystemObject fso = status.getFSO();
                    fso.setFile(fso.getDestinationFile());
                } else {
                    allSucceeded = false;
                    errorMessage.append("\n");
                    errorMessage.append(status.getFSO().getFullPath());
                }
            }
        } else {
            jobDetailStatus = errorMessage.toString();
        }
    } else {
        Action checkDigestStatusAction = new AbstractAction() {
            private static final long serialVersionUID = 5562669711772031634L;

            public void actionPerformed(ActionEvent e) {
                Timer t = (Timer) e.getSource();
                t.stop();
                checkDigestStatus();
            }
        };
        new Timer(500, checkDigestStatusAction).start();
    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

@SuppressWarnings("serial")
public void setupScreen(final AppProperties appProperties, final String settingsPath) throws Exception {
    LOG.debug("setupScreen");
    this.setJMenuBar(mnuMain);
    theSettingsPath = settingsPath;/* w ww.jav a  2  s.  co m*/
    LOG.debug("setupScreen, setting provenance event presenter");
    theAppProperties = appProperties;
    theUserGroupData = theAppProperties.getUserData().getUser(theAppProperties.getLoggedOnUser())
            .getUserGroupData();
    final boolean searchVisible = (theUserGroupData.isIncludeCMS2Search()
            || theUserGroupData.isIncludeCMS1Search() || theUserGroupData.isIncludeProducerList()
            || theUserGroupData.isIncludeNoCMSOption());
    pnlCmsReference.setVisible(searchVisible);
    mnuViewShowSearch.setVisible(searchVisible);
    if (theUserGroupData.isIncludeCMS2Search()) {
        rbnCMS2.setSelected(true);
    } else if (theUserGroupData.isIncludeCMS1Search()) {
        rbnCMS1.setSelected(true);
    } else if (theUserGroupData.isIncludeProducerList()) {
        rbnStaffMediated.setSelected(true);
    } else if (theUserGroupData.isIncludeNoCMSOption()) {
        rbnNoCmsRef.setSelected(true);
    }
    rbnCMS2.setVisible(theUserGroupData.isIncludeCMS2Search());
    rbnCMS1.setVisible(theUserGroupData.isIncludeCMS1Search());
    rbnNoCmsRef.setVisible(theUserGroupData.isIncludeNoCMSOption());
    rbnStaffMediated.setVisible(theUserGroupData.isIncludeProducerList());
    rbnCMS1.setText(theAppProperties.getApplicationData().getCMS1Label());
    rbnCMS2.setText(theAppProperties.getApplicationData().getCMS2Label());
    if (theUserGroupData.isIncludeCMS2Search()) {
        rbnCMS2.setSelected(true);
    } else {
        if (theUserGroupData.isIncludeCMS1Search()) {
            rbnCMS1.setSelected(true);
        } else {
            rbnNoCmsRef.setSelected(true);
        }
    }
    setTitle(title + theAppProperties.getAppVersion());
    ClassLoader cLoader = Thread.currentThread().getContextClassLoader();
    java.net.URL imageURL = cLoader.getResource("Indigo_logo_64x64.jpg");
    setIconImage(Toolkit.getDefaultToolkit().getImage(imageURL));
    LOG.debug("setupScreen, setting FormControl");
    try {
        theFormControl = new FormControl(this, theSettingsPath);
        fixBackwardsCompatibility();
    } catch (Exception ex) {
        LOG.error("Error loading form parameters", ex);
    }
    LOG.debug("setupScreen, adding handlers");
    depositPresenter.addHandlers(treeFileSystem, treeEntities, treeStructMap, cmbSelectTemplate,
            cmbSelectStructTemplate, cmbSortBy, cmbFixityType, tblDetail, tblJobQueueRunning,
            tblJobQueuePending, tblJobQueueFailed, tblJobQueueDeposited, tblJobQueueComplete, mnuFileFavourites,
            lstProducers, lstMaterialFlow);
    LOG.debug("setupScreen, handlers added");
    checkButtons();
    setCMSDetails();
    setHotKeyVisibility();
    depositPresenter.checkForInitialLoadScreenSizes(theFormControl, splitAddIE, SPLIT_IE_ATTR, splitMain,
            SPLIT_MAIN_ATTR, splitMainDetail, SPLIT_MAIN_DETAIL_ATTR, splitMainRight, SPLIT_MAIN_RIGHT_ATTR);
    final Action updateDividersAction = new AbstractAction() {
        public void actionPerformed(final ActionEvent e) {
            Timer t = (Timer) e.getSource();
            t.stop();
            splitAddIE.setDividerLocation(theFormControl.getExtra(SPLIT_IE_ATTR, 175));
            splitMain.setDividerLocation(theFormControl.getExtra(SPLIT_MAIN_ATTR, 200));
            splitMainDetail.setDividerLocation(theFormControl.getExtra(SPLIT_MAIN_DETAIL_ATTR, 200));
            splitMainRight.setDividerLocation(theFormControl.getExtra(SPLIT_MAIN_RIGHT_ATTR, 200));
            splitMain.repaint();
            splitMainDetail.repaint();
            splitMainRight.repaint();
            TableColumn col = tblDetail.getColumnModel().getColumn(0);
            col.setPreferredWidth(theFormControl.getExtra(META_DATA_COL_1_ATTR, 200));
            col = tblDetail.getColumnModel().getColumn(1);
            col.setPreferredWidth(theFormControl.getExtra(META_DATA_COL_2_ATTR, 200));

            MultiSplitLayout layout = mspJobQueue.getMultiSplitLayout();
            layout.setFloatingDividers(false);
            MultiSplitLayout.Split model = (MultiSplitLayout.Split) layout.getModel();
            MultiSplitLayout.Divider divider = (MultiSplitLayout.Divider) model.getChildren().get(1);
            Rectangle bounds = divider.getBounds();
            int top = theFormControl.getExtra(JOB_QUEUE_DIVIDER_1_ATTR, bounds.y);
            bounds.y = top;
            divider.setBounds(bounds);
            theOldHeight1 = top;

            divider = (MultiSplitLayout.Divider) model.getChildren().get(3);
            bounds = divider.getBounds();
            top = theFormControl.getExtra(JOB_QUEUE_DIVIDER_2_ATTR, bounds.y);
            bounds.y = top;
            divider.setBounds(bounds);
            theOldHeight2 = top;

            divider = (MultiSplitLayout.Divider) model.getChildren().get(5);
            bounds = divider.getBounds();
            top = theFormControl.getExtra(JOB_QUEUE_DIVIDER_3_ATTR, bounds.y);
            bounds.y = top;
            divider.setBounds(bounds);
            theOldHeight3 = top;

            divider = (MultiSplitLayout.Divider) model.getChildren().get(7);
            bounds = divider.getBounds();
            top = theFormControl.getExtra(JOB_QUEUE_DIVIDER_4_ATTR, bounds.y);
            bounds.y = top;
            divider.setBounds(bounds);
            theOldHeight4 = top;
        }
    };
    new Timer(200, updateDividersAction).start();
    final PersonalSettings personalSettings = theAppProperties.getApplicationData().getPersonalSettings();
    theStandardFont = personalSettings.getStandardFont();
    final SortBy sortBy = personalSettings.getSortFilesBy();
    for (int i = 0; i < cmbSortBy.getItemCount(); i++) {
        final SortBy item = (SortBy) cmbSortBy.getItemAt(i);
        if (item.equals(sortBy)) {
            cmbSortBy.setSelectedIndex(i);
            break;
        }
    }
    setJobQueuePanes();
    LOG.debug("setupScreen, end");
    addHotKeyListener(this);
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

@SuppressWarnings("serial")
private void stopEditingTree() {
    treeFileSystem.stopEditing();/* ww  w.j  a va2  s  .  c o  m*/
    Action stopEditingAction = new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            Timer t = (Timer) e.getSource();
            t.stop();
            try {
                treeFileSystem.stopEditing();
            } catch (Exception ex) {
            }
        }
    };
    new Timer(100, stopEditingAction).start();
}