com.vaadin.ui.Link Java Examples

The following examples show how to use com.vaadin.ui.Link. 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: AbstractView.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the top header actions for user context.
 */
private void createTopHeaderActionsForUserContext() {
	if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN) || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) {
		final Link userHomePageLink = pageLinkFactory.createUserHomeViewPageLink();
		topHeaderRightPanel.addComponent(userHomePageLink);
		topHeaderRightPanel.setComponentAlignment(userHomePageLink, Alignment.MIDDLE_RIGHT);

		final Button logoutButton = new Button(LOGOUT,VaadinIcons.SIGN_OUT);

		final LogoutRequest logoutRequest = new LogoutRequest();
		logoutRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
		logoutButton.addClickListener(new LogoutClickListener(logoutRequest));

		topHeaderRightPanel.addComponent(logoutButton);
		topHeaderRightPanel.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT);

	} else {
		final Link createRegisterPageLink = pageLinkFactory.createRegisterPageLink();
		topHeaderRightPanel.addComponent(createRegisterPageLink);
		topHeaderRightPanel.setComponentAlignment(createRegisterPageLink, Alignment.MIDDLE_RIGHT);

		final Link createLoginPageLink = pageLinkFactory.createLoginPageLink();
		topHeaderRightPanel.addComponent(createLoginPageLink);
		topHeaderRightPanel.setComponentAlignment(createLoginPageLink, Alignment.MIDDLE_RIGHT);
	}
}
 
Example #2
Source File: TenantConfigurationDashboardView.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private HorizontalLayout saveConfigurationButtonsLayout() {

        final HorizontalLayout hlayout = new HorizontalLayout();
        hlayout.setSpacing(true);
        saveConfigurationBtn = SPUIComponentProvider.getButton(UIComponentIdProvider.SYSTEM_CONFIGURATION_SAVE, "", "",
                "", true, FontAwesome.SAVE, SPUIButtonStyleNoBorder.class);
        saveConfigurationBtn.setEnabled(false);
        saveConfigurationBtn.setDescription(i18n.getMessage("configuration.savebutton.tooltip"));
        saveConfigurationBtn.addClickListener(event -> saveConfiguration());
        hlayout.addComponent(saveConfigurationBtn);

        undoConfigurationBtn = SPUIComponentProvider.getButton(UIComponentIdProvider.SYSTEM_CONFIGURATION_CANCEL, "",
                "", "", true, FontAwesome.UNDO, SPUIButtonStyleNoBorder.class);
        undoConfigurationBtn.setEnabled(false);
        undoConfigurationBtn.setDescription(i18n.getMessage("configuration.cancellbutton.tooltip"));
        undoConfigurationBtn.addClickListener(event -> undoConfiguration());
        hlayout.addComponent(undoConfigurationBtn);

        final Link linkToSystemConfigHelp = SPUIComponentProvider.getHelpLink(i18n,
                uiProperties.getLinks().getDocumentation().getSystemConfigurationView());
        hlayout.addComponent(linkToSystemConfigHelp);

        return hlayout;
    }
 
Example #3
Source File: TargetAssignmentOperations.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private static void addValueChangeListener(final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout,
        final CheckBox enableMaintenanceWindowControl, final Link maintenanceWindowHelpLinkControl) {
    actionTypeOptionGroupLayout.getActionTypeOptionGroup()
            .addValueChangeListener(new Property.ValueChangeListener() {
                private static final long serialVersionUID = 1L;

                @Override
                // Vaadin is returning object so "==" might not work
                @SuppressWarnings("squid:S4551")
                public void valueChange(final Property.ValueChangeEvent event) {

                    if (event.getProperty().getValue()
                            .equals(AbstractActionTypeOptionGroupLayout.ActionTypeOption.DOWNLOAD_ONLY)) {
                        enableMaintenanceWindowControl.setValue(false);
                        enableMaintenanceWindowControl.setEnabled(false);
                        maintenanceWindowHelpLinkControl.setEnabled(false);

                    } else {
                        enableMaintenanceWindowControl.setEnabled(true);
                        maintenanceWindowHelpLinkControl.setEnabled(true);
                    }

                }
            });
}
 
Example #4
Source File: LoginWindow.java    From jpa-invoicer with The Unlicense 6 votes vote down vote up
@Override
public void attach() {
    super.attach();

    service = createService();
    String url = service.getAuthorizationUrl(null);
    
    gplusLoginButton = new Link("Login with Google", new ExternalResource(url));
    gplusLoginButton.addStyleName(ValoTheme.LINK_LARGE);

    VaadinSession.getCurrent().addRequestHandler(this);

    setContent(new MVerticalLayout(gplusLoginButton).alignAll(
            Alignment.MIDDLE_CENTER).withFullHeight());
    setModal(true);
    setWidth("300px");
    setHeight("200px");

}
 
Example #5
Source File: RolloutConfigurationView.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void init() {

        final Panel rootPanel = new Panel();
        rootPanel.setSizeFull();

        rootPanel.addStyleName("config-panel");

        final VerticalLayout vLayout = new VerticalLayout();
        vLayout.setMargin(true);
        vLayout.setSizeFull();

        final Label header = new Label(i18n.getMessage("configuration.rollout.title"));
        header.addStyleName("config-panel-header");
        vLayout.addComponent(header);

        final GridLayout gridLayout = new GridLayout(3, 1);
        gridLayout.setSpacing(true);
        gridLayout.setImmediate(true);
        gridLayout.setColumnExpandRatio(1, 1.0F);
        gridLayout.setSizeFull();

        approvalCheckbox = SPUIComponentProvider.getCheckBox("", "", null, false, "");
        approvalCheckbox.setId(UIComponentIdProvider.ROLLOUT_APPROVAL_ENABLED_CHECKBOX);
        approvalCheckbox.setValue(approvalConfigurationItem.isConfigEnabled());
        approvalCheckbox.addValueChangeListener(this);
        approvalConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(approvalCheckbox, 0, 0);
        gridLayout.addComponent(approvalConfigurationItem, 1, 0);

        final Link linkToApprovalHelp = SPUIComponentProvider.getHelpLink(i18n,
                uiProperties.getLinks().getDocumentation().getRollout());
        gridLayout.addComponent(linkToApprovalHelp, 2, 0);
        gridLayout.setComponentAlignment(linkToApprovalHelp, Alignment.BOTTOM_RIGHT);

        vLayout.addComponent(gridLayout);
        rootPanel.setContent(vLayout);
        setCompositionRoot(rootPanel);
    }
 
Example #6
Source File: SOSConfigForm.java    From sensorhub with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void build(String title, MyBeanItem<? extends Object> beanItem)
{
    super.build(title, beanItem);
    
    // add link to capabilities
    Property<?> endPointProp = beanItem.getItemProperty(PROP_ENDPOINT);
    if (endPointProp != null)
    {
        String baseUrl = ((String)endPointProp.getValue()).substring(1);
        String href = baseUrl + "?service=SOS&version=2.0&request=GetCapabilities";
        Link link = new Link("Link to capabilities", new ExternalResource(href), "_blank", 0, 0, null);
        this.addComponent(link, 0);
    }
}
 
Example #7
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createUserHomeViewPageLink() {
	final Link pageLink = new Link("User account:", new ExternalResource(PAGE_PREFIX
			+ UserViews.USERHOME_VIEW_NAME));
		pageLink.setId(ViewAction.VISIT_USER_HOME_VIEW.name());
		pageLink.setIcon(VaadinIcons.USER);
		return pageLink;
}
 
Example #8
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createRegisterPageLink() {
	final Link pageLink = new Link("Register", new ExternalResource(
			LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME + PAGE_SEPARATOR + ApplicationPageMode.REGISTER));
	pageLink.setId(ViewAction.VISIT_REGISTER.name());
	pageLink.setIcon(VaadinIcons.RANDOM);
	return pageLink;
}
 
Example #9
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createPoliticianPageLink(final PersonData personData) {
	final Link pageLink = new Link(POLITICIAN
			+ personData.getFirstName() + ' '
			+ personData.getLastName(), new ExternalResource(PAGE_PREFIX
					+ UserViews.POLITICIAN_VIEW_NAME + PAGE_SEPARATOR + personData.getId()));
	pageLink.setId(ViewAction.VISIT_POLITICIAN_VIEW.name() + PAGE_SEPARATOR
			+ personData.getId());
	pageLink.setIcon(VaadinIcons.BUG);
	return pageLink;
}
 
Example #10
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createMainViewPageLink() {
	final Link pageLink = new Link(MAIN_VIEW_LINK_TEXT, new ExternalResource(
			LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME));
	pageLink.setId(ViewAction.VISIT_MAIN_VIEW.name());
	pageLink.setIcon(VaadinIcons.STAR);
	return pageLink;
}
 
Example #11
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createLoginPageLink() {
	final Link pageLink = new Link("Login", new ExternalResource(
			LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME + PAGE_SEPARATOR + ApplicationPageMode.LOGIN));
	pageLink.setId(ViewAction.VISIT_LOGIN.name());
	pageLink.setIcon(VaadinIcons.SIGN_IN);
	return pageLink;
}
 
Example #12
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createAdminPagingLink(final String label,final String page, final String pageId, final String pageNr) {
	final Link pageLink = new Link(label,
			new ExternalResource(PAGE_PREFIX + page + PAGE_SEPARATOR
					+ "[" + pageNr + "]"));
	pageLink.setId(page +"ShowPage" + PAGE_SEPARATOR
			+ pageNr);
	pageLink.setIcon(VaadinIcons.SERVER);

	return pageLink;
}
 
Example #13
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link addPartyPageLink(final ViewRiksdagenParty data) {
	final Link pageLink = new Link(PARTY + data.getPartyName(),
			new ExternalResource(PAGE_PREFIX + UserViews.PARTY_VIEW_NAME + PAGE_SEPARATOR
					+ data.getPartyId()));
	pageLink.setId(ViewAction.VISIT_PARTY_VIEW.name() + PAGE_SEPARATOR
			+ data.getPartyId());
	pageLink.setIcon(VaadinIcons.GROUP);
	return pageLink;
}
 
Example #14
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link addMinistryPageLink(final ViewRiksdagenMinistry data) {
	final Link pageLink = new Link(MINISTRY + data.getNameId(),
			new ExternalResource(PAGE_PREFIX + UserViews.MINISTRY_VIEW_NAME + PAGE_SEPARATOR
					+ data.getNameId()));
	pageLink.setId(ViewAction.VISIT_MINISTRY_VIEW.name() + PAGE_SEPARATOR
			+ data.getNameId());
	pageLink.setIcon(VaadinIcons.GROUP);
	return pageLink;
}
 
Example #15
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link addCommitteePageLink(final ViewRiksdagenCommittee data) {
	final Link pageLink = new Link(COMMITTEE
			+ data.getEmbeddedId().getDetail(), new ExternalResource(PAGE_PREFIX
					+ UserViews.COMMITTEE_VIEW_NAME + PAGE_SEPARATOR + data.getEmbeddedId().getOrgCode()));
	pageLink.setId(ViewAction.VISIT_COMMITTEE_VIEW.name() + PAGE_SEPARATOR
			+ data.getEmbeddedId().getOrgCode());
	pageLink.setIcon(VaadinIcons.GROUP);
	return pageLink;
}
 
Example #16
Source File: AbstractHawkbitLoginUI.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected Component buildLinks() {

        final HorizontalLayout links = new HorizontalLayout();
        links.setSpacing(true);
        links.addStyleName("links");
        final String linkStyle = "v-link";

        if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
            final Link docuLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_DOCUMENTATION,
                    i18n.getMessage("link.documentation.name"), uiProperties.getLinks().getDocumentation().getRoot(),
                    FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle);
            links.addComponent(docuLink);
            docuLink.addStyleName(ValoTheme.LINK_SMALL);
        }

        if (!uiProperties.getLinks().getRequestAccount().isEmpty()) {
            final Link requestAccountLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_REQUESTACCOUNT,
                    i18n.getMessage("link.requestaccount.name"), uiProperties.getLinks().getRequestAccount(),
                    FontAwesome.SHOPPING_CART, "", linkStyle);
            links.addComponent(requestAccountLink);
            requestAccountLink.addStyleName(ValoTheme.LINK_SMALL);
        }

        if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
            final Link userManagementLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_USERMANAGEMENT,
                    i18n.getMessage("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
                    FontAwesome.USERS, "_blank", linkStyle);
            links.addComponent(userManagementLink);
            userManagementLink.addStyleName(ValoTheme.LINK_SMALL);
        }

        return links;
    }
 
Example #17
Source File: TargetFilterTable.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void addContainerproperties() {
    /* Create HierarchicalContainer container */
    container.addContainerProperty(SPUILabelDefinitions.NAME, Link.class, null);
    container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_USER, String.class, null);
    container.addContainerProperty(SPUILabelDefinitions.VAR_CREATED_DATE, Date.class, null);
    container.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_DATE, Date.class, null);
    container.addContainerProperty(SPUILabelDefinitions.VAR_MODIFIED_BY, String.class, null);
    container.addContainerProperty(SPUILabelDefinitions.AUTO_ASSIGN_DISTRIBUTION_SET, String.class, null);
}
 
Example #18
Source File: TargetAssignmentOperations.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private static HorizontalLayout createHorizontalLayout(final CheckBox maintenanceWindowControl,
        final Link maintenanceWindowHelpLink) {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(maintenanceWindowControl);
    layout.addComponent(maintenanceWindowHelpLink);
    return layout;
}
 
Example #19
Source File: CommonDialogWindow.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void addHelpLink() {

        if (StringUtils.isEmpty(helpLink)) {
            return;
        }
        final Link helpLinkComponent = SPUIComponentProvider.getHelpLink(i18n, helpLink);
        buttonsLayout.addComponent(helpLinkComponent);
        buttonsLayout.setComponentAlignment(helpLinkComponent, Alignment.MIDDLE_RIGHT);
    }
 
Example #20
Source File: AuthenticationConfigurationView.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private void init() {

        final Panel rootPanel = new Panel();
        rootPanel.setSizeFull();

        rootPanel.addStyleName("config-panel");

        final VerticalLayout vLayout = new VerticalLayout();
        vLayout.setMargin(true);
        vLayout.setSizeFull();

        final Label header = new Label(i18n.getMessage("configuration.authentication.title"));
        header.addStyleName("config-panel-header");
        vLayout.addComponent(header);

        final GridLayout gridLayout = new GridLayout(3, 4);
        gridLayout.setSpacing(true);
        gridLayout.setImmediate(true);
        gridLayout.setSizeFull();
        gridLayout.setColumnExpandRatio(1, 1.0F);

        certificateAuthCheckbox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        certificateAuthCheckbox.setValue(certificateAuthenticationConfigurationItem.isConfigEnabled());
        certificateAuthCheckbox.addValueChangeListener(this);
        certificateAuthenticationConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(certificateAuthCheckbox, 0, 0);
        gridLayout.addComponent(certificateAuthenticationConfigurationItem, 1, 0);

        targetSecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        targetSecTokenCheckBox.setValue(targetSecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
        targetSecTokenCheckBox.addValueChangeListener(this);
        targetSecurityTokenAuthenticationConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(targetSecTokenCheckBox, 0, 1);
        gridLayout.addComponent(targetSecurityTokenAuthenticationConfigurationItem, 1, 1);

        gatewaySecTokenCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        gatewaySecTokenCheckBox.setId("gatewaysecuritycheckbox");
        gatewaySecTokenCheckBox.setValue(gatewaySecurityTokenAuthenticationConfigurationItem.isConfigEnabled());
        gatewaySecTokenCheckBox.addValueChangeListener(this);
        gatewaySecurityTokenAuthenticationConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(gatewaySecTokenCheckBox, 0, 2);
        gridLayout.addComponent(gatewaySecurityTokenAuthenticationConfigurationItem, 1, 2);

        downloadAnonymousCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        downloadAnonymousCheckBox.setId(UIComponentIdProvider.DOWNLOAD_ANONYMOUS_CHECKBOX);
        downloadAnonymousCheckBox.setValue(anonymousDownloadAuthenticationConfigurationItem.isConfigEnabled());
        downloadAnonymousCheckBox.addValueChangeListener(this);
        anonymousDownloadAuthenticationConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(downloadAnonymousCheckBox, 0, 3);
        gridLayout.addComponent(anonymousDownloadAuthenticationConfigurationItem, 1, 3);

        final Link linkToSecurityHelp = SPUIComponentProvider.getHelpLink(i18n,
                uiProperties.getLinks().getDocumentation().getSecurity());
        gridLayout.addComponent(linkToSecurityHelp, 2, 3);
        gridLayout.setComponentAlignment(linkToSecurityHelp, Alignment.BOTTOM_RIGHT);

        vLayout.addComponent(gridLayout);
        rootPanel.setContent(vLayout);
        setCompositionRoot(rootPanel);
    }
 
Example #21
Source File: RepositoryConfigurationView.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private void init() {

        final Panel rootPanel = new Panel();
        rootPanel.setSizeFull();

        rootPanel.addStyleName("config-panel");

        final VerticalLayout vLayout = new VerticalLayout();
        vLayout.setMargin(true);
        vLayout.setSizeFull();

        final Label header = new Label(i18n.getMessage("configuration.repository.title"));
        header.addStyleName("config-panel-header");
        vLayout.addComponent(header);

        final GridLayout gridLayout = new GridLayout(3, 3);
        gridLayout.setSpacing(true);
        gridLayout.setImmediate(true);
        gridLayout.setColumnExpandRatio(1, 1.0F);
        gridLayout.setSizeFull();

        final boolean isMultiAssignmentsEnabled = multiAssignmentsConfigurationItem.isConfigEnabled();

        actionAutocloseCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        actionAutocloseCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLOSE_CHECKBOX);
        actionAutocloseCheckBox.setEnabled(!isMultiAssignmentsEnabled);
        actionAutocloseConfigurationItem.setEnabled(!isMultiAssignmentsEnabled);
        actionAutocloseCheckBox.setValue(actionAutocloseConfigurationItem.isConfigEnabled());
        actionAutocloseCheckBox.addValueChangeListener(this);
        actionAutocloseConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(actionAutocloseCheckBox, 0, 0);
        gridLayout.addComponent(actionAutocloseConfigurationItem, 1, 0);

        multiAssignmentsCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        multiAssignmentsCheckBox.setId(UIComponentIdProvider.REPOSITORY_MULTI_ASSIGNMENTS_CHECKBOX);
        multiAssignmentsCheckBox.setValue(multiAssignmentsConfigurationItem.isConfigEnabled());
        multiAssignmentsCheckBox.addValueChangeListener(this);
        multiAssignmentsCheckBox.setEnabled(!isMultiAssignmentsEnabled);
        multiAssignmentsConfigurationItem.setEnabled(!isMultiAssignmentsEnabled);
        multiAssignmentsConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(multiAssignmentsCheckBox, 0, 1);
        gridLayout.addComponent(multiAssignmentsConfigurationItem, 1, 1);

        actionAutocleanupCheckBox = SPUIComponentProvider.getCheckBox("", DIST_CHECKBOX_STYLE, null, false, "");
        actionAutocleanupCheckBox.setId(UIComponentIdProvider.REPOSITORY_ACTIONS_AUTOCLEANUP_CHECKBOX);
        actionAutocleanupCheckBox.setValue(actionAutocleanupConfigurationItem.isConfigEnabled());
        actionAutocleanupCheckBox.addValueChangeListener(this);
        actionAutocleanupConfigurationItem.addChangeListener(this);
        gridLayout.addComponent(actionAutocleanupCheckBox, 0, 2);
        gridLayout.addComponent(actionAutocleanupConfigurationItem, 1, 2);

        final Link linkToProvisioningHelp = SPUIComponentProvider.getHelpLink(i18n,
                uiProperties.getLinks().getDocumentation().getProvisioningStateMachine());
        gridLayout.addComponent(linkToProvisioningHelp, 2, 2);
        gridLayout.setComponentAlignment(linkToProvisioningHelp, Alignment.BOTTOM_RIGHT);

        vLayout.addComponent(gridLayout);
        rootPanel.setContent(vLayout);
        setCompositionRoot(rootPanel);
    }
 
Example #22
Source File: TargetAssignmentOperations.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create the Assignment Confirmation Tab
 *
 * @param actionTypeOptionGroupLayout
 *            the action Type Option Group Layout
 * @param maintenanceWindowLayout
 *            the Maintenance Window Layout
 * @param saveButtonToggle
 *            The event listener to derimne if save button should be enabled
 *            or not
 * @param i18n
 *            the Vaadin Message Source for multi language
 * @param uiProperties
 *            the UI Properties
 * @return the Assignment Confirmation tab
 */
public static ConfirmationTab createAssignmentTab(
        final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout,
        final MaintenanceWindowLayout maintenanceWindowLayout, final Consumer<Boolean> saveButtonToggle,
        final VaadinMessageSource i18n, final UiProperties uiProperties) {

    final CheckBox maintenanceWindowControl = maintenanceWindowControl(i18n, maintenanceWindowLayout,
            saveButtonToggle);
    final Link maintenanceWindowHelpLink = maintenanceWindowHelpLinkControl(uiProperties, i18n);
    final HorizontalLayout layout = createHorizontalLayout(maintenanceWindowControl, maintenanceWindowHelpLink);
    actionTypeOptionGroupLayout.selectDefaultOption();

    initMaintenanceWindow(maintenanceWindowLayout, saveButtonToggle);
    addValueChangeListener(actionTypeOptionGroupLayout, maintenanceWindowControl, maintenanceWindowHelpLink);
    return createAssignmentTab(actionTypeOptionGroupLayout, layout, maintenanceWindowLayout);
}
 
Example #23
Source File: TargetAssignmentOperations.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private static Link maintenanceWindowHelpLinkControl(final UiProperties uiProperties,
        final VaadinMessageSource i18n) {
    final String maintenanceWindowHelpUrl = uiProperties.getLinks().getDocumentation().getMaintenanceWindowView();
    return SPUIComponentProvider.getHelpLink(i18n, maintenanceWindowHelpUrl);
}
 
Example #24
Source File: DashboardMenu.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private VerticalLayout buildLinksAndVersion() {
    final VerticalLayout links = new VerticalLayout();
    links.setSpacing(true);
    links.addStyleName("links");
    final String linkStyle = "v-link";

    if (!uiProperties.getLinks().getDocumentation().getRoot().isEmpty()) {
        final Link docuLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_DOCUMENTATION,
                i18n.getMessage("link.documentation.name"), uiProperties.getLinks().getDocumentation().getRoot(),
                FontAwesome.QUESTION_CIRCLE, "_blank", linkStyle);
        docuLink.setSizeFull();
        links.addComponent(docuLink);
        links.setComponentAlignment(docuLink, Alignment.BOTTOM_CENTER);
    }

    if (!uiProperties.getLinks().getUserManagement().isEmpty()) {
        final Link userManagementLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_USERMANAGEMENT,
                i18n.getMessage("link.usermanagement.name"), uiProperties.getLinks().getUserManagement(),
                FontAwesome.USERS, "_blank", linkStyle);
        links.addComponent(userManagementLink);
        userManagementLink.setSizeFull();
        links.setComponentAlignment(userManagementLink, Alignment.BOTTOM_CENTER);
    }

    if (!uiProperties.getLinks().getSupport().isEmpty()) {
        final Link supportLink = SPUIComponentProvider.getLink(UIComponentIdProvider.LINK_SUPPORT,
                i18n.getMessage("link.support.name"), uiProperties.getLinks().getSupport(), FontAwesome.ENVELOPE_O,
                "", linkStyle);
        supportLink.setSizeFull();
        links.addComponent(supportLink);
        links.setComponentAlignment(supportLink, Alignment.BOTTOM_CENTER);

    }

    final Component buildVersionInfo = buildVersionInfo();
    links.addComponent(buildVersionInfo);
    links.setComponentAlignment(buildVersionInfo, Alignment.BOTTOM_CENTER);
    links.setSizeFull();
    links.setHeightUndefined();
    return links;
}
 
Example #25
Source File: SPUIComponentProvider.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Method to create a link.
 *
 * @param id
 *            of the link
 * @param name
 *            of the link
 * @param resource
 *            path of the link
 * @param icon
 *            of the link
 * @param targetOpen
 *            specify how the link should be open (f. e. new windows = _blank)
 * @param style
 *            chosen style of the link. Might be {@code null} if no style should
 *            be used
 * @return a link UI component
 */
public static Link getLink(final String id, final String name, final String resource, final FontAwesome icon,
        final String targetOpen, final String style) {

    final Link link = new Link(name, new ExternalResource(resource));
    link.setId(id);
    link.setIcon(icon);
    link.setDescription(name);

    link.setTargetName(targetOpen);
    if (style != null) {
        link.setStyleName(style);
    }

    return link;

}
 
Example #26
Source File: CommitteeOverviewPageModContentFactoryImpl.java    From cia with Apache License 2.0 3 votes vote down vote up
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout panelContent = createPanelContent();

	final String pageId = getPageId(parameters);

	final ViewRiksdagenCommittee viewRiksdagenCommittee = getItem(parameters);

	getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, OVERVIEW);

	final Link addCommitteePageLink = getPageLinkFactory().addCommitteePageLink(viewRiksdagenCommittee);
	panelContent.addComponent(addCommitteePageLink);

	getFormFactory().addFormPanelTextFields(panelContent, viewRiksdagenCommittee, ViewRiksdagenCommittee.class,
			AS_LIST);

	final VerticalLayout overviewLayout = new VerticalLayout();
	overviewLayout.setSizeFull();

	panelContent.addComponent(overviewLayout);
	panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);

	getCommitteeMenuItemFactory().createOverviewPage(overviewLayout, pageId);

	panelContent.setExpandRatio(addCommitteePageLink, ContentRatio.SMALL);

	panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail());
	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME,
			parameters, pageId);
	return panelContent;

}
 
Example #27
Source File: SPUIComponentProvider.java    From hawkbit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Generates help/documentation links from within management UI.
 *
 * @param i18n
 *            the i18n
 * @param uri
 *            to documentation site
 *
 * @return generated link
 */
public static Link getHelpLink(final VaadinMessageSource i18n, final String uri) {

    final Link link = new Link("", new ExternalResource(uri));
    link.setTargetName("_blank");
    link.setIcon(FontAwesome.QUESTION_CIRCLE);
    link.setDescription(i18n.getMessage("tooltip.documentation.link"));
    return link;

}
 
Example #28
Source File: MinistryOverviewPageModContentFactoryImpl.java    From cia with Apache License 2.0 3 votes vote down vote up
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout panelContent = createPanelContent();

	final String pageId = getPageId(parameters);

	final ViewRiksdagenMinistry viewRiksdagenMinistry = getItem(parameters);
	getMinistryMenuItemFactory().createMinistryMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, OVERVIEW);

	final Link addMinistryPageLink = getPageLinkFactory().addMinistryPageLink(viewRiksdagenMinistry);
	panelContent.addComponent(addMinistryPageLink);

	getFormFactory().addFormPanelTextFields(panelContent, viewRiksdagenMinistry, ViewRiksdagenMinistry.class,
			AS_LIST);

	panelContent.setExpandRatio(addMinistryPageLink, ContentRatio.SMALL);

	panel.setCaption(NAME + "::" + MINISTRY + viewRiksdagenMinistry.getNameId());

	final VerticalLayout overviewLayout = new VerticalLayout();
	overviewLayout.setSizeFull();

	panelContent.addComponent(overviewLayout);
	panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);
	getMinistryMenuItemFactory().createOverviewPage(overviewLayout, pageId);

	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_VIEW, ApplicationEventGroup.USER, NAME,
			parameters, pageId);

	return panelContent;

}
 
Example #29
Source File: PoliticianOverviewPageModContentFactoryImpl.java    From cia with Apache License 2.0 3 votes vote down vote up
/**
 * Creates the overview content.
 *
 * @param panelContent the panel content
 * @param personData the person data
 * @param viewRiksdagenPolitician the view riksdagen politician
 * @param pageId the page id
 */
private void createOverviewContent(final VerticalLayout panelContent, final PersonData personData,
		final ViewRiksdagenPolitician viewRiksdagenPolitician, final String pageId) {
	LabelFactory.createHeader2Label(panelContent, OVERVIEW);

	final Link createPoliticianPageLink = getPageLinkFactory().createPoliticianPageLink(personData);
	panelContent.addComponent(createPoliticianPageLink);

	final Image image = new Image("",
			new ExternalResource(personData.getImageUrl192().replace("http://", "https://")));

	final HorizontalLayout horizontalLayout = new HorizontalLayout();
	horizontalLayout.setSizeFull();

	panelContent.addComponent(horizontalLayout);

	horizontalLayout.addComponent(image);

	getFormFactory().addFormPanelTextFields(horizontalLayout, viewRiksdagenPolitician,
			ViewRiksdagenPolitician.class, AS_LIST);

	final VerticalLayout overviewLayout = new VerticalLayout();
	overviewLayout.setSizeFull();

	panelContent.addComponent(overviewLayout);
	panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);

	getPoliticianMenuItemFactory().createOverviewPage(overviewLayout, pageId);

	panelContent.setExpandRatio(createPoliticianPageLink, ContentRatio.SMALL);
	panelContent.setExpandRatio(horizontalLayout, ContentRatio.GRID);

}
 
Example #30
Source File: PageLinkFactory.java    From cia with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new PageLink object.
 *
 * @return the link
 */
Link createUserHomeViewPageLink();