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

The following examples show how to use com.vaadin.ui.Panel#setContent() . 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: UserHomeSecuritySettingsPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the change password button.
 *
 * @return the vertical layout
 */
private VerticalLayout createChangePasswordButton() {

	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 ChangePasswordRequest request = new ChangePasswordRequest();
	request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
	request.setCurrentPassword("");
	request.setNewPassword("");
	request.setRepeatNewPassword("");
	
	final ClickListener listener = new ChangePasswordClickListener(request);
	getFormFactory().addRequestInputFormFields(formContent, request,
			ChangePasswordRequest.class, Arrays.asList("currentPassword","newPassword","repeatNewPassword"), "Change password", listener);

	return formLayout;
}
 
Example 2
Source File: ToolEditorUI.java    From chipster with MIT License 5 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
	treeToolEditor = new TreeToolEditor(this);
	toolEditor = new ToolEditor(this);
	textEditor = new TextEditor(this);
	final Panel vLayout = new Panel();
	vSplitPanel = new VerticalSplitPanel();
	vSplitPanel.setSplitPosition(50, Unit.PERCENTAGE);
	vSplitPanel.setImmediate(true);
	vSplitPanel.setLocked(false);
	vSplitPanel.setWidth("100%");
	vLayout.setContent(vSplitPanel);
    setContent(vSplitPanel);
    VerticalLayout vvLayout = new VerticalLayout();
    vvLayout.setSizeFull();
    Label title = new Label("<h2><b>&nbsp;Tool Editor</b></h2>", ContentMode.HTML);

    vvLayout.addComponent(title);
    vvLayout.setComponentAlignment(title, Alignment.TOP_LEFT);
    HorizontalSplitPanel hSplitpPanel = new HorizontalSplitPanel();
    hSplitpPanel.setSizeFull();
    vvLayout.addComponent(hSplitpPanel);

    HorizontalLayout buttonPanel = getButtonPanel();
    vvLayout.addComponent(buttonPanel);
    vvLayout.setComponentAlignment(buttonPanel, Alignment.MIDDLE_CENTER);

    vvLayout.setExpandRatio(hSplitpPanel, 5);
    vvLayout.setComponentAlignment(hSplitpPanel, Alignment.TOP_LEFT);
    vvLayout.setMargin(false);
    vvLayout.setSpacing(false);
    hSplitpPanel.setFirstComponent(treeToolEditor);
    hSplitpPanel.setSecondComponent(toolEditor);
    vSplitPanel.setFirstComponent(vvLayout);
    vSplitPanel.setSecondComponent(textEditor);
    hSplitpPanel.setStyleName("topborder");
}
 
Example 3
Source File: StorageAdminPanel.java    From sensorhub with Mozilla Public License 2.0 5 votes vote down vote up
protected Panel newPanel(String title)
{
    Panel panel = new Panel(title);
    GridLayout layout = new GridLayout(2, 2);
    layout.setWidth(100.0f, Unit.PERCENTAGE);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setColumnExpandRatio(0, 0.2f);
    layout.setColumnExpandRatio(1, 0.8f);
    layout.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    panel.setContent(layout);
    return panel;
}
 
Example 4
Source File: TenantConfigurationDashboardView.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Init method adds all Configuration Views to the list of Views.
 */
@PostConstruct
public void init() {
    if (defaultDistributionSetTypeLayout.getComponentCount() > 0) {
        configurationViews.add(defaultDistributionSetTypeLayout);
    }
    configurationViews.add(repositoryConfigurationView);
    configurationViews.add(rolloutConfigurationView);
    configurationViews.add(authenticationConfigurationView);
    configurationViews.add(pollingConfigurationView);
    if (customConfigurationViews != null) {
        configurationViews.addAll(
                customConfigurationViews.stream().filter(ConfigurationGroup::show).collect(Collectors.toList()));
    }

    final Panel rootPanel = new Panel();
    rootPanel.setStyleName("tenantconfig-root");

    final VerticalLayout rootLayout = new VerticalLayout();
    rootLayout.setSizeFull();
    rootLayout.setMargin(true);
    rootLayout.setSpacing(true);

    configurationViews.forEach(rootLayout::addComponent);

    final HorizontalLayout buttonContent = saveConfigurationButtonsLayout();
    rootLayout.addComponent(buttonContent);
    rootLayout.setComponentAlignment(buttonContent, Alignment.BOTTOM_LEFT);
    rootPanel.setContent(rootLayout);
    setCompositionRoot(rootPanel);

    configurationViews.forEach(view -> view.addChangeListener(this));
}
 
Example 5
Source File: RegexpEditorComponent.java    From XACML with MIT License 5 votes vote down vote up
@AutoGenerated
private Panel buildPanelTester() {
	// common part: create layout
	panelTester = new Panel();
	panelTester.setCaption("Test The Expression");
	panelTester.setImmediate(false);
	panelTester.setWidth("-1px");
	panelTester.setHeight("-1px");
	
	// verticalLayout_2
	verticalLayout_2 = buildVerticalLayout_2();
	panelTester.setContent(verticalLayout_2);
	
	return panelTester;
}
 
Example 6
Source File: AbstractTableLayout.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildLayout() {
    setSizeFull();
    setSpacing(true);
    setMargin(false);
    setStyleName("group");
    final VerticalLayout tableHeaderLayout = new VerticalLayout();
    tableHeaderLayout.setSizeFull();
    tableHeaderLayout.setSpacing(false);
    tableHeaderLayout.setMargin(false);

    tableHeaderLayout.setStyleName("table-layout");
    tableHeaderLayout.addComponent(tableHeader);

    tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER);
    if (isShortCutKeysRequired()) {
        final Panel tablePanel = new Panel();
        tablePanel.setStyleName("table-panel");
        tablePanel.setHeight(100.0F, Unit.PERCENTAGE);
        tablePanel.setContent(table);
        tablePanel.addActionHandler(getShortCutKeysHandler(i18n));
        tablePanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
        tableHeaderLayout.addComponent(tablePanel);
        tableHeaderLayout.setComponentAlignment(tablePanel, Alignment.TOP_CENTER);
        tableHeaderLayout.setExpandRatio(tablePanel, 1.0F);
    } else {
        tableHeaderLayout.addComponent(table);
        tableHeaderLayout.setComponentAlignment(table, Alignment.TOP_CENTER);
        tableHeaderLayout.setExpandRatio(table, 1.0F);
    }

    addComponent(tableHeaderLayout);
    addComponent(detailsLayout);
    setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER);
    setComponentAlignment(detailsLayout, Alignment.TOP_CENTER);
    setExpandRatio(tableHeaderLayout, 1.0F);
}
 
Example 7
Source File: DocumentPersonReferencesPageModContentFactoryImpl.java    From cia with Apache License 2.0 5 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);
	getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

	final DataContainer<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager()
			.getDataContainer(DocumentStatusContainer.class);

	final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer
			.findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document,
					DocumentData.class, DocumentData_.id, pageId);

	LabelFactory.createHeader2Label(panelContent, PERSON_REFERENCES);

	if (documentStatusContainer != null && documentStatusContainer.getDocumentPersonReferenceContainer() != null
			&& documentStatusContainer.getDocumentPersonReferenceContainer()
					.getDocumentPersonReferenceList() != null) {

		getGridFactory().createBasicBeanItemGrid(panelContent, DocumentPersonReferenceData.class,
				documentStatusContainer.getDocumentPersonReferenceContainer().getDocumentPersonReferenceList(),
				DOCUMENT_PERSON_REFERENCES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);

	}

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

	return panelContent;

}
 
Example 8
Source File: DocumentReferencesPageModContentFactoryImpl.java    From cia with Apache License 2.0 5 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);

	getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

	final DataContainer<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager()
			.getDataContainer(DocumentStatusContainer.class);

	final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer
			.findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document,
					DocumentData.class, DocumentData_.id, pageId);

	LabelFactory.createHeader2Label(panelContent, DOCUMENT_REFERENCES);

	if (documentStatusContainer != null && documentStatusContainer.getDocumentReferenceContainer() != null
			&& documentStatusContainer.getDocumentReferenceContainer().getDocumentReferenceList() != null) {

		getGridFactory().createBasicBeanItemGrid(panelContent, DocumentReferenceData.class,
				documentStatusContainer.getDocumentReferenceContainer().getDocumentReferenceList(),
				DOCUMENT_REFERENCES2, COLUMN_ORDER, HIDE_COLUMNS, null, null, null);
	}

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

	return panelContent;

}
 
Example 9
Source File: DocumentAttachementsPageModContentFactoryImpl.java    From cia with Apache License 2.0 5 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);

	getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

	final DataContainer<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager()
			.getDataContainer(DocumentStatusContainer.class);

	final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer
			.findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document,
					DocumentData.class, DocumentData_.id, pageId);

	LabelFactory.createHeader2Label(panelContent, DOCUMENT_ATTACHMENTS);

	if (documentStatusContainer != null && documentStatusContainer.getDocumentAttachmentContainer() != null
			&& documentStatusContainer.getDocumentAttachmentContainer().getDocumentAttachmentList() != null) {

		getGridFactory().createBasicBeanItemGrid(panelContent, DocumentAttachment.class,
				documentStatusContainer.getDocumentAttachmentContainer().getDocumentAttachmentList(),
				DOCUMENT_ATTACHMENTS, COLUMN_ORDER, HIDE_COLUMNS, null, null, null);

		displayDocumentAttachements(panelContent,
				documentStatusContainer.getDocumentAttachmentContainer().getDocumentAttachmentList());
	}

	panel.setContent(panelContent);
	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER, NAME,
			parameters, pageId);
	return panelContent;

}
 
Example 10
Source File: DocumentOverviewPageModContentFactoryImpl.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);

	final DocumentElement documentElement = getItem(parameters);
	getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

	final DataContainer<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager()
			.getDataContainer(DocumentStatusContainer.class);

	final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer
			.findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document,
					DocumentData.class, DocumentData_.id, pageId);

	LabelFactory.createHeader2Label(panelContent, OVERVIEW);

	getFormFactory().addFormPanelTextFields(panelContent, documentElement, DocumentElement.class, AS_LIST);

	if (documentStatusContainer != null) {
		getFormFactory().addFormPanelTextFields(panelContent, documentStatusContainer,
				DocumentStatusContainer.class, AS_LIST3);

		getFormFactory().addFormPanelTextFields(panelContent, documentStatusContainer.getDocument(),
				DocumentData.class, AS_LIST2);
	}

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

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

	getDocumentMenuItemFactory().createOverviewPage(overviewLayout, pageId);

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

	return panelContent;

}
 
Example 11
Source File: MyCloudAdd.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    // myCloud名
    cloudNameField = new TextField(ViewProperties.getCaption("field.cloudName"));
    getLayout().addComponent(cloudNameField);

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

    // テンプレート選択テーブル
    templateTable = new SelectTemplateTable();
    getLayout().addComponent(templateTable);

    // テンプレート説明欄
    final Label nameLabel = new Label();
    final Label descriptionLabel = new Label();

    Panel descriptionPanel = new Panel();
    CssLayout layout = new CssLayout();
    layout.addStyleName("template-desc");
    descriptionPanel.setHeight("80px");
    descriptionPanel.setContent(layout);
    layout.setSizeFull();
    layout.addComponent(nameLabel);
    layout.addComponent(descriptionLabel);
    getLayout().addComponent(descriptionPanel);

    templateTable.addListener(new ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (templateTable.getValue() == null) {
                return;
            }

            TemplateDto template = findTemplate(templateTable.getValue());
            nameLabel.setValue(template.getTemplate().getTemplateNameDisp() + ":");
            descriptionLabel.setValue(template.getTemplate().getTemplateDescriptionDisp());
        }
    });

    cloudNameField.focus();

    initValidation();
}
 
Example 12
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 13
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 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: 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 17
Source File: DemoUI.java    From gantt with Apache License 2.0 4 votes vote down vote up
private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);
    controls.setMargin(true);
    panel.setContent(controls);

    subControls = new HorizontalLayout();
    subControls.setSpacing(true);
    subControls.setVisible(false);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect<Resolution>("Resolution");
    reso.setEmptySelectionAllowed(false);
    reso.setItems(org.tltv.gantt.client.shared.Resolution.Hour, org.tltv.gantt.client.shared.Resolution.Day,
            org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    resolutionValueChangeRegistration = Optional.of(reso.addValueChangeListener(resolutionValueChangeListener));

    localeSelect = new NativeSelect<Locale>("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setEmptySelectionAllowed(false);
    localeSelect.setItems(Locale.getAvailableLocales());
    localeSelect.setItemCaptionGenerator((l) -> l.getDisplayName(getLocale()));

    ComboBox<String> timezoneSelect = new ComboBox<String>("Timezone");
    timezoneSelect.setWidth(300, Unit.PIXELS);
    timezoneSelect.setEmptySelectionAllowed(false);
    timezoneSelect.setItemCaptionGenerator(new ItemCaptionGenerator<String>() {

        @Override
        public String apply(String item) {
            if ("Default".equals(item)) {
                return "Default (" + getDefaultTimeZone().getDisplayName() + ")";
            }
            TimeZone tz = TimeZone.getTimeZone(item);
            return tz.getID() + " (raw offset " + (tz.getRawOffset() / 60000) + "m)";
        }
    });
    List<String> items = new ArrayList<>();
    items.add("Default");
    items.addAll(Gantt.getSupportedTimeZoneIDs());
    timezoneSelect.setItems((caption, fltr) -> caption.contains(fltr), items);
    timezoneSelect.setValue("Default");
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    final Button toggleSubControlsBtn = new Button("Show More Settings...");
    toggleSubControlsBtn.addStyleName("link");
    toggleSubControlsBtn.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            subControls.setVisible(!subControls.isVisible());
            toggleSubControlsBtn.setCaption(subControls.isVisible() ? "Less Settings..." : "More Settings...");
        }
    });

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    controls.addComponent(subControls);
    controls.addComponent(toggleSubControlsBtn);
    controls.setComponentAlignment(toggleSubControlsBtn, Alignment.BOTTOM_CENTER);

    subControls.addComponent(localeSelect);
    subControls.addComponent(timezoneSelect);
    subControls.addComponent(heightAndUnit);
    subControls.addComponent(widthAndUnit);
    subControls.addComponent(createStep);
    subControls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);

    return panel;
}
 
Example 18
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 19
Source File: DocumentDecisionPageModContentFactoryImpl.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);

	getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

	final DataContainer<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager()
			.getDataContainer(DocumentStatusContainer.class);

	final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer
			.findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document,
					DocumentData.class, DocumentData_.id, pageId);

	LabelFactory.createHeader2Label(panelContent, DOCUMENT_DECISION);

	if (documentStatusContainer != null && documentStatusContainer.getDocumentProposal() != null
			&& documentStatusContainer.getDocumentProposal().getProposal() != null) {

		getFormFactory().addFormPanelTextFields(panelContent,
				documentStatusContainer.getDocumentProposal().getProposal(), DocumentProposalData.class, AS_LIST);

	}

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

	return panelContent;

}
 
Example 20
Source File: DocumentDataPageModContentFactoryImpl.java    From cia with Apache License 2.0 2 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);

	getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, DOCUMENT_DATA);

	final DataContainer<DocumentContentData, String> documentContentDataDataContainer = getApplicationManager()
			.getDataContainer(DocumentContentData.class);

	final List<DocumentContentData> documentContentlist = documentContentDataDataContainer
			.getAllBy(DocumentContentData_.id, pageId);

	if (!documentContentlist.isEmpty()) {

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

		panelContent.addComponent(formPanel);

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

		final String cleanContent = Jsoup.clean(documentContentlist.get(0).getContent(), "", Whitelist.simpleText(),
				new OutputSettings().indentAmount(4));

		final Label htmlContent = new Label(cleanContent, ContentMode.PREFORMATTED);

		formContent.addComponent(htmlContent);

		final DocumentWordCountRequest documentWordCountRequest = new DocumentWordCountRequest();
		documentWordCountRequest.setDocumentId(pageId);
		documentWordCountRequest.setMaxResults(MAX_RESULTS);
		documentWordCountRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
		final DocumentWordCountResponse resp = (DocumentWordCountResponse) getApplicationManager()
				.service(documentWordCountRequest);

		if (resp.getWordCountMap() != null) {
			final Label wordCloud = new Label(createWordCloud(resp.getWordCountMap()), ContentMode.HTML);
			formContent.addComponent(wordCloud);
		}

		panelContent.setExpandRatio(formPanel, ContentRatio.GRID);

	}

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

	return panelContent;

}