@SuppressWarnings("serial") protected Panel getOptionTable() { this.optionTable = new Table(); this.optionTable.setPageLength(3); this.optionTable.setSizeFull(); this.optionTable.setImmediate(true); this.optionTable.addGeneratedColumn("Enabled", new CheckBoxGenerator()); this.optionTable.addContainerProperty("Name", String.class, null); this.optionTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { optionTableClicked(event); } }); this.optionPanel = new Panel(); this.optionPanel.addStyleName(StyleConstants.FORM_PANEL); this.optionPanel.setWidth(100, Sizeable.Unit.PERCENTAGE); this.optionPanel.setContent(this.optionTable); return this.optionPanel; }
protected Panel getAttributesPanel() { this.sharedKey = new PasswordField(); this.sharedKey.setRequiredError("shared secret key cannot be empty"); this.sharedKey.setRequired(true); // best show/hide this conditionally based on Manager type. this.sharedKey.setValue("dummy1234"); this.attributes = new Table(); this.attributes.setPageLength(0); this.attributes.setSelectable(true); this.attributes.setSizeFull(); this.attributes.setImmediate(true); this.attributes.addContainerProperty("Attribute Name", String.class, null); this.attributes.addContainerProperty("Value", PasswordField.class, null); this.attributes.addItem(new Object[] { "Shared Secret key", this.sharedKey }, new Integer(1)); // creating panel to store attributes table this.attributePanel = new Panel("Common Appliance Configuration Attributes:"); this.attributePanel.addStyleName("form_Panel"); this.attributePanel.setWidth(100, Sizeable.Unit.PERCENTAGE); this.attributePanel.setContent(this.attributes); return this.attributePanel; }
public SteppersView() { setAlignSelf(FlexLayout.AlignSelf.BASELINE); setFlexDirection(FlexLayout.FlexDirection.COLUMN); addStyleName(Paddings.All.LARGE); addStyleName(Spacings.Bottom.LARGE); setWidth(100, Sizeable.Unit.PERCENTAGE); Stepper s1 = createStepper(); s1.selectStep(0); Stepper s2 = createStepper(); s2.completeStep(0); s2.selectStep(1); Stepper s3 = createStepper(); s3.completeStep(0); s3.invalidateStep(1); s3.selectStep(2); addComponents(s1, s2, s3); }
@PostConstruct public void init() { handler.setView(this); setSizeFull(); addComponent(instructions); ImportAttendeePresenter.UploadReceiver receiver = handler.getUploadReceiver(); Upload upload = new Upload("Upload JSON file", receiver); upload.addSucceededListener(receiver); upload.addFailedListener(receiver); addComponent(upload); status.setSizeFull(); status.setWidth(600, Sizeable.Unit.PIXELS); status.setEnabled(false); addComponent(status); // setExpandRatio(status, 1.0f); }
public void showBadgesInBrowser(List<Attendee> attendeeList) { if (attendeeList.size() > 0) { StreamResource.StreamSource source = handler.getBadgeFormatter(this, attendeeList); String filename = "testbadge" + System.currentTimeMillis() + ".pdf"; StreamResource resource = new StreamResource(source, filename); resource.setMIMEType("application/pdf"); resource.getStream().setParameter("Content-Disposition", "attachment; filename="+filename); Window window = new Window(); window.setWidth(800, Sizeable.Unit.PIXELS); window.setHeight(600, Sizeable.Unit.PIXELS); window.setModal(true); window.center(); BrowserFrame pdf = new BrowserFrame("test", resource); pdf.setSizeFull(); window.setContent(pdf); getUI().addWindow(window); } else { Notification.show("No attendees selected"); } }
protected void applyScrollBarsPolicy(ScrollBarPolicy scrollBarPolicy) { switch (scrollBarPolicy) { case VERTICAL: getContent().setHeightUndefined(); getContent().setWidth(100, Sizeable.Unit.PERCENTAGE); break; case HORIZONTAL: getContent().setHeight(100, Sizeable.Unit.PERCENTAGE); getContent().setWidthUndefined(); break; case BOTH: getContent().setSizeUndefined(); break; case NONE: getContent().setSizeFull(); break; } }
protected void addMenuItemComponent(final ViewDefinition viewDefinition, String parameters) { CssLayout dashboardWrapper = new CssLayout(); dashboardWrapper.addStyleName("badgewrapper"); dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM); dashboardWrapper.setWidth(100.0f, Sizeable.Unit.PERCENTAGE); Label notificationsBadge = new Label(); notificationsBadge.addStyleName(ValoTheme.MENU_BADGE); notificationsBadge.setWidthUndefined(); notificationsBadge.setVisible(false); if (viewDefinition != null) { dashboardWrapper.addComponents(new ValoMenuItemButton(viewDefinition, parameters), notificationsBadge); menuItemsLayout.addComponent(dashboardWrapper); } else if (HybridbpmUI.getDeveloperMode()) { dashboardWrapper.addComponents(new ValoMenuAddViewButton(), notificationsBadge); menuItemsLayout.addComponent(dashboardWrapper); } }
public void initUI() { removeAllComponents(); btnAdd.setCaption(("Add file")); btnAdd.setStyleName(ValoTheme.BUTTON_LINK); btnAdd.setIcon(FontAwesome.PLUS_CIRCLE); setMargin(true); setSpacing(true); setWidth(100, Sizeable.Unit.PERCENTAGE); for (FileModel fileModel : processModel.getFileModels()) { FileForm fileForm = new FileForm(); fileForm.setFileModel(fileModel); addComponent(fileForm); } addComponent(btnAdd); setComponentAlignment(btnAdd, Alignment.MIDDLE_RIGHT); }
public void initUI() { removeAllComponents(); btnAdd.setCaption(("Add variable")); btnAdd.setStyleName(ValoTheme.BUTTON_LINK); btnAdd.setIcon(FontAwesome.PLUS_CIRCLE); setMargin(true); setSpacing(true); setWidth(100, Sizeable.Unit.PERCENTAGE); for (FieldModel fieldModel : processModel.getVariableModels()) { FieldForm fieldForm = new FieldForm(FieldForm.CLASS_LIST_TYPE.COMPLEX_DATA); fieldForm.setFieldModel(fieldModel); addComponent(fieldForm); } addComponent(btnAdd); setComponentAlignment(btnAdd, Alignment.MIDDLE_RIGHT); }
public void initUI() { removeAllComponents(); addStyleName("process-model"); setImmediate(true); setWidth(processModel.getWidth(), Sizeable.Unit.PIXELS); setHeight(processModel.getHeight(), Sizeable.Unit.PIXELS); prepareButtonsBars(); transitionManager = new TransitionManager(this); transitionManager.setSizeFull(); transitionManager.setValue(processModel.getWidth(), processModel.getHeight()); transitionManager.setValue(processModel.getTaskModels(), processModel.getTransitionModels()); addComponent(transitionManager); for (TaskModel taskModel : processModel.getTaskModels().values()) { ElementModelLayout elementModelLayout = new ElementModelLayout(taskModel, this); addComponent(elementModelLayout, "left:" + taskModel.getX() + "px; top:" + taskModel.getY() + "px"); } activeElement = new ActiveElement(ActiveElement.TYPE.PROCESS, processModel, null, null); }
public void initUI(boolean editable) { removeAllComponents(); btnAdd.setCaption(("Add parameter")); btnAdd.setStyleName(ValoTheme.BUTTON_LINK); btnAdd.setIcon(FontAwesome.PLUS_CIRCLE); setMargin(true); setSpacing(true); setWidth(100, Sizeable.Unit.PERCENTAGE); for (FieldModel fieldModel : formModel.getParameters()) { FieldForm fieldForm = new FieldForm(FieldForm.CLASS_LIST_TYPE.BOTH); fieldForm.setFieldModel(fieldModel); fieldForm.setEnabled(editable); fieldForm.setReadOnly(!editable); addComponent(fieldForm); } addComponent(btnAdd); setComponentAlignment(btnAdd, Alignment.MIDDLE_RIGHT); btnAdd.setVisible(editable); }
public void initUI() { removeAllComponents(); btnAdd.setCaption(("Add parameter")); btnAdd.setStyleName(ValoTheme.BUTTON_LINK); btnAdd.setIcon(FontAwesome.PLUS_CIRCLE); setMargin(true); setSpacing(true); setWidth(100, Sizeable.Unit.PERCENTAGE); for (FieldModel fieldModel : connectoModel.getOutParameters()) { FieldForm fieldForm = new FieldForm(FieldForm.CLASS_LIST_TYPE.BOTH); fieldForm.setFieldModel(fieldModel); addComponent(fieldForm); } addComponent(btnAdd); setComponentAlignment(btnAdd, Alignment.MIDDLE_RIGHT); }
public void initUI() { removeAllComponents(); btnAdd.setCaption(("Add parameter")); btnAdd.setStyleName(ValoTheme.BUTTON_LINK); btnAdd.setIcon(FontAwesome.PLUS_CIRCLE); setMargin(true); setSpacing(true); setWidth(100, Sizeable.Unit.PERCENTAGE); for (FieldModel fieldModel : connectoModel.getInParameters()) { FieldForm fieldForm = new FieldForm(FieldForm.CLASS_LIST_TYPE.BOTH); fieldForm.setFieldModel(fieldModel); addComponent(fieldForm); } addComponent(btnAdd); setComponentAlignment(btnAdd, Alignment.MIDDLE_RIGHT); }
private void prepareModeler() { btnAdd.setCaption("Add field"); btnAdd.setIcon(FontAwesome.PLUS_CIRCLE); btnAdd.setStyleName(ValoTheme.BUTTON_LINK); btnAdd.addStyleName(ValoTheme.BUTTON_SMALL); modelerLayout.setMargin(true); modelerLayout.setSpacing(true); modelerLayout.setWidth(100, Sizeable.Unit.PERCENTAGE); for (FieldModel fieldModel : dataModel.getFields()) { FieldForm fieldForm = new FieldForm(FieldForm.CLASS_LIST_TYPE.BOTH); fieldForm.setFieldModel(fieldModel); modelerLayout.addComponent(fieldForm); } modelerLayout.addComponent(btnAdd); modelerLayout.setComponentAlignment(btnAdd, Alignment.MIDDLE_RIGHT); }
/** * Shows a distribution set select window for the given target filter query * * @param tfqId * target filter query id */ public void showForTargetFilter(final Long tfqId) { this.tfqId = tfqId; final TargetFilterQuery tfq = targetFilterQueryManagement.get(tfqId) .orElseThrow(() -> new EntityNotFoundException(TargetFilterQuery.class, tfqId)); final VerticalLayout verticalLayout = initView(); final DistributionSet distributionSet = tfq.getAutoAssignDistributionSet(); if (distributionSet != null) { setValue(distributionSet.getId()); } else { setValue(null); } // build window after values are set to view elements final CommonDialogWindow window = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW) .caption(i18n.getMessage("caption.select.auto.assign.dist")).content(verticalLayout) .layout(verticalLayout).i18n(i18n).saveDialogCloseListener(this).buildCommonDialogWindow(); window.setId(UIComponentIdProvider.DIST_SET_SELECT_WINDOW_ID); window.setWidth(40.0F, Sizeable.Unit.PERCENTAGE); UI.getCurrent().addWindow(window); window.setVisible(true); }
private void confirmWithConsequencesDialog(final TargetFilterQuery tfq, final Long dsId) { final ConfirmConsequencesDialog dialog = new ConfirmConsequencesDialog(tfq, dsId, new ConfirmCallback() { @Override public void onConfirmResult(final boolean accepted) { if (accepted) { targetFilterQueryManagement.updateAutoAssignDS(tfq.getId(), dsId); eventBus.publish(this, CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY); } } }); dialog.setWidth(40.0F, Sizeable.Unit.PERCENTAGE); UI.getCurrent().addWindow(dialog); dialog.setVisible(true); }
@Override public Component getDetails(Grid.RowReference rowReference) { rowReference.getGrid().scrollTo(rowReference.getItemId()); Customer customer = (Customer)rowReference.getItemId(); HorizontalLayout layout = new HorizontalLayout(); layout.setHeight(300, Sizeable.Unit.PIXELS); layout.setMargin(true); layout.setSpacing(true); Image image = new Image("", customer.getPhoto()); image.setHeight(200, Sizeable.Unit.PIXELS); image.setWidth(200, Sizeable.Unit.PIXELS); layout.addComponent(image); Label nameLabel = new Label("<h1>" + customer.getFirstName() + " " + customer.getLastName() + "</h1>", ContentMode.HTML); layout.addComponent(nameLabel); layout.setExpandRatio(nameLabel, 1.0f); return layout; }
@Override public Component getDetails(Grid.RowReference rowReference) { rowReference.getGrid().scrollTo(rowReference.getItemId()); StaticCustomer customer = (StaticCustomer)rowReference.getItemId(); HorizontalLayout layout = new HorizontalLayout(); layout.setHeight(300, Sizeable.Unit.PIXELS); layout.setMargin(true); layout.setSpacing(true); Image image = new Image("", customer.getPhoto()); image.setHeight(200, Sizeable.Unit.PIXELS); image.setWidth(200, Sizeable.Unit.PIXELS); layout.addComponent(image); Label nameLabel = new Label("<h1>" + customer.getFirstName() + " " + customer.getLastName() + "</h1>", ContentMode.HTML); layout.addComponent(nameLabel); layout.setExpandRatio(nameLabel, 1.0f); return layout; }
public static CssLayout createRating(Customer customer) { CssLayout layout = new CssLayout(); layout.setHeight(49, Sizeable.Unit.PIXELS); layout.setWidth(100, Sizeable.Unit.PIXELS); Label overallRating = new Label(FontAwesome.STAR.getHtml(), ContentMode.HTML); overallRating.addStyleName("green"); overallRating.setDescription("Very good : " + testData.getNumberBetween(90, 100) + "% Chance"); overallRating.setWidthUndefined(); overallRating.setWidth(49, Sizeable.Unit.PIXELS); overallRating.setHeight(49, Sizeable.Unit.PIXELS); layout.addComponent(overallRating); Label carRating = new Label(FontAwesome.CAR.getHtml(), ContentMode.HTML); carRating.addStyleName("red"); carRating.setDescription("Unlikely : " + testData.getNumberBetween(1, 15) + "%"); carRating.setWidthUndefined(); carRating.setWidth(49, Sizeable.Unit.PIXELS); carRating.setHeight(49, Sizeable.Unit.PIXELS); layout.addComponent(carRating); return layout; }
public static Component createFoodIcon(Customer cust) { Label label = new Label(FontAwesome.HOURGLASS_2.getHtml(), ContentMode.HTML); label.setHeight(24, Sizeable.Unit.PIXELS); label.setWidth(30, Sizeable.Unit.PIXELS); if (cust.getFood() == Customer.Food.HAMBURGER) { label.setValue(FontAwesome.AMBULANCE.getHtml()); } if (cust.getFood() == Customer.Food.FISH) { label.setValue(FontAwesome.HEART.getHtml()); } if (cust.getFood() == Customer.Food.VEGETABLES) { label.setValue(FontAwesome.SUN_O.getHtml()); } return label; }
public static Button createClassicDeleteButton(Grid grid, FocusPreserveExtension focusPreserveExtension, BeanItemContainer<Customer> beanItemContainer, Customer customer) { Button delete = new Button("Delete", event -> { beanItemContainer.removeItem(customer); if (grid instanceof ComponentGrid) { ((ComponentGrid) grid).refresh(); } else { // a hack to force rerendering of the grid focusPreserveExtension.saveFocus(); grid.setCellStyleGenerator(grid.getCellStyleGenerator()); focusPreserveExtension.restoreFocus(); } }); delete.setHeight(ROW_HEIGHT, Sizeable.Unit.PIXELS); delete.setWidth(150, Sizeable.Unit.PIXELS); return delete; }
public static Component createPremiumCheckbox(ComponentGridDecorator componentGridDecorator, Customer customer) { CheckBox premium = new CheckBox(); premium.setImmediate(true); premium.setWidth(19, Sizeable.Unit.PIXELS); premium.setHeight(19, Sizeable.Unit.PIXELS); premium.setDescription("Premium Customer?"); Property property = new BeanItem<>(customer).getItemProperty(Customer.PREMIUM); premium.setPropertyDataSource(property); premium.addValueChangeListener(e -> { Notification.show(String.valueOf(customer.getPremium())); componentGridDecorator.refresh(); }); return premium; }
public static Component createClassicFoodSelector(Grid grid, FocusPreserveExtension focusPreserveExtension, Customer customer) { ComboBox select = new ComboBox(); select.setWidth(200, Sizeable.Unit.PIXELS); select.setHeight(ROW_HEIGHT, Sizeable.Unit.PIXELS); select.addItems(Customer.Food.FISH, Customer.Food.HAMBURGER, Customer.Food.VEGETABLES); select.setPropertyDataSource(new BeanItem<>(customer).getItemProperty(Customer.FOOD)); select.addValueChangeListener(e -> { if (grid instanceof ComponentGrid) { ((ComponentGrid) grid).refresh(); } else { // a hack to force rerendering of the grid focusPreserveExtension.saveFocus(); grid.setCellStyleGenerator(grid.getCellStyleGenerator()); focusPreserveExtension.restoreFocus(); } }); return select; }
/** * Shows QR Code dialog. * @param qrCodeUrl the QR code URL */ public static void showGrCodeDialog(final String qrCodeUrl) { final Window subWindow = new Window(Site.getCurrent().localize("header-scan-qr-code-with-google-authenticator")); subWindow.setModal(true); final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); final Image qrCodeImage = new Image(null, new ExternalResource(qrCodeUrl)); verticalLayout.addComponent(qrCodeImage); verticalLayout.setComponentAlignment(qrCodeImage, Alignment.MIDDLE_CENTER); subWindow.setContent(verticalLayout); subWindow.setResizable(false); subWindow.setWidth(230, Sizeable.Unit.PIXELS); subWindow.setHeight(260, Sizeable.Unit.PIXELS); subWindow.center(); UI.getCurrent().addWindow(subWindow); }
/** * Start the registration process. */ public void startRegistration(final U2fRegistrationListener u2FRegistrationListener) { this.u2FRegistrationListener = u2FRegistrationListener; sendRegisterRequest(); registerWindow.setModal(true); final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true); final Label label = new Label(Site.getCurrent().localize("message-insert-u2f-device")); verticalLayout.addComponent(label); verticalLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); registerWindow.setContent(verticalLayout); registerWindow.setResizable(false); registerWindow.setWidth(300, Sizeable.Unit.PIXELS); registerWindow.setHeight(200, Sizeable.Unit.PIXELS); registerWindow.center(); UI.getCurrent().addWindow(registerWindow); }
@Test public void testAddComponentToParentWithExpandRatio() throws Exception { Button btn1 = new Button(); Button btn2 = new Button(); HorizontalSplitPanel panel = new HorizontalSplitPanel(); VisualTreeNode splitPanelVisualTreeNode = new VisualTreeNodeImpl(panel); splitPanelVisualTreeNode.setAdditionalParameter("splitPosition", "0.65"); factory.addComponentToParent(splitPanelVisualTreeNode, new VisualTreeNodeImpl(btn1)); factory.addComponentToParent(splitPanelVisualTreeNode, new VisualTreeNodeImpl(btn2)); assertThat(panel.getComponentCount()).isEqualTo(2); assertThat(panel.getFirstComponent()).isSameAs(btn1); assertThat(panel.getSecondComponent()).isSameAs(btn2); assertThat(panel.getSplitPositionUnit()).isEqualTo(Sizeable.Unit.PERCENTAGE); assertThat(panel.getSplitPosition()).isEqualTo(0.65f * 100.f, Offset.offset(0.01f)); }
public static Component projectLogoComp(String projectShortname, Integer projectId, String projectAvatarId, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(projectAvatarId)) { wrapper = new Image(null, new ExternalResource(StorageUtils.getResourcePath (String.format("%s/%s_%d.png", PathUtils.getProjectLogoPath(AppUI.getAccountId(), projectId), projectAvatarId, size)))); } else { ELabel projectIcon = new ELabel(projectShortname).withStyleName(UIConstants.TEXT_ELLIPSIS, ValoTheme.LABEL_LARGE, "center"); projectIcon.setWidth(size, Sizeable.Unit.PIXELS); projectIcon.setHeight(size, Sizeable.Unit.PIXELS); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(projectIcon); ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE)); return wrapper; }
public static Component clientLogoComp(SimpleAccount account, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(account.getAvatarid())) { wrapper = new Image(null, new ExternalResource(StorageUtils.getEntityLogoPath(AppUI.getAccountId(), account.getAvatarid(), 100))); } else { String accountName = account.getAccountname(); accountName = (accountName.length() > 3) ? accountName.substring(0, 3) : accountName; ELabel projectIcon = new ELabel(accountName).withStyleName(UIConstants.TEXT_ELLIPSIS, "center"); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(projectIcon); ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE)); return wrapper; }
public static Component accountLogoComp(SimpleAccount account, int size) { AbstractComponent wrapper; if (!StringUtils.isBlank(account.getAvatarid())) { wrapper = new Image(null, new ExternalResource(StorageUtils.getEntityLogoPath(AppUI .getAccountId(), account.getAvatarid(), 100))); } else { String accountName = account.getAccountname(); accountName = (accountName.length() > 3) ? accountName.substring(0, 3) : accountName; ELabel accountIcon = new ELabel(accountName).withStyleName(UIConstants.TEXT_ELLIPSIS, "center"); accountIcon.setWidth(size, Sizeable.Unit.PIXELS); accountIcon.setHeight(size, Sizeable.Unit.PIXELS); wrapper = new VerticalLayout(); ((VerticalLayout) wrapper).addComponent(accountIcon); ((VerticalLayout) wrapper).setComponentAlignment(accountIcon, Alignment.MIDDLE_CENTER); } wrapper.setWidth(size, Sizeable.Unit.PIXELS); wrapper.setHeight(size, Sizeable.Unit.PIXELS); wrapper.addStyleName(UIConstants.CIRCLE_BOX); wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE)); return wrapper; }
public static void showModalWin(final ExtaEditForm<?> editWin) { final Window window = new Window(editWin.getCaption(), editWin); window.setClosable(true); window.setModal(true); if (editWin.getWinHeight() != Sizeable.SIZE_UNDEFINED) window.setHeight(editWin.getWinHeight(), editWin.getWinHeightUnit()); if (editWin.getWinWidth() != Sizeable.SIZE_UNDEFINED) window.setWidth(editWin.getWinWidth(), editWin.getWinWidthUnit()); window.addCloseListener(event -> editWin.fireCloseForm()); editWin.addCloseFormListener(event -> window.close()); if (editWin.getWinHeight() != Sizeable.SIZE_UNDEFINED && editWin.getWinWidth() != Sizeable.SIZE_UNDEFINED) editWin.addAttachListener(e -> editWin.adjustSize()); else new WinSizeAdjuster(editWin, window); UI.getCurrent().addWindow(window); }
/** * Constructing the footer. */ private void initFooter() { HorizontalLayout footerLayout = new HorizontalLayout(); footerLayout.setWidth("33%"); credits.setWidth("100%"); footerLayout.addComponent(credits); Label version = new Label(bundle.getString("version")); footerLayout.addComponent(version); Label sep = new Label(" | "); sep.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PERCENTAGE); footerLayout.addComponent(sep); version.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PERCENTAGE); Label build = new Label(bundle.getString("version.build")); footerLayout.addComponent(build); build.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PERCENTAGE); footerLayout.setExpandRatio(credits, 1); content.addComponent(footerLayout); }
/** * @return AZ Panel */ @SuppressWarnings("serial") protected Panel getVirtualSystemPanel() { try { this.vsTable = new Table(); this.vsTable.setPageLength(5); this.vsTable.setImmediate(true); this.vsTable.addGeneratedColumn("Enabled", new CheckBoxGenerator()); this.vsTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { vsTableClicked((Long) event.getItemId()); } }); // populating VS table populateVirtualSystem(); Panel vsPanel = new Panel("Virtualization System:"); vsPanel.addStyleName("form_Panel"); vsPanel.setWidth(100, Sizeable.Unit.PERCENTAGE); vsPanel.setContent(this.vsTable); return vsPanel; } catch (Exception e) { log.error("Error while creating DA's VS panel", e); } return null; }
public ScrollableDialog(String title, boolean lightTheme) { super(title); setPrimaryStyleName(lightTheme ? Styles.Windows.LIGHT : Styles.Windows.DARK); addStyleName(Styles.Windows.SCROLLABLE); scrollableLayout = new FlexLayout(FlexLayout.FlexDirection.COLUMN); scrollableLayout.setOverflow(FlexLayout.Overflow.AUTO); scrollableLayout.addStyleName(Paddings.Horizontal.LARGE); scrollableLayout.addStyleName(FlexItem.FlexGrow.GROW_1); // Footer cancel = new Button("Cancel"); cancel.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK); cancel.addClickListener(e -> close()); ok = new Button("OK"); ok.setPrimaryStyleName(lightTheme ? Styles.Buttons.Flat.LIGHT : Styles.Buttons.Flat.DARK); ok.addClickListener(e -> close()); footer = new FlexLayout(cancel, ok); footer.setJustifyContent(FlexLayout.JustifyContent.FLEX_END); footer.addStyleName(Paddings.All.SMALL + " " + Spacings.Right.SMALL + " " + FlexItem.FlexShrink.SHRINK_0); footer.addStyleName(lightTheme ? Borders.Light.TOP : Borders.Dark.TOP); footer.setWidth(100, Sizeable.Unit.PERCENTAGE); // Content wrapper content = new FlexLayout(FlexLayout.FlexDirection.COLUMN, scrollableLayout, footer); content.addStyleName(MaxHeights.MH_FULL); setContent(content); }
public Step2() { super(true); // Use default actions VerticalLayout content = new VerticalLayout(); content.setWidth(100, Sizeable.Unit.PERCENTAGE); content.setSpacing(true); content.setMargin(true); Label stepAttributesTitle = new Label("Step Attributes"); stepAttributesTitle.addStyleName(ValoTheme.LABEL_H2); Label stepAttributesLabel = new Label("You can change various attributes on a single step:" + "<ul>" + "<li>caption</li>" + "<li>description</li>" + "<li>icon</li>" + "<li>optional (to be able to skip it)</li>" + "<li>editable (come back if skipped or next, show edit " + "icon)" + "</li>" + "</ul>", ContentMode.HTML); content.addComponent(stepAttributesTitle); content.addComponent(stepAttributesLabel); content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE)); setCaption("Step 2"); setDescription("Step Attributes"); setContent(content); setIcon(VaadinIcons.BAR_CHART); setOptional(true); setEditable(true); }
public Step3() { VerticalLayout content = new VerticalLayout(); content.setWidth(100, Sizeable.Unit.PERCENTAGE); content.setSpacing(true); content.setMargin(true); Label feedbackTitle = new Label("Step Feedback"); feedbackTitle.addStyleName(ValoTheme.LABEL_H2); Label stepFeedbackLabel = new Label("The stepper provides the possibility to show a " + "feedback message for long running operations.<br>Just " + "click next to see an example.", ContentMode.HTML); content.addComponent(feedbackTitle); content.addComponent(stepFeedbackLabel); content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE)); addStepBackListener(StepperActions::back); addStepNextListener(event -> { Stepper stepper = event.getSource(); stepper.showFeedbackMessage("Long loading operation is being performed"); UI currentUi = UI.getCurrent(); new Timer().schedule(new TimerTask() { @Override public void run() { currentUi.access(() -> { stepper.hideFeedbackMessage(); stepper.next(); }); } }, 2000); }); setCaption("Step 3"); setDescription("Long running Operations"); setContent(content); }
public Step4() { VerticalLayout content = new VerticalLayout(); content.setWidth(100, Sizeable.Unit.PERCENTAGE); content.setSpacing(true); content.setMargin(true); Label errorTitle = new Label("Step Validation"); errorTitle.addStyleName(ValoTheme.LABEL_H2); Label errorLabel = new Label("You can validate the contents of your step and show an " + "error message.<br>Try it out using the text field below " + "(it should not be empty).", ContentMode.HTML); TextField textField = new TextField("Please enter a value"); content.addComponent(errorTitle); content.addComponent(errorLabel); content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE)); content.addComponent(textField); addStepBackListener(StepperActions::back); addStepNextListener(event -> { Stepper stepper = event.getSource(); stepper.hideError(); String value = textField.getValue(); if (StringUtils.isBlank(value)) { stepper.showError(new RuntimeException("Field should not be empty")); } else { stepper.next(); } }); setCaption("Step 4"); setDescription("Step Validation"); setContent(content); }
public Step1() { super(true); // Use default actions VerticalLayout content = new VerticalLayout(); content.setWidth(100, Sizeable.Unit.PERCENTAGE); content.setSpacing(true); content.setMargin(true); Label basicInformationTitle = new Label("Basic Information"); basicInformationTitle.addStyleName(ValoTheme.LABEL_H2); Label basicInformationLabel = new Label("The stepper component can be used to iterate " + "through the single steps of a process. Depending on " + "whether the stepper is declared linear or not, " + "the provided steps have to be completed in order - " + "or not."); Label demoUsageTitle = new Label("Demo Usage"); demoUsageTitle.addStyleName(ValoTheme.LABEL_H3); Label demoUsageLabel = new Label("You can use the panel on the left side to change and " + "try out different attributes of the stepper.<br>" + "Additionally, the demo will show the various possibilities " + "to use the stepper and its steps when you progress through " + "the single steps.", ContentMode.HTML); content.addComponent(basicInformationTitle); content.addComponent(basicInformationLabel); content.addComponent(demoUsageTitle); content.addComponent(demoUsageLabel); content.iterator().forEachRemaining(c -> c.setWidth(100, Unit.PERCENTAGE)); setCaption("Step 1"); setDescription("Basic Stepper Features"); setContent(content); }
@Override public String getWidth() { if (composition != null && isWrapped()) { float width = composition.getWidth(); Sizeable.Unit widthUnit = composition.getWidthUnits(); return width + widthUnit.getSymbol(); } if (component != null) { return ComponentsHelper.getComponentWidth(component); } return targetWidth; }