Example usage for java.awt Cursor getPredefinedCursor

List of usage examples for java.awt Cursor getPredefinedCursor

Introduction

In this page you can find the example usage for java.awt Cursor getPredefinedCursor.

Prototype

public static Cursor getPredefinedCursor(int type) 

Source Link

Document

Returns a cursor object with the specified predefined type.

Usage

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#onDataObjectSave(List, int)
 *//*w ww  . j a  v a2s. c  o m*/
public void onDataObjectSave(List data, int operation) {
    int state = model.getState();
    if (operation == REMOVE_OBJECT && state != SAVE)
        throw new IllegalStateException("This method can only be " + "invoked in the SAVE state");
    switch (state) {
    case DISCARDED:
        throw new IllegalStateException("This method cannot be " + "invoked in the DISCARDED state");
    }
    if (data == null)
        throw new IllegalArgumentException("No data object. ");
    switch (operation) {
    case CREATE_OBJECT:
    case UPDATE_OBJECT:
    case REMOVE_OBJECT:
        break;
    default:
        throw new IllegalArgumentException("Save operation not " + "supported.");
    }
    //removeEditor(); //remove the currently selected editor.
    if (operation == REMOVE_OBJECT) {
        model.setState(READY);
        fireStateChange();
    }
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    setStatus(false, "", true);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:org.pentaho.reporting.designer.core.editor.report.AbstractRenderComponent.java

protected void updateCursorForIndicator() {
    if (currentIndicator == null) {
        setCursor(Cursor.getDefaultCursor());
        return;/*  ww w .  j av a  2s. c  om*/
    }
    switch (currentIndicator) {
    case NOT_IN_RANGE:
        setCursor(Cursor.getDefaultCursor());
        break;
    case MOVE:
        setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
        break;
    case BOTTOM_CENTER:
        setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
        break;
    case BOTTOM_LEFT:
        setCursor(Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR));
        break;
    case BOTTOM_RIGHT:
        setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
        break;
    case MIDDLE_LEFT:
        setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
        break;
    case MIDDLE_RIGHT:
        setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
        break;
    case TOP_LEFT:
        setCursor(Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR));
        break;
    case TOP_CENTER:
        setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
        break;
    case TOP_RIGHT:
        setCursor(Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
        break;
    }
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#clearFoundResults()/*from  w w  w  . ja  v a 2s  .c  om*/
 */
public void clearFoundResults() {
    switch (model.getState()) {
    case DISCARDED:
    case SAVE:
        return;
    }
    Browser browser = model.getSelectedBrowser();
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    if (browser != null) {
        browser.accept(new ClearVisitor());
        browser.setFoundInBrowser(null);
    }
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:tvbrowser.ui.mainframe.MainFrame.java

/**
 * Show Settings Dialog for a specific TabId
 *
 * @param visibleTabId//from w  w  w  .  java  2 s  .  com
 *          Id of the specific Tab
 */
public void showSettingsDialog(final String visibleTabId) {
    if (mSettingsWillBeOpened) {
        return;
    }

    new Thread(new Runnable() {
        public void run() {
            mSettingsWillBeOpened = true;

            // show busy cursor
            Window comp = UiUtilities.getLastModalChildOf(MainFrame.getInstance());
            ProgramTable programTable = MainFrame.getInstance().getProgramTableScrollPane().getProgramTable();
            Cursor oldWindowCursor = comp.getCursor();
            Cursor oldTableCursor = programTable.getCursor();
            comp.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            programTable.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            SettingsDialog dlg = new SettingsDialog(MainFrame.this, visibleTabId);
            dlg.centerAndShow();

            // restore cursors
            programTable.setCursor(oldTableCursor);
            comp.setCursor(oldWindowCursor);

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    Settings.handleChangedSettings();
                    if (mPluginView != null) {
                        mPluginView.refreshTree();
                    }
                }
            });
            mSettingsWillBeOpened = false;
        }
    }, "Show settings dialog").start();
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#addExistingObjects(DataObject)
 *///w ww  .  j  a v  a 2  s.  c o m
public void addExistingObjects(DataObject ho) {
    if (model.getState() == DISCARDED)
        throw new IllegalStateException("This method cannot be invoked in the DISCARDED state.");
    if (ho == null)
        throw new IllegalArgumentException("No object.");
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    model.fireDataExistingObjectsLoader(ho);
    fireStateChange();
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#setExistingObjects(List)
 *//*from w w  w .ja v  a2 s  . c  o m*/
public void setExistingObjects(List objects) {
    if (model.getState() != LOADING_DATA)
        throw new IllegalStateException("This method cannot be invoked in the LOADING_DATA state.");
    setStatus(false, "", true);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    model.setState(READY);
    if (CollectionUtils.isEmpty(objects))
        return;
    Browser b = model.getSelectedBrowser();
    List<Object> available = new ArrayList<Object>();
    List<Object> immutable = new ArrayList<Object>();
    Set selected = null;
    if (b != null) {
        TreeImageDisplay[] values = b.getSelectedDisplays();
        if (values != null && values.length > 0) {
            // Only modify the first group from the list of groups
            Object value = values[0].getUserObject();
            if (value instanceof GroupData) {
                long groupId = ((GroupData) value).getId();
                ExperimenterData currentUser = model.getExperimenter();
                selected = new HashSet<ExperimenterData>();
                long userID = currentUser.getId();
                long id;
                List<Long> ids = new ArrayList<Long>();
                for (ExperimenterData experimenter : (List<ExperimenterData>) objects) {
                    id = experimenter.getId();
                    if (experimenter.isMemberOfGroup(groupId)) {
                        ids.add(id);
                        selected.add(experimenter);
                        //Cannot move guest or root
                        if ((model.isSystemUser(id, GroupData.GUEST)
                                && model.isSystemGroup(groupId, GroupData.GUEST))) {
                            immutable.add(experimenter);
                        } else if (model.isSystemGroup(groupId, GroupData.SYSTEM)) {
                            if (model.isSystemUser(id, GroupData.SYSTEM) || id == userID) {
                                immutable.add(experimenter);
                            }
                        }
                    }
                    if (!ids.contains(experimenter.getId())) {
                        available.add(experimenter);
                    }
                }
            }
        } else {
            available.addAll(objects);
        }
    }
    fireStateChange();
    SelectionWizard d = new SelectionWizard(view, available, selected, objects.get(0).getClass(),
            TreeViewerAgent.getUserDetails());
    d.setImmutableElements(immutable);
    IconManager icons = IconManager.getInstance();
    String title = "User Selection";
    String text = "Select the Users who should be in the selected group.";
    Icon icon = icons.getIcon(IconManager.OWNER_48);
    d.setTitle(title, text, icon);
    d.addPropertyChangeListener(controller);
    UIUtilities.centerAndShow(d);
}

From source file:org.jab.docsearch.DocSearch.java

/**
 * Load properties file./*from   w  ww  . java2s. c o m*/
 *
 * @param propertiesFile
 *            Properties file
 * @return Properties
 */
private Properties loadProperties(String propertiesFile) {
    logger.debug("loadProperties('" + propertiesFile + "') entered");

    // cursor "wait"
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    // read property file
    Properties props = new Properties();
    FileInputStream fileIn = null;
    try {
        File propsFile = new File(propertiesFile);
        if (propsFile.isFile()) {
            fileIn = new FileInputStream(propsFile);
            props.load(fileIn);
        } else {
            logger.error("loadProperties() " + propertiesFile + " isn't a file!");
        }
    } catch (IOException ioe) {
        logger.fatal("loadProperties() failed", ioe);
        showMessage(dsErrLdgFi, "\n" + propertiesFile + "\n\n : " + ioe.toString());
    } finally {
        IOUtils.closeQuietly(fileIn);
    }

    // cursor "default"
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

    return props;
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#addExistingObjects(Set)
 *///from w  ww .  java  2s. c om
public void addExistingObjects(Set set) {
    if (model.getState() != LOADING_SELECTION)
        throw new IllegalStateException("This method cannot be invoked in the LOADING_DATA state.");
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    if (set == null || set.size() == 0)
        model.setState(READY);
    else {
        model.fireAddExistingObjects(set);
    }
    fireStateChange();
}

From source file:org.nuclos.client.main.MainController.java

/**
 * the main frame is about to close/*from   w  w w.  jav a 2 s. c o  m*/
 */
public void cmdWindowClosing(final ResultListener<Boolean> rl) {
    allControllersMayBeClosed(new ResultListener<Boolean>() {
        @Override
        public void done(Boolean result) {
            if (Boolean.TRUE.equals(result)) {
                getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                try {

                    getMainFrame().writeMainFramePreferences(prefs);
                    getRestoreUtils().storeWorkspace(getMainFrame().getWorkspace());

                    LocalUserCaches.getInstance().store();

                    if (ctlTasks != null) {
                        ctlTasks.close();
                    } else {
                        LOG.debug("TaskController is null!");
                    }

                    LOG.debug("removes unused preferences...");
                    removeUnusedPreferences();

                    closeAllControllers();
                } catch (Exception ex) {
                    final String sMessage = getSpringLocaleDelegate().getMessage("MainController.20",
                            "Die Sitzungsdaten, die Informationen \u00fcber die zuletzt ge\u00f6ffneten Fenster enthalten,\n"
                                    + "konnten nicht geschrieben werden. Bei der n\u00e4chsten Sitzung k\u00f6nnen nicht alle Fenster\n"
                                    + "wiederhergestellt werden. Bitte \u00f6ffnen Sie diese Fenster in der n\u00e4chsten Sitzung erneut.");
                    Errors.getInstance().showExceptionDialog(getMainFrame(), sMessage, ex);
                } catch (Error error) {
                    LOG.error("Beim Beenden des Clients ist ein fataler Fehler aufgetreten.", error);
                } finally {
                    // exit even on <code>Error</code>s, especially <code>NoClassDefFoundError</code>s,
                    // which may result from installing a different version while a client is running.
                    cmdExit();
                }

                rl.done(true);
            } else {
                rl.done(false);
            }
        }
    });
}

From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowser.java

private void formatCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {
    int row = getSelectedMessageIndex();

    if (row >= 0) {
        this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        MessageBrowserTableNode messageNode = (MessageBrowserTableNode) messageTreeTable.getPathForRow(row)
                .getLastPathComponent();
        Long messageId = messageNode.getMessageId();
        Integer metaDataId = messageNode.getMetaDataId();

        Message message = messageCache.get(messageId);
        ConnectorMessage connectorMessage;

        connectorMessage = message.getConnectorMessages().get(metaDataId);

        updateDescriptionMessages(connectorMessage);

        this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }//from w ww  .  j ava2  s . c o  m
}