/**
  * Updates the specified attribute of the given anchor.
  *
  * @param anchor the anchor whose attribute will be updated
  * @param name the attribute name
  * @param value the new attribute value, {@code null} to remove the attribute
  */
 private void updateAttribute(AnchorElement anchor, String name, String value) {
   if (StringUtils.isEmpty(value)) {
     anchor.removeAttribute(name);
   } else {
     anchor.setAttribute(name, value);
   }
 }
 @Override
 public void setActive() {
   // if the search box is empty, set focus there
   if (StringUtils.isEmpty(getKeyword())) {
     searchBox.setFocus(true);
   } else {
     super.setActive();
   }
 }
示例#3
0
  /**
   * {@inheritDoc}
   *
   * @see AbstractTableFeature#execute(String)
   */
  public boolean execute(String parameter) {
    if (StringUtils.isEmpty(parameter)) {
      // The command has been executed without insertion configuration, start the insert table
      // wizard.
      getWizard().start(CONFIG_STEP_NAME, null);
    } else {
      // Insert the table element.
      insertTable((TableConfig) TableConfig.fromJson(parameter));
    }

    return true;
  }
 /**
  * {@inheritDoc}
  *
  * @see Object#equals(Object)
  */
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (!(obj instanceof AttachmentReference)) {
     return false;
   }
   AttachmentReference other = (AttachmentReference) obj;
   return StringUtils.areEqual(getFileName(), other.getFileName()) && wikiPageReference == null
       ? other.wikiPageReference == null
       : wikiPageReference.equals(other.wikiPageReference);
 }
  /** {@inheritDoc} */
  @Override
  protected ListItem<WikiPage> getListItem(WikiPage data) {
    ListItem<WikiPage> item = new ListItem<WikiPage>();
    item.setData(data);
    String documentReferenceAsString =
        serializeDocumentReference(new WikiPageReference(data.getReference()));
    Label pageName =
        new Label(Strings.INSTANCE.entityLocatedIn() + " " + documentReferenceAsString);
    pageName.addStyleName("xPagePreviewFullname");
    Label title = new Label(data.getTitle());
    title.addStyleName("xPagePreviewTitle");

    FlowPanel ui = new FlowPanel();
    if (!StringUtils.isEmpty(data.getTitle())) {
      ui.add(title);
    }
    ui.setTitle(data.getTitle());
    ui.add(pageName);
    ui.addStyleName("xPagePreview");
    item.add(ui);
    return item;
  }