public CubaDateFieldWrapper(WebDateField dateField, Layout composition) { this.dateField = dateField; this.composition = composition; if (App.isBound()) { theme = App.getInstance().getThemeConstants(); } setSizeUndefined(); //noinspection unchecked setConverter(new ObjectToObjectConverter()); setValidationVisible(false); setShowBufferedSourceException(false); setShowErrorForDisabledState(false); setFocusDelegate(dateField.getDateField()); setPrimaryStyleName("c-datefield-composition"); }
private Layout createEmptyLayout() { Label label = new Label("Add new job..."); label.setSizeUndefined(); label.addStyleName(ValoTheme.LABEL_LARGE); VerticalLayout emptyLayout = new VerticalLayout(label); emptyLayout.addStyleName("dashed-border"); emptyLayout.setWidth(380, Unit.PIXELS); emptyLayout.setHeight(220, Unit.PIXELS); emptyLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); emptyLayout.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { BatchJobConfiguration jobConfig = presenter.createBatchJob(); BatchJobCard batchJobCard = batchJobCardInstances.get(); batchJobCard.load(jobConfig); batchJobCard.addBatchJobCardListener(BatchJobsLayout.this); batchJobLayout.addComponent(batchJobCard, batchJobLayout.getComponentCount()-1); } }); return emptyLayout; }
private Layout buttonsLayout(Button... buttons) { HorizontalLayout layout = new HorizontalLayout(); layout.setSizeFull(); List<Component> components = new ArrayList<>(Arrays.asList(buttons)); // Set HTML id for each button for(Component b : components) { b.setId(b.getCaption().replace(' ', '-')+"-btn"); } // Split components into sublists of 5 elements int partitionSize = 5; List<List<Component>> partitions = new ArrayList<>(); for (int i = 0; i < components.size(); i += partitionSize) { partitions.add(components.subList(i, Math.min(i + partitionSize, components.size()))); } // Create vertical layouts for each list of buttons for(List<Component> sublist : partitions) { VerticalLayout vLayout = new VerticalLayout(); vLayout.setMargin(false); sublist.stream().forEach(btn -> { btn.setSizeFull(); vLayout.addComponent(btn); }); layout.addComponent(vLayout); } return layout; }
@Override protected void init(VaadinRequest request) { // Root layout final VerticalLayout root = new VerticalLayout(); root.setSizeFull(); root.setSpacing(false); root.setMargin(false); setContent(root); // Main panel springViewDisplay = new Panel(); springViewDisplay.setSizeFull(); root.addComponent(springViewDisplay); root.setExpandRatio(springViewDisplay, 1); // Footer Layout footer = getFooter(); root.addComponent(footer); root.setExpandRatio(footer, 0); // Error handler UI.getCurrent().setErrorHandler(new UIErrorHandler()); // Disable session expired notification, the page will be reloaded on any action VaadinService.getCurrent().setSystemMessagesProvider( systemMessagesInfo -> { CustomizedSystemMessages msgs = new CustomizedSystemMessages(); msgs.setSessionExpiredNotificationEnabled(false); return msgs; }); }
private Layout getFooter() { Layout footer = new HorizontalLayout(); footer.addComponent(new Label("Persephone v"+persephoneVersion)); footer.addComponent(new Link("Created by Vianney FAIVRE", new ExternalResource("https://vianneyfaiv.re"), "_blank", 0, 0, BorderStyle.DEFAULT)); footer.addComponent(new Link("GitHub", new ExternalResource("https://github.com/vianneyfaivre/Persephone"), "_blank", 0, 0, BorderStyle.DEFAULT)); footer.setHeight(20, Unit.PIXELS); footer.setStyleName("persephone-footer"); return footer; }
public void setLayout(Layout newLayout) { if (newLayout == null) { newLayout = new CubaFieldGroupLayout(); } if (newLayout instanceof CubaFieldGroupLayout) { super.setContent(newLayout); } else { throw new IllegalArgumentException("FieldGroup supports only CubaFieldGroupLayout"); } }
public CubaGroupBox() { registerRpc((CubaGroupBoxServerRpc) expanded -> { if (getState().collapsable) { setExpanded(expanded); } }); Layout content = new CubaVerticalActionsLayout(); setContent(content); setWidth(100, Unit.PERCENTAGE); }
@Override public void setAlignment(Alignment alignment) { this.alignment = alignment; if (getComposition().getParent() != null) { com.vaadin.ui.Component component = this.getComposition().getParent(); if (component instanceof Layout.AlignmentHandler) { ((Layout.AlignmentHandler) component).setComponentAlignment(this.getComposition(), WebWrapperUtils.toVaadinAlignment(alignment)); } } }
@Override public Accordion.Tab addLazyTab(String name, Element descriptor, ComponentLoader loader) { WebVBoxLayout tabContent = new WebVBoxLayout(); Layout layout = (Layout) tabContent.getComponent(); layout.setSizeFull(); Tab tab = new Tab(name, tabContent); tabs.put(name, tab); com.vaadin.ui.Component tabComponent = WebComponentsHelper.getComposition(tabContent); tabComponent.setSizeFull(); tabMapping.put(tabComponent, new ComponentDescriptor(name, tabContent)); com.vaadin.ui.Accordion.Tab tabControl = this.component.addTab(tabComponent); getLazyTabs().add(tabComponent); this.component.addSelectedTabChangeListener(new LazyTabChangeListener(tabContent, descriptor, loader)); context = loader.getContext(); if (!postInitTaskAdded) { context.addPostInitTask((context1, window) -> initComponentTabChangeListener()); postInitTaskAdded = true; } if (getDebugId() != null) { this.component.setTestId(tabControl, AppUI.getCurrent().getTestIdManager().getTestId(getDebugId() + "." + name)); } if (AppUI.getCurrent().isTestMode()) { this.component.setCubaId(tabControl, name); } tabContent.setFrame(context.getFrame()); return tab; }
protected void showInfo(Object target) { com.haulmont.cuba.gui.components.Window.Editor editor = findEditor((Layout) target); Entity entity = editor.getItem(); Metadata metadata = AppBeans.get(Metadata.NAME); MetaClass metaClass = metadata.getSession().getClass(entity.getClass()); new ShowInfoAction().showInfo(entity, metaClass, editor); }
protected void analyzeLayout(Object target) { Window window = findWindow((Layout) target); if (window != null) { LayoutAnalyzer analyzer = new LayoutAnalyzer(); List<LayoutTip> tipsList = analyzer.analyze(window); if (tipsList.isEmpty()) { window.showNotification("No layout problems found", Frame.NotificationType.HUMANIZED); } else { window.openWindow("layoutAnalyzer", WindowManager.OpenType.DIALOG, ParamsMap.of("tipsList", tipsList)); } } }
@Nullable protected com.haulmont.cuba.gui.components.Window getWindow(Object target) { if (target instanceof Layout) { Layout layout = (Layout) target; for (Component component : layout) { if (component instanceof WindowBreadCrumbs) { WindowBreadCrumbs breadCrumbs = (WindowBreadCrumbs) component; return breadCrumbs.getCurrentWindow(); } } } return null; }
protected com.haulmont.cuba.gui.components.Window.Editor findEditor(Layout layout) { for (Object component : layout) { if (component instanceof WindowBreadCrumbs) { WindowBreadCrumbs breadCrumbs = (WindowBreadCrumbs) component; if (breadCrumbs.getCurrentWindow() instanceof Window.Editor) return (Window.Editor) breadCrumbs.getCurrentWindow(); } } return null; }
protected com.haulmont.cuba.gui.components.Window findWindow(Layout layout) { for (Object component : layout) { if (component instanceof WindowBreadCrumbs) { WindowBreadCrumbs breadCrumbs = (WindowBreadCrumbs) component; if (breadCrumbs.getCurrentWindow() != null) { return breadCrumbs.getCurrentWindow(); } } } return null; }
public void setRoot(Layout root) { this.root = root; this.root.setSizeFull(); removeAllComponents(); addComponent(this.root); setExpandRatio(this.root, 1); }
/** * Layouts header, grid and optional footer. */ protected void buildLayout() { setSizeFull(); setSpacing(true); setMargin(false); setStyleName("group"); final VerticalLayout gridHeaderLayout = new VerticalLayout(); gridHeaderLayout.setSizeFull(); gridHeaderLayout.setSpacing(false); gridHeaderLayout.setMargin(false); gridHeaderLayout.setStyleName("table-layout"); gridHeaderLayout.addComponent(gridHeader); gridHeaderLayout.setComponentAlignment(gridHeader, Alignment.TOP_CENTER); gridHeaderLayout.addComponent(grid); gridHeaderLayout.setComponentAlignment(grid, Alignment.TOP_CENTER); gridHeaderLayout.setExpandRatio(grid, 1.0F); addComponent(gridHeaderLayout); setComponentAlignment(gridHeaderLayout, Alignment.TOP_CENTER); setExpandRatio(gridHeaderLayout, 1.0F); if (hasFooterSupport()) { final Layout footerLayout = getFooterSupport().createFooterMessageComponent(); addComponent(footerLayout); setComponentAlignment(footerLayout, Alignment.BOTTOM_CENTER); } }
/** * Creates a sub-layout for the footer. * * @return the footer sub-layout. */ private Layout createFooterMessageComponent() { final HorizontalLayout footerLayout = new HorizontalLayout(); footerLayout.addComponent(getFooterMessageLabel()); footerLayout.setStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT); footerLayout.setWidth(100, Unit.PERCENTAGE); return footerLayout; }
@Secured({ "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); getMenuItemFactory().createMainPageMenuBar(menuBar); LabelFactory.createHeader2Label(content,ADMIN_AGENT_OPERATION); final ComboBox targetSelect = new ComboBox(TARGET, Arrays.asList(DataAgentTarget.values())); targetSelect.setId(ViewAction.START_AGENT_BUTTON + TARGET2); content.addComponent(targetSelect); content.setExpandRatio(targetSelect, ContentRatio.SMALL2); final ComboBox operationSelect = new ComboBox(OPERATION, Arrays.asList(DataAgentOperation.values())); operationSelect.setId(ViewAction.START_AGENT_BUTTON + OPERATION2); content.addComponent(operationSelect); content.setExpandRatio(operationSelect, ContentRatio.SMALL2); final Button startAgentButton = new Button(START, new StartAgentClickListener(targetSelect, operationSelect, agentContainer)); startAgentButton.setId(ViewAction.START_AGENT_BUTTON.name()); startAgentButton.setIcon(VaadinIcons.CROSSHAIRS); content.addComponent(startAgentButton); content.setExpandRatio(startAgentButton, ContentRatio.SMALL3); content.setSizeFull(); content.setMargin(false); content.setSpacing(true); content.setWidth(100, Unit.PERCENTAGE); content.setHeight(100, Unit.PERCENTAGE); return content; }
@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,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; }
@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, 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; }
@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<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent,DOCUMENT_HISTORY); final DataContainer<ViewRiksdagenPoliticianDocument, String> politicianDocumentDataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenPoliticianDocument.class); getGridFactory().createBasicBeanItemGrid( panelContent, ViewRiksdagenPoliticianDocument.class, politicianDocumentDataContainer.findOrderedListByProperty( ViewRiksdagenPoliticianDocument_.org, viewRiksdagenCommittee.getEmbeddedId().getOrgCode() .replace(" ", "").replace("_", "").trim(), ViewRiksdagenPoliticianDocument_.madePublicDate), DOCUMENTS, 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; }
@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<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent, BALLOT_DECISION_SUMMARY); final DataContainer<ViewRiksdagenCommitteeBallotDecisionSummary, ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId> committeeBallotDecisionPartyDataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommitteeBallotDecisionSummary.class); final List<ViewRiksdagenCommitteeBallotDecisionSummary> decisionPartySummaryList = committeeBallotDecisionPartyDataContainer .findOrderedListByProperty(ViewRiksdagenCommitteeBallotDecisionSummary_.org, pageId.toUpperCase(Locale.ENGLISH), ViewRiksdagenCommitteeBallotDecisionSummary_.createdDate); getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenCommitteeBallotDecisionSummary.class, decisionPartySummaryList, COMMITTEE_BALLOT_DECISION_SUMMARY, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, BALLOT_ID, null); panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail()); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId); } return panelContent; }
@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<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent, DECISION_SUMMARY); final DataContainer<ViewRiksdagenCommitteeDecisions, ViewRiksdagenCommitteeDecisionsEmbeddedId> committeeDecisionDataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommitteeDecisions.class); final List<ViewRiksdagenCommitteeDecisions> decisionPartySummaryList = committeeDecisionDataContainer .findOrderedListByProperty(ViewRiksdagenCommitteeDecisions_.org, pageId, ViewRiksdagenCommitteeDecisions_.createdDate); getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenCommitteeDecisions.class,decisionPartySummaryList, DECISION_SUMMARY, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, BALLOT_ID, null); panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail()); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId); } return panelContent; }
@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<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent,MEMBER_HISTORY); final DataContainer<ViewRiksdagenCommitteeRoleMember, String> committeeRoleMemberDataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommitteeRoleMember.class); getGridFactory().createBasicBeanItemGrid( panelContent, ViewRiksdagenCommitteeRoleMember.class, committeeRoleMemberDataContainer.getAllBy(ViewRiksdagenCommitteeRoleMember_.detail, viewRiksdagenCommittee.getEmbeddedId().getDetail()), MEMBER_HISTORY, 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; }
@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<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { 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; }
@Override public Layout getLayout() { return layout; }
public WindowBreadCrumbs(AppWorkArea workArea) { setWidth(100, Unit.PERCENTAGE); setHeightUndefined(); setPrimaryStyleName(C_HEADLINE_CONTAINER); tabbedMode = workArea.getMode() == AppWorkArea.Mode.TABBED; if (tabbedMode) { super.setVisible(false); } addAttachListener((AttachListener) event -> adjustParentStyles() ); logoLayout = createLogoLayout(); linksLayout = createLinksLayout(); linksLayout.setSizeUndefined(); if (!tabbedMode) { closeBtn = new CubaButton("", (Button.ClickListener) event -> { Window window = getCurrentWindow(); if (!isCloseWithCloseButtonPrevented(window)) { window.close(Window.CLOSE_ACTION_ID); } }); closeBtn.setIcon(WebComponentsHelper.getIcon("icons/close.png")); closeBtn.setStyleName("c-closetab-button"); } AppUI ui = AppUI.getCurrent(); if (ui.isTestMode()) { TestIdManager testIdManager = ui.getTestIdManager(); linksLayout.setId(testIdManager.getTestId("breadCrumbs")); linksLayout.setCubaId("breadCrumbs"); if (closeBtn != null) { closeBtn.setId(testIdManager.getTestId("closeBtn")); closeBtn.setCubaId("closeBtn"); } } Layout enclosingLayout = createEnclosingLayout(); enclosingLayout.addComponent(linksLayout); addComponent(logoLayout); addComponent(enclosingLayout); if (closeBtn != null) { addComponent(closeBtn); } }
protected Layout createEnclosingLayout() { Layout enclosingLayout = new CssLayout(); enclosingLayout.setPrimaryStyleName("c-breadcrumbs-container"); return enclosingLayout; }
protected Layout createLinksLayout() { CssLayout linksLayout = new CssLayout(); linksLayout.setPrimaryStyleName("c-breadcrumbs"); return linksLayout; }
protected Layout createLogoLayout() { CssLayout logoLayout = new CssLayout(); logoLayout.setPrimaryStyleName("c-breadcrumbs-logo"); return logoLayout; }
@Override public void setContextMenuPopup(Layout contextMenu) { getState().contextMenu = contextMenu; }
public void setContextMenuPopup(Layout contextMenu) { getState().contextMenu = contextMenu; }
@Override public Action[] getActions(Object target, Object sender) { if (!initialized) { Messages messages = AppBeans.get(Messages.NAME); closeAllTabs = new com.vaadin.event.Action(messages.getMainMessage("actions.closeAllTabs")); closeOtherTabs = new com.vaadin.event.Action(messages.getMainMessage("actions.closeOtherTabs")); closeCurrentTab = new com.vaadin.event.Action(messages.getMainMessage("actions.closeCurrentTab")); showInfo = new com.vaadin.event.Action(messages.getMainMessage("actions.showInfo")); analyzeLayout = new com.vaadin.event.Action(messages.getMainMessage("actions.analyzeLayout")); saveSettings = new com.vaadin.event.Action(messages.getMainMessage("actions.saveSettings")); restoreToDefaults = new com.vaadin.event.Action(messages.getMainMessage("actions.restoreToDefaults")); initialized = true; } List<Action> actions = new ArrayList<>(5); actions.add(closeCurrentTab); actions.add(closeOtherTabs); actions.add(closeAllTabs); if (target != null) { Configuration configuration = AppBeans.get(Configuration.NAME); ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); if (clientConfig.getManualScreenSettingsSaving()) { actions.add(saveSettings); actions.add(restoreToDefaults); } UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME); UserSession userSession = sessionSource.getUserSession(); if (userSession.isSpecificPermitted(ShowInfoAction.ACTION_PERMISSION) && findEditor((Layout) target) != null) { actions.add(showInfo); } if (clientConfig.getLayoutAnalyzerEnabled()) { actions.add(analyzeLayout); } } return actions.toArray(new com.vaadin.event.Action[actions.size()]); }
@Override public TabSheet.Tab addLazyTab(String name, Element descriptor, ComponentLoader loader) { ComponentsFactory cf = AppBeans.get(ComponentsFactory.NAME); BoxLayout tabContent = (BoxLayout) cf.createComponent(VBoxLayout.NAME); Layout layout = tabContent.unwrap(Layout.class); layout.setSizeFull(); Tab tab = new Tab(name, tabContent); tabs.put(name, tab); com.vaadin.ui.Component tabComponent = WebComponentsHelper.getComposition(tabContent); tabComponent.setSizeFull(); tabMapping.put(tabComponent, new ComponentDescriptor(name, tabContent)); com.vaadin.ui.TabSheet.Tab tabControl = this.component.addTab(tabComponent); getLazyTabs().add(tabComponent); this.component.addSelectedTabChangeListener(new LazyTabChangeListener(tabContent, descriptor, loader)); context = loader.getContext(); if (!postInitTaskAdded) { context.addPostInitTask((context1, window) -> initComponentTabChangeListener() ); postInitTaskAdded = true; } if (getDebugId() != null) { this.component.setTestId(tabControl, AppUI.getCurrent().getTestIdManager().getTestId(getDebugId() + "." + name)); } if (AppUI.getCurrent().isTestMode()) { this.component.setCubaId(tabControl, name); } tabContent.setFrame(context.getFrame()); return tab; }
public static ConfigureWindow create(Layout dataLayout, String caption) { return new ConfigureWindow(dataLayout, caption); }
public static ConfigureWindow createSizeUndefined(Layout dataLayout, String caption) { ConfigureWindow configureWindow = new ConfigureWindow(dataLayout, caption); configureWindow.setSizeUndefined(); return configureWindow; }
@Override public void buttonClick(Button.ClickEvent event) { ((Layout) this.getParent()).removeComponent(this); }
@Secured({ "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); getMenuItemFactory().createMainPageMenuBar(menuBar); LabelFactory.createHeader2Label(content, ADMIN_DATA_SUMMARY); final HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setSizeFull(); content.addComponent(horizontalLayout); content.setExpandRatio(horizontalLayout, ContentRatio.LARGE); final DataContainer<DataSummary, String> dataContainer = getApplicationManager() .getDataContainer(DataSummary.class); final List<DataSummary> all = dataContainer.getAll(); if (!all.isEmpty()) { final DataSummary dataSummary = all.get(0); getFormFactory().addFormPanelTextFields(horizontalLayout, dataSummary, DataSummary.class, DATASUMMARY_FORM_FIELDS); } final VerticalLayout overviewLayout = new VerticalLayout(); overviewLayout.setSizeFull(); content.addComponent(overviewLayout); content.setExpandRatio(overviewLayout, ContentRatio.LARGE); final ResponsiveRow grid = createGridLayout(overviewLayout); final Button refreshViewsButton = new Button(REFRESH_VIEWS, VaadinIcons.REFRESH); refreshViewsButton.addClickListener(new RefreshDataViewsClickListener()); createRowItem(grid, refreshViewsButton, REFRESH_ALL_VIEWS); final Button updateSearchIndexButton = new Button(UPDATE_SEARCH_INDEX, VaadinIcons.REFRESH); updateSearchIndexButton.addClickListener(new UpdateSearchIndexClickListener()); createRowItem(grid, updateSearchIndexButton, UPDATE_DOCUMENT_SEARCH_INDEX); final Button removeDataButton = new Button(REMOVE_POLITICIANS, VaadinIcons.DEL); removeDataButton.addClickListener(new RemoveDataClickListener(RemoveDataRequest.DataType.POLITICIAN)); createRowItem(grid, removeDataButton, REMOVE_POLITICIANS); final Button removeDocumentsButton = new Button(REMOVE_DOCUMENTS, VaadinIcons.DEL); removeDocumentsButton.addClickListener(new RemoveDataClickListener(RemoveDataRequest.DataType.DOCUMENTS)); createRowItem(grid, removeDocumentsButton, REMOVE_DOCUMENTS); final Button removeApplicationHistoryButton = new Button(REMOVE_APPLICATION_HISTORY, VaadinIcons.DEL); removeApplicationHistoryButton .addClickListener(new RemoveDataClickListener(RemoveDataRequest.DataType.APPLICATION_HISTORY)); createRowItem(grid, removeApplicationHistoryButton, REMOVE_APPLICATION_HISTORY); return content; }
@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_APPLICATION_ACTION_EVENT); getAdminChartDataManager().createApplicationActionEventPageDailySummaryChart(content); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_EVENTS_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId); return content; }