/**
   * Handles the event of an option being selected.
   *
   * @param evt, the event associated with the option being selected.
   */
  public void actionPerformed(ActionEvent evt) {

    Object source = evt.getSource();

    if (source.equals(miMenuItemShow)) {
      UITagUsageDialog dlg = new UITagUsageDialog(code, oParent);
      dlg.setVisible(true);
    } else if (source.equals(miMenuItemEdit)) {
      IModel model = ProjectCompendium.APP.getModel();

      String sOldName = code.getName();
      String sNewName =
          JOptionPane.showInputDialog(
              LanguageProperties.getString(
                  LanguageProperties.TAGS_BUNDLE, "UITagTreeLeafPopupMenu.edittagname"),
              sOldName); //$NON-NLS-1$
      sNewName = sNewName.trim();
      if (!sNewName.equals("")) { // $NON-NLS-1$
        try {
          String sCodeID = code.getId();

          // CHECK NAME DOES NOT ALREADY EXIST
          if (model.codeNameExists(sCodeID, sNewName)) {
            ProjectCompendium.APP.displayMessage(
                LanguageProperties.getString(
                        LanguageProperties.TAGS_BUNDLE, "UITagTreeLeafPopupMenu.tagexists")
                    + "\n\n"
                    + sNewName
                    + LanguageProperties.getString(
                        LanguageProperties.TAGS_BUNDLE, "UITagTreeLeafPopupMenu.pleasetryagain")
                    + "\n\n",
                LanguageProperties.getString(
                    LanguageProperties.TAGS_BUNDLE,
                    "UITagTreeLeafPopupMenu.tagmaintenance")); //$NON-NLS-1$ //$NON-NLS-2$
                                                               // //$NON-NLS-3$
          } else {
            code.initialize(model.getSession(), model);
            code.setName(sNewName); // Updates Database and model as model holds same object.
            oParent.updateTreeData();
          }

        } catch (Exception ex) {
          ProjectCompendium.APP.displayError(
              "UITagTreeLeafPopupMenu.editTagName\n\n" + ex.getMessage()); // $NON-NLS-1$
        }
      }
    } else if (source.equals(miMenuItemDelete)) {
      oParent.onDeleteCode(code);
    } else if (source.equals(miMenuItemRemove)) {
      oParent.onRemoveCodeFromGroup(code, sGroupID);
    } else if (source.equals(miMenuItemRemoveTag)) {
      oParent.onRemoveCodeFromNodes(code);
    }
  }
예제 #2
0
  /** Update the arrow head type on the currently selected links. */
  private void onUpdateArrowType(int nArrowType) {
    if (!bJustSetting) {

      UIViewFrame frame = ProjectCompendium.APP.getCurrentFrame();
      Model oModel = (Model) ProjectCompendium.APP.getModel();
      if (frame instanceof UIMapViewFrame) {

        Vector vtUpdateLinks = new Vector();
        UIMapViewFrame oMapFrame = (UIMapViewFrame) frame;
        UIViewPane pane = oMapFrame.getViewPane();
        UILink link = null;
        LinkProperties props = null;
        for (Enumeration e = pane.getSelectedLinks(); e.hasMoreElements(); ) {
          link = (UILink) e.nextElement();
          props = link.getLinkProperties();
          if (nArrowType != props.getArrowType()) {
            vtUpdateLinks.addElement(props);
          }
        }
        if (vtUpdateLinks.size() > 0) {
          try {
            ((ViewService) oModel.getViewService())
                .setArrowType(
                    oModel.getSession(), pane.getView().getId(), vtUpdateLinks, nArrowType);
            int count = vtUpdateLinks.size();
            for (int i = 0; i < count; i++) {
              props = (LinkProperties) vtUpdateLinks.elementAt(i);
              props.setArrowType(nArrowType);
            }
          } catch (SQLException ex) {
            ProjectCompendium.APP.displayError(
                LanguageProperties.getString(
                        LanguageProperties.TOOLBARS_BUNDLE,
                        "UIToolBarFormatLink.unableUpdateArrowType")
                    + ":\n\n"
                    + ex.getMessage()); // $NON-NLS-1$
          }
        }
      }
    }
  }
예제 #3
0
  /**
   * Create the model and the meeting data for the given meeting id.
   *
   * @param oMeeting the object holding the meeting data.
   * @param model the model to add the data to.
   */
  public synchronized void addMeetingData(Meeting oMeeting, com.hp.hpl.jena.rdf.model.Model model) {

    Resource meeting = model.createResource(oMeeting.getMeetingID());

    meeting.addProperty(
        model.createProperty(MEETING_NS, "has-transcription"),
        model.createResource(
            oMeeting.getMeetingID()
                + "-"
                + oMeeting.getMeetingMapID())); // $NON-NLS-1$ //$NON-NLS-2$

    // Define the map owner, 'person', Reource and add their type, name, and if Compendium created
    // (always 'true').
    UserProfile oUser = oMeeting.getUser();
    if (oUser == null) {
      oUser = ProjectCompendium.APP.getModel().getUserProfile();
    }

    Resource person = model.createResource(MEMETIC_STUB + oUser.getId());
    person.addProperty(
        model.createProperty(RDF_NS, "type"),
        model.createResource(PORTAL_NS + "Person")); // $NON-NLS-1$ //$NON-NLS-2$
    person.addProperty(
        model.createProperty(PORTAL_NS, "full-name"), oUser.getUserName()); // $NON-NLS-1$
    person.addProperty(
        model.createProperty(MEMETIC_NS, "is-compendium-created"),
        "true"); //$NON-NLS-1$ //$NON-NLS-2$

    // UPLOAD THE DATA ABOUT THE MEETING MAP NODE ITSELF
    MeetingEvent oMeetingEvent =
        new MeetingEvent(
            oMeeting.getMeetingID(),
            false,
            MeetingEvent.NODE_ADDED_EVENT,
            (View) oMeeting.getMapNode(),
            oMeeting.getMapNode());
    addNode(oMeetingEvent, model);
  }
예제 #4
0
  /**
   * Does Nothing
   *
   * @param selected, true to enable, false to disable.
   */
  public void setNodeOrLinkSelected(boolean selected) {
    if (tbrToolBar != null) {

      UIViewFrame frame = ProjectCompendium.APP.getCurrentFrame();
      if (selected && frame instanceof UIMapViewFrame) {
        UIMapViewFrame oMapFrame = (UIMapViewFrame) frame;
        UIViewPane pane = oMapFrame.getViewPane();

        int nLinkCount = pane.getNumberOfSelectedLinks();
        if (nLinkCount == 0) return;

        bJustSetting = true;

        int i = 0;
        UILink link = null;
        LinkProperties linkProps = null;
        boolean bDefaultLinkStyle = false;
        boolean bDefaultLinkDashed = false;
        boolean bDefaultLinkWeight = false;
        boolean bDefaultLinkColour = false;
        boolean bDefaultArrowType = false;

        LinkProperties defaultprops = UIUtilities.getLinkProperties("");
        int linkstyle = defaultprops.getLinkStyle();
        int linkdashed = defaultprops.getLinkDashed();
        int linkweight = defaultprops.getLinkWeight();
        int linkcolour = defaultprops.getLinkColour();
        int arrowtype = defaultprops.getArrowType();

        for (Enumeration e = pane.getSelectedLinks(); e.hasMoreElements(); ) {
          link = (UILink) e.nextElement();
          linkProps = link.getLinkProperties();
          if (i == 0) {
            linkstyle = linkProps.getLinkStyle();
            linkdashed = linkProps.getLinkDashed();
            linkweight = linkProps.getLinkWeight();
            linkcolour = linkProps.getLinkColour();
            arrowtype = linkProps.getArrowType();
            i++;
          } else {
            if (arrowtype != linkProps.getArrowType()) {
              bDefaultArrowType = true;
            }
            if (linkstyle != linkProps.getLinkStyle()) {
              bDefaultLinkStyle = true;
            }
            if (linkdashed != linkProps.getLinkDashed()) {
              bDefaultLinkDashed = true;
            }
            if (linkweight != linkProps.getLinkWeight()) {
              bDefaultLinkWeight = true;
            }
            if (linkcolour != linkProps.getLinkColour()) {
              bDefaultLinkColour = true;
            }
          }
        }

        tbrToolBar.setEnabled(true);

        if (bDefaultLinkColour) {
          selectedLinkColour = new Color(defaultprops.getLinkColour());
        } else {
          selectedLinkColour = new Color(linkcolour);
        }

        linkColourPanel.setEnabled(true);
        txtLinkColour.setEnabled(true);

        cbLineWeight.setEnabled(true);
        if (bDefaultLinkWeight) {
          cbLineWeight.setSelectedIndex(defaultprops.getLinkWeight() - 1);
        } else {
          cbLineWeight.setSelectedIndex(linkweight - 1);
        }

        cbArrows.setEnabled(true);
        if (bDefaultArrowType) {
          cbArrows.setSelectedIndex(defaultprops.getArrowType());
        } else {
          cbArrows.setSelectedIndex(arrowtype);
        }

        cbLinkStyle.setEnabled(true);
        if (bDefaultLinkStyle) {
          cbLinkStyle.setSelectedIndex(defaultprops.getLinkStyle());
        } else {
          cbLinkStyle.setSelectedIndex(linkstyle);
        }

        cbLinkDashed.setEnabled(true);
        if (bDefaultLinkDashed) {
          cbLinkDashed.setSelectedIndex(defaultprops.getLinkDashed());
        } else {
          cbLinkDashed.setSelectedIndex(linkdashed);
        }

        bJustSetting = false;

      } else if (!selected) {

        bJustSetting = true;

        linkColourPanel.setEnabled(false);
        txtLinkColour.setEnabled(false);
        tbrToolBar.setEnabled(false);
        cbArrows.setEnabled(false);
        cbLineWeight.setEnabled(false);
        cbLinkStyle.setEnabled(false);
        cbLinkDashed.setEnabled(false);

        bJustSetting = false;
      }
    }
  }