com.vaadin.ui.AbstractComponent Java Examples
The following examples show how to use
com.vaadin.ui.AbstractComponent.
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: AbstractEditItemComp.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public AbstractComponent getLayout() { final AddViewLayout formAddLayout = new AddViewLayout(initFormHeader(), initFormIconResource()); final ComponentContainer buttonControls = createButtonControls(); if (buttonControls != null) { formAddLayout.addHeaderRight(buttonControls); } formAddLayout.setTitle(initFormTitle()); wrappedLayoutFactory = initFormLayoutFactory(); formAddLayout.addBody(wrappedLayoutFactory.getLayout()); ComponentContainer bottomPanel = createBottomPanel(); if (bottomPanel != null) { formAddLayout.addBottom(bottomPanel); } return formAddLayout; }
Example #2
Source File: InvalidValueExceptionHandler.java From cuba with Apache License 2.0 | 6 votes |
@Override public boolean handle(ErrorEvent event, App app) { boolean handled = super.handle(event, app); if (handled && event.getThrowable() != null) { // Finds the original source of the error/exception AbstractComponent component = DefaultErrorHandler.findAbstractComponent(event); if (component != null) { component.markAsDirty(); } if (component instanceof Component.Focusable) { ((Component.Focusable) component).focus(); } } return handled; }
Example #3
Source File: WebLayoutAnalyzerContextMenuProvider.java From cuba with Apache License 2.0 | 6 votes |
@Override public void initContextMenu(Window window, Component contextMenuTarget) { ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); if (clientConfig.getLayoutAnalyzerEnabled()) { ContextMenu contextMenu = new ContextMenu(contextMenuTarget.unwrap(AbstractComponent.class), true); MenuItem menuItem = contextMenu.addItem(messages.getMainMessage("actions.analyzeLayout"), c -> { LayoutAnalyzer analyzer = new LayoutAnalyzer(); List<LayoutTip> tipsList = analyzer.analyze(window); if (tipsList.isEmpty()) { window.showNotification("No layout problems found", NotificationType.HUMANIZED); } else { window.openWindow("layoutAnalyzer", OpenType.DIALOG, ParamsMap.of("tipsList", tipsList) ); } }); menuItem.setStyleName("c-cm-item"); } }
Example #4
Source File: AttributesLocationCompanion.java From cuba with Apache License 2.0 | 6 votes |
protected void removeFromSourceGrid(Grid currentSourceGrid, boolean isAttributesSourceGrid, AbstractComponent dropComponent, int dropIndex) { if (!droppedSuccessful || draggedItem == null) { return; } //noinspection unchecked List<CategoryAttribute> items = (List<CategoryAttribute>) ((ListDataProvider) currentSourceGrid.getDataProvider()).getItems(); if (currentSourceGrid.equals(dropComponent) && dropIndex >= 0) { int removeIndex = items.indexOf(draggedItem) == dropIndex ? items.lastIndexOf(draggedItem) : items.indexOf(draggedItem); if (removeIndex >= 0 && removeIndex != dropIndex) { items.remove(removeIndex); } } else { items.remove(draggedItem); } if (isAttributesSourceGrid && AttributesLocationFrame.EMPTY_ATTRIBUTE_NAME.equals(draggedItem.getName())) { attributesSourceDataContainer.add(createEmptyAttribute()); } currentSourceGrid.getDataProvider().refreshAll(); }
Example #5
Source File: TicketComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public AbstractComponent createStartDatePopupField(ProjectTicket assignment) { if (assignment.getStartDate() == null) { Div divHint = new Div().setCSSClass("nonValue"); divHint.appendText(VaadinIcons.TIME_FORWARD.getHtml()); divHint.appendChild(new Span().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)).setCSSClass("hide")); return new MetaFieldBuilder().withCaption(divHint.write()) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE))).build(); } else { return new MetaFieldBuilder().withCaption(String.format(" %s %s", VaadinIcons.TIME_FORWARD.getHtml(), UserUIContext.formatDate(assignment.getStartDate()))) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE))).build(); } }
Example #6
Source File: ContextMenu.java From cuba with Apache License 2.0 | 6 votes |
/** * @param parentComponent * The component to whose lifecycle the context menu is tied to. * @param setAsMenuForParentComponent * Determines if this menu will be shown for the parent * component. */ public ContextMenu(AbstractComponent parentComponent, boolean setAsMenuForParentComponent) { extend(parentComponent); registerRpc(new ContextMenuServerRpc() { @Override public void itemClicked(int itemId) { MenuItem clickedItem = itemById.get(itemId); if (clickedItem != null) { if (clickedItem.isCheckable()) clickedItem.setChecked(!clickedItem.isChecked()); if (clickedItem.getCommand() != null) clickedItem.getCommand().menuSelected(clickedItem); } } }); if (setAsMenuForParentComponent) { setAsContextMenuOf(parentComponent); } }
Example #7
Source File: DefaultFieldInitializer.java From vaadinator with Apache License 2.0 | 6 votes |
@Override public void initializeField(Component component, Component view) { if (view instanceof EagerValidatableView) { EagerValidatableView eagerValidatableView = (EagerValidatableView) view; if (component instanceof Field<?>) { ((AbstractComponent) component).setImmediate(true); ((Field<?>) component).addValueChangeListener(eagerValidatableView); if (component instanceof EagerValidateable) { ((EagerValidateable) component).setEagerValidation(true); } if (component instanceof TextChangeNotifier) { final TextChangeNotifier abstractTextField = (TextChangeNotifier) component; abstractTextField.addTextChangeListener(eagerValidatableView); } } } }
Example #8
Source File: TaskComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public AbstractComponent createEndDatePopupField(SimpleTask task) { if (task.getEnddate() == null) { Div divHint = new Div().setCSSClass("nonValue"); divHint.appendText(VaadinIcons.TIME_BACKWARD.getHtml()); divHint.appendChild(new Span().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)).setCSSClass("hide")); return new MetaFieldBuilder().withCaption(divHint.write()) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_END_DATE))).build(); } else { return new MetaFieldBuilder().withCaption(String.format(" %s %s", VaadinIcons.TIME_BACKWARD.getHtml(), UserUIContext.formatDate(task.getEnddate()))) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_END_DATE))).build(); } }
Example #9
Source File: MilestoneComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public AbstractComponent createStartDatePopupField(SimpleMilestone milestone) { if (milestone.getStartdate() == null) { Div divHint = new Div().setCSSClass("nonValue"); divHint.appendText(VaadinIcons.TIME_FORWARD.getHtml()); divHint.appendChild(new Span().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)).setCSSClass("hide")); return new MetaFieldBuilder().withCaption(divHint.write()) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE))).build(); } else { return new MetaFieldBuilder().withCaption(String.format(" %s %s", VaadinIcons.TIME_FORWARD.getHtml(), UserUIContext.formatDate(milestone.getStartdate()))) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE))).build(); } }
Example #10
Source File: TicketComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public AbstractComponent createDueDatePopupField(ProjectTicket assignment) { if (assignment.getDueDatePlusOne() == null) { Div divHint = new Div().setCSSClass("nonValue"); divHint.appendText(VaadinIcons.CLOCK.getHtml()); divHint.appendChild(new Span().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)).setCSSClass("hide")); return new MetaFieldBuilder().withCaption(divHint.write()) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE))).build(); } else { return new MetaFieldBuilder().withCaption(String.format(" %s %s", VaadinIcons.CLOCK.getHtml(), UserUIContext.formatPrettyTime(assignment.getDueDatePlusOne()))) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE))).build(); } }
Example #11
Source File: TaskComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
@Override public AbstractComponent createDeadlinePopupField(SimpleTask task) { if (task.getDeadlineRoundPlusOne() == null) { Div divHint = new Div().setCSSClass("nonValue"); divHint.appendText(VaadinIcons.CLOCK.getHtml()); divHint.appendChild(new Span().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)).setCSSClass("hide")); return new MetaFieldBuilder().withCaption(divHint.write()) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE))).build(); } else { return new MetaFieldBuilder().withCaption(String.format(" %s %s", VaadinIcons.CLOCK.getHtml(), UserUIContext.formatPrettyTime(task.getDeadlineRoundPlusOne()))) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE))).build(); } }
Example #12
Source File: WebAbstractComponent.java From cuba with Apache License 2.0 | 5 votes |
@Override public void setContextHelpTextHtmlEnabled(boolean enabled) { if (isContextHelpTextHtmlEnabled() != enabled) { ((AbstractComponent) getComposition()).setContextHelpTextHtmlEnabled(enabled); setContextHelpText(getContextHelpText()); } }
Example #13
Source File: ProjectMemberFormLayoutFactory.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public AbstractComponent getLayout() { final FormContainer layout = new FormContainer(); informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN); layout.addSection(UserUIContext.getMessage(ProjectMemberI18nEnum.FORM_INFORMATION_SECTION), informationLayout.getLayout()); return layout; }
Example #14
Source File: EditableColumnFieldWrapper.java From cuba with Apache License 2.0 | 5 votes |
public EditableColumnFieldWrapper(Component component, com.haulmont.cuba.gui.components.Component columnComponent) { this.component = component; if (component.getWidth() < 0) { // do not trigger overridden method super.setWidth(-1, Unit.PIXELS); } if (columnComponent instanceof Field) { AbstractComponent vComponent = columnComponent.unwrap(AbstractComponent.class); if (vComponent instanceof Focusable) { setFocusDelegate((Focusable) vComponent); } } }
Example #15
Source File: TicketRelationWindow.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public AbstractComponent getLayout() { MVerticalLayout layout = new MVerticalLayout(); informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN); layout.addComponent(informationLayout.getLayout()); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> { ProjectTicket relatedTicket = ticketRelationSelectField.getSelectedTicket(); ticketRelation.setType(relatedTicket.getType()); ticketRelation.setTypeid(relatedTicket.getTypeId()); if (editForm.validateForm()) { TicketRelationService relatedBugService = AppContextUtil.getSpringBean(TicketRelationService.class); ProjectTicket relationTicket = ticketRelationSelectField.getSelectedTicket(); if (relationTicket == null) { throw new UserInvalidInputException("The related ticket must be not null"); } if (relationTicket.getTypeId().equals(hostedTicket.getTypeId()) && relationTicket.getType().equals(hostedTicket.getType())) { throw new UserInvalidInputException("The relation is invalid since the both entries are the same"); } ticketRelation.setTypeid(relationTicket.getTypeId()); ticketRelation.setType(relationTicket.getType()); relatedBugService.saveWithSession(ticketRelation, UserUIContext.getUsername()); close(); EventBusFactory.getInstance().post(new TicketEvent.DependencyChange(this, hostedTicket.getType(), hostedTicket.getTypeId())); } }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()) .withStyleName(WebThemes.BUTTON_OPTION); MHorizontalLayout controlsBtn = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(false); layout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT); return layout; }
Example #16
Source File: CubaTreeTable.java From cuba with Apache License 2.0 | 5 votes |
@Override public void showCustomPopup(Component popupComponent) { if (getState().customPopup != null) { ((AbstractComponent) getState().customPopup).setParent(null); } getState().customPopup = popupComponent; getRpcProxy(CubaTableClientRpc.class).showCustomPopup(); popupComponent.setParent(this); }
Example #17
Source File: CubaTable.java From cuba with Apache License 2.0 | 5 votes |
@Override public void showCustomPopup(Component popupComponent) { if (getState().customPopup != null) { ((AbstractComponent) getState().customPopup).setParent(null); } getState().customPopup = popupComponent; getRpcProxy(CubaTableClientRpc.class).showCustomPopup(); popupComponent.setParent(this); }
Example #18
Source File: WebWindow.java From cuba with Apache License 2.0 | 5 votes |
@Override public boolean isResponsive() { com.vaadin.ui.ComponentContainer container = getContainer(); return container instanceof AbstractComponent && ((AbstractComponent) container).isResponsive(); }
Example #19
Source File: BugComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public AbstractComponent createEndDatePopupField(SimpleBug bug) { if (bug.getEnddate() == null) { Div divHint = new Div().setCSSClass("nonValue"); divHint.appendText(VaadinIcons.TIME_BACKWARD.getHtml()); divHint.appendChild(new Span().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)).setCSSClass("hide")); return new MetaFieldBuilder().withCaption(divHint.write()).withDescription(UserUIContext.getMessage (GenericI18Enum.FORM_END_DATE)).build(); } else { return new MetaFieldBuilder().withCaption(String.format("%s %s", VaadinIcons.TIME_BACKWARD.getHtml(), UserUIContext.formatPrettyTime(bug.getEnddate()))).withDescription(UserUIContext.getMessage (GenericI18Enum.FORM_END_DATE)).build(); } }
Example #20
Source File: BugComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public AbstractComponent createStartDatePopupField(SimpleBug bug) { if (bug.getStartdate() == null) { Div divHint = new Div().setCSSClass("nonValue"); divHint.appendText(VaadinIcons.TIME_FORWARD.getHtml()); divHint.appendChild(new Span().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)).setCSSClass("hide")); return new MetaFieldBuilder().withCaption(divHint.write()).withDescription(UserUIContext.getMessage (GenericI18Enum.FORM_START_DATE)).build(); } else { return new MetaFieldBuilder().withCaption(String.format("%s %s", VaadinIcons.TIME_FORWARD.getHtml(), UserUIContext.formatPrettyTime(bug.getStartdate()))).withDescription(UserUIContext.getMessage (GenericI18Enum.FORM_START_DATE)).build(); } }
Example #21
Source File: ElementIntegration.java From serverside-elements with Apache License 2.0 | 5 votes |
public static Root getRoot(AbstractComponent target) { Optional<Extension> existing = target.getExtensions().stream() .filter(e -> e.getClass() == ElementIntegration.class) .findFirst(); ElementIntegration integration = existing.isPresent() ? (ElementIntegration) existing .get() : new ElementIntegration(target); return integration.root; }
Example #22
Source File: BugComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public AbstractComponent createDeadlinePopupField(SimpleBug bug) { if (bug.getDueDateRoundPlusOne() == null) { Div divHint = new Div().setCSSClass("nonValue"); divHint.appendText(VaadinIcons.CLOCK.getHtml()); divHint.appendChild(new Span().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)).setCSSClass("hide")); return new MetaFieldBuilder().withCaption(divHint.write()).withDescription(UserUIContext.getMessage (GenericI18Enum.FORM_DUE_DATE)).build(); } else { return new MetaFieldBuilder().withCaption(String.format("%s %s", VaadinIcons.CLOCK.getHtml(), UserUIContext.formatPrettyTime(bug.getDueDateRoundPlusOne()))).withDescription(UserUIContext.getMessage (GenericI18Enum.FORM_DUE_DATE)).build(); } }
Example #23
Source File: BugComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public AbstractComponent createMilestonePopupField(SimpleBug bug) { if (bug.getMilestoneid() == null) { Div divHint = new Div().setCSSClass("nonValue"); divHint.appendText(ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE).getHtml()); divHint.appendChild(new Span().appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)).setCSSClass("hide")); return new MetaFieldBuilder().withCaption(divHint.write()).withDescription(UserUIContext.getMessage (MilestoneI18nEnum.SINGLE)).build(); } else { return new MetaFieldBuilder().withCaptionAndIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE), bug.getMilestoneName()).withDescription(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE)).build(); } }
Example #24
Source File: BugComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public AbstractComponent createCommentsPopupField(SimpleBug bug) { if (bug.getNumComments() != null) { return new MetaFieldBuilder().withCaptionAndIcon(VaadinIcons.COMMENT_O, "" + bug.getNumComments()) .withDescription(UserUIContext.getMessage(GenericI18Enum.OPT_COMMENTS)).build(); } else { return new MetaFieldBuilder().withCaptionAndIcon(VaadinIcons.COMMENT_O, " 0") .withDescription(UserUIContext.getMessage(GenericI18Enum.OPT_COMMENTS)).build(); } }
Example #25
Source File: BugComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public AbstractComponent createAssigneePopupField(SimpleBug bug) { String avatarLink = StorageUtils.getAvatarPath(bug.getAssignUserAvatarId(), 16); Img img = new Img(bug.getAssignuserFullName(), avatarLink).setTitle(bug.getAssignuserFullName()) .setCSSClass(WebThemes.CIRCLE_BOX); return new MetaFieldBuilder().withCaption(img.write()) .withDescription(UserUIContext.getMessage(GenericI18Enum.FORM_ASSIGNEE)).build(); }
Example #26
Source File: SpringSecurityErrorHandler.java From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 | 5 votes |
/** * Returns the AbstractComponent associated with the given error if such can * be found * * @param event * The error to investigate * @return The {@link AbstractComponent} to error relates to or null if * could not be determined or if the error does not relate to any * AbstractComponent. */ public static AbstractComponent findAbstractComponent( com.vaadin.server.ErrorEvent event) { if (event instanceof ConnectorErrorEvent) { Component c = findComponent(((ConnectorErrorEvent) event) .getConnector()); if (c instanceof AbstractComponent) { return (AbstractComponent) c; } } return null; }
Example #27
Source File: TicketComponentFactoryImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override public AbstractComponent createPriorityPopupField(ProjectTicket ticket) { return new MetaFieldBuilder().withCaption(ProjectAssetsManager.getPriorityHtml(ticket.getPriority()) + " " + UserUIContext.getMessage(Priority.class, ticket.getPriority())) .withDescription(UserUIContext.getMessage(ShellI18nEnum.OPT_UPGRADE_PRO_INTRO, UserUIContext.getMessage(GenericI18Enum.FORM_PRIORITY))).build(); }
Example #28
Source File: WebWindow.java From cuba with Apache License 2.0 | 5 votes |
@Override public void setResponsive(boolean responsive) { com.vaadin.ui.ComponentContainer container = getContainer(); if (container instanceof AbstractComponent) { ((AbstractComponent) container).setResponsive(responsive); } }
Example #29
Source File: AbstractForm.java From viritin with Apache License 2.0 | 5 votes |
public AbstractForm<T> removeValidator( MBeanFieldGroup.MValidator<T> validator) { Collection<AbstractComponent> remove = mValidators.remove(validator); if (remove != null) { if (getFieldGroup() != null) { getFieldGroup().removeValidator(validator); } } return this; }
Example #30
Source File: MBeanFieldGroup.java From viritin with Apache License 2.0 | 5 votes |
private void clearMValidationErrors() { for (AbstractComponent value : mValidationErrors.values()) { if (value != null) { value.setComponentError(null); } } mValidationErrors.clear(); for (AbstractComponent ac : validatorToErrorTarget.values()) { ac.setComponentError(null); } }