List of usage examples for com.vaadin.ui Button getParent
@Override
public HasComponents getParent()
From source file:at.peppol.webgui.app.components.TabInvoiceHeader.java
License:Mozilla Public License
private void initElements() { additionalDocRefList = parent.getInvoice().getAdditionalDocumentReference(); setWidth("100%"); setHeight("100%"); //final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); //outerLayout.setMargin(true); //outerLayout.setSpacing(true); //grid that contains "Details", "Contract", "Order" final GridLayout topGridLayout = new GridLayout(2, 2); //topGridLayout.setSizeFull(); topGridLayout.setMargin(true);/* w ww. j a v a2 s.c om*/ topGridLayout.setSpacing(true); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true); hiddenContent.setMargin(true); final Panel outerPanel = new Panel("Invoice Header"); //outerPanel.addComponent(grid); outerPanel.setScrollable(true); outerPanel.setContent(outerLayout); //outerLayout.addComponent(outerPanel); VerticalLayout tabLayout = new VerticalLayout(); tabLayout.addComponent(outerPanel); outerLayout.addComponent(topGridLayout); final Panel invoiceDetailsPanel = new Panel("Invoice Header Details"); invoiceDetailsPanel.setStyleName("light"); invoiceDetailsPanel.setWidth("50%"); //invoiceDetailsPanel.setSizeFull(); invoiceDetailsPanel.addComponent(createInvoiceTopForm()); topGridLayout.addComponent(invoiceDetailsPanel, 0, 0); final Panel orderReferencePanel = new Panel("Referencing Order"); orderReferencePanel.setStyleName("light"); orderReferencePanel.setWidth("50%"); //orderReferencePanel.setSizeFull(); orderReferencePanel.addComponent(createInvoiceOrderReferenceForm()); topGridLayout.addComponent(orderReferencePanel, 0, 1); final VerticalLayout tableVerticalLayout = new VerticalLayout(); //tableVerticalLayout.setSpacing (true); tableVerticalLayout.setMargin(true); outerLayout.addComponent(tableVerticalLayout); table = new InvoiceAdditionalDocRefTable(parent.getInvoice().getAdditionalDocumentReference()); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setSizeFull(); //table.setWidth("300px"); table.setFooterVisible(false); table.addStyleName("striped strong"); Panel tablePanel = new Panel("Relevant Documents"); tablePanel.setStyleName("light"); tablePanel.setWidth("60%"); tableVerticalLayout.addComponent(tablePanel); GridLayout h = new GridLayout(2, 2); h.setMargin(true); h.setSpacing(true); tablePanel.setContent(h); h.addComponent(table, 0, 0); h.setColumnExpandRatio(0, 3); h.setColumnExpandRatio(1, 1); h.setSizeFull(); Button addButton = new Button("Add new"); Button editButton = new Button("Edit selected"); Button deleteButton = new Button("Delete selected"); VerticalLayout buttonsContainer = new VerticalLayout(); buttonsContainer.setSpacing(true); buttonsContainer.addComponent(addButton); buttonsContainer.addComponent(editButton); buttonsContainer.addComponent(deleteButton); InvoiceAdditionalDocRefTableEditor editor = new InvoiceAdditionalDocRefTableEditor(editMode); Label label = new Label("<h3>Adding new relevant document</h3>", Label.CONTENT_XHTML); addButton.addListener(editor.addButtonListener(editButton, deleteButton, hiddenContent, table, additionalDocRefList, label)); label = new Label("<h3>Edit relevant document</h3>", Label.CONTENT_XHTML); editButton.addListener(editor.editButtonListener(addButton, deleteButton, hiddenContent, table, additionalDocRefList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); final Button addContractReferenceBtn = new Button("Add Contract Reference"); final Button removeContractReferenceBtn = new Button("Remove Contract Reference"); removeContractReferenceBtn.setVisible(false); addContractReferenceBtn.setStyleName("marginLeft"); removeContractReferenceBtn.setStyleName("marginLeft"); addContractReferenceBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Panel panel = createInvoiceContractReference(removeContractReferenceBtn); topGridLayout.removeComponent(1, 0); topGridLayout.addComponent(panel, 1, 0); removeContractReferenceBtn.setVisible(true); } }); removeContractReferenceBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { //remove the legal entity component panel Component c = removeContractReferenceBtn.getParent().getParent(); topGridLayout.removeComponent(c); if (parent.getInvoice().getContractDocumentReference().size() > 0) { //parent.getInvoice().getContractDocumentReference().remove(0); parent.getInvoice().getContractDocumentReference().clear(); ValidatorsList.removeListeners(Utils.getFieldListeners(contractReferenceForm)); } topGridLayout.addComponent(addContractReferenceBtn, 1, 0); } }); h.addComponent(buttonsContainer, 1, 0); topGridLayout.addComponent(addContractReferenceBtn, 1, 0); if (parent.getInvoice().getContractDocumentReference().size() > 0) addContractReferenceBtn.click(); // ---- HIDDEN FORM BEGINS ----- VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); h.addComponent(formLayout, 0, 1); // ---- HIDDEN FORM ENDS ----- setLayout(tabLayout); }
From source file:com.esofthead.mycollab.vaadin.ui.ConfirmDialogFactory.java
License:Open Source License
@Override public ConfirmDialog create(final String caption, final String message, final String okCaption, final String cancelCaption, String notOkCaption) { final ConfirmDialog d = super.create(caption, message, okCaption, cancelCaption, notOkCaption); d.getContent().setStyleName("custom-dialog"); d.getContent().setHeightUndefined(); d.setHeightUndefined();/*from w ww. j a v a 2 s. c om*/ final Button ok = d.getOkButton(); ok.setStyleName(UIConstants.THEME_GREEN_LINK); HorizontalLayout buttons = (HorizontalLayout) ok.getParent(); buttons.setHeightUndefined(); final Button cancelBtn = d.getCancelButton(); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); cancelBtn.focus(); return d; }
From source file:com.esofthead.mycollab.vaadin.web.ui.ConfirmDialogFactory.java
License:Open Source License
@Override public ConfirmDialog create(String caption, String message, String okCaption, String cancelCaption, String notOkCaption) {//from w w w.j a va2 s . c om ConfirmDialog d = super.create(caption, message, okCaption, cancelCaption, notOkCaption); d.getContent().setStyleName("custom-dialog"); d.getContent().setHeightUndefined(); d.setHeightUndefined(); Button ok = d.getOkButton(); ok.setStyleName(UIConstants.BUTTON_ACTION); HorizontalLayout buttons = (HorizontalLayout) ok.getParent(); buttons.setHeightUndefined(); Button cancelBtn = d.getCancelButton(); cancelBtn.setStyleName(UIConstants.BUTTON_OPTION); cancelBtn.focus(); return d; }
From source file:com.skysql.manager.ui.MonitorsLayout.java
License:Open Source License
/** * Adds a new monitor row./* ww w. j av a 2 s . com*/ * * @param monitorID the monitor id * @return the component */ private Component addRow(String monitorID) { HorizontalLayout row = new HorizontalLayout(); ComboBox selectMonitor = new ComboBox(); for (MonitorRecord availMonitor : availableMonitors.values()) { selectMonitor.addItem(availMonitor.getID()); selectMonitor.setItemCaption(availMonitor.getID(), availMonitor.getName()); } row.addComponent(selectMonitor); selectMonitorList.add(selectMonitor); selectMonitor.setValue(monitorID); selectMonitor.setNullSelectionAllowed(false); selectMonitor.setImmediate(true); selectMonitor.addValueChangeListener(monitorSelectListener); if (getComponentCount() > componentIndex) { Button deleteButton = new Button("X"); row.addComponent(deleteButton); deleteButton.setData(selectMonitor); deleteButton.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 0x4C656F6E6172646FL; public void buttonClick(ClickEvent event) { // remove combobox from list Button button = event.getButton(); ComboBox select = (ComboBox) button.getData(); selectMonitorList.remove(select); // remove layout from dialog int layoutIndex = getComponentIndex(button.getParent()); HorizontalLayout layout = (HorizontalLayout) getComponent(layoutIndex); removeComponent(layout); refreshMonitors(); } }); } focus(); return (row); }
From source file:org.eclipse.hawkbit.ui.common.table.AbstractTable.java
License:Open Source License
private static Table getTable(final ClickEvent event) { final Button source = (Button) event.getSource(); return (Table) source.getParent(); }