Package fr.openwide.core.wicket.behavior

Examples of fr.openwide.core.wicket.behavior.ClassAttributeAppender


   
    Artifact artifact = item.getModelObject();
    final IModel<Artifact> artifactModel = new ArtifactModel(Model.of(item.getModelObject().getArtifactKey()));
    final ArtifactLastVersionModel artifactLastVersionModel = new ArtifactLastVersionModel(artifactModel);
   
    item.add(new ClassAttributeAppender(new LoadableDetachableModel<String>() {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected String load() {
        User user = MavenArtifactNotifierSession.get().getUser();
View Full Code Here


    super(id, artifactListModel);
    setOutputMarkupId(true);
   
    // Dropdown
    BookmarkablePageLink<Void> followArtifactLink = new BookmarkablePageLink<Void>("followArtifactLink", ArtifactSearchPage.class);
    followArtifactLink.add(new ClassAttributeAppender("dropdown-toggle"));
    followArtifactLink.add(new AttributeAppender("data-toggle", "dropdown"));
    followArtifactLink.add(new AttributeModifier("href", "#"));
    followArtifactLink.add(new Label("followArtifactLabel", new ResourceModel("dashboard.artifact.add")));
   
    WebMarkupContainer caret = new WebMarkupContainer("caret");
    followArtifactLink.add(caret);
    add(followArtifactLink);
   
    WebMarkupContainer dropdownMenu = new ListView<NavigationMenuItem>("dropdownMenu", getSearchDropDownItems()) {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected void populateItem(ListItem<NavigationMenuItem> subMenuItem) {
        NavigationMenuItem subMenu = subMenuItem.getModelObject();
       
        AbstractLink navLink = subMenu.link("searchLink");
        navLink.add(new Label("searchLabel", subMenu.getLabelModel()));
       
        subMenuItem.add(navLink);
      }
    };
    add(dropdownMenu);
   
    // List-filter
    ListFilterOptions listFilterOptions = new ListFilterOptions();
    listFilterOptions.setItemsSelector(".artifact");
    listFilterOptions.setScanSelector(".artifact-property");
   
    add(new ListFilterBehavior(listFilterOptions));
   
    // Followed artifacts
    GenericEntityCollectionView<FollowedArtifact> artifacts = new GenericEntityCollectionView<FollowedArtifact>("artifacts", artifactListModel) {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected void populateItem(final Item<FollowedArtifact> item) {
        final IModel<FollowedArtifact> followedArtifactModel = item.getModel();
        item.setOutputMarkupId(true);
       
        final IModel<ArtifactBean> backupArtifactBeanModel = new Model<ArtifactBean>(null);
       
        item.add(new ClassAttributeAppender(new EitherModel<String>(new Model<String>(null), new Model<String>("error")) {
          private static final long serialVersionUID = 1L;
         
          @Override
          protected boolean shouldGetFirstModel() {
            return followedArtifactModel.getObject() != null;
View Full Code Here

    MarkupContainer htmlRootElement = new TransparentWebMarkupContainer("htmlRootElement");
    htmlRootElement.add(AttributeAppender.append("lang", MavenArtifactNotifierSession.get().getLocale().getLanguage()));
    add(htmlRootElement);
   
    MarkupContainer bodyElement = new TransparentWebMarkupContainer("bodyElement");
    bodyElement.add(new ClassAttributeAppender(new LoadableDetachableModel<String>() {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected String load() {
        StringBuilder cssClassesSb = new StringBuilder();
        for (String cssClasse : bodyCssClasses) {
          cssClassesSb.append(cssClasse).append(" ");
        }
        return cssClassesSb.toString();
      }
    }));
    add(bodyElement);
   
    add(new AnimatedGlobalFeedbackPanel("animatedGlobalFeedbackPanel"));
   
    addHeadPageTitlePrependedElement(new BreadCrumbElement(new ResourceModel("common.rootPageTitle")));
    add(createHeadPageTitle("headPageTitle"));
   
    Link<Void> homePageLink = MavenArtifactNotifierApplication.get().getHomePageLinkDescriptor().link("homePageLink");
    if (HomePage.class.equals(getClass())) {
      homePageLink.setBeforeDisabledLink("");
      homePageLink.setAfterDisabledLink("");
      homePageLink.setEnabled(false);
    } else {
      homePageLink.add(new AttributeAppender("title", new ResourceModel("navigation.backToHome")));
    }
    add(homePageLink);
   
    // Bread crumb
    add(createBodyBreadCrumb("breadCrumb"));
   
    // Main navigation bar
    add(new ListView<NavigationMenuItem>("mainNav", getMainNav()) {
      private static final long serialVersionUID = -2257358650754295013L;
     
      @Override
      protected void populateItem(ListItem<NavigationMenuItem> item) {
        NavigationMenuItem navItem = item.getModelObject();
       
        AbstractLink navLink = navItem.link("navLink");
        navLink.add(new Label("navLabel", navItem.getLabelModel()));
       
        item.setVisible(navItem.isAccessible());
        if (navItem.isActive(MainTemplate.this.getFirstMenuPage())) {
          item.add(new ClassAttributeAppender("active"));
        }
       
        item.add(navLink);
       
        // Dropdown
        List<NavigationMenuItem> subMenuItems = navItem.getSubMenuItems();
        WebMarkupContainer caret = new WebMarkupContainer("caret");
        navLink.add(caret);
        WebMarkupContainer dropdownMenu = new ListView<NavigationMenuItem>("dropdownMenu", subMenuItems) {
          private static final long serialVersionUID = 1L;
         
          @Override
          protected void populateItem(ListItem<NavigationMenuItem> subMenuItem) {
            NavigationMenuItem subMenu = subMenuItem.getModelObject();
           
            AbstractLink navLink = subMenu.link("subMenuLink");
            navLink.add(new Label("subMenuLabel", subMenu.getLabelModel()));
           
            subMenuItem.setVisible(subMenu.isAccessible());
            subMenuItem.add(navLink);
          }
        };
        item.add(dropdownMenu);
        if (!subMenuItems.isEmpty()) {
          item.add(new ClassAttributeAppender("dropdown"));
          navLink.add(new ClassAttributeAppender("dropdown-toggle"));
          navLink.add(new AttributeAppender("data-toggle", "dropdown"));
          navLink.add(new AttributeModifier("href", "#"));
          caret.setVisible(true);
          dropdownMenu.setVisible(true);
        } else {
          caret.setVisible(false);
          dropdownMenu.setVisible(false);
        }
      }
    });
   
    // Second level navigation bar
    add(new ListView<NavigationMenuItem>("subNav", getSubNav()) {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected void populateItem(ListItem<NavigationMenuItem> item) {
        NavigationMenuItem navItem = item.getModelObject();
       
        AbstractLink navLink = navItem.link("navLink");
        navLink.add(new Label("navLabel", navItem.getLabelModel()));
       
        item.setVisible(navItem.isAccessible());
        if (navItem.isActive(MainTemplate.this.getSecondMenuPage())) {
          item.add(new ClassAttributeAppender("active"));
        }
       
        item.add(navLink);
      }
     
      @Override
      protected void onConfigure() {
        super.onConfigure();
        List<NavigationMenuItem> navigationMenuItems = getModelObject();
        setVisible(navigationMenuItems != null && !navigationMenuItems.isEmpty());
      }
    });
   
    // User menu
    IModel<String> userDisplayNameModel = new LoadableDetachableModel<String>() {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected String load() {
        String userDisplayName = null;
        User user = MavenArtifactNotifierSession.get().getUser();
        if (user != null) {
          userDisplayName = user.getDisplayName();
        }
        return userDisplayName;
      }
    };
    WebMarkupContainer userMenuContainer = new WebMarkupContainer("userMenuContainer", userDisplayNameModel) {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onConfigure() {
        super.onConfigure();
        setVisible(getDefaultModelObject() != null);
      }
    };
    add(userMenuContainer);
   
    Link<Void> viewProfileLink = new BookmarkablePageLink<Void>("viewProfileLink", ViewProfilePage.class);
    viewProfileLink.add(new Label("userDisplayName", userDisplayNameModel));
    userMenuContainer.add(viewProfileLink);
    userMenuContainer.add(new BookmarkablePageLink<Void>("logoutLink", LogoutPage.class));
   
    // Navigation bar right part
   
    //  >  Sign in
    Button signIn = new Button("signIn") {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onConfigure() {
        super.onConfigure();
        setVisible(!AuthenticatedWebSession.exists() || !AuthenticatedWebSession.get().isSignedIn());
      }
    };
    add(signIn);

    IdentificationPopoverPanel identificationPopoverPanel = new IdentificationPopoverPanel("identificationPopoverPanel");
    add(identificationPopoverPanel);
   
    BootstrapPopoverOptions popoverOptions = new BootstrapPopoverOptions();
    popoverOptions.setTitleText(new ResourceModel("navigation.signIn").getObject());
    popoverOptions.setContentComponent(identificationPopoverPanel);
    popoverOptions.setPlacement(PopoverPlacement.BOTTOM);
    popoverOptions.setHtml(true);
    popoverOptions.setContainer(".navbar");
    signIn.add(new BootstrapPopoverBehavior(popoverOptions));
    signIn.add(new ClassAttributeAppender(Model.of("popover-btn")));
   
    // Footer
    add(new FooterPanel("footer"));
   
    // Tooltip
View Full Code Here

      }
    };
   
    LabelWithPlaceholder latestVersionLabel = new LabelWithPlaceholder("latestVersion", model);
    latestVersionLabel.setHideIfEmpty(!showPlaceholder);
    latestVersionLabel.add(new ClassAttributeAppender(cssClassModel));
    add(latestVersionLabel);
  }
View Full Code Here

    ArtifactBean artifactBean = item.getModelObject();

    final ArtifactModel artifactModel = new ArtifactModel(Model.of(item.getModelObject().getArtifactKey()));
    final ArtifactLastVersionModel artifactLastVersionModel = new ArtifactLastVersionModel(artifactModel);
   
    item.add(new ClassAttributeAppender(new LoadableDetachableModel<String>() {
      private static final long serialVersionUID = 1L;
     
      @Override
      protected String load() {
        User user = MavenArtifactNotifierSession.get().getUser();
View Full Code Here

TOP

Related Classes of fr.openwide.core.wicket.behavior.ClassAttributeAppender

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.