Java Code Examples for com.vaadin.ui.Panel#setSizeFull()

The following examples show how to use com.vaadin.ui.Panel#setSizeFull() . 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: MyUI.java    From framework-spring-tutorial with Apache License 2.0 6 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
    final VerticalLayout root = new VerticalLayout();
    root.setSizeFull();
    setContent(root);

    final CssLayout navigationBar = new CssLayout();
    navigationBar.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
    navigationBar.addComponent(createNavigationButton("UI Scoped View",
            UIScopedView.VIEW_NAME));
    navigationBar.addComponent(createNavigationButton("View Scoped View",
            ViewScopedView.VIEW_NAME));
    root.addComponent(navigationBar);

    springViewDisplay = new Panel();
    springViewDisplay.setSizeFull();
    root.addComponent(springViewDisplay);
    root.setExpandRatio(springViewDisplay, 1.0f);
}
 
Example 2
Source File: UserHomeSecuritySettingsPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the disable google auth button.
 *
 * @return the vertical layout
 */
private VerticalLayout createDisableGoogleAuthButton() {

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

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

	formLayout.addComponent(formPanel);

	final FormLayout formContent = new FormLayout();
	formPanel.setContent(formContent);

	final DisableGoogleAuthenticatorCredentialRequest request = new DisableGoogleAuthenticatorCredentialRequest();
	request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
	request.setUserpassword("");
	final ClickListener listener = new DisableGoogleAuthenticatorCredentialClickListener(request);
	getFormFactory().addRequestInputFormFields(formContent, request,
			DisableGoogleAuthenticatorCredentialRequest.class, AS_LIST, DISABLE_GOOGLE_AUTHENTICATOR, listener);

	return formLayout;
}
 
Example 3
Source File: UserHomeSecuritySettingsPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the enable google auth button.
 *
 * @return the vertical layout
 */
private VerticalLayout createEnableGoogleAuthButton() {
	final VerticalLayout formLayout = new VerticalLayout();
	formLayout.setSizeFull();

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

	formLayout.addComponent(formPanel);

	final FormLayout formContent = new FormLayout();
	formPanel.setContent(formContent);

	final SetGoogleAuthenticatorCredentialRequest request = new SetGoogleAuthenticatorCredentialRequest();
	request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
	request.setUserpassword("");
	final ClickListener listener = new SetGoogleAuthenticatorCredentialClickListener(request);
	getFormFactory().addRequestInputFormFields(formContent, request, SetGoogleAuthenticatorCredentialRequest.class,
			AS_LIST, ENABLE_GOOGLE_AUTHENTICATOR, listener);

	return formLayout;
}
 
Example 4
Source File: AbstractChartDataManagerImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the chart.
 *
 * @param content
 *            the content
 * @param caption
 *            the caption
 * @param chart
 *            the chart
 * @param fullPage
 *            the full page
 */
protected final void addChart(final AbstractOrderedLayout content,final String caption, final DCharts chart, final boolean fullPage) {
	final HorizontalLayout horizontalLayout = new HorizontalLayout();

	final int browserWindowWidth = getChartWindowWidth();

	final int browserWindowHeight = getChartWindowHeight(fullPage);

	horizontalLayout.setWidth(browserWindowWidth, Unit.PIXELS);
	horizontalLayout.setHeight(browserWindowHeight, Unit.PIXELS);
	horizontalLayout.setMargin(true);
	horizontalLayout.setSpacing(false);
	horizontalLayout.addStyleName("v-layout-content-overview-panel-level1");

	final Panel formPanel = new Panel();
	formPanel.setSizeFull();
	formPanel.setContent(horizontalLayout);
	formPanel.setCaption(caption);

	content.addComponent(formPanel);
	content.setExpandRatio(formPanel, ContentRatio.LARGE);


	chart.setWidth(100, Unit.PERCENTAGE);
	chart.setHeight(100, Unit.PERCENTAGE);
	chart.setMarginRight(CHART_RIGHT_MARGIN);
	chart.setMarginLeft(CHART_LEFT_MARGIN);
	chart.setMarginBottom(CHART_BOTTOM_MARGIN_SIZE);
	chart.setMarginTop(CHART_TOP_MARGIN_SIZE);

	horizontalLayout.addComponent(chart);
	chart.setCaption(caption);
}
 
Example 5
Source File: FormFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public <T extends Serializable> void addFormPanelTextFields(final AbstractOrderedLayout panelContent, final T item,
		final Class<T> beanType, final List<String> displayProperties) {


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


	panelContent.addComponent(formPanel);
	if (displayProperties.size() > SIZE_FOR_GRID) {
		panelContent.setExpandRatio(formPanel, ContentRatio.GRID);
	}
	else {
		panelContent.setExpandRatio(formPanel, ContentRatio.SMALL_GRID);
	}


	final FormLayout formContent = new FormLayout();
	formPanel.setContent(formContent);
	formContent.setWidth(ContentSize.FULL_SIZE);

	final Binder<T> binder = new Binder<>(beanType);
	binder.setBean(item);
	binder.setReadOnly(true);

	PropertyDescriptor[] propertyDescriptors=null;
	try {
		final BeanInfo info = Introspector.getBeanInfo(item.getClass());
		propertyDescriptors = info.getPropertyDescriptors();
	} catch (final IntrospectionException exception) {
		LOGGER.error("No able to getfieldtypes for type:+ item.getClass()", exception);
	}

	createDisplayPropertyConverters(displayProperties, formContent, binder, propertyDescriptors);
}
 
Example 6
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, false, true);
    setSpacing(false);

    Form form = new Form();
    form.setSizeFull();
    form.addStyleName("win-server-edit-form");

    // サーバ名
    serverNameField = new TextField(ViewProperties.getCaption("field.serverName"));
    form.getLayout().addComponent(serverNameField);

    // ホスト名
    hostNameField = new TextField(ViewProperties.getCaption("field.hostName"));
    hostNameField.setWidth("100%");
    form.getLayout().addComponent(hostNameField);

    // コメント
    commentField = new TextField(ViewProperties.getCaption("field.comment"));
    commentField.setWidth("100%");
    form.getLayout().addComponent(commentField);

    // プラットフォーム
    CssLayout cloudLayout = new CssLayout();
    cloudLayout.setWidth("100%");
    cloudLayout.setCaption(ViewProperties.getCaption("field.cloud"));
    cloudLabel = new Label();
    cloudLayout.addComponent(cloudLabel);
    form.getLayout().addComponent(cloudLayout);

    // サーバ種別
    CssLayout imageLayout = new CssLayout();
    imageLayout.setWidth("100%");
    imageLayout.setCaption(ViewProperties.getCaption("field.image"));
    imageLabel = new Label();
    imageLayout.addComponent(imageLabel);
    form.getLayout().addComponent(imageLayout);

    // OS
    CssLayout osLayout = new CssLayout();
    osLayout.setWidth("100%");
    osLayout.setCaption(ViewProperties.getCaption("field.os"));
    osLabel = new Label();
    osLayout.addComponent(osLabel);
    form.getLayout().addComponent(osLayout);

    // ロードバランサでない場合
    if (BooleanUtils.isNotTrue(instance.getInstance().getLoadBalancer())) {
        // サービスを有効にするかどうか
        String enableService = Config.getProperty("ui.enableService");

        // サービスを有効にする場合
        if (StringUtils.isEmpty(enableService) || BooleanUtils.toBoolean(enableService)) {
            // 利用可能サービス
            Panel panel = new Panel();
            serviceTable = new AvailableServiceTable();
            panel.addComponent(serviceTable);
            form.getLayout().addComponent(panel);
            panel.setSizeFull();

            // サービス選択ボタン
            Button attachServiceButton = new Button(ViewProperties.getCaption("button.serverAttachService"));
            attachServiceButton.setDescription(ViewProperties.getCaption("description.serverAttachService"));
            attachServiceButton.setIcon(Icons.SERVICETAB.resource());
            attachServiceButton.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    attachServiceButtonClick(event);
                }
            });

            HorizontalLayout layout = new HorizontalLayout();
            layout.setSpacing(true);
            layout.addComponent(attachServiceButton);
            Label label = new Label(ViewProperties.getCaption("label.serverAttachService"));
            layout.addComponent(label);
            layout.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
            form.getLayout().addComponent(layout);
        }
    }

    addComponent(form);
}
 
Example 7
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 8
Source File: AbstractView.java    From cia with Apache License 2.0 4 votes vote down vote up
/**
 * Creates the basic layout with panel and footer.
 *
 * @param panelName
 *            the panel name
 */
protected final void createBasicLayoutWithPanelAndFooter(final String panelName) {
	final VerticalLayout layout = createFullSizeVerticalLayout();
	final VerticalLayout pageModeContent = createFullSizeVerticalLayout(false,false);
	layout.addComponent(pageModeContent);

	final HorizontalLayout topHeader = new HorizontalLayout();

	addLogoToHeader(topHeader);
	createTopTitleHeader(topHeader);

	topHeaderRightPanel.removeAllComponents();
	topHeader.addComponent(topHeaderRightPanel);
	topHeader.setComponentAlignment(topHeaderRightPanel, Alignment.MIDDLE_RIGHT);
	topHeader.setExpandRatio(topHeaderRightPanel, ContentRatio.LARGE);

	createTopHeaderActionsForUserContext();

	topHeaderRightPanel.setWidth("100%");
	topHeaderRightPanel.setHeight("50px");

	topHeader.setWidth("100%");
	topHeader.setHeight("50px");

	pageModeContent.addComponent(topHeader);
	pageModeContent.setComponentAlignment(topHeader, Alignment.TOP_CENTER);

	pageModeContent.addComponent(getBarmenu());
	pageModeContent.setComponentAlignment(getBarmenu(), Alignment.TOP_CENTER);

	panel = new Panel(panelName);
	panel.addStyleName("v-panel-page-panel");

	panel.setSizeFull();
	pageModeContent.addComponent(panel);
	pageModeContent.setExpandRatio(panel, ContentRatio.FULL_SIZE);

	pageModeContent.addComponent(pageLinkFactory.createMainViewPageLink());
	setContent(layout);

	setWidth(100, Unit.PERCENTAGE);
	setHeight(100, Unit.PERCENTAGE);
	setSizeFull();

}
 
Example 9
Source File: MainViewRegisterPageModContentFactoryImpl.java    From cia with Apache License 2.0 4 votes vote down vote up
@Secured({ "ROLE_ANONYMOUS" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout content = createPanelContent();
	final String pageId = getPageId(parameters);


	getMenuItemFactory().createMainPageMenuBar(menuBar);

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

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

	registerLayout.addComponent(formPanel);

	final FormLayout formContent = new FormLayout();
	formPanel.setContent(formContent);

	final RegisterUserRequest reqisterRequest = new RegisterUserRequest();
	reqisterRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
	reqisterRequest.setUsername("");
	reqisterRequest.setEmail("");
	reqisterRequest.setCountry("");
	reqisterRequest.setUserpassword("");
	final ClickListener reqisterListener = new RegisterUserClickListener(reqisterRequest);
	getFormFactory().addRequestInputFormFields(formContent, reqisterRequest,
			RegisterUserRequest.class,
			AS_LIST, REGISTER,
			reqisterListener);

	final VerticalLayout overviewLayout = new VerticalLayout();
	overviewLayout.setSizeFull();
	content.addComponent(overviewLayout);
	content.setExpandRatio(overviewLayout, ContentRatio.LARGE);

	final ResponsiveRow grid = RowUtil.createGridLayout(overviewLayout);		
	RowUtil.createRowComponent(grid,registerLayout,"Register a new user");

	panel.setCaption(NAME + "::" + CITIZEN_INTELLIGENCE_AGENCY_MAIN);
	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MAIN_VIEW, ApplicationEventGroup.USER,
			CommonsViews.MAIN_VIEW_NAME, parameters, pageId);

	return content;

}
 
Example 10
Source File: MainViewLoginPageModContentFactoryImpl.java    From cia with Apache License 2.0 4 votes vote down vote up
@Secured({ "ROLE_ANONYMOUS" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout content = createPanelContent();
	final String pageId = getPageId(parameters);

	panel.setCaption(NAME + "::" + CITIZEN_INTELLIGENCE_AGENCY_MAIN);

	getMenuItemFactory().createMainPageMenuBar(menuBar);

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

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

	loginLayout.addComponent(formPanel);

	final FormLayout formContent = new FormLayout();
	formContent.setIcon(VaadinIcons.SIGN_IN);
	formPanel.setContent(formContent);

	final LoginRequest loginRequest = new LoginRequest();
	loginRequest.setOtpCode("");
	loginRequest.setEmail("");
	loginRequest.setUserpassword("");
	
	loginRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
	final ClickListener loginListener = new ApplicationLoginListener(loginRequest);
	getFormFactory().addRequestInputFormFields(formContent, loginRequest,
			LoginRequest.class,
			AS_LIST, LOGIN,
			loginListener);

	final VerticalLayout overviewLayout = new VerticalLayout();
	overviewLayout.setSizeFull();
	content.addComponent(overviewLayout);
	content.setExpandRatio(overviewLayout, ContentRatio.LARGE);

	final ResponsiveRow grid = RowUtil.createGridLayout(overviewLayout);		
	RowUtil.createRowComponent(grid,loginLayout,LOGIN_USER);
	
	panel.setCaption(NAME + "::" + CITIZEN_INTELLIGENCE_AGENCY_MAIN);
	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MAIN_VIEW, ApplicationEventGroup.USER,
			CommonsViews.MAIN_VIEW_NAME, parameters, pageId);


	return content;

}
 
Example 11
Source File: StorageView.java    From chipster with MIT License 4 votes vote down vote up
public StorageView(ChipsterAdminUI app) {
	super(app);

	this.addComponent(getToolbar());
	
	this.addComponent(super.getProggressIndicator());
	
	entryTable = new StorageEntryTable(this);
	aggregateTable = new StorageAggregateTable(this);

	
	HorizontalLayout aggregatePanelLayout = new HorizontalLayout();
	HorizontalLayout entryPanelLayout = new HorizontalLayout();
	
	aggregatePanelLayout.setSizeFull();
	entryPanelLayout.setSizeFull();
	
	aggregatePanelLayout.addComponent(aggregateTable);
	entryPanelLayout.addComponent(entryTable);
	
	aggregatePanelLayout.setExpandRatio(aggregateTable, 1);
	entryPanelLayout.setExpandRatio(entryTable, 1);
	
	Panel aggregatePanel = new Panel("Disk usage by user");
	Panel entryPanel = new Panel("Stored sessions");
	
	aggregatePanel.setWidth(300, Unit.PIXELS);
	aggregatePanel.setHeight(100, Unit.PERCENTAGE);
	entryPanel.setSizeFull();
	
	aggregatePanel.setContent(aggregatePanelLayout);
	entryPanel.setContent(entryPanelLayout);
	
	storagePanels = new HorizontalLayout();
	storagePanels.setSizeFull();
				
	storagePanels.addComponent(aggregatePanel);
	storagePanels.addComponent(entryPanel);
	
	storagePanels.setExpandRatio(entryPanel, 1);
	
	this.setSizeFull();
	this.addComponent(storagePanels);		
	this.setExpandRatio(storagePanels, 1);
	
	try {
		
		adminEndpoint = new StorageAdminAPI(app.getEndpoint());
		entryDataSource = new StorageEntryContainer(adminEndpoint);
		aggregateDataSource = new StorageAggregateContainer(adminEndpoint);
		
		entryTable.setContainerDataSource(entryDataSource);
		aggregateTable.setContainerDataSource(aggregateDataSource);
	} catch (JMSException | IOException | IllegalConfigurationException | MicroarrayException | InstantiationException | IllegalAccessException e) {
		logger.error(e);
	}		
}
 
Example 12
Source File: SearchDocumentPageModContentFactoryImpl.java    From cia with Apache License 2.0 4 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);

	documentMenuItemFactory.createDocumentsMenuBar(menuBar);


	final VerticalLayout searchLayout = new VerticalLayout();
	searchLayout.setSizeFull();
	panelContent.addComponent(searchLayout);

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

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

	searchresultLayout.addComponent(formPanel);

	final FormLayout formContent = new FormLayout();
	formPanel.setContent(formContent);

	panelContent.addComponent(searchresultLayout);
	panelContent.setExpandRatio(searchresultLayout, ContentRatio.LARGE);

	final SearchDocumentRequest searchRequest = new SearchDocumentRequest();
	searchRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
	searchRequest.setMaxResults(MAX_RESULT_SIZE);
	searchRequest.setSearchExpression("");
	getFormFactory().addRequestInputFormFields(formContent, searchRequest,
			SearchDocumentRequest.class, AS_LIST, SEARCH,
			new SearchDocumentClickListener(searchRequest, new SearchDocumentResponseHandlerImpl(getGridFactory(), formPanel,
					searchresultLayout)));

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

	return panelContent;

}
 
Example 13
Source File: MainLayout.java    From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 4 votes vote down vote up
@PostConstruct
public void postConstuct() {
	setSizeFull();
	eventBus.subscribe(this);
	
	navbar = new HorizontalLayout();
	navbar.setWidth("100%");
	navbar.setMargin(true);
	navbar.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT);
	addComponent(navbar);
	
	final Label brand = new Label("Vaadin4Spring Security Demo");
	brand.addStyleName(ValoTheme.LABEL_H2);
	brand.addStyleName(ValoTheme.LABEL_NO_MARGIN);
	navbar.addComponent(brand);
	navbar.setComponentAlignment(brand, Alignment.MIDDLE_LEFT);
	navbar.setExpandRatio(brand, 1);
	
	btnHome = new Button("Home", FontAwesome.HOME);
	btnHome.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnHome.setData(ViewToken.HOME);
	btnHome.addClickListener(this);
	navbar.addComponent(btnHome);
	
	btnUser = new Button("User home", FontAwesome.USER);
	btnUser.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnUser.setData(ViewToken.USER);
	btnUser.addClickListener(this);
	navbar.addComponent(btnUser);
	
	btnAdmin = new Button("Admin home", FontAwesome.USER_MD);
	btnAdmin.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnAdmin.setData(ViewToken.ADMIN);
	btnAdmin.addClickListener(this);
	navbar.addComponent(btnAdmin);
	
	btnAdminHidden = new Button("Admin secret", FontAwesome.EYE_SLASH);
	btnAdminHidden.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnAdminHidden.setData(ViewToken.ADMIN_HIDDEN);
	btnAdminHidden.addClickListener(this);
	navbar.addComponent(btnAdminHidden);
	
	btnSignIn = new Button("Sign in", FontAwesome.SIGN_IN);
	btnSignIn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnSignIn.setData(ViewToken.SIGNIN);
	btnSignIn.addClickListener(this);
	navbar.addComponent(btnSignIn);
	
	btnSignUp = new Button("Sign up", FontAwesome.PENCIL_SQUARE_O);
	btnSignUp.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	btnSignUp.setData(ViewToken.SIGNUP);
	btnSignUp.addClickListener(this);
	navbar.addComponent(btnSignUp);
					
	btnLogout = new Button("Logout", FontAwesome.SIGN_OUT);
	btnLogout.setData("-");
	btnLogout.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	navbar.addComponent(btnLogout);
	btnLogout.addClickListener(new ClickListener() {
		
		@Override
		public void buttonClick(ClickEvent event) {
			logout();			
		}
	});
	
	viewContainer = new Panel();
	viewContainer.setSizeFull();
	addComponent(viewContainer);
	setExpandRatio(viewContainer, 1);				
}
 
Example 14
Source File: AdminApplicationConfigurationPageModContentFactoryImpl.java    From cia with Apache License 2.0 4 votes vote down vote up
@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout content = createPanelContent();

	final String pageId = getPageId(parameters);
	final int pageNr= getPageNr(parameters);


	getMenuItemFactory().createMainPageMenuBar(menuBar);

	LabelFactory.createHeader2Label(content,ADMIN_APPLICATION_CONFIGURATION);

	final DataContainer<ApplicationConfiguration, Long> dataContainer = getApplicationManager()
			.getDataContainer(ApplicationConfiguration.class);

	final List<ApplicationConfiguration> pageOrderBy = dataContainer.getPageOrderBy(pageNr,DEFAULT_RESULTS_PER_PAGE, ApplicationConfiguration_.configurationGroup);

	getPagingUtil().createPagingControls(content,NAME,pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);

	getGridFactory().createBasicBeanItemGrid(content,ApplicationConfiguration.class,
			pageOrderBy,
			APPLICATION_CONFIGURATION,
			COLUMN_ORDER, HIDE_COLUMNS,
			new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_CONFIGURATION_VIEW_NAME, "hjid"), null, null);

	if (pageId != null && !pageId.isEmpty()) {

		final ApplicationConfiguration applicationConfiguration = dataContainer.load(Long.valueOf(pageId));

		if (applicationConfiguration != null) {

			final VerticalLayout leftLayout = new VerticalLayout();
			leftLayout.setSizeFull();
			final VerticalLayout rightLayout = new VerticalLayout();
			rightLayout.setSizeFull();
			final HorizontalLayout horizontalLayout = new HorizontalLayout();
			horizontalLayout.setWidth(ContentSize.FULL_SIZE);
			content.addComponent(horizontalLayout);
			horizontalLayout.addComponent(leftLayout);
			horizontalLayout.addComponent(rightLayout);


			getFormFactory().addFormPanelTextFields(leftLayout, applicationConfiguration,
					ApplicationConfiguration.class,
					AS_LIST);

			final UpdateApplicationConfigurationRequest request = new UpdateApplicationConfigurationRequest();
			request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
			request.setApplicationConfigurationId(applicationConfiguration.getHjid());

			request.setConfigTitle(applicationConfiguration.getConfigTitle());
			request.setConfigDescription(applicationConfiguration.getConfigDescription());

			request.setComponentTitle(applicationConfiguration.getConfigTitle());
			request.setComponentDescription(applicationConfiguration.getComponentDescription());

			request.setPropertyValue(applicationConfiguration.getPropertyValue());

			final ClickListener buttonListener = new UpdateApplicationConfigurationClickListener(request);

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

			rightLayout.addComponent(updateFormPanel);

			final FormLayout updateFormContent = new FormLayout();
			updateFormPanel.setContent(updateFormContent);

			getFormFactory().addRequestInputFormFields(updateFormContent, request,
					UpdateApplicationConfigurationRequest.class, AS_LIST2,
					UPDATE_CONFIGURATION, buttonListener);

		}
	}

	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_CONFIGURATION_VIEW,
			ApplicationEventGroup.ADMIN, NAME, null, pageId);

	return content;
}
 
Example 15
Source File: EmailPageModContentFactoryImpl.java    From cia with Apache License 2.0 4 votes vote down vote up
@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout content = createPanelContent();

	final String pageId = getPageId(parameters);

	getMenuItemFactory().createMainPageMenuBar(menuBar);

	LabelFactory.createHeader2Label(content, ADMIN_EMAIL);

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

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

	emailLayout.addComponent(formPanel);

	final FormLayout formContent = new FormLayout();
	formPanel.setContent(formContent);

	final SendEmailRequest sendEmailRequest = new SendEmailRequest();
	sendEmailRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
	sendEmailRequest.setEmail("");
	sendEmailRequest.setSubject("");
	sendEmailRequest.setContent("");
	final ClickListener sendEmailListener = new SendEmailClickListener(sendEmailRequest);
	getFormFactory().addRequestInputFormFields(formContent, sendEmailRequest,
			SendEmailRequest.class, SEND_EMAIL_REQUEST_FORM_FIELDS, EMAIL,
			sendEmailListener);

	content.addComponent(emailLayout);
	content.setExpandRatio(emailLayout, ContentRatio.LARGE_FORM);

	panel.setCaption(NAME + "::" + ADMIN_EMAIL);
	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_EMAIL_VIEW, ApplicationEventGroup.ADMIN, NAME,
			null, pageId);

	return content;

}
 
Example 16
Source File: AbstractHawkbitUI.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private Panel buildContent() {
    final Panel content = new Panel();
    content.setSizeFull();
    content.setStyleName("view-content");
    return content;
}
 
Example 17
Source File: DefaultDistributionSetTypeLayout.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
DefaultDistributionSetTypeLayout(final SystemManagement systemManagement,
        final DistributionSetTypeManagement distributionSetTypeManagement, final VaadinMessageSource i18n,
        final SpPermissionChecker permChecker) {
    this.systemManagement = systemManagement;
    combobox = SPUIComponentProvider.getComboBox(null, "330", null, null, false, "", "label.combobox.tag");
    changeIcon = new Label();

    if (!permChecker.hasReadRepositoryPermission()) {
        return;
    }

    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.defaultdistributionset.title"));
    header.addStyleName("config-panel-header");
    vlayout.addComponent(header);

    final DistributionSetType currentDistributionSetType = getCurrentDistributionSetType();
    currentDefaultDisSetType = currentDistributionSetType.getId();

    final HorizontalLayout hlayout = new HorizontalLayout();
    hlayout.setSpacing(true);
    hlayout.setImmediate(true);

    final Label configurationLabel = new LabelBuilder()
            .name(i18n.getMessage("configuration.defaultdistributionset.select.label")).buildLabel();
    hlayout.addComponent(configurationLabel);

    final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetTypeManagement
            .findAll(PageRequest.of(0, 100));

    combobox.setId(UIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
    combobox.setNullSelectionAllowed(false);
    for (final DistributionSetType distributionSetType : distributionSetTypeCollection) {
        combobox.addItem(distributionSetType.getId());
        combobox.setItemCaption(distributionSetType.getId(),
                distributionSetType.getKey() + " (" + distributionSetType.getName() + ")");

        if (distributionSetType.getId().equals(currentDistributionSetType.getId())) {
            combobox.select(distributionSetType.getId());
        }
    }
    combobox.setImmediate(true);
    combobox.addValueChangeListener(event -> selectDistributionSetValue());
    hlayout.addComponent(combobox);

    changeIcon.setIcon(FontAwesome.CHECK);
    hlayout.addComponent(changeIcon);
    changeIcon.setVisible(false);

    vlayout.addComponent(hlayout);
    rootPanel.setContent(vlayout);
    setCompositionRoot(rootPanel);
}
 
Example 18
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 19
Source File: QuestionnaireView.java    From gazpachoquest with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void enter(ViewChangeEvent event) {
    logger.debug("Entering {} view ", QuestionnaireView.NAME);
    addStyleName(Reindeer.LAYOUT_BLUE);
    addStyleName("questionnaires");

    WebBrowser webBrowser = Page.getCurrent().getWebBrowser();
    Integer screenWidth = webBrowser.getScreenWidth();
    Integer heightWidth = webBrowser.getScreenHeight();

    logger.debug("Browser screen settings  {} x {}", screenWidth, heightWidth);

    if (heightWidth <= 480) {
        renderingMode = RenderingMode.QUESTION_BY_QUESTION;
    }

    // centralLayout.addStyleName("questionnaires");
    // new Responsive(centralLayout);

    RespondentAccount respondent = (RespondentAccount) VaadinServletService.getCurrentServletRequest()
            .getUserPrincipal();
    if (respondent.hasPreferredLanguage()) {
        preferredLanguage =  Language.fromString(respondent.getPreferredLanguage());
    } else {
        preferredLanguage = Language.fromLocale(webBrowser.getLocale());
    }
    questionnaireId = respondent.getGrantedquestionnaireIds().iterator().next();
    logger.debug("Trying to fetch questionnair identified with id  = {} ", questionnaireId);
    QuestionnaireDefinitionDTO definition = questionnaireResource.getDefinition(questionnaireId);
    sectionInfoVisible = definition.isSectionInfoVisible();
    QuestionnairePageDTO page = questionnaireResource.getPage(questionnaireId, renderingMode, preferredLanguage,
            NavigationAction.ENTERING);

    logger.debug("Displaying page {}/{} with {} questions", page.getMetadata().getNumber(), page.getMetadata()
            .getCount(), page.getQuestions().size());
    questionsLayout = new VerticalLayout();
    update(page);

    Label questionnaireTitle = new Label(definition.getLanguageSettings().getTitle());
    questionnaireTitle.addStyleName(Reindeer.LABEL_H1);

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setMargin(true);
    mainLayout.addComponent(questionnaireTitle);
    mainLayout.addComponent(questionsLayout);
    // Add the responsive capabilities to the components

    Panel centralLayout = new Panel();
    centralLayout.setContent(mainLayout);
    centralLayout.setSizeFull();
    centralLayout.getContent().setSizeUndefined();

    Responsive.makeResponsive(questionnaireTitle);
    setCompositionRoot(centralLayout);
    setSizeFull();
}
 
Example 20
Source File: PollingConfigurationView.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
PollingConfigurationView(final VaadinMessageSource i18n, final ControllerPollProperties controllerPollProperties,
        final TenantConfigurationManagement tenantConfigurationManagement) {
    this.tenantConfigurationManagement = tenantConfigurationManagement;

    final Duration minDuration = DurationHelper
            .formattedStringToDuration(controllerPollProperties.getMinPollingTime());
    final Duration maxDuration = DurationHelper
            .formattedStringToDuration(controllerPollProperties.getMaxPollingTime());
    final Duration globalPollTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement
            .getGlobalConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class));
    final Duration globalOverdueTime = DurationHelper.formattedStringToDuration(tenantConfigurationManagement
            .getGlobalConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class));

    final TenantConfigurationValue<String> pollTimeConfValue = tenantConfigurationManagement
            .getConfigurationValue(TenantConfigurationKey.POLLING_TIME_INTERVAL, String.class);
    if (!pollTimeConfValue.isGlobal()) {
        tenantPollTime = DurationHelper.formattedStringToDuration(pollTimeConfValue.getValue());
    }

    final TenantConfigurationValue<String> overdueTimeConfValue = tenantConfigurationManagement
            .getConfigurationValue(TenantConfigurationKey.POLLING_OVERDUE_TIME_INTERVAL, String.class);
    if (!overdueTimeConfValue.isGlobal()) {
        tenantOverdueTime = DurationHelper.formattedStringToDuration(overdueTimeConfValue.getValue());
    }

    final Panel rootPanel = new Panel();
    rootPanel.setSizeFull();
    rootPanel.addStyleName("config-panel");

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

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

    fieldPollTime = DurationConfigField.builder(UIComponentIdProvider.SYSTEM_CONFIGURATION_POLLING)
            .caption(i18n.getMessage("configuration.polling.time"))
            .checkBoxTooltip(i18n.getMessage("configuration.polling.custom.value")).range(minDuration, maxDuration)
            .globalDuration(globalPollTime).tenantDuration(tenantPollTime).build();
    fieldPollTime.addChangeListener(this);
    vLayout.addComponent(fieldPollTime);

    fieldPollingOverdueTime = DurationConfigField.builder(UIComponentIdProvider.SYSTEM_CONFIGURATION_OVERDUE)
            .caption(i18n.getMessage("configuration.polling.overduetime"))
            .checkBoxTooltip(i18n.getMessage("configuration.polling.custom.value")).range(minDuration, maxDuration)
            .globalDuration(globalOverdueTime).tenantDuration(tenantOverdueTime).build();
    fieldPollingOverdueTime.addChangeListener(this);
    vLayout.addComponent(fieldPollingOverdueTime);

    rootPanel.setContent(vLayout);
    setCompositionRoot(rootPanel);
}