Ejemplo n.º 1
0
  /**
   * Adds the specified files to the list of import data.
   *
   * @param files The files to import.
   */
  private void insertFiles(Map<File, StatusLabel> files) {
    if (files == null || files.size() == 0) {
      statusLabel.setText("No files to import.");
      return;
    }
    components = new HashMap<File, FileImportComponent>();
    totalFiles = files.size();
    String text = "Importing " + totalFiles + " file";
    if (totalFiles > 1) text += "s";
    statusLabel.setText(text);

    Entry entry;
    Iterator i = files.entrySet().iterator();
    FileImportComponent c;
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    int index = 0;
    p.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    File f;
    DatasetData d = dataset;
    Object node = refNode;
    if (folderAsContainer) {
      node = null;
      d = new DatasetData();
      d.setName(file.getName());
    }
    while (i.hasNext()) {
      entry = (Entry) i.next();
      f = (File) entry.getKey();
      c = new FileImportComponent(f, folderAsContainer, browsable, group, singleGroup);
      if (f.isFile()) {
        c.setLocation(data, d, node);
        c.setParent(this);
      }
      c.showContainerLabel(showContainerLabel);
      c.setType(getType());
      attachListeners(c);
      c.setStatusLabel((StatusLabel) entry.getValue());
      if (index % 2 == 0) c.setBackground(UIUtilities.BACKGROUND_COLOUR_EVEN);
      else c.setBackground(UIUtilities.BACKGROUND_COLOUR_ODD);
      components.put((File) entry.getKey(), c);
      p.add(c);
      index++;
    }
    removeAll();
    pane = EditorUtil.createTaskPane("");
    pane.setCollapsed(false);
    setNumberOfImport();

    IconManager icons = IconManager.getInstance();
    pane.setIcon(icons.getIcon(IconManager.DIRECTORY));
    Font font = pane.getFont();
    pane.setFont(font.deriveFont(font.getStyle(), font.getSize() - 2));
    pane.add(p);
    double[][] size = {{TableLayout.FILL}, {TableLayout.PREFERRED}};
    setLayout(new TableLayout(size));
    add(pane, "0, 0");
    validate();
    repaint();
  }
Ejemplo n.º 2
0
 /**
  * Calculates the size of the unit bar.
  *
  * @param ratio The ratio to multiple the value by.
  * @return
  */
 private double getBarSize(double ratio) {
   double v = unitInRefUnits;
   double t = EditorUtil.transformSize(getPixelsSizeX()).getValue();
   if (t > 0) v = unitInRefUnits / t;
   v *= ratio;
   return v;
 }
 /**
  * Returns the text indicating what to save.
  *
  * @return See above.
  */
 String getInstanceToSave() {
   Object ref = getRefObject();
   String v = "";
   if (ref instanceof ImageData) {
     v = "Image's Data: ";
     v += EditorUtil.truncate(((ImageData) ref).getName());
   } else if (ref instanceof DatasetData) {
     v = "Dataset's Data: ";
     v += EditorUtil.truncate(((DatasetData) ref).getName());
   } else if (ref instanceof ProjectData) {
     v = "Project's Data: ";
     v += EditorUtil.truncate(((ProjectData) ref).getName());
   } else if (ref instanceof PlateData) {
     v = "Plate's Data: ";
     v += EditorUtil.truncate(((PlateData) ref).getName());
   } else if (ref instanceof PlateAcquisitionData) {
     v = "Run's Data: ";
     v += EditorUtil.truncate(((PlateAcquisitionData) ref).getLabel());
   } else if (ref instanceof ScreenData) {
     v = "Screen's Data: ";
     v += EditorUtil.truncate(((ScreenData) ref).getName());
   } else if (ref instanceof ExperimenterData) {
     v = EditorUtil.formatExperimenter((ExperimenterData) ref);
     v += "'s details";
   }
   if (ref instanceof GroupData) {
     v = ((GroupData) ref).getName();
     v += "'s details";
   }
   return v;
 }
Ejemplo n.º 4
0
  /** Initializes the UI components. */
  private void initComponents() {
    container = new JPanel();

    previewPanel.addPropertyChangeListener(this);
    imagePane = EditorUtil.createTaskPane("OMERO.editor");
    // imagePane.setCollapsed(false);
    imagePane.add(previewPanel);
    imagePane.addPropertyChangeListener(UIUtilities.COLLAPSED_PROPERTY_JXTASKPANE, this);
  }
 /**
  * Returns the name of the object if any.
  *
  * @return See above.
  */
 String getRefObjectName() {
   Object ref = getRefObject();
   if (ref instanceof ImageData) return ((ImageData) ref).getName();
   else if (ref instanceof DatasetData) return ((DatasetData) ref).getName();
   else if (ref instanceof ProjectData) return ((ProjectData) ref).getName();
   else if (ref instanceof PlateData) return ((PlateData) ref).getName();
   else if (ref instanceof ScreenData) return ((ScreenData) ref).getName();
   else if (ref instanceof ExperimenterData)
     return EditorUtil.formatExperimenter((ExperimenterData) ref);
   else if (ref instanceof GroupData) return ((GroupData) ref).getName();
   return "";
 }
Ejemplo n.º 6
0
 /**
  * Creates a new instance.
  *
  * @param data The data to host.
  * @param icon The icon to set.
  * @param canBeEnabled Flag indicating if the item can be enabled or not.
  */
 public DataMenuItem(Object data, Icon icon, boolean canBeEnabled) {
   super(false, data.toString(), canBeEnabled);
   if (data instanceof ExperimenterData)
     setText(EditorUtil.formatExperimenter((ExperimenterData) data));
   else if (data instanceof GroupData) setText(((GroupData) data).getName());
   else setText(data.toString());
   if (icon != null) setIcon(icon);
   this.canBeEnabled = canBeEnabled;
   this.data = data;
   setEnabled(true);
   addActionListener(this);
 }
 /**
  * Returns the name of the node.
  *
  * @return See above.
  */
 private String getNodeName() {
   Object obj = getUserObject();
   if (obj instanceof ProjectData) return ((ProjectData) obj).getName();
   else if (obj instanceof DatasetData) return ((DatasetData) obj).getName();
   else if (obj instanceof ImageData) return ((ImageData) obj).getName();
   else if (obj instanceof ExperimenterData) {
     ExperimenterData exp = (ExperimenterData) obj;
     return EditorUtil.formatExperimenter(exp);
   } else if (obj instanceof ScreenData) return ((ScreenData) obj).getName();
   else if (obj instanceof PlateData) return ((PlateData) obj).getName();
   else if (obj instanceof TagAnnotationData) return ((TagAnnotationData) obj).getTagValue();
   else if (obj instanceof String) return (String) obj;
   return "";
 }
Ejemplo n.º 8
0
 /**
  * Adds the experimenters who use the annotation if any.
  *
  * @param tt The {@link ToolTipGenerator} to add the information on to
  * @param annotation The annotation to handle.
  */
 private void checkAnnotators(ToolTipGenerator tt, AnnotationData annotation) {
   List<ExperimenterData> annotators = model.getAnnotators(annotation);
   if (annotators.size() == 0) return;
   Iterator<ExperimenterData> i = annotators.iterator();
   ExperimenterData annotator;
   tt.addLine("Linked by:", true);
   while (i.hasNext()) {
     annotator = i.next();
     tt.addLine(EditorUtil.formatExperimenter(annotator));
   }
   if (annotators.size() > 1) {
     String text = label.getText();
     text += " [" + annotators.size() + "]";
     label.setText(text);
   }
 }
Ejemplo n.º 9
0
 /**
  * Returns the name of the node.
  *
  * @param obj The object to handle.
  * @return See above.
  */
 private String getNodeName(Object obj) {
   if (obj instanceof ProjectData) return ((ProjectData) obj).getName();
   else if (obj instanceof DatasetData) return ((DatasetData) obj).getName();
   else if (obj instanceof ImageData) return ((ImageData) obj).getName();
   else if (obj instanceof ExperimenterData) {
     return EditorUtil.formatExperimenter((ExperimenterData) obj);
   } else if (obj instanceof GroupData) {
     return ((GroupData) obj).getName();
   } else if (obj instanceof TagAnnotationData) return ((TagAnnotationData) obj).getTagValue();
   else if (obj instanceof ScreenData) return ((ScreenData) obj).getName();
   else if (obj instanceof PlateData) {
     return ((PlateData) obj).getName();
   } else if (obj instanceof FileAnnotationData) return ((FileAnnotationData) obj).getFileName();
   else if (obj instanceof File) return ((File) obj).getName();
   else if (obj instanceof FileData) return ((FileData) obj).getName();
   else if (obj instanceof PlateAcquisitionData) return ((PlateAcquisitionData) obj).getLabel();
   else if (obj instanceof MultiImageData) return ((MultiImageData) obj).getName();
   else if (obj instanceof String) return (String) obj;
   return "";
 }
Ejemplo n.º 10
0
 /**
  * Returns the list of users who annotated that image only if the annotation cannot be unlinked.
  *
  * @param object The object the annotation is linked to.
  * @param annotation The annotation to handle.
  */
 private String formatAnnotators(DataObject object, AnnotationData annotation) {
   StringBuffer buffer = new StringBuffer();
   List<ExperimenterData> annotators = model.getAnnotators(object, annotation);
   if (annotators.size() == 0) return null;
   long userID = model.getCurrentUser().getId();
   Iterator<ExperimenterData> i = annotators.iterator();
   ExperimenterData annotator;
   int n = annotators.size() - 1;
   int index = 0;
   buffer.append(" (");
   while (i.hasNext()) {
     annotator = i.next();
     if (annotator.getId() != userID) {
       buffer.append(EditorUtil.formatExperimenter(annotator));
       if (index != n) buffer.append(", ");
       index++;
     }
   }
   if (index == 0) return null;
   buffer.append(")");
   return buffer.toString();
 }
Ejemplo n.º 11
0
 /**
  * Returns <code>true</code> if the user is the owner of the file, <code>false</code> otherwise.
  * If the file is <code>null</code>, return <code>true</code>.
  *
  * @return See above.
  */
 boolean isUserOwner() {
   if (fileAnnotation == null) return true;
   long userID = EditorAgent.getUserDetails().getId();
   return EditorUtil.isUserOwner(fileAnnotation, userID);
 }
Ejemplo n.º 12
0
  /**
   * Listens to property fired by the Editor dialog.
   *
   * @see PropertyChangeListener#propertyChange(PropertyChangeEvent)
   */
  public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (EditorDialog.CREATE_NO_PARENT_PROPERTY.equals(name)) {
      // reset text and tooltip
      String text = "";
      String description = "";
      AnnotationData annotation = null;
      if (data instanceof TagAnnotationData
          || data instanceof TermAnnotationData
          || data instanceof XMLAnnotationData) {
        annotation = (AnnotationData) data;
        text = annotation.getContentAsString();
        text = EditorUtil.truncate(text, TEXT_LENGTH, false);
      }
      if (data instanceof DoubleAnnotationData) {
        annotation = (AnnotationData) data;
        text = "" + ((DoubleAnnotationData) data).getDataValue();
      }
      if (data instanceof LongAnnotationData) {
        annotation = (AnnotationData) data;
        text = "" + ((LongAnnotationData) data).getDataValue();
      }
      if (data instanceof BooleanAnnotationData) {
        annotation = (AnnotationData) data;
        text = "" + ((BooleanAnnotationData) data).getValue();
      }
      description = model.getAnnotationDescription(annotation);
      if (annotation == null) return;
      label.setText(text);
      label.setToolTipText(formatToolTip(annotation, null));
      originalName = text;
      originalDescription = description;
      firePropertyChange(AnnotationUI.EDIT_TAG_PROPERTY, null, this);
    } else if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) {
      if (data == null) return;
      FileAnnotationData fa = (FileAnnotationData) data;
      OriginalFile f = (OriginalFile) fa.getContent();
      File folder;
      Object o = evt.getNewValue();
      if (o instanceof String) {
        String path = (String) o;
        if (!path.endsWith(File.separator)) {
          path += File.separator;
        }
        path += fa.getFileName();
        folder = new File(path);
      } else {
        File[] files = (File[]) o;
        folder = files[0];
      }
      if (folder == null) folder = UIUtilities.getDefaultFolder();
      UserNotifier un = MetadataViewerAgent.getRegistry().getUserNotifier();

      IconManager icons = IconManager.getInstance();

      DownloadActivityParam activity =
          new DownloadActivityParam(f, folder, icons.getIcon(IconManager.DOWNLOAD_22));
      // Check Name space
      activity.setLegend(fa.getDescription());
      un.notifyActivity(model.getSecurityContext(), activity);
    }
  }
Ejemplo n.º 13
0
  /** Initializes the components composing the display. */
  private void initComponents() {
    isModulo = model.isModulo(data);
    imageToLoad = -1;
    initButtons();
    label = new JLabel();
    label.setForeground(UIUtilities.DEFAULT_FONT_COLOR);
    checkbox = new JCheckBox();
    if (data == null) {
      label.setText(AnnotationUI.DEFAULT_TEXT);
    } else {
      if (data instanceof FileAnnotationData) {
        FileAnnotationData f = (FileAnnotationData) data;
        String fileName = f.getFileName();
        String s = fileName;
        if (FileAnnotationData.MEASUREMENT_NS.equals(f.getNameSpace())) {
          String desc = f.getDescription();
          if (desc != null && desc.trim().length() > 0) label.setText(desc);
          else {
            label.setText(UIUtilities.formatPartialName(EditorUtil.getPartialName(fileName)));
          }
          s = label.getText();
        } else {
          label.setText(UIUtilities.formatPartialName(EditorUtil.getPartialName(fileName)));
        }

        label.setToolTipText(formatToolTip(f, s));
        Iterator<CustomizedFileFilter> i = FILTERS.iterator();
        CustomizedFileFilter filter;
        long id = f.getId();
        while (i.hasNext()) {
          filter = i.next();
          if (filter.accept(fileName)) {
            if (id > 0) imageToLoad = LOAD_FROM_SERVER;
            else imageToLoad = LOAD_FROM_LOCAL;
            break;
          }
        }
        if (id < 0) label.setForeground(DataObjectListCellRenderer.NEW_FOREGROUND_COLOR);
        switch (imageToLoad) {
          case LOAD_FROM_LOCAL:
            if (thumbnail == null) setThumbnail(f.getFilePath());
            break;
            /*
            case LOAD_FROM_SERVER:
            	if (thumbnail == null) {
            		model.loadFile((FileAnnotationData) data, this);
            	}
            	*/
        }
      } else if (data instanceof File) {
        File f = (File) data;
        label.setText(EditorUtil.getPartialName(f.getName()));
        label.setForeground(Color.BLUE);
      } else if (data instanceof TagAnnotationData) {
        TagAnnotationData tag = (TagAnnotationData) data;
        label.setText(tag.getTagValue());
        label.setToolTipText(formatToolTip(tag, null));
        if (tag.getId() < 0) label.setForeground(DataObjectListCellRenderer.NEW_FOREGROUND_COLOR);
      } else if (data instanceof XMLAnnotationData) {
        XMLAnnotationData tag = (XMLAnnotationData) data;
        label.setText(EditorUtil.truncate(tag.getText(), TEXT_LENGTH, false));
        label.setToolTipText(formatToolTip(tag, null));
        if (tag.getId() < 0) label.setForeground(DataObjectListCellRenderer.NEW_FOREGROUND_COLOR);
      } else if (data instanceof TermAnnotationData) {
        TermAnnotationData tag = (TermAnnotationData) data;
        label.setText(tag.getTerm());
        label.setToolTipText(formatToolTip(tag, null));
        if (tag.getId() < 0) label.setForeground(DataObjectListCellRenderer.NEW_FOREGROUND_COLOR);
      } else if (data instanceof LongAnnotationData) {
        LongAnnotationData tag = (LongAnnotationData) data;
        label.setText(tag.getContentAsString());
        label.setToolTipText(formatToolTip(tag, null));
        if (tag.getId() < 0) label.setForeground(DataObjectListCellRenderer.NEW_FOREGROUND_COLOR);
      } else if (data instanceof DoubleAnnotationData) {
        DoubleAnnotationData tag = (DoubleAnnotationData) data;
        label.setText(tag.getContentAsString());
        label.setToolTipText(formatToolTip(tag, null));
        if (tag.getId() < 0) label.setForeground(DataObjectListCellRenderer.NEW_FOREGROUND_COLOR);
      } else if (data instanceof BooleanAnnotationData) {
        BooleanAnnotationData tag = (BooleanAnnotationData) data;
        label.setText(tag.getContentAsString());
        label.setToolTipText(formatToolTip(tag, null));
        if (tag.getId() < 0) label.setForeground(DataObjectListCellRenderer.NEW_FOREGROUND_COLOR);
      } else if (data instanceof TimeAnnotationData) {
        TimeAnnotationData tag = (TimeAnnotationData) data;
        label.setText(tag.getContentAsString());
        label.setToolTipText(formatToolTip(tag, null));
        if (tag.getId() < 0) label.setForeground(DataObjectListCellRenderer.NEW_FOREGROUND_COLOR);
      }
    }

    label.addMouseListener(
        new MouseAdapter() {

          /**
           * Posts an event to edit the file.
           *
           * @see MouseAdapter#mouseReleased(MouseEvent)
           */
          public void mouseReleased(MouseEvent e) {
            if (e.getClickCount() == 1 && e.isPopupTrigger()) {
              showMenu(label, e.getPoint());
            }
          }

          /**
           * Shows menu
           *
           * @see MouseAdapter#mouseReleased(MouseEvent)
           */
          public void mousePressed(MouseEvent e) {
            if (e.isPopupTrigger()) showMenu(label, e.getPoint());
          }
        });
  }
Ejemplo n.º 14
0
  /**
   * Formats the passed annotation.
   *
   * @param annotation The value to format.
   * @param name The full name.
   * @return See above.
   */
  private String formatToolTip(AnnotationData annotation, String name) {
    ToolTipGenerator tt = new ToolTipGenerator();
    if (model.isMultiSelection()) {
      Map<DataObject, Boolean> m = null;
      Entry<DataObject, Boolean> e;
      Iterator<Entry<DataObject, Boolean>> j;
      String text = "";
      if (annotation instanceof TagAnnotationData) {
        m = model.getTaggedObjects(annotation);
        text += "Can remove Tag from ";
      } else if (annotation instanceof FileAnnotationData) {
        m = model.getObjectsWith(annotation);
        text += "Can remove Attachment from ";
      } else if (annotation instanceof XMLAnnotationData) {
        m = model.getObjectsWith(annotation);
        text += "Can remove XML files from ";
      } else if (annotation instanceof TermAnnotationData) {
        m = model.getObjectsWith(annotation);
        text += "Can remove Term from ";
      }
      if (m == null) return "";
      j = m.entrySet().iterator();
      Collection<Boolean> l = m.values();
      int n = 0;
      Iterator<Boolean> k = l.iterator();
      while (k.hasNext()) {
        if (k.next().booleanValue()) n++;
      }
      tt.addLineNoBr(text + "" + n + " ");
      int index = 0;
      String s;
      while (j.hasNext()) {
        e = j.next();
        if (index == 0) {
          tt.addLine(model.getObjectTypeAsString(e.getKey()) + "s", true);
          index++;
        }
        tt.addLine(
            "ID " + e.getKey().getId(),
            UIUtilities.formatPartialName(model.getObjectName(e.getKey())),
            true);
        // Indicates who annotates the object if not the user
        // currently logged in.
        s = formatAnnotators(e.getKey(), annotation);
        if (s != null) tt.addLine(s);
      }
      return tt.toString();
    }

    if (name != null) {
      tt.addLine("Name", name, true);
    }

    ExperimenterData exp = null;

    if (annotation.getId() > 0) {
      exp = model.getOwner(annotation);
      tt.addLine("ID", "" + annotation.getId(), true);
    }

    String ns = annotation.getNameSpace();
    if (!CommonsLangUtils.isEmpty(ns) && !EditorUtil.isInternalNS(ns)) {
      tt.addLine("Namespace", ns, true);
    }

    String desc = annotation.getDescription();
    if (!CommonsLangUtils.isEmpty(desc)) {
      tt.addLine("Description", desc, true);
    }

    if (exp != null) {
      tt.addLine("Owner", EditorUtil.formatExperimenter(exp), true);
    }

    Timestamp created = annotation.getCreated();
    if (created != null) {
      tt.addLine("Date", UIUtilities.formatDefaultDate(created), true);
    }

    if (data instanceof FileAnnotationData) {
      FileAnnotationData fa = (FileAnnotationData) data;
      long size = ((FileAnnotationData) annotation).getFileSize();
      tt.addLine("File ID", "" + fa.getFileID(), true);
      tt.addLine("Size", UIUtilities.formatFileSize(size) + "kb", true);
      checkAnnotators(tt, annotation);
    } else if (data instanceof TagAnnotationData
        || data instanceof XMLAnnotationData
        || data instanceof TermAnnotationData
        || data instanceof LongAnnotationData
        || data instanceof DoubleAnnotationData
        || data instanceof BooleanAnnotationData) {
      checkAnnotators(tt, annotation);
    }
    return tt.toString();
  }
Ejemplo n.º 15
0
 /**
  * Sets the value of the flag controlling if the unit bar is painted or not.
  *
  * @param unitBar Pass <code>true</code> to paint the unit bar, <code>false</code> otherwise.
  */
 void setUnitBar(boolean unitBar) {
   double v = EditorUtil.transformSize(parent.getPixelsSizeX()).getValue();
   if (v == 0 || v == 1) unitBar = false;
   this.unitBar = unitBar;
 }
Ejemplo n.º 16
0
  /**
   * Builds the panel hosting the user's details.
   *
   * @return See above.
   */
  private JPanel buildContentPanel() {
    ExperimenterData user = (ExperimenterData) model.getRefObject();
    boolean editable = model.isUserOwner(user);
    if (!editable) editable = model.isGroupLeader() || MetadataViewerAgent.isAdministrator();
    details = EditorUtil.convertExperimenter(user);
    JPanel content = new JPanel();
    content.setBorder(BorderFactory.createTitledBorder("Profile"));
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    Entry entry;
    Iterator i = details.entrySet().iterator();
    JComponent label;
    JTextField area;
    String key, value;
    content.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    // Add log in name but cannot edit.
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    content.add(userPicture, c);
    c.gridy++;
    c.gridx = 0;
    label = EditorUtil.getLabel(EditorUtil.DISPLAY_NAME, true);
    label.setBackground(UIUtilities.BACKGROUND_COLOR);
    c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
    c.fill = GridBagConstraints.NONE; // reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    loginArea.setText(user.getUserName());
    loginArea.getDocument().addDocumentListener(this);
    content.add(loginArea, c);
    while (i.hasNext()) {
      ++c.gridy;
      c.gridx = 0;
      entry = (Entry) i.next();
      key = (String) entry.getKey();
      value = (String) entry.getValue();
      label = EditorUtil.getLabel(key, false);
      area = new JTextField(value);
      area.setBackground(UIUtilities.BACKGROUND_COLOR);
      area.setEditable(editable);
      area.setEnabled(editable);
      if (editable) area.getDocument().addDocumentListener(this);
      items.put(key, area);
      label.setBackground(UIUtilities.BACKGROUND_COLOR);
      c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
      c.fill = GridBagConstraints.NONE; // reset to default
      c.weightx = 0.0;
      content.add(label, c);
      c.gridx++;
      content.add(Box.createHorizontalStrut(5), c);
      c.gridx++;
      c.gridwidth = GridBagConstraints.REMAINDER; // end row
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      content.add(area, c);
    }
    c.gridx = 0;
    c.gridy++;
    label = EditorUtil.getLabel(EditorUtil.DEFAULT_GROUP, false);
    c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
    c.fill = GridBagConstraints.NONE; // reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    content.add(groupLabel, c);
    c.gridy++;
    content.add(permissionsPane, c);

    // content.add(groups, c);

    c.gridx = 0;
    c.gridy++;
    label = EditorUtil.getLabel(EditorUtil.GROUP_OWNER, false);
    c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
    c.fill = GridBagConstraints.NONE; // reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; // end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    content.add(ownerBox, c);
    if (activeBox.isVisible()) {
      c.gridx = 0;
      c.gridy++;
      label = EditorUtil.getLabel(EditorUtil.ACTIVE, false);
      c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
      c.fill = GridBagConstraints.NONE; // reset to default
      c.weightx = 0.0;
      content.add(label, c);
      c.gridx++;
      content.add(Box.createHorizontalStrut(5), c);
      c.gridx++;
      c.gridwidth = GridBagConstraints.REMAINDER; // end row
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      content.add(activeBox, c);
    }
    if (adminBox.isVisible()) {
      c.gridx = 0;
      c.gridy++;
      label = EditorUtil.getLabel(EditorUtil.ADMINISTRATOR, false);
      c.gridwidth = GridBagConstraints.RELATIVE; // next-to-last
      c.fill = GridBagConstraints.NONE; // reset to default
      c.weightx = 0.0;
      content.add(label, c);
      c.gridx++;
      content.add(Box.createHorizontalStrut(5), c);
      c.gridx++;
      c.gridwidth = GridBagConstraints.REMAINDER; // end row
      c.fill = GridBagConstraints.HORIZONTAL;
      c.weightx = 1.0;
      content.add(adminBox, c);
    }
    c.gridx = 0;
    c.gridy++;
    content.add(Box.createHorizontalStrut(10), c);
    c.gridy++;
    label = UIUtilities.setTextFont(EditorUtil.MANDATORY_DESCRIPTION, Font.ITALIC);
    label.setForeground(UIUtilities.REQUIRED_FIELDS_COLOR);
    c.weightx = 0.0;
    content.add(label, c);
    return content;
  }
Ejemplo n.º 17
0
 /**
  * Returns <code>true</code> if the passed value corresponds to a name space for <code>Editor
  * </code>.
  *
  * @param value The value to handle.
  * @return See above.
  */
 boolean isEditorFile(String value) {
   if (EditorUtil.isEditorFile(value)) return true;
   return (FileAnnotationData.EDITOR_EXPERIMENT_NS.equals(value)
       || FileAnnotationData.EDITOR_PROTOCOL_NS.equals(value));
 }