List of usage examples for com.vaadin.ui HorizontalLayout setHeightUndefined
@Override public void setHeightUndefined()
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();// w ww . j a v a 2s. co m 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) {//w w w . j a v a2 s .c o m 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.etest.view.tq.charts.ItemAnalysisGraphicalViewAll.java
public ItemAnalysisGraphicalViewAll(int curriculumId) { this.curriculumId = curriculumId; setModal(true);/*from w w w . ja v a2s . c om*/ setHeight("100%"); VerticalLayout v = new VerticalLayout(); v.setMargin(true); v.setSpacing(true); Label title = new Label(); title.setCaption("Item Analysis of " + cs.getCurriculumById(getCurriculumId()).getSubject()); title.setWidthUndefined(); v.addComponent(title); v.setComponentAlignment(title, Alignment.TOP_CENTER); HorizontalLayout h = new HorizontalLayout(); h.setSpacing(true); h.addComponent(getDiscriminationIndexChart()); h.addComponent(getDifficultIndexChart()); h.setWidthUndefined(); h.setHeightUndefined(); v.addComponent(h); v.setWidthUndefined(); setContent(v); getContent().setWidthUndefined(); // getContent().setHeightUndefined(); center(); }
From source file:com.haulmont.cuba.web.log.LogWindow.java
License:Apache License
private void initUI() { ClientConfig clientConfig = AppBeans.<Configuration>get(Configuration.NAME).getConfig(ClientConfig.class); String closeShortcut = clientConfig.getCloseShortcut(); KeyCombination closeCombination = KeyCombination.create(closeShortcut); com.vaadin.event.ShortcutAction closeShortcutAction = new com.vaadin.event.ShortcutAction( "closeShortcutAction", closeCombination.getKey().getCode(), KeyCombination.Modifier.codes(closeCombination.getModifiers())); addActionHandler(new com.vaadin.event.Action.Handler() { @Override/*from w w w . ja v a 2 s . co m*/ public com.vaadin.event.Action[] getActions(Object target, Object sender) { return new com.vaadin.event.Action[] { closeShortcutAction }; } @Override public void handleAction(com.vaadin.event.Action action, Object sender, Object target) { if (Objects.equals(action, closeShortcutAction)) { close(); } } }); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setSizeFull(); setContent(layout); Panel scrollablePanel = new Panel(); scrollablePanel.setSizeFull(); VerticalLayout scrollContent = new VerticalLayout(); scrollContent.setSizeUndefined(); scrollablePanel.setContent(scrollContent); final Label label = new Label(); label.setContentMode(ContentMode.HTML); label.setValue(writeLog()); label.setSizeUndefined(); label.setStyleName("c-log-content"); ((Layout) scrollablePanel.getContent()).addComponent(label); HorizontalLayout topLayout = new HorizontalLayout(); topLayout.setWidth("100%"); topLayout.setHeightUndefined(); Messages messages = AppBeans.get(Messages.NAME); Button refreshBtn = new CubaButton(messages.getMessage(getClass(), "logWindow.refreshBtn"), (Button.ClickListener) event -> label.setValue(writeLog())); topLayout.addComponent(refreshBtn); layout.addComponent(topLayout); layout.addComponent(scrollablePanel); layout.setExpandRatio(scrollablePanel, 1.0f); }
From source file:com.snowy.Chat.java
public Chat(int id, data d) { this.d = d;//from w ww .j a va2 s. c o m this.id = id; tf.setSizeFull(); //ts = d.getCurrentSqlTimestamp(); //Logger.getLogger(Chat.class).info(ts.toString()); //tA.setValue("hello\n"); lastMessageId = d.lastMessageIdFromCurrent(id); HorizontalLayout fl = new HorizontalLayout(); fl.addComponent(tf); Button b = new Button("Send"); fl.addComponent(b); tf.setSizeFull(); fl.setExpandRatio(tf, 1); b.addClickListener(e -> { if (tf.getValue().length() != 0) { d.sendMessage(id, (tf.getValue().length() < 200 ? tf.getValue() : tf.getValue().substring(0, 199))); tf.clear(); } }); /*tf.addTextChangeListener(e->{ Logger.getLogger(Chat.class).info(e.getText().charAt(e.getText().length()-1)+""); if(e.getText().charAt(e.getText().length()-1)==10){ b.click(); } });*/ tf.addFocusListener(new FocusListener() { @Override public void focus(final FocusEvent event) { b.setClickShortcut(KeyCode.ENTER); } }); tf.addBlurListener(new BlurListener() { @Override public void blur(final BlurEvent event) { b.removeClickShortcut(); } }); fl.setSizeFull(); fl.setHeightUndefined(); tA.setSizeFull(); //tA.setReadOnly(true); tf.setHeightUndefined(); tA.setWordwrap(true); tA.setImmediate(true); this.addComponent(tA); this.addComponent(fl); this.setExpandRatio(tA, 2); tA.setReadOnly(true); //this.setExpandRatio(fl, 0); this.setSizeFull(); }
From source file:com.swifta.mats.web.usermanagement.AddUserModule.java
private VerticalLayout getNewUserContainer() { VerticalLayout cAgentInfo = new VerticalLayout(); Embedded emb = new Embedded(null, new ThemeResource("img/add_user_small.png")); emb.setDescription("add new user"); emb.setStyleName("search_user_img"); emb.setSizeUndefined();//www.j a va 2 s . c o m Label lbSearch = new Label("Add New User... "); // Label lbSearch = new Label("Search " + strUserType + " by: "); lbSearch.setSizeUndefined(); lbSearch.setStyleName("label_search_user"); lbSearch.setSizeUndefined(); HorizontalLayout header = new HorizontalLayout(); header.setHeightUndefined(); header.setMargin(false); header.setSpacing(true); header.addComponent(emb); header.addComponent(lbSearch); header.setStyleName("search_user_header"); cAgentInfo.addComponent(header); cAgentInfo.setComponentAlignment(header, Alignment.TOP_CENTER); VerticalLayout cBasic = new VerticalLayout(); Label lbB = new Label("Basic"); lbB.setStyleName("lb_frm_add_user"); cBasic.addComponent(lbB); TextField tF = new TextField("First Name"); arrLDFields.add(tF); arrLAllFields.add(tF); arrLGFields.add(tF); tFFN = tF; tF.setImmediate(true); tFFN.setRequired(true); cBasic.addComponent(tF); tF = new TextField("Middle Name"); tFMN = tF; // tF.setImmediate(true); tFMN.setRequired(false); cBasic.addComponent(tF); arrLDFields.add(tF); arrLAllFields.add(tF); tF = new TextField("Last Name"); tFLN = tF; tF.setImmediate(true); tFLN.setRequired(true); cBasic.addComponent(tF); arrLDFields.add(tF); arrLAllFields.add(tF); arrLGFields.add(tF); tF = new TextField("Territory"); tFTerritory = tF; tFTerritory.setImmediate(true); tFTerritory.setRequired(true); tFTerritory.setVisible(false); cBasic.addComponent(tF); arrLDFields.add(tF); arrLAllFields.add(tF); // arrLGFields.add(tF); OptionGroup opt = new OptionGroup("Gender"); opt.addItem("FEMALE"); opt.addItem("MALE"); optSex = opt; optSex.setRequired(true); optSex.setImmediate(true); cBasic.addComponent(opt); // arrLDFields.add(opt); arrLAllFields.add(opt); arrLGFields.add(opt); ComboBox combo = new ComboBox("Prefix"); combo.addItem("Mr. "); combo.addItem("Mrs. "); combo.addItem("Dr. "); combo.addItem("Eng. "); combo.addItem("Prof. "); comboPref = combo; comboPref.select("Eng. "); //combo.addItems(); cBasic.addComponent(combo); // arrLDFields.add(combo); arrLAllFields.add(combo); combo = new ComboBox("Suffix"); combo.addItem("Ph.D"); combo.addItem("M.B.A"); combo.addItem("RA"); combo.addItem("CISA "); // combo.select("Ph.D"); comboSuff = combo; cBasic.addComponent(combo); // arrLDFields.add(combo); arrLAllFields.add(combo); combo = new ComboBox("Language"); combo.addItem(1); // combo.select(1); combo.setItemCaption(1, "en-US"); combo.addItem(2); combo.setItemCaption(2, "en-UK"); combo.addItem(3); combo.setItemCaption(3, "fr"); comboLang = combo; comboLang.setRequired(true); comboLang.setImmediate(true); cBasic.addComponent(combo); // arrLDFields.add(combo); arrLAllFields.add(combo); arrLGFields.add(combo); tF = new TextField("Occupation"); // tF.setValue("Software Engineer"); tFOcc = tF; tFOcc.setRequired(true); tFOcc.setImmediate(true); cBasic.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); arrLGFields.add(tF); tF = new TextField("Employer"); // tF.setValue("Swifta"); tFEmp = tF; cBasic.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); PopupDateField dF = new PopupDateField("DoB"); Calendar cal = Calendar.getInstance(); cal.set(1988, 11, 12); dFDoB = dF; cBasic.addComponent(dF); // arrLDFields.add(dF); arrLAllFields.add(dF); combo = new ComboBox("Country"); comboCountry = combo; comboCountry.setRequired(true); cBasic.addComponent(combo); arrLDFields.add(combo); arrLAllFields.add(combo); arrLGFields.add(combo); combo = new ComboBox("State"); comboState = combo; comboState.setRequired(true); comboState.setNullSelectionAllowed(false); cBasic.addComponent(combo); arrLDFields.add(combo); arrLAllFields.add(combo); arrLGFields.add(combo); combo = new ComboBox("Local Government"); comboLG = combo; comboLG.setRequired(true); cBasic.addComponent(combo); arrLDFields.add(combo); arrLAllFields.add(combo); arrLGFields.add(combo); VerticalLayout cC = new VerticalLayout(); HorizontalLayout cBAndCAndAcc = new HorizontalLayout(); cBAndCAndAcc.addComponent(cBasic); cBAndCAndAcc.addComponent(cC); cCompany = new VerticalLayout(); Label lbC = new Label("Identification"); lbC.setStyleName("lb_frm_add_user"); combo = new ComboBox("ID Type"); combo.addItem("Passport Number"); combo.addItem("National Registration Identification Number"); combo.addItem("Drivers License Number"); combo.addItem("Identification Card"); combo.addItem("Employer Identification Number"); comboIDType = combo; comboIDType.setRequired(true); comboIDType.setImmediate(true); cCompany.addComponent(combo); // arrLDFields.add(combo); arrLAllFields.add(combo); arrLGFields.add(combo); tF = new TextField("ID No."); // tF.setValue("001"); tFIDNo = tF; tFIDNo.setRequired(true); tFIDNo.setImmediate(true); cCompany.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); arrLGFields.add(tF); tF = new TextField("Issuer"); tFIssuer = tF; cCompany.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); dF = new PopupDateField("Issue Date"); // cal = Calendar.getInstance(); cal.set(12, 12, 12); // dF.setValue(cal.getTime()); dFDoI = dF; // cal.clear(); cal = Calendar.getInstance(); Date dToday = cal.getTime(); cal.set(1970, 0, 1); Date dMin = cal.getTime(); dFDoI.addValidator(new DateRangeValidator("Invalid issue date. Please select a date Earlier/Today.", dMin, dToday, null)); cCompany.addComponent(dF); // arrLDFields.add(dF); arrLAllFields.add(dF); arrLGFields.add(dF); dFDoI.setImmediate(true); dF = new PopupDateField("Expiry Date"); cal.set(14, 12, 12); dFDoE = dF; DateRangeValidator drv = new DateRangeValidator("ID is Expired", dToday, null, null); dFDoE.addValidator(drv); dFDoI.setRequired(true); dFDoI.setImmediate(true); dFDoE.setRequired(true); dFDoE.setImmediate(true); cCompany.addComponent(dF); // arrLDFields.add(dF); arrLAllFields.add(dF); arrLGFields.add(dF); cC.addComponent(cCompany); VerticalLayout pC = new VerticalLayout(); lbC = new Label("Primary Contacts"); HorizontalLayout cLbc = new HorizontalLayout(); cLbc.setSizeUndefined(); cLbc.setMargin(new MarginInfo(true, false, false, false)); cLbc.addComponent(lbC); pC.addComponent(cLbc); cxPC = pC; tF = new TextField("Mobile Phone No."); tFPMNo = tF; pC.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); tF = new TextField("Alt. Phone No."); tFPANo = tF; pC.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); tF = new TextField("Email Address"); // tF.setValue("pwndz172@gmail.com"); tFPEmail = tF; tFPEmail.addValidator(new EmailValidator("Invalid Email address.")); tFPEmail.setImmediate(true); pC.addComponent(tF); cC.addComponent(pC); // arrLDFields.add(tF); arrLAllFields.add(tF); tFPEmail.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 6060653158010946535L; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() == null || event.getProperty().getValue().toString().isEmpty()) { arrLGFields.remove(tFPEmail); } else { arrLGFields.add(tFPEmail); } } }); VerticalLayout sC = new VerticalLayout(); lbC = new Label("Secondary Contacts"); cLbc = new HorizontalLayout(); cLbc.setSizeUndefined(); cLbc.setMargin(new MarginInfo(true, false, false, false)); cLbc.addComponent(lbC); // arrLDFields.add(lbC); // arrLAllFields.add(lbC); cxSC = sC; sC.addComponent(cLbc); tF = new TextField("Mobile Phone No."); tFSMNo = tF; sC.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); tF = new TextField("Alt. Phone No."); // tF.setValue("+1804191152"); tFSANo = tF; sC.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); tF = new TextField("E-mail Address"); tFSEmail = tF; tFSEmail.addValidator(new EmailValidator("Invalid Email Address.")); tFSEmail.setImmediate(true); sC.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); tFSEmail.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 6060653158010946535L; @Override public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() == null || event.getProperty().getValue().toString().isEmpty()) { arrLGFields.remove(tFSEmail); } else { arrLGFields.add(tFSEmail); } } }); cC.addComponent(sC); VerticalLayout physicalC = new VerticalLayout(); lbC = new Label("Physical Address"); cLbc = new HorizontalLayout(); cLbc.setSizeUndefined(); cLbc.setMargin(new MarginInfo(true, false, false, false)); cLbc.addComponent(lbC); physicalC.addComponent(cLbc); // arrLDFields.add(lbC); // arrLAllFields.add(lbC); tF = new TextField("Postal Code"); tFPostalCode = tF; physicalC.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); tF = new TextField("Street"); // tF.setValue("Yusuf Lule Rd."); tFStreet = tF; tFStreet.setRequired(true); tFStreet.setImmediate(true); physicalC.addComponent(tF); arrLDFields.add(tF); arrLAllFields.add(tF); arrLPAddr.add(tF); tF = new TextField("Province"); tFProv = tF; physicalC.addComponent(tF); arrLDFields.add(tF); arrLAllFields.add(tF); arrLPAddr.add(tF); tF = new TextField("City"); tFCity = tF; tFCity.setRequired(true); tFCity.setImmediate(true); physicalC.addComponent(tF); arrLDFields.add(tF); arrLAllFields.add(tF); arrLPAddr.add(tF); cC.addComponent(physicalC); tFPostalCode.setImmediate(true); VerticalLayout cAcc = new VerticalLayout(); Label lbAcc = new Label("Account"); lbAcc.setStyleName("lb_frm_add_user"); cAcc.addComponent(lbAcc); ComboBox comboHierarchy = null; comboHierarchy = new ComboBox("Profile"); Set<Entry<Integer, String>> set = profToID.entrySet(); for (Entry<Integer, String> e : set) { comboHierarchy.addItem(e.getKey()); comboHierarchy.setItemCaption(e.getKey(), e.getValue()); } // comboHierarchy.select(1); comboProfile = comboHierarchy; comboProfile.setRequired(true); comboProfile.setImmediate(true); comboProfile.select(1); cAcc.addComponent(comboHierarchy); final VerticalLayout cLBody = new VerticalLayout(); tF = new TextField("Username"); // tF.setValue("Livepwndz"); tFUN = tF; tFUN.setRequired(true); cLBody.addComponent(tF); arrLDFields.add(tF); arrLAllFields.add(tF); arrLGFields.add(tF); tF = new TextField("MSISDN"); // tF.setValue("+256774191152"); tFMSISDN = tF; tFMSISDN.setRequired(true); tFMSISDN.setImmediate(true); cLBody.addComponent(tF); arrLDFields.add(tF); arrLAllFields.add(tF); arrLGFields.add(tF); // / tF = new TextField("PIN"); // / cLBody.addComponent(tF); tF = new TextField("Email"); tFAccEmail = tF; tFAccEmail.addValidator(new EmailValidator("Invalid Email Address.")); tFAccEmail.setRequired(true); tFAccEmail.setImmediate(true); cLBody.addComponent(tF); arrLDFields.add(tF); arrLAllFields.add(tF); arrLGFields.add(tF); combo = new ComboBox("Bank Domain"); combo.addItem("Heritage Bank"); // combo.select("Heritage Bank"); comboBDomain = combo; cLBody.addComponent(combo); // arrLDFields.add(combo); arrLAllFields.add(combo); combo = new ComboBox("Bank Code ID"); combo.addItem("001"); // combo.select("001"); comboBID = combo; cLBody.addComponent(comboBID); // arrLDFields.add(combo); arrLAllFields.add(combo); tF = new TextField("Bank Account"); tFBAcc = tF; cLBody.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); combo = new ComboBox("Currency"); combo.addItem(1); combo.setItemCaption(1, "US Dollars"); comboCur = combo; cLBody.addComponent(combo); // arrLDFields.add(combo); arrLAllFields.add(combo); tF = new TextField("Clearing Number"); tFClrNo = tF; cLBody.addComponent(tF); // arrLDFields.add(tF); arrLAllFields.add(tF); Label lbAccRec = new Label("Account Recovery"); HorizontalLayout cLbAccRec = new HorizontalLayout(); cLbAccRec.setSizeUndefined(); cLbAccRec.setMargin(new MarginInfo(true, false, false, false)); cLbAccRec.addComponent(lbAccRec); cLBody.addComponent(cLbAccRec); combo = new ComboBox("Security Question"); combo.addItem(1); combo.addItem(2); combo.addItem(3); combo.setItemCaption(1, "What is your grandfather's last name?"); combo.setItemCaption(2, "What was your favorite junior school teacher's name?"); combo.setItemCaption(3, "What was one of your nicknames in school?"); // combo.select(2); comboSecQn = combo; cLBody.addComponent(combo); tF = new TextField("Answer"); // tF.setValue("Mrs. X"); tFSecAns = tF; cLBody.addComponent(tF); CheckBox chk = new CheckBox("I accept the terms" + " and conditons."); chcTAndC = chk; chk.setStyleName("check_t_and_c"); comboProfile.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { isValidatorAdded = false; /* * COMMENTED OUT BECAUSE THE FEATURE FOR CHANGING THE UI BASED * ON USER PROFILEL SELECTED HAS NOT BEEN FULLY TESTED if * (comboProfile.getValue() != null && * comboProfile.getValue().equals(11)) { * btnSave.setEnabled(true); for (Field<?> f : arrLAllFields) { * f.setVisible(false); } for (Field<?> f : arrLDFields) { * f.setVisible(true); f.setRequired(true); } * * tFFN.setCaption("Station Name"); tFMN.setCaption("Zone"); * tFLN.setCaption("Sales Area"); */ /* * arrLPAddr.get(0).setCaption("Zone"); * arrLPAddr.get(1).setCaption("Sales Area"); * arrLPAddr.get(1).setRequired(true); * arrLPAddr.get(2).setCaption("Territory"); */ /* * cxSC.setVisible(false); cxPC.setVisible(false); * cCompany.setVisible(false); arrLValidatable = arrLDFields; * reset(); // btnSave.setEnabled(false); * * return; } */ btnSave.setEnabled(true); tFFN.setCaption("First Name"); tFMN.setCaption("Middle Name"); tFLN.setCaption("Last Name"); for (Field<?> f : arrLAllFields) { f.setVisible(true); f.setRequired(false); } for (Field<?> f : arrLGFields) { f.setRequired(true); } /* * arrLPAddr.get(0).setCaption("Street"); * arrLPAddr.get(1).setCaption("Province"); * arrLPAddr.get(2).setCaption("City"); */ cxSC.setVisible(true); cxPC.setVisible(true); cCompany.setVisible(true); arrLValidatable = arrLGFields; reset(); } }); chk.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { // Notification.show(event.getProperty().getValue().toString()); } }); tFPostalCode.addValidator(new Validator() { private static final long serialVersionUID = 9193817369890607387L; @Override public void validate(Object value) throws InvalidValueException { if (value.toString().trim().isEmpty()) return; try { Long.parseLong(tFPostalCode.getValue()); } catch (Exception e) { tFPostalCode.focus(); throw new InvalidValueException("Only digits in Postal Code field."); } } }); comboCountry.addFocusListener(new FocusListener() { private static final long serialVersionUID = -5162384967736354225L; @Override public void focus(FocusEvent event) { if (isCSelected) return; Set<Entry<Integer, String>> es = (Set<Entry<Integer, String>>) getCountries().entrySet(); if (es.size() == 0) return; Iterator<Entry<Integer, String>> itr = es.iterator(); comboCountry.setNullSelectionAllowed(false); while (itr.hasNext()) { Entry<Integer, String> e = itr.next(); comboCountry.addItem(e.getKey()); comboCountry.setItemCaption(e.getKey(), e.getValue()); } comboCountry.select(null); isCSelected = true; } }); comboCountry.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = -404551290095133508L; @Override public void valueChange(ValueChangeEvent event) { comboState.removeAllItems(); comboLG.removeAllItems(); if (comboCountry.getValue() == null) return; Set<Entry<Integer, String>> es = (Set<Entry<Integer, String>>) getStates( Integer.valueOf(comboCountry.getValue().toString())).entrySet(); if (es.isEmpty()) { return; } Iterator<Entry<Integer, String>> itr = es.iterator(); while (itr.hasNext()) { Entry<Integer, String> e = itr.next(); comboState.addItem(e.getKey()); comboState.setItemCaption(e.getKey(), e.getValue()); } comboState.select(null); } }); comboState.addFocusListener(new FocusListener() { private static final long serialVersionUID = 892516817835461278L; @Override public void focus(FocusEvent event) { Object c = comboCountry.getValue(); if (c == null) { Notification.show("Please select country first", Notification.Type.WARNING_MESSAGE); comboCountry.focus(); return; } } }); comboState.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 8849241310354979908L; @Override public void valueChange(ValueChangeEvent event) { comboLG.removeAllItems(); if (comboState.getValue() == null) return; Set<Entry<Integer, String>> esl = (Set<Entry<Integer, String>>) getLGs( Integer.valueOf(comboState.getValue().toString())).entrySet(); if (esl.isEmpty()) { return; } Iterator<Entry<Integer, String>> itrl = esl.iterator(); while (itrl.hasNext()) { Entry<Integer, String> e = itrl.next(); comboLG.addItem(e.getKey()); comboLG.setItemCaption(e.getKey(), e.getValue()); } } }); comboLG.addFocusListener(new FocusListener() { private static final long serialVersionUID = 8925916817835461278L; @Override public void focus(FocusEvent event) { Object s = comboState.getValue(); if (comboCountry.getValue() == null) { Notification.show("Please select country first", Notification.Type.WARNING_MESSAGE); comboCountry.focus(); return; } if (s == null) { Notification.show("Please select state first", Notification.Type.WARNING_MESSAGE); comboState.focus(); return; } } }); HorizontalLayout cChk = new HorizontalLayout(); cChk.setSizeUndefined(); cChk.setMargin(new MarginInfo(true, false, true, false)); cChk.addComponent(chk); cLBody.addComponent(cChk); final VerticalLayout cRBody = new VerticalLayout(); String strNameCap = "Username"; tF = new TextField(strNameCap); cRBody.addComponent(tF); HorizontalLayout cAccBody = new HorizontalLayout(); cAccBody.addComponent(cLBody); cAccBody.addComponent(cRBody); cLBody.setStyleName("c_body_visible"); cRBody.setStyleName("c_body_invisible"); cAcc.addComponent(cAccBody); cBAndCAndAcc.addComponent(cAcc); cC.setMargin(new MarginInfo(false, true, false, true)); cAgentInfo.addComponent(cBAndCAndAcc); btnSave = new Button("Save"); btnSave.setIcon(FontAwesome.SAVE); btnSave.setStyleName("btn_link"); Button btnReset = new Button("Reset"); btnReset.setIcon(FontAwesome.UNDO); btnReset.setStyleName("btn_link"); HorizontalLayout cBtnSR = new HorizontalLayout(); cBtnSR.addComponent(btnSave); cBtnSR.addComponent(btnReset); cAcc.addComponent(cBtnSR); arrLValidatable = arrLGFields; btnSave.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -935880570210949227L; @Override public void buttonClick(ClickEvent event) { UserManagementService ums = new UserManagementService(); String strResponse = ""; String idtype = ""; try { try { if (!isValidatorAdded) addValidators(arrLValidatable); validate(arrLValidatable); } catch (InvalidValueException e) { Notification.show("Message: ", e.getMessage(), Notification.Type.ERROR_MESSAGE); return; } String bacc = (tFBAcc.getValue() == null) ? "" : tFBAcc.getValue().toString(); int bid = (comboBID.getValue() == null) ? 0 : Integer.valueOf(comboBID.getValue().toString()); String bd = (comboBDomain.getValue() == null) ? "" : comboBDomain.getValue().toString(); String clrno = (tFClrNo.getValue() == null) ? "" : tFClrNo.getValue().toString(); String cur = (comboCur.getValue() == null) ? "000" : comboCur.getValue().toString(); String accEmail = (tFAccEmail.getValue() == null) ? "" : tFAccEmail.getValue().toString(); String msisdn = (tFMSISDN.getValue() == null) ? "" : tFMSISDN.getValue().toString(); int profid = (comboProfile.getValue() == null) ? 0 : Integer.valueOf(comboProfile.getValue().toString()); String secQn = (comboSecQn.getValue() == null) ? "" : comboSecQn.getValue().toString(); String secAns = (tFSecAns.getValue() == null) ? "" : tFSecAns.getValue().toString(); String tAndC = (chcTAndC.getValue() == null) ? "" : chcTAndC.getValue().toString(); String un = (tFUN.getValue() == null) ? "" : tFUN.getValue().toString(); int country = (comboCountry.getValue() == null) ? 0 : (comboCountry.getValue().toString().trim().isEmpty()) ? 0 : Integer.valueOf(comboCountry.getValue().toString()); Date dob = (dFDoB.getValue() == null) ? new Date() : dFDoB.getValue(); String employer = (tFEmp.getValue() == null) ? "" : tFEmp.getValue().toString(); String fn = (tFFN.getValue() == null) ? "" : tFFN.getValue().toString(); String gender = (optSex.getValue() == null) ? "" : optSex.getItemCaption(optSex.getValue()).toString(); int lang = (comboLang.getValue() == null) ? 0 : (comboLang.getValue().toString().trim().isEmpty()) ? 0 : Integer.valueOf(comboLang.getValue().toString()); String ln = (tFLN.getValue() == null) ? "" : tFLN.getValue().toString(); int lgid = (comboLG.getValue() == null) ? 0 : (comboLG.getValue().toString().trim().isEmpty()) ? 0 : Integer.valueOf(comboLG.getValue().toString()); String mn = (tFMN.getValue() == null) ? "" : tFMN.getValue().toString(); String occ = (tFOcc.getValue() == null) ? "" : tFOcc.getValue().toString(); String pref = (comboPref.getValue() == null) ? "" : comboPref.getValue().toString(); int stateid = (comboState.getValue() == null) ? 0 : (comboState.getValue().toString().trim().isEmpty()) ? 0 : Integer.valueOf(comboState.getValue().toString()); String suff = (comboSuff.getValue() == null) ? "" : comboSuff.getValue().toString(); String city = (tFCity.getValue() == null) ? "" : tFCity.getValue().toString(); String pcode = (tFPostalCode.getValue() == null) ? "" : (tFPostalCode.getValue().isEmpty()) ? "000" : tFPostalCode.getValue().toString(); String str = (tFStreet.getValue() == null) ? "" : tFStreet.getValue().toString(); String prov = (tFProv.getValue() == null) ? "" : tFProv.getValue().toString(); Date doe = (dFDoE.getValue() == null) ? new Date() : dFDoE.getValue(); String idno = (tFIDNo.getValue() == null) ? "" : tFIDNo.getValue().toString(); Date doi = (dFDoI.getValue() == null) ? new Date() : dFDoI.getValue(); String issuer = (tFIssuer.getValue() == null) ? "" : tFIssuer.getValue().toString(); String pem = (tFPEmail.getValue() == null) ? "" : tFPEmail.getValue().toString(); String pmno = (tFPMNo.getValue() == null) ? "" : tFPMNo.getValue().toString(); String pamno = (tFPANo.getValue() == null) ? "" : tFPANo.getValue().toString(); String sem = (tFSEmail.getValue() == null) ? "" : tFSEmail.getValue().toString(); String smno = (tFSMNo.getValue() == null) ? "" : tFSMNo.getValue().toString(); String samno = (tFSANo.getValue() == null) ? "" : tFSANo.getValue().toString(); // IdentificationType idtype = // ProvisioningStub.IdentificationType.Factory // .fromValue(comboIDType.getValue().toString()); if (comboIDType.getValue() != null) if (comboIDType.getValue().toString().equals("Passport Number")) { idtype = ProvisioningStub.IdentificationType.PASSP.toString(); System.out.println("idtype>>>>>1 " + idtype); } else if (comboIDType.getValue().toString() .equals("National Registration Identification Number")) { idtype = ProvisioningStub.IdentificationType.NRIN.toString(); System.out.println("idtype>>>>>2 " + idtype); } else if (comboIDType.getValue().toString().equals("Drivers License Number")) { idtype = ProvisioningStub.IdentificationType.DRLCS.toString(); System.out.println("idtype>>>>>3 " + idtype); } else if (comboIDType.getValue().toString().equals("Identification Card")) { idtype = ProvisioningStub.IdentificationType.IDCD.toString(); System.out.println("idtype>>>>>4 " + idtype); } else if (comboIDType.getValue().toString().equals("Employer Identification Number")) { idtype = ProvisioningStub.IdentificationType.EMID.toString(); } else idtype = ""; System.out.println("idtype>>>>> " + idtype); System.out.println("idtype>>>>> " + ProvisioningStub.IdentificationType.PASSP.toString()); strResponse = ums.registerUser(bacc, bid, bd, clrno, cur, accEmail, msisdn, profid, secQn, secAns, tAndC, un, country, dob, employer, fn, gender, lang, ln, lgid, mn, occ, pref, stateid, suff, city, pcode, str, prov, doe, idno, idtype, doi, issuer, pem, pmno, pamno, sem, smno, samno); } catch (Exception e) { e.printStackTrace(); Notification.show("Response: ", e.getMessage(), Notification.Type.ERROR_MESSAGE); System.out.println(e.getMessage()); return; } if (strResponse.contains("completed") && strResponse.contains("successful")) { NotifCustom.show("Message: ", strResponse); reset(); } else { Notification.show("Response: " + strResponse, Notification.Type.ERROR_MESSAGE); System.out.println(strResponse); } } }); btnReset.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 3212854064282339617L; @Override public void buttonClick(ClickEvent event) { reset(); } }); return cAgentInfo; }
From source file:de.symeda.sormas.ui.dashboard.statistics.DashboardStatisticsSubComponent.java
License:Open Source License
public void addHeader(String headline, Image icon, boolean showTotalCount) { HorizontalLayout headerLayout = new HorizontalLayout(); headerLayout.setWidth(100, Unit.PERCENTAGE); headerLayout.setSpacing(true);/*from ww w .j a v a 2 s. co m*/ headerLayout.setMargin(false); CssStyles.style(headerLayout, CssStyles.VSPACE_4); VerticalLayout labelAndTotalLayout = new VerticalLayout(); { labelAndTotalLayout.setMargin(false); labelAndTotalLayout.setSpacing(false); Label headlineLabel = new Label(headline); CssStyles.style(headlineLabel, CssStyles.H2, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE); labelAndTotalLayout.addComponent(headlineLabel); if (showTotalCount) { totalCountLabel = new Label(); CssStyles.style(totalCountLabel, CssStyles.LABEL_PRIMARY, CssStyles.LABEL_XXXLARGE, CssStyles.LABEL_BOLD, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE); labelAndTotalLayout.addComponent(totalCountLabel); } else { CssStyles.style(labelAndTotalLayout, CssStyles.VSPACE_4); } } headerLayout.addComponent(labelAndTotalLayout); headerLayout.setComponentAlignment(labelAndTotalLayout, Alignment.BOTTOM_LEFT); headerLayout.setHeightUndefined(); headerLayout.setExpandRatio(labelAndTotalLayout, 1); if (icon != null) { headerLayout.addComponent(icon); headerLayout.setComponentAlignment(icon, Alignment.TOP_RIGHT); } addComponent(headerLayout); setExpandRatio(headerLayout, 0); }
From source file:de.symeda.sormas.ui.dashboard.surveillance.SurveillanceOverviewLayout.java
License:Open Source License
private void addShowMoreAndLessButtons() { HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setHeightUndefined(); buttonsLayout.setWidth(100, Unit.PERCENTAGE); buttonsLayout.setMargin(new MarginInfo(false, true)); showMoreButton = new Button(I18nProperties.getCaption(Captions.dashboardShowAllDiseases), VaadinIcons.CHEVRON_DOWN);/*from ww w .ja v a2s. c o m*/ CssStyles.style(showMoreButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4); showLessButton = new Button(I18nProperties.getCaption(Captions.dashboardShowFirstDiseases), VaadinIcons.CHEVRON_UP); CssStyles.style(showLessButton, ValoTheme.BUTTON_BORDERLESS, CssStyles.VSPACE_TOP_NONE, CssStyles.VSPACE_4); hideOverview = new CheckBox(I18nProperties.getCaption(Captions.dashboardHideOverview)); CssStyles.style(hideOverview, CssStyles.VSPACE_3); showMoreButton.addClickListener(e -> { isShowingAllDiseases = true; refresh(); showMoreButton.setVisible(false); showLessButton.setVisible(true); }); showLessButton.addClickListener(e -> { isShowingAllDiseases = false; refresh(); showLessButton.setVisible(false); showMoreButton.setVisible(true); }); hideOverview.addValueChangeListener(e -> { if (hideOverview.getValue()) { diseaseBurdenView.setVisible(false); diseaseDifferenceComponent.setVisible(false); showLessButton.setVisible(false); showMoreButton.setVisible(false); } else { diseaseBurdenView.setVisible(true); diseaseDifferenceComponent.setVisible(true); showLessButton.setVisible(isShowingAllDiseases); showMoreButton.setVisible(!isShowingAllDiseases); } }); buttonsLayout.addComponent(showMoreButton); buttonsLayout.addComponent(showLessButton); buttonsLayout.setComponentAlignment(showMoreButton, Alignment.BOTTOM_CENTER); buttonsLayout.setExpandRatio(showMoreButton, 1); buttonsLayout.setComponentAlignment(showLessButton, Alignment.BOTTOM_CENTER); buttonsLayout.setExpandRatio(showLessButton, 1); buttonsLayout.addComponent(hideOverview); buttonsLayout.setComponentAlignment(hideOverview, Alignment.BOTTOM_RIGHT); buttonsLayout.setExpandRatio(hideOverview, 0); addComponent(buttonsLayout, EXTEND_BUTTONS_LOC); isShowingAllDiseases = false; showLessButton.setVisible(false); buttonsLayout.setExpandRatio(showLessButton, 1); }
From source file:de.symeda.sormas.ui.statistics.StatisticsView.java
License:Open Source License
public void generateMap() { List<Object[]> resultData = generateStatistics(); if (resultData.isEmpty()) { resultsLayout.addComponent(emptyResultLabel); return;//from w ww . j a va 2 s . com } HorizontalLayout mapLayout = new HorizontalLayout(); mapLayout.setSpacing(true); mapLayout.setMargin(false); mapLayout.setWidth(100, Unit.PERCENTAGE); mapLayout.setHeightUndefined(); LeafletMap map = new LeafletMap(); map.setTileLayerOpacity(0.5f); map.setWidth(100, Unit.PERCENTAGE); map.setHeight(580, Unit.PIXELS); map.setZoom(6); GeoLatLon mapCenter = FacadeProvider.getGeoShapeProvider().getCenterOfAllRegions(); map.setCenter(mapCenter.getLon(), mapCenter.getLat()); List<RegionReferenceDto> regions = FacadeProvider.getRegionFacade().getAllAsReference(); List<LeafletPolygon> outlinePolygones = new ArrayList<LeafletPolygon>(); // draw outlines of all regions for (RegionReferenceDto region : regions) { GeoLatLon[][] regionShape = FacadeProvider.getGeoShapeProvider().getRegionShape(region); if (regionShape == null) { continue; } for (int part = 0; part < regionShape.length; part++) { GeoLatLon[] regionShapePart = regionShape[part]; LeafletPolygon polygon = new LeafletPolygon(); polygon.setCaption(region.getCaption()); // fillOpacity is used, so we can still hover the region polygon.setOptions("{\"weight\": 1, \"color\": '#888', \"fillOpacity\": 0.02}"); polygon.setLatLons(regionShapePart); outlinePolygones.add(polygon); } } map.addPolygonGroup("outlines", outlinePolygones); resultData.sort((a, b) -> { return Long.compare(((Number) a[0]).longValue(), ((Number) b[0]).longValue()); }); BigDecimal valuesLowerQuartile = new BigDecimal( resultData.size() > 0 ? ((Number) resultData.get((int) (resultData.size() * 0.25))[0]).longValue() : null); BigDecimal valuesMedian = new BigDecimal( resultData.size() > 0 ? ((Number) resultData.get((int) (resultData.size() * 0.5))[0]).longValue() : null); BigDecimal valuesUpperQuartile = new BigDecimal( resultData.size() > 0 ? ((Number) resultData.get((int) (resultData.size() * 0.75))[0]).longValue() : null); List<LeafletPolygon> resultPolygons = new ArrayList<LeafletPolygon>(); // Draw relevant district fills for (Object[] resultRow : resultData) { ReferenceDto regionOrDistrict = (ReferenceDto) resultRow[1]; String shapeUuid = regionOrDistrict.getUuid(); BigDecimal regionOrDistrictValue = new BigDecimal(((Number) resultRow[0]).longValue()); GeoLatLon[][] shape; switch (visualizationComponent.getVisualizationMapType()) { case REGIONS: shape = FacadeProvider.getGeoShapeProvider().getRegionShape(new RegionReferenceDto(shapeUuid)); break; case DISTRICTS: shape = FacadeProvider.getGeoShapeProvider().getDistrictShape(new DistrictReferenceDto(shapeUuid)); break; default: throw new IllegalArgumentException(visualizationComponent.getVisualizationMapType().toString()); } if (shape == null) { continue; } for (int part = 0; part < shape.length; part++) { GeoLatLon[] shapePart = shape[part]; String fillColor; if (regionOrDistrictValue.compareTo(BigDecimal.ZERO) == 0) { fillColor = "#000"; } else if (regionOrDistrictValue.compareTo(valuesLowerQuartile) < 0) { fillColor = "#FEDD6C"; } else if (regionOrDistrictValue.compareTo(valuesMedian) < 0) { fillColor = "#FDBF44"; } else if (regionOrDistrictValue.compareTo(valuesUpperQuartile) < 0) { fillColor = "#F47B20"; } else { fillColor = "#ED1B24"; } LeafletPolygon polygon = new LeafletPolygon(); polygon.setCaption(regionOrDistrict.getCaption() + "<br>" + regionOrDistrictValue); // fillOpacity is used, so we can still hover the region polygon.setOptions("{\"stroke\": false, \"color\": '" + fillColor + "', \"fillOpacity\": 0.8}"); polygon.setLatLons(shapePart); resultPolygons.add(polygon); } } map.addPolygonGroup("results", resultPolygons); mapLayout.addComponent(map); mapLayout.setExpandRatio(map, 1); AbstractOrderedLayout regionLegend = DashboardMapComponent.buildRegionLegend(true, CaseMeasure.CASE_COUNT, false, valuesLowerQuartile, valuesMedian, valuesUpperQuartile); Label legendHeader = new Label(I18nProperties.getCaption(Captions.dashboardMapKey)); CssStyles.style(legendHeader, CssStyles.H4, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_NONE); regionLegend.addComponent(legendHeader, 0); mapLayout.addComponent(regionLegend); mapLayout.setExpandRatio(regionLegend, 0); resultsLayout.addComponent(mapLayout); resultsLayout.setExpandRatio(mapLayout, 1); }
From source file:org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout.java
License:Open Source License
private void buildLayout() { final HorizontalLayout header = new HorizontalLayout(); header.addStyleName("artifact-details-header"); header.addStyleName("bordered-layout"); header.addStyleName("no-border-bottom"); header.setSpacing(false);//from w w w . j a v a 2 s.c o m header.setMargin(false); header.setSizeFull(); header.setHeightUndefined(); header.setImmediate(true); header.addComponents(titleOfArtifactDetails, maxMinButton); header.setComponentAlignment(titleOfArtifactDetails, Alignment.TOP_LEFT); header.setComponentAlignment(maxMinButton, Alignment.TOP_RIGHT); header.setExpandRatio(titleOfArtifactDetails, 1.0F); setSizeFull(); setImmediate(true); addStyleName("artifact-table"); addStyleName("table-layout"); addComponent(header); setComponentAlignment(header, Alignment.MIDDLE_CENTER); addComponent(artifactDetailsTable); setComponentAlignment(artifactDetailsTable, Alignment.MIDDLE_CENTER); setExpandRatio(artifactDetailsTable, 1.0F); }