public void cancel() { if (!readonly && isDirty()) { documentsForm.discard(); dirty = true; BeanItem<AttachedDocumentObject> beanItemAttachedDocumentObject = null; LoadFilteredFacade loadFilteredFacade = new LoadFilteredFacade(context); AttachedDocumentObject e = (AttachedDocumentObject) loadFilteredFacade.loadFilteredAttachedDocumentObjectById( (AttachedDocumentObject) this.beanItem.getBean()); if (e != null) beanItemAttachedDocumentObject = new BeanItem<AttachedDocumentObject>(e); beanItem = beanItemAttachedDocumentObject; } }
public AttachedDocumentsSubWindow( Window subWindow, BeanItem<AttachedDocumentObject> beanItem, boolean readonly, boolean isNewAttach, WebApplicationContext context) { this.context = context; this.subWindow = subWindow; this.beanItem = beanItem; this.readonly = readonly; setCaption(FactoryI18nManager.getI18nManager().getMessage(Messages.COMMON_ABM_TAB_DOCUMENTS)); setModal(true); setHeight("68%"); setWidth("40%"); center(); setStyleName("pagingButtonBar"); documentsForm = new AttachedDocumentsForm(); documentsForm.setFormFieldFactory(new AttachedDocumentsFormFieldFactory()); fileTable = new Table(); fileTable.setWidth("500"); fileTable.setHeight("180"); fileTable.setSelectable(true); fileTable.setImmediate(true); fileTable.addContainerProperty( FactoryI18nManager.getI18nManager() .getMessage(Messages.ATTACHED_DOCUMENT_OBJECT_FILE_TABLE_HEADER_NAME), String.class, null); fileTable.addContainerProperty( FactoryI18nManager.getI18nManager() .getMessage(Messages.ATTACHED_DOCUMENT_OBJECT_FILE_TABLE_HEADER_SIZE), String.class, null); fileTable.addListener((ValueChangeListener) this); footerTable = new HorizontalLayout(); footerTable.setVisible(true); setIconsAndDescriptionButton(); footerTable.addComponent(buttonNew); footerTable.addComponent(buttonDelete); footerTable.addComponent(buttonModify); footerTable.addComponent(buttonDownload); footerTable.addComponent(buttonLookUp); verticalLayout.setMargin(true); verticalLayout.addComponent(documentsForm); verticalLayout.addComponent(new Label("Archivos:")); verticalLayout.addComponent(fileTable); verticalLayout.addComponent(footerTable); horizontalLayout.addComponent(buttonAdd); horizontalLayout.setComponentAlignment(buttonAdd, Alignment.BOTTOM_CENTER); horizontalLayout.addComponent(buttonCancel); horizontalLayout.setComponentAlignment(buttonCancel, Alignment.BOTTOM_CENTER); verticalLayout.addComponent(horizontalLayout); verticalLayout.setComponentAlignment(horizontalLayout, Alignment.BOTTOM_CENTER); setContent(verticalLayout); initializeForm(); initializeTable(); setComponentsState(isNewAttach); setClosable(readonly); }
public void initializeForm() { documentsForm.setItemDataSource(beanItem); }
private void setComponentsState(boolean isNewAttach) { documentsForm.setReadOnly(readonly); setEnableButtonsBySelection(false); }