/**
  * Creates a new instance.
  *
  * @param model The model. Mustn't be <code>null</code>.
  * @param createSingleFigure Passed <code>true</code> to set the tool to create a single figure at
  *     a time, <code>false</code> otherwise.
  */
 public CreateFigureAction(MeasurementViewer model, boolean createSingleFigure) {
   super(model);
   this.createSingleFigure = createSingleFigure;
   if (createSingleFigure) {
     name = NAME_CREATE_SINGLE;
     putValue(Action.NAME, NAME_CREATE_SINGLE);
     putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_CREATE_SINGLE));
   } else {
     name = NAME_CREATE_MULTIPLE;
     putValue(Action.NAME, NAME_CREATE_MULTIPLE);
     putValue(
         Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_CREATE_MULTIPLE));
   }
 }
示例#2
0
 /**
  * Creates a new instance.
  *
  * @param model Reference to the Model. Mustn't be <code>null</code>.
  */
 public TaggingAction(DataBrowser model) {
   super(model);
   putValue(Action.NAME, NAME);
   putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION));
   IconManager im = IconManager.getInstance();
   putValue(Action.SMALL_ICON, im.getIcon(IconManager.TAG));
 }
 /**
  * Creates a new instance.
  *
  * @param model Reference to the Model. Mustn't be <code>null</code>.
  */
 public RefreshExperimenterData(TreeViewer model) {
   super(model);
   putValue(Action.NAME, NAME);
   putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION));
   IconManager im = IconManager.getInstance();
   putValue(Action.SMALL_ICON, im.getIcon(IconManager.REFRESH));
 }
 /**
  * Creates a new instance.
  *
  * @param model Reference to the Model. Mustn't be <code>null</code>.
  */
 public CollapseAction(Browser model) {
   super(model);
   setEnabled(true);
   putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION));
   IconManager im = IconManager.getInstance();
   putValue(Action.SMALL_ICON, im.getIcon(IconManager.COLLAPSE));
 }
示例#5
0
 /**
  * Creates a new instance.
  *
  * @param model Reference to the Model. Mustn't be <code>null</code>.
  */
 public TaggingAction(TreeViewer model) {
   super(model);
   name = NAME;
   putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION));
   description = (String) getValue(Action.SHORT_DESCRIPTION);
   IconManager im = IconManager.getInstance();
   putValue(Action.SMALL_ICON, im.getIcon(IconManager.TAG));
 }
示例#6
0
 /**
  * Creates a new instance.
  *
  * @param model Reference to the Model. Mustn't be <code>null</code>.
  */
 public LogOffAction(TreeViewer model) {
   super(model);
   name = NAME;
   putValue(Action.NAME, NAME);
   putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION));
   IconManager im = IconManager.getInstance();
   putValue(Action.SMALL_ICON, im.getIcon(IconManager.LOGIN));
 }
 /**
  * Checks if the passed value is supported.
  *
  * @param value The value to handle.
  */
 private void checkType(int value) {
   IconManager icons = IconManager.getInstance();
   switch (value) {
     case PROJECT:
       name = NAME_PROJECT;
       putValue(Action.SMALL_ICON, icons.getIcon(IconManager.PROJECT));
       putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_PROJECT));
       break;
     case DATASET:
       name = NAME_DATASET;
       putValue(Action.SMALL_ICON, icons.getIcon(IconManager.DATASET));
       putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_DATASET));
       break;
     case TAG:
       name = NAME_TAG;
       putValue(Action.SMALL_ICON, icons.getIcon(IconManager.TAG));
       putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_TAG));
       break;
     case TAG_SET:
       name = NAME_TAG_SET;
       putValue(Action.SMALL_ICON, icons.getIcon(IconManager.TAG_SET));
       putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_TAG_SET));
       break;
     case SCREEN:
       name = NAME_SCREEN;
       putValue(Action.SMALL_ICON, icons.getIcon(IconManager.SCREEN));
       putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_SCREEN));
       break;
     case GROUP:
       name = NAME_GROUP;
       putValue(Action.SMALL_ICON, icons.getIcon(IconManager.OWNER_GROUP));
       putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_GROUP));
       break;
     case EXPERIMENTER:
       name = NAME_EXPERIMENTER;
       putValue(Action.SMALL_ICON, icons.getIcon(IconManager.OWNER));
       putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION_EXPERIMENTER));
       break;
     default:
       throw new IllegalArgumentException("Type not supported.");
   }
 }
示例#8
0
  /**
   * Creates and initializes the components
   *
   * @param userName The name of the user.
   * @param hostName The default hostName.
   */
  private void initialize(String userName, String hostName) {
    components = new ArrayList<JComponent>();
    // status update.
    currentTask = new JLabel();
    Font newFont = currentTask.getFont().deriveFont(8);
    currentTask.setFont(newFont);
    currentTask.setForeground(ScreenLogin.TEXT_COLOR);
    progressBar = new JProgressBar();
    progressBar.setVisible(false);
    progressBar.setStringPainted(false);
    progressBar.setFont(newFont);

    originalName = userName;
    user = new JTextField();
    user.setName("username field");
    user.setText(userName);
    user.setToolTipText("Enter your username.");
    user.setColumns(TEXT_COLUMN);
    pass = new JPasswordField();
    pass.setName("password field");
    pass.setToolTipText("Enter your password.");
    pass.setColumns(TEXT_COLUMN);
    Map<String, String> servers = editor.getServers();
    if (CommonsLangUtils.isNotBlank(hostName)) {
      serverName = hostName;
      // if user did point to another server
      if (servers != null && servers.size() > 0) {
        int n = servers.size() - 1;
        Iterator<String> i = servers.keySet().iterator();
        int k = 0;
        String value;
        while (i.hasNext()) {
          serverName = i.next();
          if (k == n) {
            value = servers.get(serverName);
            if (value != null) {
              try {
                selectedPort = Integer.parseInt(value);
              } catch (Exception e) {
              }
            }
          }
          k++;
        }
      } else {
        editor.removeLastRow();
        editor.addRow(hostName);
      }
    } else {
      if (servers == null || servers.size() == 0) serverName = hostName;
      else {
        int n = servers.size() - 1;
        Iterator<String> i = servers.keySet().iterator();
        int k = 0;
        String value;
        while (i.hasNext()) {
          serverName = i.next();
          if (k == n) {
            value = servers.get(serverName);
            if (value != null) {
              try {
                selectedPort = Integer.parseInt(value);
              } catch (Exception e) {
              }
            }
          }
          k++;
        }
      }
    }
    if (serverName.length() == 0) serverName = DEFAULT_SERVER;
    if (!DEFAULT_SERVER.equals(serverName)) originalServerName = serverName;
    connectionSpeedText = new JLabel(getConnectionSpeed());
    connectionSpeedText.setForeground(TEXT_COLOR);
    connectionSpeedText.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    serverText = UIUtilities.buildTextPane(serverName, TEXT_COLOR);
    serverText.setName("server name text pane");

    serverTextPane = UIUtilities.buildComponentPanelRight(serverText, false);
    serverTextPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));

    initializeGroups();
    ref = new ArrayList<JComponent>();
    login = new JButton("Login");
    login.setName("login button");
    defaultForeground = login.getForeground();
    login.setMnemonic('L');
    login.setToolTipText("Login");
    setButtonDefault(login);
    login.setEnabled(false);
    // UIUtilities.enterPressesWhenFocused(login);
    UIUtilities.opacityCheck(login);
    cancel = new JButton("Quit");
    cancel.setMnemonic('Q');
    cancel.setToolTipText("Cancel Login.");
    setButtonDefault(cancel);
    UIUtilities.opacityCheck(cancel);
    configButton = new JButton();
    configButton.setName("config server button");
    configButton.setMnemonic('X');
    configButton.setToolTipText("Enter the server's address.");
    configButton.setBorderPainted(false);
    configButton.setBorder(null);
    // configButton.setMargin(new Insets(1, 1, 1, 1));
    configButton.setFocusPainted(false);
    configButton.setContentAreaFilled(false);
    IconManager icons = IconManager.getInstance();
    configButton.setIcon(icons.getIcon(IconManager.CONFIG_24));
    // configButton.setPressedIcon(icons.getIcon(
    //		IconManager.CONFIG_PRESSED_24));

    encrypted = !isEncrypted();
    encryptedButton = new JButton();
    List<String> tips = new ArrayList<String>();
    tips.add("The connection to the server is always encrypted.");
    tips.add(
        "If selected, the data transfer (e.g. annotations, images) " + "will also be encrypted.");
    tips.add("But the transfer will be much slower.");

    encryptedButton.setToolTipText(UIUtilities.formatToolTipText(tips));
    encryptedButton.setBorderPainted(false);
    encryptedButton.setBorder(null);
    encryptedButton.setFocusPainted(false);
    encryptedButton.setContentAreaFilled(false);
    if (encrypted) encryptedButton.setIcon(icons.getIcon(IconManager.ENCRYPTED_24));
    else encryptedButton.setIcon(icons.getIcon(IconManager.DECRYPTED_24));
    getRootPane().setDefaultButton(login);
    enableControls();
  }
示例#9
0
 /**
  * Creates a new instance.
  *
  * @param model Reference to the Model. Mustn't be <code>null</code>.
  */
 public ShowNameAction(Browser model) {
   super(model);
   putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION));
   IconManager im = IconManager.getInstance();
   putValue(Action.SMALL_ICON, im.getIcon(IconManager.MESSED_WORDS));
 }
示例#10
0
 /**
  * Creates a new instance.
  *
  * @param model Reference to the Model. Mustn't be <code>null</code>.
  */
 public ManagerAction(TreeViewer model) {
   super(model);
   putValue(Action.SHORT_DESCRIPTION, UIUtilities.formatToolTipText(DESCRIPTION));
   IconManager im = IconManager.getInstance();
   putValue(Action.SMALL_ICON, im.getIcon(IconManager.DATA_MANAGER));
 }