com.vaadin.ui.Panel Java Examples

The following examples show how to use com.vaadin.ui.Panel. 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: PartyCurrentMembersPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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 ViewRiksdagenParty viewRiksdagenParty = getItem(parameters);
	getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, CURRENT_MEMBERS);

	final DataContainer<ViewRiksdagenPolitician, String> politicianDataContainer = getApplicationManager()
			.getDataContainer(ViewRiksdagenPolitician.class);

	getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenPolitician.class,
			politicianDataContainer.findListByProperty(
					new Object[] { viewRiksdagenParty.getPartyId(), Boolean.TRUE }, ViewRiksdagenPolitician_.party,
					ViewRiksdagenPolitician_.active),
			POLITICIANS, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);

	pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
	return panelContent;

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

	createPageVisitHistory(NAME, pageId, panelContent);

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

	return panelContent;

}
 
Example #3
Source File: LogoutClickListenerTest.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Show notification failure test.
 */
@Test
public void showNotificationFailureTest() {
	final LogoutRequest request = new LogoutRequest();		
	final LogoutClickListener listener = Mockito.spy(new LogoutClickListener(request));
	final ApplicationManager applicationManager = Mockito.mock(ApplicationManager.class);
	Mockito.doReturn(applicationManager).when(listener).getApplicationManager();
	
	final LogoutResponse response = new LogoutResponse(ServiceResult.FAILURE);
	response.setErrorMessage("errorMessage");
	Mockito.when(applicationManager.service(request)).thenReturn(response);
	
	Mockito.doNothing().when(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
	listener.buttonClick(new ClickEvent(new Panel()));
	Mockito.verify(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
}
 
Example #4
Source File: PoliticianVotesHistoryPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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 ViewRiksdagenPolitician viewRiksdagenPolitician = getItem(parameters);
	getPoliticianMenuItemFactory().createPoliticianMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, PoliticianPageMode.VOTEHISTORY.toString());

	getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent,
			ViewRiksdagenVoteDataBallotPoliticianSummary.class,
			viewRiksdagenVoteDataBallotPoliticianSummaryChartDataManager
					.findByValue(viewRiksdagenPolitician.getPersonId()),
			BALLOTS, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, EMBEDDED_ID_BALLOT_ID, null);

	pageCompleted(parameters, panel, pageId, viewRiksdagenPolitician);
	return panelContent;

}
 
Example #5
Source File: DemoUI.java    From gantt with Apache License 2.0 6 votes vote down vote up
@Override
protected void init(VaadinRequest request) {
    ganttListener = null;
    createGantt();

    MenuBar menu = controlsMenuBar();
    Panel controls = createControls();

    Component wrapper = UriFragmentWrapperFactory.wrapByUriFragment(UI.getCurrent().getPage().getUriFragment(),
            gantt);
    if (wrapper instanceof GanttListener) {
        ganttListener = (GanttListener) wrapper;
    }

    final VerticalLayout layout = new VerticalLayout();
    layout.setStyleName("demoContentLayout");
    layout.setMargin(false);
    layout.setSizeFull();
    layout.addComponent(menu);
    layout.addComponent(controls);
    layout.addComponent(wrapper);
    layout.setExpandRatio(wrapper, 1);

    setContent(layout);
}
 
Example #6
Source File: PoliticianRoleListPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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 ViewRiksdagenPolitician viewRiksdagenPolitician = getItem(parameters);
	getPoliticianMenuItemFactory().createPoliticianMenuBar(menuBar, pageId);
	LabelFactory.createHeader2Label(panelContent, PoliticianPageMode.ROLELIST.toString());

	final PersonData personData = getApplicationManager().getDataContainer(PersonData.class)
			.load(viewRiksdagenPolitician.getPersonId());

	final List<AssignmentData> assignmentList = personData.getPersonAssignmentData().getAssignmentList();

	createRoleList(panelContent, assignmentList);

	pageCompleted(parameters, panel, pageId, viewRiksdagenPolitician);
	return panelContent;

}
 
Example #7
Source File: ManageUserAccountClickListenerTest.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Show notification failure test.
 */
@Test
public void showNotificationFailureTest() {
	final ManageUserAccountRequest request = new ManageUserAccountRequest();		
	final ManageUserAccountClickListener listener = Mockito.spy(new ManageUserAccountClickListener(request));
	final ApplicationManager applicationManager = Mockito.mock(ApplicationManager.class);
	Mockito.doReturn(applicationManager).when(listener).getApplicationManager();
	
	final ManageUserAccountResponse response = new ManageUserAccountResponse(ServiceResult.FAILURE);
	response.setErrorMessage("errorMessage");
	Mockito.when(applicationManager.service(request)).thenReturn(response);
	
	Mockito.doNothing().when(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
	listener.buttonClick(new ClickEvent(new Panel()));
	Mockito.verify(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
}
 
Example #8
Source File: CommitteeDocumentActivityPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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, DOCUMENT_ACTIVITY);

	chartDataManager.createDocumentHistoryChartByOrg(panelContent,
			viewRiksdagenCommittee.getEmbeddedId().getOrgCode());

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

}
 
Example #9
Source File: PartyVoteHistoryPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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 ViewRiksdagenParty viewRiksdagenParty = getItem(parameters);
	getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, VOTE_HISTORY);

	getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent,
			ViewRiksdagenVoteDataBallotPartySummary.class,
			viewRiksdagenVoteDataBallotPartySummaryChartDataManager.findByValue(pageId), BALLOTS, NESTED_PROPERTIES,
			COLUMN_ORDER, HIDE_COLUMNS, LISTENER, EMBEDDED_ID_BALLOT_ID, null);

	pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
	return panelContent;

}
 
Example #10
Source File: PoliticianIndicatorsPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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 ViewRiksdagenPolitician viewRiksdagenPolitician = getItem(parameters);
	getPoliticianMenuItemFactory().createPoliticianMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, INDICATORS);

	politicianChartDataManager.createPersonLineChart(panelContent, viewRiksdagenPolitician.getPersonId());

	pageCompleted(parameters, panel, pageId, viewRiksdagenPolitician);
	return panelContent;

}
 
Example #11
Source File: CommitteeDecisionTypeDailySummaryPageModContentFactoryImpl2.java    From cia with Apache License 2.0 6 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, DECISION_TYPE_DAILY_SUMMARY);

	chartDataManager.createDecisionTypeChart(panelContent, viewRiksdagenCommittee.getEmbeddedId().getOrgCode());

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

}
 
Example #12
Source File: PartyLeaderHistoryPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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 ViewRiksdagenParty viewRiksdagenParty = getItem(parameters);
	getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, LEADER_HISTORY);

	final DataContainer<ViewRiksdagenPartyRoleMember, String> partyRoleMemberDataContainer = getApplicationManager()
			.getDataContainer(ViewRiksdagenPartyRoleMember.class);

	getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenPartyRoleMember.class,
			partyRoleMemberDataContainer.getAllBy(ViewRiksdagenPartyRoleMember_.party,
					viewRiksdagenParty.getPartyId()),
			LEADER_HISTORY2, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);

	pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
	return panelContent;

}
 
Example #13
Source File: PartySupportAnnualSummaryChartPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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 ViewRiksdagenParty viewRiksdagenParty = getItem(parameters);
	getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, TITLE);
	chartDataManager.createPartyChart(panelContent,pageId);

	pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
	return panelContent;

}
 
Example #14
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 #15
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 #16
Source File: PartyMemberHistoryPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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 ViewRiksdagenParty viewRiksdagenParty = getItem(parameters);
	getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, MEMBER_HISTORY);

	final DataContainer<ViewRiksdagenPolitician, String> politicianDataContainer = getApplicationManager()
			.getDataContainer(ViewRiksdagenPolitician.class);

	getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenPolitician.class,
			politicianDataContainer.getAllBy(ViewRiksdagenPolitician_.party, viewRiksdagenParty.getPartyId()),
			POLITICIANS, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);

	pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
	return panelContent;

}
 
Example #17
Source File: PartyCommitteeRolesPageModContentFactoryImpl.java    From cia with Apache License 2.0 6 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 ViewRiksdagenParty viewRiksdagenParty = getItem(parameters);

	getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, COMMITTEE_ROLES);

	final DataContainer<ViewRiksdagenCommitteeRoleMember, String> committeeRoleMemberDataContainer = getApplicationManager()
			.getDataContainer(ViewRiksdagenCommitteeRoleMember.class);

	getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenCommitteeRoleMember.class,
			committeeRoleMemberDataContainer.findListByProperty(
					new Object[] { viewRiksdagenParty.getPartyId(), Boolean.TRUE },
					ViewRiksdagenCommitteeRoleMember_.party, ViewRiksdagenCommitteeRoleMember_.active),
			COMMITTEE_ROLES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);

	pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
	return panelContent;

}
 
Example #18
Source File: SearchDocumentClickListenerTest.java    From cia with Apache License 2.0 6 votes vote down vote up
/**
 * Show notification failure test.
 */
@Test
public void showNotificationFailureTest() {
	final SearchDocumentRequest request = new SearchDocumentRequest();		
	final SearchDocumentClickListener listener = Mockito.spy(new SearchDocumentClickListener(request,null));
	final ApplicationManager applicationManager = Mockito.mock(ApplicationManager.class);
	Mockito.doReturn(applicationManager).when(listener).getApplicationManager();
	
	final SearchDocumentResponse response = new SearchDocumentResponse(ServiceResult.FAILURE);
	response.setErrorMessage("errorMessage");
	Mockito.when(applicationManager.service(request)).thenReturn(response);
	
	Mockito.doNothing().when(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
	listener.buttonClick(new ClickEvent(new Panel()));
	Mockito.verify(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
}
 
Example #19
Source File: StorageAdminPanel.java    From sensorhub with Mozilla Public License 2.0 5 votes vote down vote up
protected void buildDataPanel(GridLayout form, IRecordStorageModule<?> storage)
{        
    // measurement outputs
    int i = 1;        
    if (storage.isEnabled())
    {
        for (IRecordStoreInfo dsInfo: storage.getRecordStores().values())
        {
            Panel panel = newPanel("Stream #" + i++);                
            GridLayout panelLayout = ((GridLayout)panel.getContent());
            panelLayout.setSpacing(true);
            
            // stored time period
            double[] timeRange = storage.getRecordsTimeRange(dsInfo.getName());
            Label l = new Label("<b>Time Range:</b> " + new DateTimeFormat().formatIso(timeRange[0], 0)
                                 + " / " + new DateTimeFormat().formatIso(timeRange[1], 0));
            l.setContentMode(ContentMode.HTML);
            panelLayout.addComponent(l, 0, 0, 1, 0);
            
            // time line
            panelLayout.addComponent(buildGantt(storage, dsInfo), 0, 1, 1, 1);
            
            // data structure
            DataComponent dataStruct = dsInfo.getRecordDescription();
            Component sweForm = new SWECommonForm(dataStruct);
            panelLayout.addComponent(sweForm);
            
            // data table
            panelLayout.addComponent(buildTable(storage, dsInfo));
            
            if (oldPanel != null)
                form.replaceComponent(oldPanel, panel);
            else
                form.addComponent(panel);
            oldPanel = panel;
        }
    }
}
 
Example #20
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 #21
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 #22
Source File: UpdateApplicationConfigurationClickListenerTest.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
 * Show notification failure test.
 */
@Test
public void showNotificationFailureTest() {
	final UpdateApplicationConfigurationRequest request = new UpdateApplicationConfigurationRequest();		
	final UpdateApplicationConfigurationClickListener listener = Mockito.spy(new UpdateApplicationConfigurationClickListener(request));
	final ApplicationManager applicationManager = Mockito.mock(ApplicationManager.class);
	Mockito.doReturn(applicationManager).when(listener).getApplicationManager();
	
	Mockito.when(applicationManager.service(request)).thenReturn(new UpdateApplicationConfigurationResponse(ServiceResult.FAILURE));
	
	Mockito.doNothing().when(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
	listener.buttonClick(new ClickEvent(new Panel()));
	Mockito.verify(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
}
 
Example #23
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 #24
Source File: CommitteeCurrentMembersHistoryPageModContentFactoryImpl.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);

	final ViewRiksdagenCommittee viewRiksdagenCommittee = getItem(parameters);
	getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, CURRENT_MEMBERS);

	final DataContainer<ViewRiksdagenCommitteeRoleMember, String> committeeRoleMemberDataContainer = getApplicationManager()
			.getDataContainer(ViewRiksdagenCommitteeRoleMember.class);

	getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenCommitteeRoleMember.class,
			committeeRoleMemberDataContainer.findListByProperty(
					new Object[] { viewRiksdagenCommittee.getEmbeddedId().getDetail(), Boolean.TRUE },
					ViewRiksdagenCommitteeRoleMember_.detail, ViewRiksdagenCommitteeRoleMember_.active),
			CURRENT_MEMBERS, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);

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

}
 
Example #25
Source File: RangeEditorComponent.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 Range Values");
	panelTester.setImmediate(true);
	panelTester.setWidth("-1px");
	panelTester.setHeight("-1px");
	
	// verticalLayout_2
	verticalLayout_2 = buildVerticalLayout_2();
	panelTester.setContent(verticalLayout_2);
	
	return panelTester;
}
 
Example #26
Source File: MinistryCurrentMembersPageModContentFactoryImpl.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);

	final ViewRiksdagenMinistry viewRiksdagenMinistry = getItem(parameters);

	getMinistryMenuItemFactory().createMinistryMenuBar(menuBar, pageId);

	LabelFactory.createHeader2Label(panelContent, CURRENT_MEMBERS);

	final DataContainer<ViewRiksdagenGovermentRoleMember, String> govermentRoleMemberDataContainer = getApplicationManager()
			.getDataContainer(ViewRiksdagenGovermentRoleMember.class);

	getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenGovermentRoleMember.class,
			govermentRoleMemberDataContainer.findListByProperty(
					new Object[] { viewRiksdagenMinistry.getNameId(), Boolean.TRUE },
					ViewRiksdagenGovermentRoleMember_.detail, ViewRiksdagenGovermentRoleMember_.active),
			CURRENT_MEMBERS, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);

	panel.setCaption(NAME + "::" + MINISTRY + viewRiksdagenMinistry.getNameId());
	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_VIEW, ApplicationEventGroup.USER, NAME,
			parameters, pageId);

	return panelContent;

}
 
Example #27
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 #28
Source File: SensorAdminPanel.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);
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    panel.setContent(layout);
    return panel;
}
 
Example #29
Source File: RemoveDataClickListenerTest.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
 * Show notification success test.
 */
@Test
public void showNotificationSuccessTest() {
	final RemoveDataRequest request = new RemoveDataRequest();		
	final RemoveDataClickListener listener = Mockito.spy(new RemoveDataClickListener(request));
	final ApplicationManager applicationManager = Mockito.mock(ApplicationManager.class);
	Mockito.doReturn(applicationManager).when(listener).getApplicationManager();
	
	final RemoveDataResponse response = new RemoveDataResponse(ServiceResult.SUCCESS);
	Mockito.when(applicationManager.asyncService(request)).thenReturn(Mockito.mock(Future.class));
	
	Mockito.doNothing().when(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
	listener.buttonClick(new ClickEvent(new Panel()));
	Mockito.verify(listener).showNotification(ArgumentMatchers.anyString(), ArgumentMatchers.anyString(), ArgumentMatchers.any(Type.class));
}
 
Example #30
Source File: UserHomeApplicationEventsPageModContentFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Secured({ "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 Optional<UserAccount> userAccount = getActiveUserAccount();

	if (userAccount.isPresent()) {

		userHomeMenuItemFactory.createUserHomeMenuBar(menuBar, pageId);

		LabelFactory.createHeader2Label(panelContent, USER_EVENTS);

		final DataContainer<ApplicationActionEvent, Long> eventDataContainer = getApplicationManager()
				.getDataContainer(ApplicationActionEvent.class);

		getGridFactory().createBasicBeanItemGrid(panelContent, ApplicationActionEvent.class,
				eventDataContainer.findOrderedListByProperty(ApplicationActionEvent_.userId,
						userAccount.get().getUserId(), ApplicationActionEvent_.createdDate),
				APPLICATION_ACTION_EVENT, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);

		panel.setCaption(NAME + "::" + USERHOME + USER_EVENTS);
	}

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

	return panelContent;

}