public void showHideStatusBar() {
   if (statusPanel.isVisible()) {
     statusPanel.getElement().<FxElement>cast().slideOut(Direction.UP);
     widget.setVisible(false);
   } else {
     widget.setVisible(true);
     statusPanel.getElement().<FxElement>cast().slideIn(Direction.DOWN);
   }
 }
Exemple #2
0
  public SongPanel(String albumId, String artistId, String collectionId) {
    initWidget(uiBinder.createAndBindUi(this));

    this.albumId = albumId;
    this.artistId = artistId;
    this.inCollection = collectionId;

    // Get album info (null means all songs)
    if (albumId == null && artistId == null) {
      if (inCollection != null) {
        titleLabel.setText(
            Controller.INSTANCE.getModel().getTagCache().get(inCollection).getName());
      } else {
        titleLabel.setText(Constants.I18N.allMusic());
      }
      byLabel.setVisible(false);
      subtitlePanel.setVisible(false);
      setViewLinks(true, true);
      backButton.setVisible(false);
    } else if (artistId != null) {
      Cache<String, ArtistInfo> artistCache = Controller.INSTANCE.getModel().getArtistCache();
      artistCache.addHandler(
          artistId,
          new CacheHandler<String, ArtistInfo>() {
            @Override
            public void onCacheUpdated(String k, ArtistInfo v) {
              titleLabel.setText(v.getName());
            }
          });
      artistCache.obtain(artistId);
      byLabel.setVisible(false);
      subtitlePanel.setVisible(false);
      setViewLinks(false, true);
      Utils.setBackButton(backButton, collectionId);
    } else {
      Cache<String, AlbumInfo> albumCache = Controller.INSTANCE.getModel().getAlbumCache();
      albumCache.addHandler(
          albumId,
          new CacheHandler<String, AlbumInfo>() {
            @Override
            public void onCacheUpdated(String k, AlbumInfo v) {
              titleLabel.setText(v.getName());
              byLabel.setVisible(true);
              setSubtitles(v.getArtistList());
            }
          });
      albumCache.obtain(albumId);
      setViewLinks(false, false);
      Utils.setBackButton(backButton, collectionId);
    }

    // Create button line
    createButtonLine();
  }
Exemple #3
0
  private void createConditionExpressionPanel() {
    conditionalPanel = new HorizontalPanel();
    mainPanel.add(conditionalPanel);
    conditionalPanel.setVisible(conditionalBox.getValue());

    Label conditionalExpressionLabel = new Label(myConstants.conditionalPrompt() + ":");
    conditionalExpressionLabel.setStyleName("keyLabel");
    conditionalPanel.add(conditionalExpressionLabel);

    final TextBox conditionText = new TextBox();
    conditionText.setText(input.getConditionExpression());
    conditionalPanel.add(conditionText);
    conditionText.addValueChangeHandler(
        new ValueChangeHandler() {
          @Override
          public void onValueChange(ValueChangeEvent arg0) {
            input.setConditionExpression(conditionText.getText());
          }
        });

    conditionalPanel.add(
        new HTML(
            "   <span style='font-style:italic;font-size:small;"
                + "text-color:#888888;'>"
                + "("
                + myConstants.eg()
                + ", "
                + "q1name < 3"
                + ")"
                + "</span>"));
  }
 @Override
 public void setMainTabSelectedItem(VDSGroup selectedItem) {
   driver.edit(getDetailModel());
   form.update();
   glusterSwiftPanel.setVisible(
       selectedItem.supportsGlusterService()
           && GlusterFeaturesUtil.isGlusterSwiftSupported(
               selectedItem.getcompatibility_version()));
 }
  // Hide\display the additional CEP widget is appropriate
  private void operatorChanged(OperatorSelection selection) {
    parametersContainer.clear();
    String operator = selection.getValue();

    if (CEPOracle.isCEPWindowOperatorTime(operator)) {
      AbstractRestrictedEntryTextBox txt = new CEPTimeParameterTextBox(hcw.getWindow(), 1);
      initialiseTextBox(txt);
    } else if (CEPOracle.isCEPWindowOperatorLength(operator)) {
      AbstractRestrictedEntryTextBox txt = new CEPLengthParameterTextBox(hcw.getWindow(), 1);
      initialiseTextBox(txt);
    } else {
      parametersContainer.setVisible(false);
      hcw.getWindow().clearParameters();
    }
  }
 private void initialiseTextBox(AbstractRestrictedEntryTextBox txt) {
   String key = String.valueOf(1);
   String value = hcw.getWindow().getParameter(key);
   if (value == null) {
     value = "";
     hcw.getWindow().setParameter(key, value);
   }
   if (!txt.isValidValue(value, false)) {
     value = "";
     hcw.getWindow().setParameter(key, value);
   }
   txt.setText(value);
   txt.setEnabled(!isReadOnly);
   parametersContainer.add(txt);
   parametersContainer.setVisible(true);
   hcw.getWindow()
       .setParameter(
           SharedConstants.OPERATOR_PARAMETER_GENERATOR, CEP_OPERATOR_PARAMETER_GENERATOR);
 }
  public ExecutionWidget(final ExecutionTrace executionTrace, boolean showResults) {

    this.executionTrace = executionTrace;

    final HorizontalPanel simulDatePanel = simulDate();
    simulDatePanel.setVisible(isScenarioSimulatedDateSet());

    final ListBox choice = new ListBox();

    choice.addItem(TestScenarioConstants.INSTANCE.UseRealDateAndTime());
    choice.addItem(TestScenarioConstants.INSTANCE.UseASimulatedDateAndTime());
    choice.setSelectedIndex((executionTrace.getScenarioSimulatedDate() == null) ? 0 : 1);
    choice.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            if (choice.getSelectedIndex() == 0) {
              simulDatePanel.setVisible(false);
              executionTrace.setScenarioSimulatedDate(null);
            } else {
              simulDatePanel.setVisible(true);
            }
          }
        });

    HorizontalPanel layout = new HorizontalPanel();
    layout.add(new Image(TestScenarioImages.INSTANCE.executionTrace()));
    layout.add(choice);
    layout.add(simulDatePanel);

    if (showResults && isResultNotNullAndHaveRulesFired()) {
      VerticalPanel replacingLayout = new VerticalPanel();

      replacingLayout.add(new FiredRulesPanel(executionTrace));
      replacingLayout.add(layout);
      initWidget(replacingLayout);
    } else {
      initWidget(layout);
    }
  }
Exemple #8
0
 public void setSubtitles(List<String> artistList) {
   subtitlePanel.clear();
   for (String artistId : artistList) {
     final Hyperlink artistLink = new Hyperlink();
     Label commaLabel = new Label(",");
     commaLabel.getElement().addClassName(style.space());
     Cache<String, ArtistInfo> artistCache = Controller.INSTANCE.getModel().getArtistCache();
     artistCache.addHandler(
         artistId,
         new CacheHandler<String, ArtistInfo>() {
           @Override
           public void onCacheUpdated(String k, ArtistInfo v) {
             artistLink.setText(v.getName());
             artistLink.setTargetHistoryToken(v.getTargetHistoryToken());
           }
         });
     artistCache.obtain(artistId);
     subtitlePanel.add(artistLink);
     subtitlePanel.add(commaLabel);
   }
   subtitlePanel.remove(subtitlePanel.getWidgetCount() - 1);
   subtitlePanel.setVisible(true);
 }
  @Override
  public Widget asWidget() {
    if (widget == null) {
      widget = new HorizontalPanel();

      int barHeight = 210;
      int topPadding = 50;
      int barWidth = 250;
      int right = 5;

      widget.getElement().getStyle().setPosition(Position.FIXED);
      widget.getElement().getStyle().setRight(right, Unit.PX);
      widget.getElement().getStyle().setTop(topPadding, Unit.PX);
      widget.getElement().getStyle().setHeight(barHeight, Unit.PX);
      widget.getElement().getStyle().setWidth(barWidth, Unit.PX);
      widget.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);

      widget.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
      widget.setVisible(false);
      initializeStatusPanel();
      widget.add(statusPanel);
    }
    return widget;
  }
Exemple #10
0
  /**
   * Creates a header with the specified appearance.
   *
   * @param appearance the appearance of the header
   */
  public Header(HeaderAppearance appearance) {
    this.appearance = appearance;

    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    this.appearance.render(sb);

    setElement((Element) XDOM.create(sb.toSafeHtml()));

    addStyleName("x-small-editor");

    widgetPanel = new HorizontalPanel();
    widgetPanel.addStyleName("x-panel-toolbar");

    XElement barElem = appearance.getBarElem(getElement());
    barElem.appendChild(widgetPanel.getElement());

    if (tools.size() > 0) {
      for (int i = 0; i < tools.size(); i++) {
        widgetPanel.add(tools.get(i));
      }
    } else {
      widgetPanel.setVisible(false);
    }

    ComponentHelper.setParent(this, widgetPanel);

    appearance.getTextElem(getElement()).setId(getId() + "-label");

    setText(text);

    if (icon != null) {
      setIcon(icon);
    }

    getFocusSupport().setIgnore(true);
  }
Exemple #11
0
  /** SearchControl */
  public SearchControl() {
    table = new FlexTable();
    table.setCellPadding(2);
    table.setCellSpacing(2);
    scrollPanel = new ScrollPanel(table);
    advancedView = new CheckBox(Main.i18n("search.view.advanced"));
    advancedView.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (advancedView.getValue()) {
              clean();
              switchSearchMode(SEARCH_MODE_ADVANCED);
            } else {
              clean();
              switchSearchMode(SEARCH_MODE_SIMPLE);
            }
          }
        });
    compactResultsView = new CheckBox(Main.i18n("search.view.compact.results"));
    compactResultsView.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (compactResultsView.getValue()) {
              switchResultsViewMode(RESULTS_VIEW_COMPACT);
              table.getCellFormatter().setVisible(2, 0, false); // hide view property groups
            } else {
              switchResultsViewMode(RESULTS_VIEW_NORMAL);
              table.getCellFormatter().setVisible(2, 0, true); // show view property groups
            }
          }
        });
    showPropertyGroups = new CheckBox(Main.i18n("search.view.propety.groups"));
    showPropertyGroups.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if (searchButton.isEnabled()) {
              executeSearch();
            }
          }
        });
    saveUserNews = new CheckBox(Main.i18n("search.save.as.news"));
    searchSavedName = new TextBox();
    searchSavedName.setWidth("200");
    controlSearch = new ControlSearchIn();
    resultPage = new ListBox();
    resultPage.addItem("10", "10");
    resultPage.addItem("20", "20");
    resultPage.addItem("30", "30");
    resultPage.addItem("50", "50");
    resultPage.addItem("100", "100");

    keyUpHandler =
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            evaluateSearchButtonVisible();

            if (KeyCodes.KEY_ENTER == event.getNativeKeyCode() && searchButton.isEnabled()) {
              executeSearch();
            }
          }
        };

    searchButton =
        new Button(
            Main.i18n("button.search"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                executeSearch();
              }
            });

    cleanButton =
        new Button(
            Main.i18n("button.clean"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                clean();
              }
            });

    saveSearchButton =
        new Button(
            Main.i18n("button.save.search"),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                long domain = 0;
                SearchNormal searchNormal =
                    Main.get().mainPanel.search.searchBrowser.searchIn.searchNormal;
                SearchAdvanced searchAdvanced =
                    Main.get().mainPanel.search.searchBrowser.searchIn.searchAdvanced;
                String operator = GWTQueryParams.OPERATOR_AND;
                params = new GWTQueryParams();

                if (!searchAdvanced.path.getText().equals("")) {
                  params.setPath(searchAdvanced.path.getText());
                } else {
                  params.setPath(
                      searchNormal.context.getValue(searchNormal.context.getSelectedIndex()));
                }

                if (!searchAdvanced.categoryUuid.equals("")) {
                  params.setCategoryUuid(searchAdvanced.categoryUuid);
                  params.setCategoryPath(
                      searchAdvanced.categoryPath.getText().substring(16)); // removes /okm:category
                }

                params.setContent(searchNormal.content.getText());
                params.setName(searchNormal.name.getText());
                params.setKeywords(searchNormal.keywords.getText());
                params.setProperties(
                    Main.get().mainPanel.search.searchBrowser.searchIn.getProperties());
                params.setAuthor(
                    searchNormal.userListBox.getValue(searchNormal.userListBox.getSelectedIndex()));
                params.setLastModifiedFrom(searchNormal.modifyDateFrom);
                params.setLastModifiedTo(searchNormal.modifyDateTo);
                params.setDashboard(saveUserNews.getValue());
                params.setMailFrom(searchAdvanced.from.getText());
                params.setMailTo(searchAdvanced.to.getText());
                params.setMailSubject(searchAdvanced.subject.getText());

                if (searchAdvanced.typeDocument.getValue()) {
                  domain += GWTQueryParams.DOCUMENT;
                }

                if (searchAdvanced.typeFolder.getValue()) {
                  domain += GWTQueryParams.FOLDER;
                }

                if (searchAdvanced.typeMail.getValue()) {
                  domain += GWTQueryParams.MAIL;
                }

                params.setDomain(domain);

                if (searchTypeAnd.getValue()) {
                  operator = GWTQueryParams.OPERATOR_AND;
                } else {
                  operator = GWTQueryParams.OPERATOR_OR;
                }

                params.setOperator(operator);

                // Removes dates if dashboard is checked
                if (saveUserNews.getValue()) {
                  params.setLastModifiedFrom(null);
                  params.setLastModifiedTo(null);
                }

                params.setMimeType(
                    searchAdvanced.mimeTypes.getValue(searchAdvanced.mimeTypes.getSelectedIndex()));

                if (!searchSavedName.getText().equals("")) {
                  saveSearchButton.setEnabled(false);
                  params.setQueryName(searchSavedName.getText());
                  isUserNews = params.isDashboard();
                  saveSearch(params, "sql");
                }
              }
            });

    searchSavedName.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            evalueSaveSearchButtonVisible();
          }
        });

    searchButton.setEnabled(false);
    saveSearchButton.setEnabled(false);

    // Type of search
    searchTypePanel = new HorizontalPanel();
    searchTypePanel.setVisible(true); // On OpenKM 4.0 has hidden AND / OR option list
    searchTypeAnd = new CheckBox("AND");
    searchTypeOr = new CheckBox("OR");
    searchTypeAnd.setValue(true);
    searchTypeOr.setValue(false);

    searchTypeAnd.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            searchTypeOr.setValue(
                !searchTypeAnd.getValue()); // Always set changed between and and or type
          }
        });

    searchTypeOr.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            searchTypeAnd.setValue(
                !searchTypeOr.getValue()); // Always set changed between and and or type
          }
        });

    HTML space1 = new HTML("");
    searchTypePanel.add(searchTypeAnd);
    searchTypePanel.add(space1);
    searchTypePanel.add(searchTypeOr);
    searchTypePanel.setCellWidth(space1, "10");

    table.setWidget(0, 0, advancedView);
    table.setWidget(1, 0, compactResultsView);
    table.setWidget(2, 0, showPropertyGroups);
    table.setWidget(3, 0, saveUserNews);
    table.setWidget(4, 0, saveSearchButton);
    table.setWidget(4, 1, searchSavedName);

    resultsPageText = new HTML(Main.i18n("search.page.results"));
    table.setWidget(5, 0, resultsPageText);
    table.setWidget(5, 1, resultPage);

    searchTypeText = new HTML(Main.i18n("search.type"));
    table.setHTML(6, 0, Main.i18n("search.type"));
    table.setWidget(6, 1, searchTypePanel);

    table.setWidget(6, 0, cleanButton);
    table.setWidget(6, 1, searchButton);

    table.setWidget(7, 0, controlSearch);

    table.getCellFormatter().setHorizontalAlignment(4, 0, HasAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(5, 0, HasAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(6, 0, HasAlignment.ALIGN_RIGHT);
    table.getFlexCellFormatter().setColSpan(0, 0, 2);
    table.getFlexCellFormatter().setColSpan(1, 0, 2);
    table.getFlexCellFormatter().setColSpan(2, 0, 2);
    table.getFlexCellFormatter().setColSpan(3, 0, 2);
    table.getFlexCellFormatter().setColSpan(7, 0, 2);

    // By default is enabled search mode simple
    table.getCellFormatter().setVisible(3, 0, false);
    table.getCellFormatter().setVisible(4, 0, false);
    table.getCellFormatter().setVisible(4, 1, false);

    searchButton.setStyleName("okm-YesButton");
    saveSearchButton.setStyleName("okm-AddButton");
    saveSearchButton.addStyleName("okm-NoWrap");
    cleanButton.setStyleName("okm-NoButton");
    searchSavedName.setStyleName("okm-Input");
    resultPage.setStyleName("okm-Input");

    initWidget(scrollPanel);
  }
  public FactTypeBrowserWidget(final ClickEvent ev) {
    this.tree = new Tree();

    final VerticalPanel panel = new VerticalPanel();
    final HorizontalPanel hpFactsAndHide = new HorizontalPanel();
    final HorizontalPanel hpShow = new HorizontalPanel();

    hpShow.add(
        new ClickableLabel(
            DRLTextEditorConstants.INSTANCE.ShowFactTypes(),
            new ClickHandler() {
              public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
                hpShow.setVisible(false);
                hpFactsAndHide.setVisible(true);
                tree.setVisible(true);
              }
            }));
    panel.add(hpShow);

    hpFactsAndHide.add(new SmallLabel(DRLTextEditorConstants.INSTANCE.FactTypes()));
    hpFactsAndHide.add(
        new ClickableLabel(
            DRLTextEditorConstants.INSTANCE.hide(),
            new ClickHandler() {
              public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
                hpShow.setVisible(true);
                hpFactsAndHide.setVisible(false);
                tree.setVisible(false);
              }
            }));
    panel.add(hpFactsAndHide);

    panel.add(tree);

    tree.setStyleName(DRLTextEditorResources.INSTANCE.CSS().categoryExplorerTree());
    tree.addSelectionHandler(
        new SelectionHandler<TreeItem>() {
          public void onSelection(SelectionEvent<TreeItem> event) {
            Object o = event.getSelectedItem().getUserObject();
            if (o instanceof ClassUserObject) {
              ev.selected(((ClassUserObject) o).textToInsert);
            } else if (o instanceof String) {
              ev.selected((String) o);
            }
          }
        });

    tree.addOpenHandler(
        new OpenHandler<TreeItem>() {
          @Override
          public void onOpen(final OpenEvent<TreeItem> event) {
            final TreeItem item = event.getTarget();
            if (needsLoading(item)) {
              final Object userObject = event.getTarget().getUserObject();
              presenter.loadClassFields(
                  ((ClassUserObject) userObject).fullyQualifiedClassName,
                  new Callback<List<String>>() {
                    @Override
                    public void callback(final List<String> fields) {
                      item.getChild(0).remove();
                      if (fields != null) {
                        for (String field : fields) {
                          final TreeItem fi = new TreeItem();
                          fi.setHTML(
                              AbstractImagePrototype.create(
                                          DRLTextEditorResources.INSTANCE.images().fieldImage())
                                      .getHTML()
                                  + "<small>"
                                  + field
                                  + "</small>");
                          fi.setUserObject(field);
                          item.addItem(fi);
                        }
                      }
                    }
                  });
            }
          }
        });

    tree.setVisible(false);
    hpFactsAndHide.setVisible(false);
    hpShow.setVisible(true);

    initWidget(panel);
  }
Exemple #13
0
 /**
  * Inserts a tool.
  *
  * @param tool the tool to insert
  * @param index the insert location
  */
 public void insertTool(Widget tool, int index) {
   tools.add(index, tool);
   widgetPanel.setVisible(true);
   widgetPanel.insert(tool, index);
 }
  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());
    }
  }