public AnnotationsViewSettingsPanel(final OWLModel owlModel) {
    this.owlModel = owlModel;
    list = new SelectableList();
    list.setListData(
        ((AbstractOWLModel) owlModel).getDefaultAnnotationPropertiesInView().toArray());
    list.setCellRenderer(new ResourceRenderer());
    LabeledComponent lc =
        new OWLLabeledComponent(
            "Default annotation properties to be shown in the Annotation Widget",
            new JScrollPane(list));
    lc.addHeaderButton(
        new AbstractAction("Add property...", OWLIcons.getAddIcon(OWLIcons.RDF_PROPERTY)) {
          public void actionPerformed(ActionEvent e) {
            addProperty();
          }
        });

    lc.addHeaderButton(
        new AllowableAction(
            "Remove selected property", OWLIcons.getRemoveIcon(OWLIcons.RDF_PROPERTY), list) {
          public void actionPerformed(ActionEvent e) {
            removeSelectedProperty();
          }
        });

    setLayout(new BorderLayout());
    add(BorderLayout.CENTER, lc);
  }
Ejemplo n.º 2
0
  protected void addActions() {

    LabeledComponent c = new LabeledComponent("Class", itsList);

    itsSelectAction = getSelectClsAction();
    itsViewAction = getViewClsAction();
    itsRemoveAction = getRemoveClsAction();

    c.addHeaderButton(itsViewAction);
    c.addHeaderButton(itsSelectAction);
    c.addHeaderButton(itsRemoveAction);

    itsComp = c;
  }
  private LabeledComponent getGroupLabeledComponent() {
    if (groupLabeledComponent == null) {
      ListPanel pnl = getGroupListPanel();
      groupLabeledComponent = new LabeledComponent("Queries", new JScrollPane(pnl));
      groupLabeledComponent.setBorder(
          BorderFactory.createCompoundBorder(
              BorderFactory.createEmptyBorder(0, 2, 0, 2),
              BorderFactory.createLoweredBevelBorder()));

      JButton btn2 =
          groupLabeledComponent.addHeaderButton(
              new AbstractAction("Add Negated Query", Icons.getAddQueryLibraryIcon()) {
                public void actionPerformed(ActionEvent e) {
                  addNegatedQueryComponent();
                }
              });
      btn2.setText("Add Negated Query");
      // have to change the sizes to show the text
      final Dimension dim2 = new Dimension(100, btn2.getPreferredSize().height);
      btn2.setMinimumSize(dim2);
      btn2.setPreferredSize(dim2);
      btn2.setMaximumSize(dim2);

      JButton btn =
          groupLabeledComponent.addHeaderButton(
              new AbstractAction("Add another query", Icons.getAddQueryLibraryIcon()) {
                public void actionPerformed(ActionEvent e) {
                  addQueryComponent();
                }
              });
      btn.setText("Add Query");
      // have to change the sizes to show the text
      final Dimension dim = new Dimension(100, btn.getPreferredSize().height);
      btn.setMinimumSize(dim);
      btn.setPreferredSize(dim);
      btn.setMaximumSize(dim);

      btnAndQuery = new JRadioButton("Match All ", false);
      btnOrQuery = new JRadioButton("Match Any ", true);
      btn.getParent().add(btnAndQuery);
      btn.getParent().add(btnOrQuery);
      ButtonGroup group = new ButtonGroup();
      group.add(btnAndQuery);
      group.add(btnOrQuery);
    }
    return groupLabeledComponent;
  }
Ejemplo n.º 4
0
  public JPanel createPanel() {
    JPanel panel = new JPanel();
    panel.setLocation(450, 300);
    panel.setLayout(new GridLayout(2, 1));

    LabeledComponent lc = null;
    JPanel definingPanel = new JPanel();
    definingPanel.setLayout(new BorderLayout());
    JLabel definingLabel = new JLabel("  Defining");
    definingCheckBox = new JCheckBox();
    definingCheckBox.setSelected(defining);
    definingCheckBox.setEnabled(definingEditable);

    definingPanel.add(definingCheckBox, BorderLayout.WEST);
    definingPanel.add(definingLabel, BorderLayout.CENTER);

    panel.add(definingPanel);

    value_field = new JTextField("");
    value_field.setEditable(false);

    String pt = selectedCls != null ? selectedCls.getBrowserText() : "";
    value_field.setText(pt);

    value_field.setPreferredSize(new Dimension(300, 20));
    lc = new LabeledComponent("Select a superclass", value_field);

    Action SelectPropertyValueAction =
        new AbstractAction("Select a superclass...", OWLIcons.getAddIcon("PrimitiveClass")) {
          private static final long serialVersionUID = 123456009L;

          public void actionPerformed(ActionEvent e) {
            // java.awt.TextField textfield = new TextField();
            String label = "Select a named class";

            Collection clses = tab.getOWLWrapper().getSelectableRoots();

            boolean ok = false;

            while (!ok) {

              final NCISelectClsesPanel p = new NCISelectClsesPanel(owlModel, clses);
              int result = ModalDialog.showDialog(tab, p, label, ModalDialog.MODE_OK_CANCEL);
              if (result == ModalDialogFactory.OPTION_OK) {
                Collection c = p.getSelection();
                if (c != null && c.size() > 0) {
                  Iterator it = c.iterator();
                  Object obj = it.next();
                  String clsName = ((OWLNamedClass) obj).getPrefixedName();
                  // tab.getOWLWrapper()
                  // .getInternalName((Cls) obj);
                  if (clsName.compareTo("owl:Thing") == 0) {

                  } else {
                    setCls((Cls) obj);
                    ok = true;
                  }
                }

              } else {
                // user cancelled
                ok = true;
              }
            }
          }
        };

    lc.addHeaderButton(SelectPropertyValueAction);
    panel.add(lc);

    return panel;
  }