Package fr.openwide.maven.artifact.notifier.web.application.common.behavior

Examples of fr.openwide.maven.artifact.notifier.web.application.common.behavior.AuthenticatedOnlyBehavior


        super.onConfigure();
        setVisible(!artifactService.hasProject(getModelObject()) &&
            ArtifactDeprecationStatus.NORMAL.equals(getModelObject().getDeprecationStatus()));
      }
    };
    noProjectContainer.add(new AuthenticatedOnlyBehavior());
    add(noProjectContainer);
   
    //  >  No project label
    noProjectContainer.add(new Label("noProject", new ResourceModel("artifact.project.noProject")));
   
View Full Code Here


  private Form<Artifact> form;
 
  public ArtifactDeprecationFormPopupPanel(String id, IModel<? extends Artifact> artifactModel) {
    super(id, artifactModel);
   
    add(new AuthenticatedOnlyBehavior());
  }
View Full Code Here

        boolean isDeprecated = artifact != null && ArtifactDeprecationStatus.DEPRECATED.equals(artifact.getDeprecationStatus());

        setVisible(!isDeprecated && user != null && artifactBean != null && !userService.isFollowedArtifactBean(user, artifactBean));
      }
    };
    follow.add(new AuthenticatedOnlyBehavior());
    item.add(follow);
   
    final IModel<Artifact> relatedArtifactModel = BindingModel.of(artifactModel, Binding.artifact().relatedArtifact());
    Link<Void> relatedArtifactLink = ArtifactDescriptionPage.linkDescriptor(relatedArtifactModel).link("relatedArtifactLink");
    relatedArtifactLink.add(new Behavior() {
      private static final long serialVersionUID = 1L;

      @Override
      public void onConfigure(Component component) {
        super.onConfigure(component);
        ArtifactBean artifactBean = item.getModelObject();
        Artifact artifact = artifactModel.getObject();
        User user = MavenArtifactNotifierSession.get().getUser();
        boolean isDeprecated = (artifact != null) && ArtifactDeprecationStatus.DEPRECATED.equals(artifact.getDeprecationStatus());
       
        component.setVisibilityAllowed(isDeprecated && user != null && artifactBean != null && !userService.isFollowedArtifactBean(user, artifactBean));
        component.setEnabled(relatedArtifactModel.getObject() != null);
      }
    });
    relatedArtifactLink.add(new AuthenticatedOnlyBehavior());
    relatedArtifactLink.add(new AttributeModifier("title", new LoadableDetachableModel<String>() {
      private static final long serialVersionUID = 1L;

      @Override
      protected String load() {
        Artifact relatedArtifact = relatedArtifactModel.getObject();
        StringBuilder sb = new StringBuilder(getString("artifact.description.deprecated"));
        if (relatedArtifact != null) {
          sb.append(" ").append(getString("artifact.deprecation.link.title", relatedArtifactModel));
        }
        return sb.toString();
      }
    }));
    item.add(relatedArtifactLink);
   
    AjaxLink<Artifact> unfollow = new AjaxLink<Artifact>("unfollow", artifactModel) {
      private static final long serialVersionUID = 1L;
     
      @Override
      public void onClick(AjaxRequestTarget target) {
        try {
          if (!userService.unfollowArtifact(MavenArtifactNotifierSession.get().getUser(), getModelObject())) {
            getSession().warn(getString("artifact.delete.notFollowed"));
          }
          refresh(target, item);
        } catch (Exception e) {
          LOGGER.error("Error occured while unfollowing artifact", e);
          getSession().error(getString("common.error.unexpected"));
        }
        FeedbackUtils.refreshFeedback(target, getPage());
      }
     
      @Override
      protected void onConfigure() {
        super.onConfigure();
        Artifact artifact = getModelObject();
        User user = MavenArtifactNotifierSession.get().getUser();
       
        setVisible(user != null && artifact != null && userService.isFollowedArtifact(user, artifact));
      }
    };
    unfollow.add(new AuthenticatedOnlyBehavior());
    item.add(unfollow);
   
    item.add(new WebMarkupContainer("registerTooltip") {
      private static final long serialVersionUID = 1L;
View Full Code Here

TOP

Related Classes of fr.openwide.maven.artifact.notifier.web.application.common.behavior.AuthenticatedOnlyBehavior

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.