use of com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener in project cia by Hack23.
the class AdminApplicationConfigurationPageModContentFactoryImpl method createContent.
@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);
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;
}
use of com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener in project cia by Hack23.
the class AdminApplicationSessionPageModContentFactoryImpl method createContent.
@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_SESSION);
final DataContainer<ApplicationSession, Long> dataContainer = getApplicationManager().getDataContainer(ApplicationSession.class);
final List<ApplicationSession> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, ApplicationSession_.createdDate);
createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
getGridFactory().createBasicBeanItemGrid(content, ApplicationSession.class, pageOrderBy, APPLICATION_SESSION, COLUMN_ORDER, HIDE_COLUMNS, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_SESSION_VIEW_NAME, "hjid"), null, new ListPropertyConverter[] { new ListPropertyConverter("page", "events", "actionName") });
if (pageId != null && !pageId.isEmpty()) {
final ApplicationSession applicationSession = dataContainer.load(Long.valueOf(pageId));
if (applicationSession != null) {
final VerticalLayout rightLayout = new VerticalLayout();
rightLayout.setSizeFull();
final HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setWidth(ContentSize.FULL_SIZE);
content.addComponent(horizontalLayout);
content.setExpandRatio(horizontalLayout, ContentRatio.GRID);
getFormFactory().addFormPanelTextFields(horizontalLayout, applicationSession, ApplicationSession.class, AS_LIST);
horizontalLayout.addComponent(rightLayout);
horizontalLayout.setExpandRatio(rightLayout, ContentRatio.GRID);
getGridFactory().createBasicBeanItemGrid(rightLayout, ApplicationActionEvent.class, applicationSession.getEvents(), APPLICATION_ACTION_EVENT, COLUMN_ORDER2, HIDE_COLUMNS2, new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_EVENTS_VIEW_NAME, "hjid"), null, null);
}
}
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_SESSION_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
return content;
}
use of com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener in project cia by Hack23.
the class AdminPortalPageModContentFactoryImpl method createContent.
@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_PORTAL);
final DataContainer<Portal, Long> dataContainer = getApplicationManager().getDataContainer(Portal.class);
final List<Portal> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, Portal_.portalName);
createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
getGridFactory().createBasicBeanItemGrid(content, Portal.class, pageOrderBy, PORTAL2, COLUMN_ORDER, HIDE_COLUMNS, new PageItemPropertyClickListener(AdminViews.ADMIN_PORTAL_VIEW_NAME, "hjid"), null, null);
if (pageId != null && !pageId.isEmpty()) {
final Portal portal = dataContainer.load(Long.valueOf(pageId));
if (portal != null) {
getFormFactory().addFormPanelTextFields(content, portal, Portal.class, AS_LIST);
}
}
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_PORTAL_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
return content;
}
use of com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener in project cia by Hack23.
the class PageItemPropertyClickListenerTest method checkCorrectPageIdSuccessTest.
/**
* Check correct page id success test.
*/
@Test
public void checkCorrectPageIdSuccessTest() {
final PageItemPropertyClickListener pageItemPropertyClickListener = new PageItemPropertyClickListener(UserViews.POLITICIAN_VIEW_NAME, "wrongProperty");
final String pageId = pageItemPropertyClickListener.getPageId(new ViewRiksdagenPolitician());
assertEquals("ErrorGettingPageId", pageId);
}
use of com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener in project cia by Hack23.
the class PartyGovernmentRolesPageModContentFactoryImpl method createContent.
@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 DataContainer<ViewRiksdagenParty, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenParty.class);
final ViewRiksdagenParty viewRiksdagenParty = dataContainer.load(pageId);
if (viewRiksdagenParty != null) {
getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, GOVERNMENT_ROLES);
final DataContainer<ViewRiksdagenGovermentRoleMember, String> govermentRoleMemberDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenGovermentRoleMember.class);
getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenGovermentRoleMember.class, govermentRoleMemberDataContainer.findListByProperty(new Object[] { viewRiksdagenParty.getPartyId(), Boolean.TRUE }, ViewRiksdagenGovermentRoleMember_.party, ViewRiksdagenGovermentRoleMember_.active), GOVERNMENT_ROLES, COLUMN_ORDER, HIDE_COLUMNS, new PageItemPropertyClickListener(UserViews.POLITICIAN_VIEW_NAME, PERSON_ID), null, null);
pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
}
return panelContent;
}
Aggregations