List of usage examples for com.vaadin.ui VerticalLayout getComponentCount
@Override public int getComponentCount()
From source file:at.peppol.webgui.app.components.PartyDetailForm.java
License:Mozilla Public License
private void initElements() { setCaption(party + " Party"); //setStyleName("light"); final VerticalLayout outerLayout = new VerticalLayout(); outerLayout.setSpacing(true);//ww w . jav a 2 s . co m outerLayout.setMargin(true); hiddenContent = new VerticalLayout(); hiddenContent.setSpacing(true); hiddenContent.setMargin(true); PropertysetItem partyItemSet = new PropertysetItem(); PartyIdentificationType supplierPartyID; if (partyBean.getPartyIdentification().size() == 0) { supplierPartyID = new PartyIdentificationType(); supplierPartyID.setID(new IDType()); partyBean.getPartyIdentification().add(supplierPartyID); } else { supplierPartyID = partyBean.getPartyIdentification().get(0); } partyItemSet.addItemProperty("Party ID", new NestedMethodProperty(supplierPartyID, "ID.value")); EndpointIDType endPointID; if (partyBean.getEndpointID() == null) { endPointID = new EndpointIDType(); partyBean.setEndpointID(endPointID); } else { endPointID = partyBean.getEndpointID(); } partyItemSet.addItemProperty("Endpoint ID", new NestedMethodProperty(endPointID, "SchemeAgencyID")); PartyNameType partyName; if (partyBean.getPartyName().size() == 0) { partyName = new PartyNameType(); partyName.setName(new NameType()); partyBean.getPartyName().add(partyName); } else { partyName = partyBean.getPartyName().get(0); } partyItemSet.addItemProperty("Party Name", new NestedMethodProperty(partyName, "name.value")); /* partyItemSet.addItemProperty("Agency Name", new NestedMethodProperty(supplierPartyID, "ID.SchemeAgencyID") ); */ /* final AddressType partyrAddress = new AddressType(); partyBean.setPostalAddress(partyrAddress); partyrAddress.setStreetName(new StreetNameType()); partyrAddress.setCityName(new CityNameType()); partyrAddress.setPostalZone(new PostalZoneType()); partyrAddress.setCountry(new CountryType()); partyrAddress.getCountry().setIdentificationCode(new IdentificationCodeType()); partyItemSet.addItemProperty("Street Name", new NestedMethodProperty(partyrAddress, "streetName.value")); partyItemSet.addItemProperty("City", new NestedMethodProperty(partyrAddress, "cityName.value")); partyItemSet.addItemProperty("Postal Zone", new NestedMethodProperty(partyrAddress, "postalZone.value")); partyItemSet.addItemProperty("Country", new NestedMethodProperty(partyrAddress, "country.identificationCode.value")); */ AddressDetailForm partyAddressForm; AddressType address; if (partyBean.getPostalAddress() == null) { address = new AddressType(); } else { address = partyBean.getPostalAddress(); } partyAddressForm = new AddressDetailForm(party, address); partyBean.setPostalAddress(address); PartyTaxSchemeType taxScheme; if (partyBean.getPartyTaxScheme().size() == 0) { taxScheme = new PartyTaxSchemeType(); taxScheme.setCompanyID(new CompanyIDType()); //partyItemSet.addItemProperty(taxSchemeCompanyID, // new NestedMethodProperty(taxScheme.getCompanyID(),"value")); // TODO: Hardcoded ShemeID etc for TaxScheme. Should be from a codelist? taxScheme.setTaxScheme(new TaxSchemeType()); taxScheme.getTaxScheme().setID(new IDType()); taxScheme.getTaxScheme().getID().setValue("VAT"); taxScheme.getTaxScheme().getID().setSchemeID("UN/ECE 5153"); taxScheme.getTaxScheme().getID().setSchemeAgencyID("6"); partyBean.getPartyTaxScheme().add(taxScheme); } else { taxScheme = partyBean.getPartyTaxScheme().get(0); } partyItemSet.addItemProperty(taxSchemeCompanyID, new NestedMethodProperty(taxScheme.getCompanyID(), "value")); partyItemSet.addItemProperty(taxSchemeID, new NestedMethodProperty(taxScheme.getTaxScheme().getID(), "value")); final Form partyForm = new Form(); partyForm.setFormFieldFactory(new PartyFieldFactory()); partyForm.setItemDataSource(partyItemSet); partyForm.setImmediate(true); final Button addLegalEntityBtn = new Button("Add Legal Entity"); final Button removeLegalEntityBtn = new Button("Remove Legal Entity"); //removeLegalEntityBtn.setVisible(false); addLegalEntityBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { //add the legal entity component Panel panel = createLegalEntityPanel(removeLegalEntityBtn); outerLayout.addComponent(panel); panel.setWidth("90%"); addLegalEntityBtn.setVisible(false); //removeLegalEntityBtn.setVisible(true); //outerLayout.replaceComponent(removeLegalEntityBtn, panel); } }); removeLegalEntityBtn.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { //remove the legal entity component for (int i = 0; i < outerLayout.getComponentCount(); i++) { Component c = outerLayout.getComponent(i); if (c instanceof Panel) { if (c.getCaption().equals("Legal Entity")) { outerLayout.removeComponent(c); if (partyBean.getPartyLegalEntity().size() > 0) { partyBean.getPartyLegalEntity().clear(); ValidatorsList.removeListeners(Utils.getFieldListeners(legalEntityForm)); } } } } //removeLegalEntityBtn.setVisible(false); addLegalEntityBtn.setVisible(true); } }); outerLayout.addComponent(partyForm); partyForm.setWidth("90%"); outerLayout.addComponent(partyAddressForm); partyAddressForm.setWidth("90%"); outerLayout.addComponent(addLegalEntityBtn); if (partyBean.getPartyLegalEntity().size() > 0) addLegalEntityBtn.click(); //outerLayout.addComponent(removeLegalEntityBtn); //outerLayout.addComponent(createLegalEntityPanel()); setContent(outerLayout); }
From source file:com.haulmont.cuba.web.gui.components.WebAbstractTable.java
License:Apache License
@Override public void showCustomPopupActions(List<Action> actions) { VerticalLayout customContextMenu = new VerticalLayout(); customContextMenu.setWidthUndefined(); customContextMenu.setStyleName("c-cm-container"); for (Action action : actions) { ContextMenuButton contextMenuButton = createContextMenuButton(); contextMenuButton.setStyleName("c-cm-button"); contextMenuButton.setAction(action); Component vButton = WebComponentsHelper.unwrap(contextMenuButton); customContextMenu.addComponent(vButton); }// w ww . j a v a 2 s . c o m if (customContextMenu.getComponentCount() > 0) { component.showCustomPopup(customContextMenu); component.setCustomPopupAutoClose(true); } }
From source file:com.peergreen.webconsole.scope.deployment.internal.components.DeployableWindow.java
License:Open Source License
public Component getContent() { FormLayout content = new FormLayout(); content.setSpacing(true);/*w ww. j a v a 2 s . c o m*/ content.setMargin(true); Label name = new Label(deployableEntry.getName()); name.setCaption("Name"); content.addComponent(name); Label uri = new Label(deployableEntry.getUri().toString()); uri.setCaption("URI"); content.addComponent(uri); VerticalLayout status = new VerticalLayout(); status.setCaption("Status"); content.addComponent(status); if (report == null) { // is not deployed yet status.addComponent(new Label("Ready to be deployed")); } else { if (report.getExceptions().size() == 0) { status.addComponent(new Label("<p style=\"color:#329932\">Deployed</p>", ContentMode.HTML)); } else { for (ArtifactError artifactError : report.getExceptions()) { for (ArtifactErrorDetail detail : artifactError.getDetails()) { ExceptionView exceptionView = new ExceptionView(detail); status.addComponent(exceptionView); } } } VerticalLayout endPointsLayout = new VerticalLayout(); for (Endpoint endpoint : report.getEndpoints()) { try { Link link = new Link(endpoint.getURI().toString(), new ExternalResource(endpoint.getURI().toURL())); link.setTargetName("_blank"); endPointsLayout.addComponent(link); } catch (MalformedURLException e) { endPointsLayout.addComponent(new Label(endpoint.getURI().toString())); } } if (endPointsLayout.getComponentCount() > 0) { content.addComponent(endPointsLayout); endPointsLayout.setCaption("End points"); } } return content; }
From source file:com.peergreen.webconsole.scope.deployment.internal.deployed.EndPointsHomeFrame.java
License:Open Source License
private void updateEndPoints() { removeAllItems();/*from w w w.j a v a 2 s. com*/ int i = 0; for (URI uri : artifactModelManager.getDeployedRootURIs()) { VerticalLayout endPointsLayout = new VerticalLayout(); try { for (Endpoint endpoint : deploymentManager.getReport(uri.toString()).getEndpoints()) { Link link = new Link(endpoint.getURI().toString(), new ExternalResource(endpoint.getURI().toURL())); link.setTargetName("_blank"); endPointsLayout.addComponent(link); } } catch (ArtifactStatusReportException | MalformedURLException e) { e.printStackTrace(); } if (endPointsLayout.getComponentCount() > 0) { addItem(new Object[] { endPointsLayout, artifactModelManager.getArtifactModel(uri).getArtifact().name() }, i); i++; } } }
From source file:edu.nps.moves.mmowgli.components.WordCloudPanel.java
License:Open Source License
private void addAButton(WordButton butt) { if (!isIE7)//www. j a v a2 s .com meat.addComponent(butt); else { VerticalLayout vLay = (VerticalLayout) meat; int numLines = vLay.getComponentCount(); HorizontalLayout hL; if (numLines == 0) { hL = new HorizontalLayout(); vLay.addComponent(hL); vLay.setComponentAlignment(hL, Alignment.MIDDLE_CENTER); numLines = 1; } hL = (HorizontalLayout) vLay.getComponent(numLines - 1); hL.addComponent(butt); if (hL.getComponentCount() >= IE7MAXCOLCOUNT) { vLay.addComponent(hL = new HorizontalLayout()); vLay.setComponentAlignment(hL, Alignment.MIDDLE_CENTER); } } }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabTalk.java
License:Open Source License
@Override public boolean logUpdated_oobTL(Serializable chatLogId) { // This comes in on MY updates too, should do nothing since my just-entered msg is already displayed ActionPlan ap = ActionPlan.getTL(apId); ChatLog log = ap.getChatLog();/*from ww w . j a va2 s .c o m*/ if (chatLogId.equals(log.getId())) { // somebody else updated this log. // try not to load everything. All lists should be in order SortedSet<Message> msgs = log.getMessages(); if (msgs.size() <= 0) return false; VerticalLayout lay = (VerticalLayout) chatScroller.getContent(); Message topMsg = null; if (lay.getComponentCount() > 0) topMsg = ((ChatMsg) lay.getComponent(0)).getMessage(); int pos = 0; for (Iterator<Message> itr = msgs.iterator(); itr.hasNext();) { Message m = itr.next(); if (topMsg != null && m.getId() == topMsg.getId()) break; addMessageToScrollerAtPosition(m, pos++, HSess.get()); } return true; } return false; }
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java
License:Open Source License
private void listFollowers_oob(Session sess, Object badboyId) { Card badboy = Card.get(badboyId, sess); Set<Card> children = badboy.getFollowOns(); Vector<CardSummary> vec = new Vector<CardSummary>(); User me = User.get(Mmowgli2UI.getGlobals().getUserID(), sess); int col = -1; for (CardType ct : followOnTypes) { col++;/*from w w w . j a v a 2s . c om*/ VerticalLayout columnV = columnVLs.get(col); int numcards = columnV.getComponentCount(); // including header, which we // don't touch for (int i = numcards - 1; i > 0; i--) columnV.removeComponent(columnV.getComponent(i)); if (children != null) { vec.clear(); // need to sort below // todo, enforce this in db for (Card c : children) { if (!isGameMaster && CardMarkingManager.isHidden(c)) continue; if (!Card.canSeeCard_oob(c, me, sess)) continue; if (c.getCardType().getId() == ct.getId()) { CardSummary summ = CardSummary.newCardSummary(c.getId(), sess, me); vec.add(summ); } } for (CardSummary cs : vec) { columnV.addComponent(cs); cs.initGui(sess); } } } }
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java
License:Open Source License
private boolean isDescendent(Card possibleChildCard) { VerticalLayout vl = getCardColumnLayout(possibleChildCard); if (vl == null) return false; int numChil = vl.getComponentCount(); for (int i = 0; i < numChil; i++) { Object comp = vl.getComponent(i); if (comp instanceof CardSummary) { CardSummary cs = (CardSummary) comp; if (cs.getCardId().equals(possibleChildCard.getId())) { cs.refreshContents(possibleChildCard); return true; }//from w w w.java 2s.c o m } } return false; }
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java
License:Open Source License
/** This is an attempt to put more logic on the server and less into big client updates */ private void updateFollowers_oobTL(Card thisCard) { // Easiest to throw everything away and reload, but trying to increase performance here. // We've been informed that the parent card has been updated, the most obvious reason being that // some one has played a follow on card. Cards are immutable, so the only thing to check is the addition // of a new one -- i.e., don't have to worry about updated text or author, etc. // The follow-on list in a card is now maintained sorted by Hibernate, so start picking off the top until // we get to one we have, then stop; Then add the new ones to the top of the layout SortedSet<Card> children = thisCard.getFollowOns(); //MSysOut.println(CARD_UPDATE_LOGS, "CardChainPage.updateFollowers_oobTL(), num children = " + children.size()); Vector<Card> newCards = new Vector<Card>(); for (Card c : children) { //MSysOut.println(CARD_UPDATE_LOGS, "next child, id = " + c.getId()); VerticalLayout vl = getCardColumnLayout(c); if (vl != null) { int numChil = vl.getComponentCount(); if (numChil <= 1) {// want to miss header newCards.add(c);//from w w w .j av a 2 s . c o m } else { CardSummary cs = (CardSummary) vl.getComponent(1); //MSysOut.println(CARD_UPDATE_LOGS,"CardChainPage.updateFollers_oobTL(), cs.cardId vs c.getId returns " + cs.getCardId().equals(c.getId()) + " " + cs.getCardId() + " " + c.getId()); if (!cs.getCardId().equals(c.getId())) { newCards.add(c); //MSysOut.println(CARD_UPDATE_LOGS, "CardChainPage.updateFollers_oobTL(), added card " + c.getId() + " to column"); continue; // next card } else { //MSysOut.println(CARD_UPDATE_LOGS, "CardChainPage.updateFollers_oobTL(), card " + c.getId() + " already in layout!"); break; // the card has been found already in the layout, we're done since they're already sorted } } } else { //MSysOut.println(CARD_UPDATE_LOGS, "CardChainPage.updateFollowers_oobTL(), cant find card column for card " + c.getId()); } //MSysOut.println(CARD_UPDATE_LOGS, "CardChainPage.updateFollowers_oobTL(), new cards found: " + newCards.size()); } // If we looked at all and found any new ones, add them to our // Add from the bottom int sz; if ((sz = newCards.size()) > 0) { for (int i = sz - 1; i >= 0; i--) { Card cd = newCards.get(i); VerticalLayout vl = getCardColumnLayout(cd); if (vl != null) { CardSummary csum = CardSummary.newCardSummary_oobTL(cd.getId()); //MSysOut.println(CARD_UPDATE_LOGS, "CardChainPage.updateFollowers_oobTL(), new card added to layout, id: " + cd.getId()); vl.addComponent(csum, 1); // under the header csum.initGui(); } } } }
From source file:fi.jasoft.dragdroplayouts.demo.views.DragdropDragGrabFilterDemo.java
License:Apache License
private Panel createCompositeChild(String caption) { Panel compositePanel = new Panel(); compositePanel.setWidthUndefined();/* w ww . j av a2 s.c om*/ compositePanel.setCaption("Composite Widget " + caption); VerticalLayout content = new VerticalLayout(); content.setWidthUndefined(); compositePanel.setContent(content); content.addComponent(new Label("Grab me to drag Panel")); content.addComponent(new Button("Cannot be grabbed")); content.addComponent(new TextField("Cannot be grabbed TextField")); content.addComponent(new Label("Grab me too!")); for (int i = 0; i < content.getComponentCount(); i++) { content.getComponent(i).setWidth(100, Unit.PERCENTAGE); } return compositePanel; }