List of usage examples for com.vaadin.ui Panel setStyleName
@Override public void setStyleName(String style)
From source file:at.peppol.webgui.app.components.InvoiceForm.java
License:Mozilla Public License
private void initElements() { final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); final Panel outerPanel = new Panel("Invoice Header"); outerPanel.addComponent(grid);// w w w . ja va2 s.co m outerPanel.setScrollable(true); outerLayout.addComponent(outerPanel); setLayout(outerLayout); final Panel invoiceDetailsPanel = new Panel("Invoice Details"); invoiceDetailsPanel.setStyleName("light"); invoiceDetailsPanel.setSizeFull(); invoiceDetailsPanel.addComponent(createInvoiceTopForm()); grid.addComponent(invoiceDetailsPanel, 0, 0, 3, 0); grid.setSizeUndefined(); outerPanel.requestRepaintAll(); }
From source file:at.peppol.webgui.app.components.PartyDetailForm.java
License:Mozilla Public License
private Panel createLegalEntityPanel(Button removeButton) { Panel legalEntityPanel = new Panel("Legal Entity"); legalEntityPanel.setStyleName("light"); legalEntityPanel.setSizeFull();/*from w w w .j a va 2 s .c o m*/ PropertysetItem legalEntityItemSet = new PropertysetItem(); PartyLegalEntityType legalEntity; if (partyBean.getPartyLegalEntity().size() == 0) { legalEntity = new PartyLegalEntityType(); legalEntity.setRegistrationName(new RegistrationNameType()); legalEntity.setCompanyID(new CompanyIDType()); legalEntity.setRegistrationAddress(new AddressType()); legalEntity.getRegistrationAddress().setCityName(new CityNameType()); legalEntity.getRegistrationAddress().setCountrySubentity(new CountrySubentityType()); legalEntity.getRegistrationAddress().setCountry(new CountryType()); legalEntity.getRegistrationAddress().getCountry().setIdentificationCode(new IdentificationCodeType()); } else { legalEntity = partyBean.getPartyLegalEntity().get(0); } //make fields legalEntityItemSet.addItemProperty("Registration Name", new NestedMethodProperty(legalEntity, "registrationName.value")); legalEntityItemSet.addItemProperty("Company ID", new NestedMethodProperty(legalEntity, "companyID.value")); legalEntityItemSet.addItemProperty("City Name", new NestedMethodProperty(legalEntity.getRegistrationAddress(), "cityName.value")); legalEntityItemSet.addItemProperty("Country Subentity", new NestedMethodProperty(legalEntity.getRegistrationAddress(), "countrySubentity.value")); legalEntityItemSet.addItemProperty("Country ID", new NestedMethodProperty(legalEntity.getRegistrationAddress(), "country.identificationCode.value")); legalEntityForm = new Form(); legalEntityForm.setFormFieldFactory(new PartyFieldFactory()); legalEntityForm.setItemDataSource(legalEntityItemSet); legalEntityForm.setImmediate(true); legalEntityPanel.addComponent(legalEntityForm); legalEntityPanel.addComponent(removeButton); //add the legal entity partyBean.getPartyLegalEntity().add(legalEntity); return legalEntityPanel; }
From source file:at.peppol.webgui.app.components.TabInvoiceDelivery.java
License:Mozilla Public License
private void initElements() { deliveryList = parent.getInvoice().getDelivery(); if (deliveryList.size() == 0) { deliveryItem = createDeliveryItem(); deliveryList.add(deliveryItem);//from www . j av a 2 s . c o m } else { deliveryItem = deliveryList.get(0); deliveryAddress = deliveryItem.getDeliveryLocation().getAddress(); prepareForms(); } final GridLayout grid = new GridLayout(2, 2); final VerticalLayout outerLayout = new VerticalLayout(); final Panel outerPanel = new Panel("Delivery"); outerPanel.addComponent(grid); outerPanel.setScrollable(true); outerLayout.addComponent(outerPanel); final Panel invoiceDetailsPanel = new Panel("Delivery Details"); invoiceDetailsPanel.setStyleName("light"); invoiceDetailsPanel.setSizeFull(); invoiceDetailsPanel.addComponent(createInvoiceDeliveryTopForm()); invoiceDetailsPanel.addComponent(deliveryAddressForm); grid.addComponent(invoiceDetailsPanel, 0, 0); grid.setSizeUndefined(); setLayout(outerLayout); outerPanel.requestRepaintAll(); }
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);/*from w w w .j ava 2 s .c o m*/ 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:at.peppol.webgui.app.components.TabInvoiceHeader.java
License:Mozilla Public License
public Panel createInvoiceContractReference(Button removeButton) { Panel contractReferencePanel = new Panel("Contract Reference"); contractReferencePanel.setStyleName("light"); //contractReferencePanel.setSizeFull(); PropertysetItem contractReferenceItemSet = new PropertysetItem(); DocumentReferenceType dr = new DocumentReferenceType(); dr.setID(new IDType()); dr.setDocumentType(new DocumentTypeType()); //add the contract document reference parent.getInvoice().getContractDocumentReference().add(dr); contractReferenceItemSet.addItemProperty("Contract document reference ID", new NestedMethodProperty( parent.getInvoice().getContractDocumentReference().get(0).getID(), "value")); contractReferenceItemSet.addItemProperty("Contract document reference type", new NestedMethodProperty( parent.getInvoice().getContractDocumentReference().get(0).getDocumentType(), "value")); contractReferenceForm = new Form(); contractReferenceForm.setFormFieldFactory(new InvoiceFieldFactory()); contractReferenceForm.setItemDataSource(contractReferenceItemSet); contractReferenceForm.setImmediate(true); contractReferencePanel.addComponent(contractReferenceForm); contractReferencePanel.addComponent(removeButton); return contractReferencePanel; }
From source file:at.peppol.webgui.app.components.TabInvoiceMonetaryTotal.java
License:Mozilla Public License
private void initElements() { // monetaryTotal = parent.getInvoice().getLegalMonetaryTotal (); monetaryTotal = createMonetaryTotal(); parent.getInvoice().setLegalMonetaryTotal(monetaryTotal); final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); final Panel outerPanel = new Panel("Monetary Total"); outerPanel.addComponent(grid);//w w w. j av a2 s . co m outerPanel.setScrollable(true); outerLayout.addComponent(outerPanel); final Panel invoiceDetailsPanel = new Panel("Monetary Total Details"); invoiceDetailsPanel.setStyleName("light"); invoiceDetailsPanel.setSizeFull(); invoiceMonetaryTotalTopForm = createInvoiceMonetaryTotalTopForm(); invoiceDetailsPanel.addComponent(invoiceMonetaryTotalTopForm); //invoiceDetailsPanel.addComponent (createInvoiceMonetaryTotalTopForm ()); grid.addComponent(invoiceDetailsPanel, 0, 0, 3, 0); grid.setSizeUndefined(); //Add the Total Line Extension Amount Listener setLayout(outerLayout); outerPanel.requestRepaintAll(); }
From source file:at.peppol.webgui.app.components.TabInvoicePayment.java
License:Mozilla Public License
@SuppressWarnings("serial") private void initElements() { editMode = false;//from w w w . java 2 s . c om paymentMeansList = parent.getInvoice().getPaymentMeans(); //paymentMeansItem = createPaymentMeansItem(); //paymentMeansList.add (paymentMeansItem); //paymentTermsList = parent.getInvoice().getPaymentTerms (); //PaymentTermsType pt = new PaymentTermsType(); //paymentTermsList.add (pt); if (parent.getInvoice().getPaymentTerms().size() == 0) { paymentTermsItem = new PaymentTermsType(); paymentTermsItem.getNote().add(new NoteType()); parent.getInvoice().getPaymentTerms().add(paymentTermsItem); } else { paymentTermsItem = parent.getInvoice().getPaymentTerms().get(0); } //payeeParty = parent.getInvoice().getPayeeParty (); if (parent.getInvoice().getPayeeParty() == null) { payeeParty = createPayeePartyItem(); parent.getInvoice().setPayeeParty(payeeParty); } else { payeeParty = parent.getInvoice().getPayeeParty(); } //payeeParty = new PartyType(); //payeeParty.setParty(new PartyType()); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true); hiddenContent.setMargin(true); final GridLayout grid = new GridLayout(2, 2); grid.setSpacing(true); //grid.setMargin(true); final VerticalLayout outerLayout = new VerticalLayout(); final Panel outerPanel = new Panel("Payment"); outerPanel.addComponent(grid); outerPanel.setScrollable(true); outerLayout.addComponent(outerPanel); final Panel invoiceDetailsPanel = new Panel("Payment Details"); invoiceDetailsPanel.setStyleName("light"); invoiceDetailsPanel.setSizeFull(); //invoiceDetailsPanel.addComponent(createInvoicePaymentTopForm()); //grid.addComponent(invoiceDetailsPanel, 0, 0); final Panel payeePartyPanel = new Panel("Payee Details"); payeePartyPanel.setStyleName("light"); payeePartyPanel.setSizeFull(); payeePartyPanel.addComponent(createInvoicePayeePartyForm()); //payeeForm = new PartyDetailForm("Payee", payeeParty); //payeePartyPanel.addComponent(payeeForm); grid.addComponent(payeePartyPanel, 0, 0); final Panel paymentTermsPanel = new Panel("Payment Terms"); paymentTermsPanel.setStyleName("light"); paymentTermsPanel.setSizeFull(); paymentTermsPanel.addComponent(createInvoicePaymentTermsForm()); grid.addComponent(paymentTermsPanel, 1, 0); final Panel paymentMeansPanel = new Panel("Payment Means"); VerticalLayout paymentMeansLayout = new VerticalLayout(); paymentMeansPanel.setContent(paymentMeansLayout); paymentMeansPanel.setStyleName("light"); paymentMeansPanel.setSizeFull(); paymentMeansLayout.setSpacing(true); paymentMeansLayout.setMargin(true); table = new PaymentMeansTable(paymentMeansList); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(200, UNITS_PIXELS); table.setSizeFull(); table.setWidth("80%"); table.setFooterVisible(false); table.addStyleName("striped strong"); HorizontalLayout tableLayout = new HorizontalLayout(); paymentMeansLayout.addComponent(tableLayout); paymentMeansLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); VerticalLayout tableButtonsLayout = new VerticalLayout(); tableButtonsLayout.setSpacing(true); tableButtonsLayout.setMargin(true); final Button addButton = new Button("Add new"); final Button editButton = new Button("Edit selected"); final Button deleteButton = new Button("Delete selected"); tableButtonsLayout.addComponent(addButton); tableButtonsLayout.addComponent(editButton); tableButtonsLayout.addComponent(deleteButton); tableLayout.addComponent(table); tableLayout.addComponent(tableButtonsLayout); outerPanel.addComponent(paymentMeansPanel); grid.setSizeUndefined(); PaymentMeansTableEditor editor = new PaymentMeansTableEditor(editMode, parent.getInvoice()); Label label = new Label("<h3>Adding new payments means</h3>", Label.CONTENT_XHTML); addButton.addListener( editor.addButtonListener(editButton, deleteButton, hiddenContent, table, paymentMeansList, label)); label = new Label("<h3>Edit payment means line</h3>", Label.CONTENT_XHTML); editButton.addListener( editor.editButtonListener(addButton, deleteButton, hiddenContent, table, paymentMeansList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); setLayout(outerLayout); outerPanel.requestRepaintAll(); }
From source file:at.peppol.webgui.app.components.TabInvoiceTaxTotal.java
License:Mozilla Public License
@SuppressWarnings("serial") private void initElements() { taxTotalList = parent.getInvoice().getTaxTotal(); if (taxTotalList.size() == 0) { taxTotalItem = createTaxTotalItem(); taxTotalList.add(taxTotalItem);// w ww . j a va 2s .com } else { taxTotalItem = taxTotalList.get(0); } //taxSubtotalList = parent.getInvoice ().getTaxTotal ().get (0).getTaxSubtotal (); taxSubtotalList = taxTotalItem.getTaxSubtotal(); final GridLayout grid = new GridLayout(4, 4); final VerticalLayout outerLayout = new VerticalLayout(); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true); hiddenContent.setMargin(true); final Panel outerPanel = new Panel("Tax Total"); outerPanel.addComponent(grid); outerPanel.setScrollable(true); outerLayout.addComponent(outerPanel); table = new InvoiceTaxSubtotalTable(taxTotalList.get(0).getTaxSubtotal()); table.setSelectable(true); table.setImmediate(true); table.setNullSelectionAllowed(false); table.setHeight(150, UNITS_PIXELS); table.setFooterVisible(true); table.addStyleName("striped strong"); final VerticalLayout tableContainer = new VerticalLayout(); tableContainer.addComponent(table); tableContainer.setMargin(false, true, false, false); Button addButton = new Button("Add new"); Button editButton = new Button("Edit selected"); Button deleteButton = new Button("Delete selected"); final VerticalLayout buttonsContainer = new VerticalLayout(); buttonsContainer.setSpacing(true); buttonsContainer.addComponent(addButton); buttonsContainer.addComponent(editButton); buttonsContainer.addComponent(deleteButton); InvoiceTaxSubtotalTableEditor editor = new InvoiceTaxSubtotalTableEditor(editMode); Label label = new Label("<h3>Adding new tax subtotal</h3>", Label.CONTENT_XHTML); addButton.addListener( editor.addButtonListener(editButton, deleteButton, hiddenContent, table, taxSubtotalList, label)); label = new Label("<h3>Edit tax subtotal</h3>", Label.CONTENT_XHTML); editButton.addListener( editor.editButtonListener(addButton, deleteButton, hiddenContent, table, taxSubtotalList, label)); deleteButton.addListener(editor.deleteButtonListener(table)); /* // buttons Add, Edit, Delete final Button addBtn = new Button ("Add New", new Button.ClickListener () { @Override public void buttonClick (final Button.ClickEvent event) { addMode = true; hiddenContent.removeAllComponents (); taxSubtotalItem = createTaxSubtotalItem (); final Label formLabel = new Label ("<h3>Adding new tax subtotal line</h3>", Label.CONTENT_XHTML); hiddenContent.addComponent (formLabel); hiddenContent.addComponent (createInvoiceTaxSubtotalForm ()); // Save new line button final HorizontalLayout buttonLayout = new HorizontalLayout (); buttonLayout.setSpacing (true); buttonLayout.addComponent (new Button ("Save tax subtotal line", new Button.ClickListener () { @Override public void buttonClick (final ClickEvent event) { // update table (and consequently add new item to taxSubtotalList // list) table.addTaxSubtotalLine (taxSubtotalItem); // hide form hiddenContent.setVisible (false); addMode = false; // update Total Tax Amount taxTotalItem.getTaxAmount ().setValue (SumTaxSubtotalAmount ()); // update form as well // invoiceTaxTotalTopForm.getField("Tax Total Amount").setRequired(true); invoiceTaxTotalTopForm.getField ("Tax Total Amount").setValue (taxTotalItem.getTaxAmount ().getValue ()); } })); buttonLayout.addComponent (new Button ("Cancel", new Button.ClickListener () { @Override public void buttonClick (final ClickEvent event) { hiddenContent.removeAllComponents (); // hide form hiddenContent.setVisible (false); addMode = false; } })); hiddenContent.addComponent (buttonLayout); // hiddenContent.setVisible(!hiddenContent.isVisible()); hiddenContent.setVisible (true); } }); final Button editBtn = new Button ("Edit Selected", new Button.ClickListener () { @Override public void buttonClick (final Button.ClickEvent event) { /* * Object rowId = table.getValue(); // get the selected rows id if(rowId * != null){ if(addMode || editMode){ parent.getWindow * ().showNotification("Info", "You cannot edit while in add/edit mode", * Window.Notification.TYPE_HUMANIZED_MESSAGE); return; } final String * sid = * (String)table.getContainerProperty(rowId,"ID.value").getValue(); // * TODO: PUT THIS IN FUNCTION BEGINS editMode = true; * hiddenContent.removeAllComponents (); //get selected item * allowanceChargeItem = (InvoiceAllowanceChargeAdapter) * allowanceChargeList.get (table.getIndexFromID (sid)); //clone it to * original item originalItem = new InvoiceAllowanceChargeAdapter (); * cloneInvoiceAllowanceChargeItem(allowanceChargeItem, originalItem); * Label formLabel = new Label("<h3>Editing allowance charge line</h3>", * Label.CONTENT_XHTML); hiddenContent.addComponent (formLabel); * hiddenContent.addComponent(createInvoiceAllowanceChargeForm()); * //Save new line button HorizontalLayout buttonLayout = new * HorizontalLayout(); buttonLayout.setSpacing (true); * buttonLayout.addComponent(new Button("Save changes",new * Button.ClickListener(){ * @Override public void buttonClick (ClickEvent event) { //update table * (and consequently edit item to allowanceChargeList list) * table.setAllowanceChargeLine (sid, allowanceChargeItem); //hide form * hiddenContent.setVisible(false); editMode = false; } })); * buttonLayout.addComponent(new Button("Cancel editing",new * Button.ClickListener(){ * @Override public void buttonClick (ClickEvent event) { * hiddenContent.removeAllComponents (); table.setAllowanceChargeLine * (sid, originalItem); //hide form hiddenContent.setVisible(false); * editMode = false; } })); hiddenContent.addComponent(buttonLayout); * //hiddenContent.setVisible(!hiddenContent.isVisible()); * hiddenContent.setVisible(true); // TODO: PUT THIS IN FUNCTION ENDS } * else { parent.getWindow ().showNotification("Info", * "No table line is selected", * Window.Notification.TYPE_HUMANIZED_MESSAGE); } */ /* } }); editBtn.setEnabled (false); final Button deleteBtn = new Button ("Delete Selected", new Button.ClickListener () { @Override public void buttonClick (final Button.ClickEvent event) { final Object rowId = table.getValue (); // get the selected rows id if (rowId != null) { if (addMode || editMode) { parent.getWindow ().showNotification ("Info", "You cannot delete while in add/edit mode", Window.Notification.TYPE_HUMANIZED_MESSAGE); return; } if (table.getContainerProperty (rowId, "TableLineID").getValue () != null) { final String sid = (String) table.getContainerProperty (rowId, "TableLineID").getValue (); table.removeTaxSubtotalLine (sid); // update Total Tax Amount taxTotalItem.getTaxAmount ().setValue (SumTaxSubtotalAmount ()); invoiceTaxTotalTopForm.getField ("Tax Total Amount").setValue (taxTotalItem.getTaxAmount ().getValue ()); } } else { parent.getWindow ().showNotification ("Info", "No table line is selected", Window.Notification.TYPE_HUMANIZED_MESSAGE); } } });*/ final Panel invoiceDetailsPanel = new Panel("Tax Total Details"); invoiceDetailsPanel.setStyleName("light"); invoiceDetailsPanel.setSizeFull(); invoiceDetailsPanel.addComponent(createInvoiceTaxTotalTopForm()); table.addListener(new ItemSetChangeListener() { @Override public void containerItemSetChange(ItemSetChangeEvent event) { Field f = invoiceTaxTotalTopForm.getField(taxTotalAmount); f.setValue(addTaxSubTotals()); } }); grid.setSpacing(true); grid.addComponent(invoiceDetailsPanel, 0, 0); grid.addComponent(tableContainer, 0, 1); grid.addComponent(buttonsContainer, 1, 1); grid.setSizeUndefined(); // ---- HIDDEN FORM BEGINS ----- final VerticalLayout formLayout = new VerticalLayout(); formLayout.addComponent(hiddenContent); hiddenContent.setVisible(false); outerLayout.addComponent(formLayout); // ---- HIDDEN FORM ENDS ----- setLayout(outerLayout); outerPanel.requestRepaintAll(); }
From source file:com.bellkenz.modules.PersonalInformation.java
public ComponentContainer personalInformation() { employeeInformationDAO = new EmployeeInformationDAO(getEmployeeId()); employeePersonalInformation = new EmployeePersonalInformation(); GridLayout glayout = new GridLayout(5, 9); glayout.setSpacing(true);//ww w . ja va2s.c om glayout.setMargin(true); final Panel imagePanel = new Panel(); imagePanel.setStyleName("light"); AbstractLayout panelLayout = (AbstractLayout) imagePanel.getContent(); panelLayout.setMargin(false); imagePanel.setSizeFull(); employeeImage = new Embedded(null, new ThemeResource("../myTheme/images/ronnie.jpg")); employeeImage.setImmediate(true); employeeImage.setWidth(90, Sizeable.UNITS_PIXELS); employeeImage.setHeight(90, Sizeable.UNITS_PIXELS); employeeImage.setStyleName("logo-img"); imagePanel.addComponent(employeeImage); glayout.addComponent(employeeImage, 0, 0, 0, 1); glayout.setComponentAlignment(imagePanel, Alignment.MIDDLE_CENTER); firstname = createTextField("Firstname: "); glayout.addComponent(firstname, 1, 0, 2, 0); final TextField middlename = createTextField("Middlename: "); glayout.addComponent(middlename, 3, 0); final TextField lastname = createTextField("Lastname: "); glayout.addComponent(lastname, 4, 0); final TextField houseNo = createTextField("No: "); houseNo.setWidth("40px"); glayout.addComponent(houseNo, 1, 1); final TextField street = createTextField("Street: "); street.setWidth("118"); glayout.addComponent(street, 2, 1); final TextField city = createTextField("City: "); glayout.addComponent(city, 3, 1); final TextField zipCode = createTextField("Zip Code:"); glayout.addComponent(zipCode, 4, 1); final TextField nickname = createTextField("Nickname: "); nickname.setWidth("90px"); glayout.addComponent(nickname, 0, 2); final TextField permanentAddress = createTextField("Permanent/Provincial Address: "); permanentAddress.setWidth("533px"); glayout.addComponent(permanentAddress, 1, 2, 4, 2); Button uploadPicture = new Button("Upload..."); uploadPicture.setWidth("100%"); uploadPicture.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (employeeId == null) { getWindow().showNotification("You did not select and Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window uploadImage = new UploadImage(imagePanel, employeeImage, employeeId); uploadImage.setWidth("450px"); if (uploadImage.getParent() == null) { getWindow().addWindow(uploadImage); } uploadImage.setModal(true); uploadImage.center(); } }); glayout.addComponent(uploadPicture, 0, 3); final TextField landline = createTextField("Landline #: "); glayout.addComponent(landline, 1, 3, 2, 3); final TextField mobileNo = createTextField("Mobile #: "); glayout.addComponent(mobileNo, 3, 3); final TextField age = createTextField("Age: "); glayout.addComponent(age, 4, 3); final TextField emailAddress = createTextField("Email Address: "); glayout.addComponent(emailAddress, 1, 4, 2, 4); final PopupDateField dob = (PopupDateField) createDateField("Date of Birth: "); glayout.addComponent(dob, 3, 4); final TextField height = createTextField("Height: "); glayout.addComponent(height, 4, 4); final ComboBox civilStatus = new ComboBox("Civil Status: "); civilStatus.setWidth("100%"); dropDownBoxList.populateCivilStatusList(civilStatus); glayout.addComponent(civilStatus, 1, 5, 2, 5); final ComboBox gender = new ComboBox("Gender: "); gender.setWidth("100%"); dropDownBoxList.populateGenderList(gender); glayout.addComponent(gender, 3, 5); final TextField weight = createTextField("Weigth: "); glayout.addComponent(weight, 4, 5); final TextField driversLicenseNo = createTextField("Drivers License: "); glayout.addComponent(driversLicenseNo, 1, 6, 2, 6); final TextField restrictionCode = createTextField("Restriction Code: "); glayout.addComponent(restrictionCode, 3, 6); final TextField religion = createTextField("Religion: "); glayout.addComponent(religion, 4, 6); final ComboBox division = new ComboBox("Division: "); division.setWidth("100%"); dropDownBoxList.populateBranchComboBox(division); glayout.addComponent(division, 1, 7, 2, 7); final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox()); department.setWidth("100%"); division.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (division.getValue() == null) { } else { divisionId = branchDAO.getBranchId(division.getValue().toString()); } } }); glayout.addComponent(department, 3, 7); final TextField position = createTextField("Position: "); glayout.addComponent(position, 4, 7); //glayout.setComponentAlignment(position, Alignment.BOTTOM_LEFT); Button transferButton = new Button("Transfer Employee"); transferButton.setWidth("100%"); transferButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (getEmployeeId() == null) { getWindow().showNotification("You did not select an Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window subWindow = transferEmployee(getEmployeeId(), division, department, position); if (subWindow.getParent() == null) { getWindow().addWindow(subWindow); } subWindow.setModal(true); subWindow.center(); } }); glayout.addComponent(transferButton, 1, 8, 2, 8); glayout.setComponentAlignment(transferButton, Alignment.BOTTOM_CENTER); if (employeeId != null) { epiList = employeeInformationDAO.employeePersonalInformation(); for (EmployeePersonalInformation epi : epiList) { final byte[] image = epi.getImage(); if (image != null) { StreamResource.StreamSource imageSource = new StreamResource.StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(image); } }; StreamResource imageResource = new StreamResource(imageSource, epi.getFirstname() + ".jpg", getApplication()); imageResource.setCacheTime(0); employeeImage.setSource(imageResource); } firstname.setValue(epi.getFirstname()); middlename.setValue(epi.getMiddlename()); lastname.setValue(epi.getLastname()); houseNo.setValue(epi.getHouseNumber()); street.setValue(epi.getStreet()); city.setValue(epi.getStreet()); zipCode.setValue(epi.getZipCode()); nickname.setValue(epi.getNickname()); permanentAddress.setValue(epi.getPermanentAddress()); landline.setValue(epi.getLandlineNumber()); mobileNo.setValue(epi.getMobileNumber()); age.setValue(epi.getAge()); emailAddress.setValue(epi.getEmailAddress()); if (epi.getDob() != null) { dob.setValue(conUtil.parsingDate(epi.getDob())); } else { dob.setValue(null); } height.setValue(epi.getHeight()); if (epi.getCivilStatus() != null) { Object civilStatusId = civilStatus.addItem(); civilStatus.setItemCaption(civilStatusId, epi.getCivilStatus()); civilStatus.setValue(civilStatusId); } if (epi.getGender() != null) { Object genderId = gender.addItem(); gender.setItemCaption(genderId, epi.getGender()); gender.setValue(genderId); } weight.setValue(epi.getWeight()); driversLicenseNo.setValue(epi.getDriversLicense()); restrictionCode.setValue(epi.getRestrictionCode()); religion.setValue(epi.getReligion()); position.setValue(epi.getPosition()); Object divisionObjectId = division.addItem(); division.setItemCaption(divisionObjectId, epi.getDivision()); division.setValue(divisionObjectId); Object departmentObjectId = department.addItem(); department.setItemCaption(departmentObjectId, epi.getDepartment()); department.setValue(departmentObjectId); } } firstname.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { employeePersonalInformation.setFirstname(event.getProperty().getValue().toString()); } }); firstname.setImmediate(true); setInformation(employeePersonalInformation); return glayout; }
From source file:com.esofthead.mycollab.module.project.view.task.GanttChartTaskContainer.java
License:Open Source License
private Panel createControls() { Panel panel = new Panel(); panel.setWidth(100, Unit.PERCENTAGE); HorizontalLayout controls = new HorizontalLayout(); controls.setSpacing(true);/*from w w w.j ava 2s.c o m*/ controls.setMargin(true); panel.setContent(controls); start = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE)); start.setValue(gantt.getStartDate()); start.setResolution(Resolution.DAY); start.setImmediate(true); start.addValueChangeListener(startDateValueChangeListener); end = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE)); end.setValue(gantt.getEndDate()); end.setResolution(Resolution.DAY); end.setImmediate(true); end.addValueChangeListener(endDateValueChangeListener); reso = new NativeSelect("Resolution"); reso.setNullSelectionAllowed(false); reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour); reso.addItem(org.tltv.gantt.client.shared.Resolution.Day); reso.addItem(org.tltv.gantt.client.shared.Resolution.Week); reso.setValue(gantt.getResolution()); reso.setImmediate(true); reso.addValueChangeListener(resolutionValueChangeListener); controls.addComponent(start); controls.addComponent(end); controls.addComponent(reso); panel.setStyleName(UIConstants.THEME_NO_BORDER); return panel; }