예제 #1
0
 @Override
 public boolean isVisible(Project project, String loggedInUserId) {
   LinkGroupsProjectExt ext = project.getExtension(LinkGroupsProjectExt.class);
   if (ext == null || ext.getLinkGroups().isEmpty()) {
     return false;
   } else {
     return true;
   }
 }
예제 #2
0
  @Override
  public Component getContent(Project project, ExtensionUtil util) {
    Layout layout = new CssLayout();
    layout.addStyleName(SYTLE_LINKGROUPS_INFOBOX);
    layout.setSizeFull();
    LinkGroupsProjectExt ext = project.getExtension(LinkGroupsProjectExt.class);
    if (ext != null && !ext.getLinkGroups().isEmpty()) {
      for (LinkGroup linkGroup : ext.getLinkGroups()) {
        Label linkGroupHeaderLabel = new Label(linkGroup.getCaption());
        linkGroupHeaderLabel.addStyleName(STYLE_LABEL_GROUP);
        layout.addComponent(linkGroupHeaderLabel);

        for (Link link : linkGroup.getItems()) {
          com.vaadin.ui.Link uiLink =
              new com.vaadin.ui.Link(link.getLabel(), new ExternalResource(link.getUrl()));
          uiLink.setDescription(link.getUrl());
          uiLink.addStyleName(STYLE_LABEL_LINK);
          uiLink.setTargetName("_blank"); // $NON-NLS-1$
          layout.addComponent(uiLink);
        }
      }
    }
    return layout;
  }