コード例 #1
0
  public void createSocialBar(HorizontalPanel socialBar, final MAnnotation annotation) {
    try {
      socialBar.clear();

      if (((BooleanPreference)
              _domeo
                  .getPreferences()
                  .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_ALLOW_COMMENTING))
          .getValue()) {
        Resources resource = Domeo.resources;

        Image commentIcon = new Image(resource.littleCommentIcon());
        commentIcon.setTitle("Comment on Item");
        commentIcon.setStyleName(ATileComponent.tileResources.css().button());
        commentIcon.addClickHandler(
            ActionCommentAnnotation.getClickHandler(_domeo, this, annotation));
        commentIcon.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                _curationPopup.hide();
              }
            });
        socialBar.add(commentIcon);
        socialBar.add(new Label("(10)"));

        Image usersIcon = new Image(resource.usersIcon());
        usersIcon.setTitle("Involved users");
        usersIcon.setStyleName(ATileComponent.tileResources.css().button());
        usersIcon.addClickHandler(
            ActionCommentAnnotation.getClickHandler(_domeo, this, annotation));
        usersIcon.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                _curationPopup.hide();
              }
            });
        socialBar.add(usersIcon);
        socialBar.setCellWidth(usersIcon, "24px");
        socialBar.setCellHorizontalAlignment(usersIcon, HasHorizontalAlignment.ALIGN_RIGHT);
        socialBar.add(new Label("(2)"));
      }
    } catch (Exception e) {
      _domeo.getLogger().exception(this, "create social bar" + e.getMessage());
    }
  }
コード例 #2
0
  public void injectButtons(String plugin, FlowPanel content, final MAnnotation annotation) {
    try {
      if (!((BooleanPreference)
                  _domeo
                      .getPreferences()
                      .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_PROVENANCE))
              .getValue()
          || !(((BooleanPreference)
                  _domeo
                      .getPreferences()
                      .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_USER_PROVENANCE))
              .getValue())) {

        Resources resource = Domeo.resources;

        Image commentIcon = null;
        if (((BooleanPreference)
                _domeo
                    .getPreferences()
                    .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_ALLOW_COMMENTING))
            .getValue()) {
          commentIcon = new Image(resource.littleCommentIcon());
          commentIcon.setTitle("Comment on Item");
          commentIcon.setStyleName(ATileComponent.tileResources.css().button());
          commentIcon.addClickHandler(
              ActionCommentAnnotation.getClickHandler(_domeo, this, annotation));
          commentIcon.addClickHandler(
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  _curationPopup.hide();
                }
              });
        }

        Image editIcon = new Image(resource.editLittleIcon());
        editIcon.setTitle("Edit Item");
        if (_domeo.getProfileManager().getUserCurrentProfile().isPluginEnabled(plugin)) {
          editIcon.setStyleName(ATileComponent.tileResources.css().button());
          editIcon.addClickHandler(ActionEditAnnotation.getClickHandler(_domeo, this, annotation));
          editIcon.addClickHandler(
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  _curationPopup.hide();
                }
              });
        }

        Image deleteIcon = new Image(resource.deleteLittleIcon());
        deleteIcon.setTitle("Delete Item");
        deleteIcon.setStyleName(ATileComponent.tileResources.css().button());
        deleteIcon.addClickHandler(
            ActionDeleteAnnotation.getClickHandler(_domeo, this, annotation));
        deleteIcon.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                _curationPopup.hide();
              }
            });

        if (((BooleanPreference)
                _domeo
                    .getPreferences()
                    .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_ALLOW_COMMENTING))
            .getValue()) {
          content.add(commentIcon);
        }

        content.add(editIcon);
        content.add(deleteIcon);
      }
    } catch (Exception e) {
      _domeo.getLogger().exception(this, "injectButtons: " + e.getMessage());
    }
  }
コード例 #3
0
  public void createProvenanceBar(
      String plugin, HorizontalPanel provenance, final MAnnotation annotation) {
    try {
      Resources resource = Domeo.resources;

      Image commentIcon = null;
      if (((BooleanPreference)
              _domeo
                  .getPreferences()
                  .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_ALLOW_COMMENTING))
          .getValue()) {
        commentIcon = new Image(resource.littleCommentIcon());
        commentIcon.setTitle("Comment on Item");
        commentIcon.setStyleName(ATileComponent.tileResources.css().button());
        commentIcon.addClickHandler(
            ActionCommentAnnotation.getClickHandler(_domeo, this, annotation));
        commentIcon.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                _curationPopup.hide();
              }
            });
      }

      Image editIcon = new Image(resource.editLittleIcon());
      editIcon.setTitle("Edit Item");
      if (_domeo.getProfileManager().getUserCurrentProfile().isPluginEnabled(plugin)) {
        editIcon.setStyleName(ATileComponent.tileResources.css().button());
        editIcon.addClickHandler(ActionEditAnnotation.getClickHandler(_domeo, this, annotation));
        editIcon.addClickHandler(
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                _curationPopup.hide();
              }
            });
      }

      Image deleteIcon = new Image(resource.deleteLittleIcon());
      deleteIcon.setTitle("Delete Item");
      deleteIcon.setStyleName(ATileComponent.tileResources.css().button());
      deleteIcon.addClickHandler(ActionDeleteAnnotation.getClickHandler(_domeo, this, annotation));
      deleteIcon.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              _curationPopup.hide();
            }
          });

      // TODO move to an abstract tile class
      if (((BooleanPreference)
              _domeo
                  .getPreferences()
                  .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_PROVENANCE))
          .getValue()) {
        if (annotation
            .getCreator()
            .getUri()
            .equals(_domeo.getAgentManager().getUserPerson().getUri())) {
          if (((BooleanPreference)
                  _domeo
                      .getPreferences()
                      .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_DISPLAY_USER_PROVENANCE))
              .getValue()) {
            provenance.clear();

            // TODO Externalize the icon management to the plugins
            if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) {
              Image ic = new Image(Domeo.resources.multipleLittleIcon());
              ic.setTitle("Annotation on multiple targets");
              provenance.add(ic);
              provenance.setCellWidth(ic, "18px");
            } else if (annotation.getSelector() != null
                && annotation.getSelector().getTarget() instanceof MOnlineImage) {
              Image ic = new Image(Domeo.resources.littleImageIcon());
              ic.setTitle("Annotation on image");
              provenance.add(ic);
              provenance.setCellWidth(ic, "18px");
            } else {
              Image ic = new Image(Domeo.resources.littleTextIcon());
              ic.setTitle("Annotation on text");
              provenance.add(ic);
              provenance.setCellWidth(ic, "18px");
            }

            provenance.add(new Label("By Me on " + annotation.getFormattedCreationDate()));

            if (((BooleanPreference)
                    _domeo
                        .getPreferences()
                        .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_ALLOW_COMMENTING))
                .getValue()) {
              provenance.add(commentIcon);
              provenance.setCellWidth(commentIcon, "20px");
              provenance.setCellHorizontalAlignment(
                  commentIcon, HasHorizontalAlignment.ALIGN_RIGHT);
            }

            provenance.add(editIcon);
            provenance.setCellWidth(editIcon, "20px");
            provenance.setCellHorizontalAlignment(editIcon, HasHorizontalAlignment.ALIGN_RIGHT);
            provenance.add(deleteIcon);
            provenance.setCellWidth(deleteIcon, "20px");
            provenance.setCellHorizontalAlignment(deleteIcon, HasHorizontalAlignment.ALIGN_RIGHT);
          } else {
            provenance.setVisible(false);
          }
        } else {
          provenance.clear();

          // TODO Externalize the icon management to the plugins
          if (SelectorUtils.isOnMultipleTargets(annotation.getSelectors())) {
            Image ic = new Image(Domeo.resources.multipleLittleIcon());
            ic.setTitle("Annotation on multiple targets");
            provenance.add(ic);
            provenance.setCellWidth(ic, "18px");
          } else if (annotation.getSelector() != null
              && annotation.getSelector().getTarget() instanceof MOnlineImage) {
            Image ic = new Image(Domeo.resources.littleImageIcon());
            ic.setTitle("Annotation on image");
            provenance.add(ic);
            provenance.setCellWidth(ic, "18px");
          } else {
            Image ic = new Image(Domeo.resources.littleTextIcon());
            ic.setTitle("Annotation on text");
            provenance.add(ic);
            provenance.setCellWidth(ic, "18px");
          }

          provenance.add(
              new Label(
                  "By "
                      + annotation.getCreator().getName()
                      + " on "
                      + annotation.getFormattedCreationDate()));

          if (((BooleanPreference)
                  _domeo
                      .getPreferences()
                      .getPreferenceItem(Domeo.class.getName(), Domeo.PREF_ALLOW_COMMENTING))
              .getValue()) {
            provenance.add(commentIcon);
            provenance.setCellWidth(commentIcon, "20px");
            provenance.setCellHorizontalAlignment(commentIcon, HasHorizontalAlignment.ALIGN_RIGHT);
          }

          provenance.add(editIcon);
          provenance.setCellWidth(editIcon, "20px");
          provenance.setCellHorizontalAlignment(editIcon, HasHorizontalAlignment.ALIGN_RIGHT);
          provenance.add(deleteIcon);
          provenance.setCellWidth(deleteIcon, "20px");
          provenance.setCellHorizontalAlignment(deleteIcon, HasHorizontalAlignment.ALIGN_RIGHT);
        }
      } else {
        provenance.setVisible(false);
      }
    } catch (Exception e) {
      _domeo.getLogger().exception(this, "createProvenanceBar2" + e.getMessage());
    }
  }