org.apache.wicket.extensions.markup.html.tabs.AbstractTab Java Examples

The following examples show how to use org.apache.wicket.extensions.markup.html.tabs.AbstractTab. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstancePanel.java    From inception with Apache License 2.0 6 votes vote down vote up
private List<ITab> makeTabs()
{
    List<ITab> tabs = new ArrayList<>();
            
    tabs.add(new AbstractTab(Model.of("Mentions"))
    {
        private static final long serialVersionUID = 6703144434578403272L;

        @Override
        public Panel getPanel(String panelId)
        {
            if (selectedInstanceHandle.getObject() != null) {
                return new AnnotatedListIdentifiers(panelId, kbModel, selectedConceptHandle,
                        selectedInstanceHandle, true);
            }
            else {
                return new EmptyPanel(panelId);
            }
        }
    });        
    return tabs;
}
 
Example #2
Source File: SCIMConfUserPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
private <T extends Enum<?>> void buildComplexAccordion(
        final SCIMComplexConf<T> complex,
        final String basePanelId,
        final String baseTabId,
        final T canonicalType) {

    Accordion accordion = new Accordion(basePanelId + '_' + complex.getType().name(),
            Collections.<ITab>singletonList(new AbstractTab(Model.of(baseTabId + '.' + complex.getType().name())) {

                private static final long serialVersionUID = -5861786415855103549L;

                @Override
                public WebMarkupContainer getPanel(final String panelId) {
                    return buildComplexAccordionContent(complex, canonicalType, panelId);
                }

            }), Model.of(-1)); // accordion closed at beginning
    add(accordion.setOutputMarkupId(true));
}
 
Example #3
Source File: RoleWizardBuilder.java    From syncope with Apache License 2.0 6 votes vote down vote up
public Details(final RoleWrapper modelObject) {
    add(new AjaxTextFieldPanel(
            Constants.KEY_FIELD_NAME,
            Constants.KEY_FIELD_NAME,
            new PropertyModel<>(modelObject.getInnerObject(), Constants.KEY_FIELD_NAME), false).
            setEnabled(StringUtils.isEmpty(modelObject.getInnerObject().getKey())));

    // ------------------------
    // dynMembershipCond
    // ------------------------
    add(new Accordion("dynMembershipCond", Collections.<ITab>singletonList(
            new AbstractTab(new ResourceModel("dynMembershipCond", "Dynamic USER Membership Conditions")) {

        private static final long serialVersionUID = 1037272333056449378L;

        @Override
        public Panel getPanel(final String panelId) {
            return new UserSearchPanel.Builder(
                    new PropertyModel<>(modelObject, "dynClauses")).
                    required(true).build(panelId);
        }
    }), Model.of(StringUtils.isBlank(modelObject.getDynMembershipCond()) ? -1 : 0)).setOutputMarkupId(true));
    // ------------------------
}
 
Example #4
Source File: SchemasPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
private List<ITab> buildTabList() {
    List<ITab> tabs = new ArrayList<>();

    for (final SchemaType schemaType : SchemaType.values()) {
        tabs.add(new AbstractTab(new Model<>(schemaType.name())) {

            private static final long serialVersionUID = 1037272333056449378L;

            @Override
            public Panel getPanel(final String panelId) {
                return new SchemaTypePanel(panelId, schemaType, pageRef);
            }
        });
    }

    return tabs;
}
 
Example #5
Source File: LinkedAccountPlainAttrsPanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
public <T extends AnyTO> LinkedAccountPlainAttrsPanel(
        final EntityWrapper<LinkedAccountTO> modelObject,
        final UserTO userTO,
        final List<String> whichPlainAttrs) throws IllegalArgumentException {

    super(userTO,
            AjaxWizard.Mode.EDIT,
            AnyTypeRestClient.read(userTO.getType()).getClasses(),
            whichPlainAttrs,
            modelObject);

    this.linkedAccountTO = modelObject.getInnerObject();
    this.fixedAttrs.addAll(this.linkedAccountTO.getPlainAttrs().stream().
            filter(attrTO -> checkIsReadonlyAttr(attrTO.getSchema())).
            collect(Collectors.toList()));
    this.userTO = userTO;

    add(new Accordion("plainSchemas", List.of(new AbstractTab(
            new ResourceModel("attributes.accordion", "Plain Attributes")) {

        private static final long serialVersionUID = -7078941093668723016L;

        @Override
        public WebMarkupContainer getPanel(final String panelId) {
            return new PlainSchemasOwn(panelId, schemas, attrs);
        }
    }), Model.of(0)).setOutputMarkupId(true));
}
 
Example #6
Source File: SCIMConfUserPanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
private void buildAddressAccordion(final SCIMUserAddressConf address, final AddressCanonicalType canonicalType) {
    Accordion accordion = new Accordion("addressesAccordion_" + address.getType().name(),
            Collections.<ITab>singletonList(new AbstractTab(Model.of("address." + address.getType().name())) {

                private static final long serialVersionUID = -5861786415855103549L;

                @Override
                public WebMarkupContainer getPanel(final String panelId) {
                    return buildAddressAccordionContent(address, canonicalType, panelId);
                }

            }), Model.of(-1)); // accordion closed at beginning
    add(accordion.setOutputMarkupId(true));
}
 
Example #7
Source File: SCIMConfUserPanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
private void buildNameAccordion() {
    final Accordion accordion = new Accordion("nameAccordion",
            Collections.<ITab>singletonList(new AbstractTab(Model.of("name")) {

                private static final long serialVersionUID = -5861786415855103549L;

                @Override
                public WebMarkupContainer getPanel(final String panelId) {
                    return buildNameAccordionContent(panelId);
                }

            }), Model.of(-1)); // accordion closed at beginning
    add(accordion.setOutputMarkupId(true));
}
 
Example #8
Source File: SCIMConfEnterpriseUserPanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
private void buildManagerAccordion() {
    final Accordion accordion = new Accordion("managerAccordion",
            Collections.<ITab>singletonList(new AbstractTab(Model.of("manager")) {

                private static final long serialVersionUID = -5861786415855103549L;

                @Override
                public WebMarkupContainer getPanel(final String panelId) {
                    return buildNameAccordionContent(panelId);
                }

            }), Model.of(-1)); // accordion closed at beginning
    add(accordion.setOutputMarkupId(true));

}
 
Example #9
Source File: NetworkServices.java    From syncope with Apache License 2.0 5 votes vote down vote up
private List<ITab> buildTabList() {
    return Stream.of(NetworkService.Type.values()).
            sorted().
            map(type -> new AbstractTab(Model.of(type.name())) {

        private static final long serialVersionUID = -5861786415855103549L;

        @Override
        public WebMarkupContainer getPanel(final String panelId) {
            return new NetworkServiceDirectoryPanel(panelId, type, getPageReference());
        }
    }).collect(Collectors.toList());
}
 
Example #10
Source File: Implementations.java    From syncope with Apache License 2.0 5 votes vote down vote up
private List<ITab> buildTabList() {
    return SyncopeConsoleSession.get().getPlatformInfo().getImplementationTypes().stream().
            filter(type -> !IdRepoImplementationType.JWT_SSO_PROVIDER.equals(type)
            && !IdRepoImplementationType.AUDIT_APPENDER.equals(type)).
            sorted().
            map(type -> new AbstractTab(Model.of(type)) {

        private static final long serialVersionUID = -5861786415855103549L;

        @Override
        public WebMarkupContainer getPanel(final String panelId) {
            return new ImplementationDirectoryPanel(panelId, type, getPageReference());
        }
    }).collect(Collectors.toList());
}
 
Example #11
Source File: PushTaskFilters.java    From syncope with Apache License 2.0 5 votes vote down vote up
public PushTaskFilters(final PushTaskWrapper pushTaskWrapper) {
    super();

    final LoadableDetachableModel<List<AnyTypeTO>> types = new LoadableDetachableModel<List<AnyTypeTO>>() {

        private static final long serialVersionUID = 5275935387613157437L;

        @Override
        protected List<AnyTypeTO> load() {
            return AnyTypeRestClient.listAnyTypes();
        }
    };

    add(new ListView<AnyTypeTO>("filters", types) {

        private static final long serialVersionUID = 9101744072914090143L;

        @Override
        protected void populateItem(final ListItem<AnyTypeTO> item) {
            final String key = item.getModelObject().getKey();
            item.add(new Accordion("filters", Collections.<ITab>singletonList(
                    new AbstractTab(new StringResourceModel(
                            "filters", this, new Model<>(item.getModelObject()))) {

                private static final long serialVersionUID = 1037272333056449378L;

                @Override
                public Panel getPanel(final String panelId) {
                    return new AnyObjectSearchPanel.Builder(
                            key, new MapOfListModel<>(pushTaskWrapper, "filterClauses", key)).
                            required(false).build(panelId);
                }
            }), Model.of(StringUtils.isBlank(pushTaskWrapper.getFilters().get(key)) ? -1 : 0))
                    .setOutputMarkupId(true));
        }
    });
}
 
Example #12
Source File: WidgetTabs.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public WidgetTabs(String id, List<AbstractTab> tabs, int selectedTab) {
	super(id, new Model(Integer.valueOf(-1)));
	setOutputMarkupId(true);
	setVersioned(false);
	this.setTabs(tabs);
	if(this.tabs == null) {
		this.tabs = new ArrayList<AbstractTab>();
	}
	
	// tabs	
	Loop tabLoop = new Loop("tabs", tabs.size()) {
		private static final long serialVersionUID = 1L;
		@Override
		protected void populateItem(LoopItem item) {
			int index = item.getIndex();
			AbstractTab tab = ((AbstractTab) WidgetTabs.this.tabs.get(index));
			
			int selected = getSelectedTab();
			if(index == selected) {
				item.add(new AttributeModifier("class", new Model("tabsel")));
			}
			
			final WebMarkupContainer titleLink = newLink("link", index);
			titleLink.add(new Label("title", tab.getTitle()));
			item.add(titleLink);
		}			
	};
	add(tabLoop);
	
	// add ajax behavior
	loadSelectedTabBehavior = new LoadSelectedTabBehavior();
	add(loadSelectedTabBehavior);	
	
	// select initial tab
	setSelectedTab(selectedTab, false);
}
 
Example #13
Source File: Widget.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public Widget(String id, String iconUrl, String title, List<WidgetMiniStat> widgetMiniStats, List<AbstractTab> widgetTabs, String siteId) {
	super(id);
	this.iconUrl = iconUrl;
	this.title = title;
	this.widgetMiniStats = widgetMiniStats;
	this.tabs = widgetTabs;

	StatsAuthz statsAuthz = Locator.getFacade().getStatsAuthz();
	siteStatsView = statsAuthz.isUserAbleToViewSiteStats(siteId);
}
 
Example #14
Source File: Widget.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public Widget(String id, String iconUrl, String title, List<WidgetMiniStat> widgetMiniStats, List<AbstractTab> widgetTabs, String siteId) {
	super(id);
	this.iconUrl = iconUrl;
	this.title = title;
	this.widgetMiniStats = widgetMiniStats;
	this.tabs = widgetTabs;

	StatsAuthz statsAuthz = Locator.getFacade().getStatsAuthz();
	siteStatsView = statsAuthz.isUserAbleToViewSiteStats(siteId);
}
 
Example #15
Source File: WidgetTabs.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public WidgetTabs(String id, List<AbstractTab> tabs, int selectedTab) {
	super(id, new Model(Integer.valueOf(-1)));
	setOutputMarkupId(true);
	setVersioned(false);
	this.setTabs(tabs);
	if(this.tabs == null) {
		this.tabs = new ArrayList<AbstractTab>();
	}
	
	// tabs	
	Loop tabLoop = new Loop("tabs", tabs.size()) {
		private static final long serialVersionUID = 1L;
		@Override
		protected void populateItem(LoopItem item) {
			int index = item.getIndex();
			AbstractTab tab = ((AbstractTab) WidgetTabs.this.tabs.get(index));
			
			int selected = getSelectedTab();
			if(index == selected) {
				item.add(new AttributeModifier("class", new Model("tabsel")));
			}
			
			final WebMarkupContainer titleLink = newLink("link", index);
			titleLink.add(new Label("title", tab.getTitle()));
			item.add(titleLink);
		}			
	};
	add(tabLoop);
	
	// add ajax behavior
	loadSelectedTabBehavior = new LoadSelectedTabBehavior();
	add(loadSelectedTabBehavior);	
	
	// select initial tab
	setSelectedTab(selectedTab, false);
}
 
Example #16
Source File: RoomsTabbedPanel.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	User u = userDao.get(getUserId());
	add(new AjaxBootstrapTabbedPanel<>("orgTabs", u.getGroupUsers().stream().map(gu -> new AbstractTab(Model.of(gu.getGroup().getName())) {
		private static final long serialVersionUID = 1L;

		@Override
		public WebMarkupContainer getPanel(String panelId) {
			return new RoomsPanel(panelId, roomDao.getGroupRooms(gu.getGroup().getId()));
		}
	}).collect(Collectors.toList())));
}
 
Example #17
Source File: WidgetTabs.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public List<AbstractTab> getTabs() {
	return tabs;
}
 
Example #18
Source File: ViewBusiness.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public ViewBusiness(String id, String userUuid, SakaiPerson sakaiPerson,
		boolean isBusinessInfoAllowed) {

	super(id);

	WebMarkupContainer businessInfoContainer = new WebMarkupContainer(
			"mainSectionContainer_business");
	businessInfoContainer.setOutputMarkupId(true);
	businessInfoContainer.add(new Label("mainSectionHeading_business",
			new ResourceModel("heading.business")));
	add(businessInfoContainer);

	WebMarkupContainer businessBiographyContainer = new WebMarkupContainer(
			"businessBiographyContainer");

	businessBiographyContainer.add(new Label("businessBiographyLabel",
			new ResourceModel("profile.business.bio")));
	businessBiographyContainer.add(new Label("businessBiography",
			sakaiPerson.getBusinessBiography()));

	businessInfoContainer.add(businessBiographyContainer);

	if (StringUtils.isBlank(sakaiPerson.getBusinessBiography())) {
		businessBiographyContainer.setVisible(false);
	} else {
		visibleFieldCount_business++;
	}

	WebMarkupContainer companyProfilesContainer = new WebMarkupContainer(
			"companyProfilesContainer");

	companyProfilesContainer.add(new Label("companyProfilesLabel",
			new ResourceModel("profile.business.company.profiles")));

	List<CompanyProfile> companyProfiles = profileLogic.getCompanyProfiles(userUuid);

	List<ITab> tabs = new ArrayList<ITab>();
	if (null != companyProfiles) {

		for (final CompanyProfile companyProfile : companyProfiles) {

			visibleFieldCount_business++;

			tabs.add(new AbstractTab(new ResourceModel(
					"profile.business.company.profile")) {

				private static final long serialVersionUID = 1L;

				@Override
				public Panel getPanel(String panelId) {

					return new CompanyProfileDisplay(panelId,
							companyProfile);
				}

			});
		}
	}

	companyProfilesContainer.add(new AjaxTabbedPanel("companyProfiles", tabs));
	businessInfoContainer.add(companyProfilesContainer);

	if (0 == tabs.size()) {
		companyProfilesContainer.setVisible(false);
	}

	// if nothing/not allowed, hide whole panel
	if (visibleFieldCount_business == 0 || !isBusinessInfoAllowed) {
		businessInfoContainer.setVisible(false);
	}
}
 
Example #19
Source File: MyBusinessEdit.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private WebMarkupContainer createCompanyProfileEditsContainer(
		final UserProfile userProfile, TabDisplay tabDisplay) {

	WebMarkupContainer companyProfilesContainer = new WebMarkupContainer(
			"companyProfilesContainer");

	companyProfilesContainer.add(new Label("companyProfilesLabel",
			new ResourceModel("profile.business.company.profiles")));

	List<ITab> tabs = new ArrayList<ITab>();
	if (null != userProfile.getCompanyProfiles()) {

		for (final CompanyProfile companyProfile : userProfile
				.getCompanyProfiles()) {

			tabs.add(new AbstractTab(new ResourceModel("profile.business.company.profile")) {

				private static final long serialVersionUID = 1L;

				@Override
				public Panel getPanel(String panelId) {

					return new CompanyProfileEdit(panelId, companyProfile);
				}

			});
		}
	}

	companyProfileTabs = new AjaxTabbedPanel("companyProfiles", tabs);
	companyProfilesContainer.add(companyProfileTabs);

	if (tabs.size() > 0) {
		switch (tabDisplay) {
		case START:
			companyProfileTabs.setSelectedTab(0);
			break;
		case END:
			companyProfileTabs.setSelectedTab(tabs.size() - 1);
		}
	} else {
		companyProfilesContainer.setVisible(false);
	}

	return companyProfilesContainer;
}
 
Example #20
Source File: MyBusinessDisplay.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private int addCompanyProfiles(final UserProfile userProfile,
		int visibleFieldCount) {
	
	WebMarkupContainer companyProfilesContainer = new WebMarkupContainer(
			"companyProfilesContainer");

	companyProfilesContainer.add(new Label("companyProfilesLabel",
			new ResourceModel("profile.business.company.profiles")));
	
	List<ITab> tabs = new ArrayList<ITab>();

	if (null != userProfile.getCompanyProfiles()) {

		for (final CompanyProfile companyProfile : userProfile
				.getCompanyProfiles()) {

			tabs.add(new AbstractTab(new ResourceModel("profile.business.company.profile")) {

				private static final long serialVersionUID = 1L;

				@Override
				public Panel getPanel(String panelId) {

					return new CompanyProfileDisplay(panelId, companyProfile);
				}

			});
		}
	}

	companyProfilesContainer.add(new AjaxTabbedPanel("companyProfiles", tabs));
	add(companyProfilesContainer);
	
	if (0 == tabs.size()) {			
		companyProfilesContainer.setVisible(false);
	} else {
		visibleFieldCount++;
	}

	return visibleFieldCount;
}
 
Example #21
Source File: WidgetTabs.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public WidgetTabs(String id, List<AbstractTab> tabs) {
	this(id, tabs, -1);
}
 
Example #22
Source File: WidgetTabs.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public void setTabs(List<AbstractTab> tabs) {
	this.tabs = tabs;
}
 
Example #23
Source File: OIDCClient.java    From syncope with Apache License 2.0 4 votes vote down vote up
private List<ITab> buildTabList() {

        final List<ITab> tabs = new ArrayList<>(1);

        tabs.add(new AbstractTab(new ResourceModel("op")) {
            private static final long serialVersionUID = -6815067322125799251L;


            @Override
            public Panel getPanel(final String panelId) {
                return new OIDCProvidersDirectoryPanel(panelId, getPageReference());
            }
        });

        return tabs;
    }
 
Example #24
Source File: UserDetails.java    From syncope with Apache License 2.0 4 votes vote down vote up
public UserDetails(
        final UserWrapper wrapper,
        final boolean templateMode,
        final boolean includeStatusPanel,
        final boolean showPasswordManagement,
        final PageReference pageRef) {
    super(wrapper, templateMode, includeStatusPanel, pageRef);

    userTO = wrapper.getInnerObject();
    // ------------------------
    // Username
    // ------------------------
    username = new AjaxTextFieldPanel("username", "username", new PropertyModel<>(userTO, "username"), false);

    if (wrapper.getPreviousUserTO() != null && StringUtils.compare(
            wrapper.getPreviousUserTO().getUsername(), wrapper.getInnerObject().getUsername()) != 0) {

        username.showExternAction(new LabelInfo("externalAction", wrapper.getPreviousUserTO().getUsername()));
    }

    if (templateMode) {
        username.enableJexlHelp();
    } else {
        username.addRequiredLabel();
    }
    add(username);
    // ------------------------

    // ------------------------
    // Password
    // ------------------------
    final Model<Integer> model = Model.of(-1);

    final Accordion accordion = new Accordion("accordionPanel", Collections.<ITab>singletonList(
            new AbstractTab(new ResourceModel("password.change", "Change password")) {

        private static final long serialVersionUID = 1037272333056449378L;

        @Override
        public Panel getPanel(final String panelId) {
            EditUserPasswordPanel panel = new EditUserPasswordPanel(panelId, wrapper, templateMode);
            panel.setEnabled(model.getObject() >= 0);
            return panel;
        }
    }), model) {

        private static final long serialVersionUID = -2898628183677758699L;

        @Override
        protected Component newTitle(final String markupId, final ITab tab, final Accordion.State state) {
            return new AjaxLink<Integer>(markupId) {

                private static final long serialVersionUID = 7021195294339489084L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    model.setObject(model.getObject() == 0 ? -1 : 0);
                    Component passwordPanel = getParent().get(PASSWORD_CONTENT_PATH);
                    passwordPanel.setEnabled(model.getObject() >= 0);
                    target.add(passwordPanel);
                }
            }.setBody(new ResourceModel("password.change", "Change password ..."));
        }
    };

    accordion.setOutputMarkupId(true);
    accordion.setVisible(showPasswordManagement);
    add(accordion);
    // ------------------------        
}
 
Example #25
Source File: AnyPanel.java    From syncope with Apache License 2.0 4 votes vote down vote up
public AnyPanel(
        final String id,
        final AnyTypeTO anyTypeTO,
        final RealmTO realmTO,
        final AnyLayout anyLayout,
        final boolean enableSearch,
        final DirectoryPanelSupplier directoryPanelSupplier,
        final PageReference pageRef) {

    super(id);
    this.anyTypeTO = anyTypeTO;
    this.realmTO = realmTO;
    this.anyLayout = anyLayout;
    this.pageRef = pageRef;
    // ------------------------
    // Accordion
    // ------------------------
    Model<Integer> model = Model.of(-1);
    Accordion accordion = new Accordion("accordionPanel",
            List.of(new AbstractTab(new ResourceModel("search.result")) {

                protected static final long serialVersionUID = 1037272333056449377L;

                @Override
                public WebMarkupContainer getPanel(final String panelId) {
                    searchPanel = getSearchPanel(panelId);
                    return searchPanel;
                }

            }), model) {

        protected static final long serialVersionUID = -3056452800492734900L;

        @Override
        protected Component newTitle(final String markupId, final ITab tab, final Accordion.State state) {
            return new AjaxLink<Integer>(markupId) {

                protected static final long serialVersionUID = 6250423506463465679L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    model.setObject(model.getObject() == 0 ? -1 : 0);
                }
            }.setBody(tab.getTitle()).setEscapeModelStrings(false);
        }
    };
    accordion.setOutputMarkupId(true);
    add(accordion.setEnabled(enableSearch).setVisible(enableSearch));

    directoryPanel = createDirectoryPanel(anyTypeTO, realmTO, anyLayout, enableSearch, directoryPanelSupplier);
    add(directoryPanel);
    // ------------------------
}
 
Example #26
Source File: WidgetTabs.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public List<AbstractTab> getTabs() {
	return tabs;
}
 
Example #27
Source File: WidgetTabs.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public void setTabs(List<AbstractTab> tabs) {
	this.tabs = tabs;
}
 
Example #28
Source File: WidgetTabs.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public WidgetTabs(String id, List<AbstractTab> tabs) {
	this(id, tabs, -1);
}
 
Example #29
Source File: MyBusinessEdit.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private WebMarkupContainer createCompanyProfileEditsContainer(
		final UserProfile userProfile, TabDisplay tabDisplay) {

	WebMarkupContainer companyProfilesContainer = new WebMarkupContainer(
			"companyProfilesContainer");

	companyProfilesContainer.add(new Label("companyProfilesLabel",
			new ResourceModel("profile.business.company.profiles")));

	List<ITab> tabs = new ArrayList<ITab>();
	if (null != userProfile.getCompanyProfiles()) {

		for (final CompanyProfile companyProfile : userProfile
				.getCompanyProfiles()) {

			tabs.add(new AbstractTab(new ResourceModel("profile.business.company.profile")) {

				private static final long serialVersionUID = 1L;

				@Override
				public Panel getPanel(String panelId) {

					return new CompanyProfileEdit(panelId, companyProfile);
				}

			});
		}
	}

	companyProfileTabs = new AjaxTabbedPanel("companyProfiles", tabs);
	companyProfilesContainer.add(companyProfileTabs);

	if (tabs.size() > 0) {
		switch (tabDisplay) {
		case START:
			companyProfileTabs.setSelectedTab(0);
			break;
		case END:
			companyProfileTabs.setSelectedTab(tabs.size() - 1);
		}
	} else {
		companyProfilesContainer.setVisible(false);
	}

	return companyProfilesContainer;
}
 
Example #30
Source File: ViewBusiness.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public ViewBusiness(String id, String userUuid, SakaiPerson sakaiPerson,
		boolean isBusinessInfoAllowed) {

	super(id);

	WebMarkupContainer businessInfoContainer = new WebMarkupContainer(
			"mainSectionContainer_business");
	businessInfoContainer.setOutputMarkupId(true);
	businessInfoContainer.add(new Label("mainSectionHeading_business",
			new ResourceModel("heading.business")));
	add(businessInfoContainer);

	WebMarkupContainer businessBiographyContainer = new WebMarkupContainer(
			"businessBiographyContainer");

	businessBiographyContainer.add(new Label("businessBiographyLabel",
			new ResourceModel("profile.business.bio")));
	businessBiographyContainer.add(new Label("businessBiography",
			sakaiPerson.getBusinessBiography()));

	businessInfoContainer.add(businessBiographyContainer);

	if (StringUtils.isBlank(sakaiPerson.getBusinessBiography())) {
		businessBiographyContainer.setVisible(false);
	} else {
		visibleFieldCount_business++;
	}

	WebMarkupContainer companyProfilesContainer = new WebMarkupContainer(
			"companyProfilesContainer");

	companyProfilesContainer.add(new Label("companyProfilesLabel",
			new ResourceModel("profile.business.company.profiles")));

	List<CompanyProfile> companyProfiles = profileLogic.getCompanyProfiles(userUuid);

	List<ITab> tabs = new ArrayList<ITab>();
	if (null != companyProfiles) {

		for (final CompanyProfile companyProfile : companyProfiles) {

			visibleFieldCount_business++;

			tabs.add(new AbstractTab(new ResourceModel(
					"profile.business.company.profile")) {

				private static final long serialVersionUID = 1L;

				@Override
				public Panel getPanel(String panelId) {

					return new CompanyProfileDisplay(panelId,
							companyProfile);
				}

			});
		}
	}

	companyProfilesContainer.add(new AjaxTabbedPanel("companyProfiles", tabs));
	businessInfoContainer.add(companyProfilesContainer);

	if (0 == tabs.size()) {
		companyProfilesContainer.setVisible(false);
	}

	// if nothing/not allowed, hide whole panel
	if (visibleFieldCount_business == 0 || !isBusinessInfoAllowed) {
		businessInfoContainer.setVisible(false);
	}
}