List of usage examples for com.vaadin.ui HorizontalLayout setMargin
@Override public void setMargin(boolean enabled)
From source file:com.swifta.mats.web.usermanagement.AddUserModule.java
public VerticalLayout aumModifier(HorizontalLayout contentC) { contentC.removeAllComponents();/* ww w . j a va 2s . c o m*/ VerticalLayout uf = getAddUserForm(); contentC.addComponent(uf); contentC.setComponentAlignment(uf, Alignment.MIDDLE_CENTER); contentC.setSpacing(false); contentC.setMargin(true); contentC.setSizeFull(); return uf; }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private HorizontalLayout getAccLog() { HorizontalLayout c = new HorizontalLayout(); c.setSizeFull();//from w w w. ja v a 2 s . c o m Label lb = new Label("No Data Available!"); c.addComponent(lb); c.setMargin(true); c.setComponentAlignment(lb, Alignment.MIDDLE_CENTER); return c; }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private HorizontalLayout getActLog() { HorizontalLayout c = new HorizontalLayout(); c.setSizeFull();//from w w w . j a va 2 s.c om Label lb = new Label("No Data Available!"); c.addComponent(lb); c.setComponentAlignment(lb, Alignment.MIDDLE_CENTER); c.setMargin(true); return c; }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private VerticalLayout getEUDContainer() { if (cBtnEditCancel != null) cBtnEditCancel.setVisible(false); HashMap<Integer, String> profToID = new HashMap<>(); profToID.put(1, "MATS_ADMIN_USER_PROFILE"); profToID.put(3, "MATS_FINANCIAL_CONTROLLER_USER_PROFILE"); profToID.put(4, "MATS_CUSTOMER_CARE_USER_PROFILE"); profToID.put(6, "MATS_SUPER_AGENT_USER_PROFILE"); profToID.put(7, "MATS_SUB_AGENT_USER_PROFILE"); profToID.put(11, "MATS_DEALER_USER_PROFILE"); profToID.put(15, "MATS_SERVICE_PROVIDER_USER_PROFILE"); VerticalLayout cAgentInfo = new VerticalLayout(); cAgentInfo.setMargin(new MarginInfo(true, false, true, false)); cAgentInfo.setStyleName("c_details_test"); cAgentInfo.setSizeUndefined();// w w w . j av a2s . c o m VerticalLayout cBasic = new VerticalLayout(); Label lbB = new Label("Basic"); lbB.setStyleName("lb_frm_add_user"); cBasic.addComponent(lbB); TextField tF = new TextField("First Name"); tFFN = tF; tFFN.setRequired(true); tF.setValue("Paul"); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cBasic.addComponent(tF); tF = new TextField("Middle Name"); tF.setValue("Pwndz"); tFMN = tF; tFMN.setRequired(true); cBasic.addComponent(tF); tF = new TextField("Last Name"); tF.setValue("Kigozi"); tFLN = tF; tFLN.setRequired(true); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cBasic.addComponent(tF); OptionGroup opt = new OptionGroup("Gender"); opt.addItem("FEMALE"); // opt.setItemCaption(1, "Female"); opt.addItem("MALE"); // opt.setItemCaption(2, "Male"); opt.select("MALE"); optSex = opt; optSex.setRequired(true); arrLAllFormFields.add(opt); arrLAllEditableFields.add(opt); arrLTfEditableVals.add(opt.getValue().toString()); cBasic.addComponent(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. "); arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); cBasic.addComponent(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; arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); cBasic.addComponent(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); arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); cBasic.addComponent(combo); tF = new TextField("Occupation"); tF.setValue("Software Engineer"); tFOcc = tF; tFOcc.setRequired(true); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cBasic.addComponent(tF); tF = new TextField("Employer"); tF.setValue("Swifta"); tFEmp = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cBasic.addComponent(tF); PopupDateField dF = new PopupDateField("DoB"); cal = Calendar.getInstance(); cal.set(1988, 11, 12); dF.setValue(cal.getTime()); dFDoB = dF; arrLAllFormFields.add(dF); arrLAllEditableFields.add(dF); arrLTfEditableVals.add(dF.getValue().toString()); cBasic.addComponent(dF); combo = new ComboBox("Country"); comboCountry = combo; comboCountry.setRequired(true); cBasic.addComponent(combo); combo = new ComboBox("State"); comboState = combo; comboState.setRequired(true); comboState.setNullSelectionAllowed(false); arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); cBasic.addComponent(combo); combo = new ComboBox("Local Government"); // combo.addItem(1); // combo.setItemCaption(1, "Ca. LG"); // combo.select(1); comboLG = combo; comboLG.setRequired(true); arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); cBasic.addComponent(combo); /* * if (!(strUserType.equals("CCO") || strUserType.equals("BA"))) { * * cBasic.addComponent(dF); * * combo.addItem("Passport"); combo.addItem("Voter's Card"); * combo.addItem("Driving License"); combo.addItem("National ID"); * combo.addItem("Residential ID"); cBasic.addComponent(combo); * * tF = new TextField("ID No."); cBasic.addComponent(tF); * * combo = new ComboBox("State"); cBasic.addComponent(combo); * * combo = new ComboBox("Country"); cBasic.addComponent(combo); } */ VerticalLayout cC = new VerticalLayout(); HorizontalLayout cBAndCAndAcc = new HorizontalLayout(); cBAndCAndAcc.addComponent(cBasic); cBAndCAndAcc.addComponent(cC); VerticalLayout cCompany = new VerticalLayout(); // Label lbC = new Label("Company"); 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"); combo.select("Passport Number"); comboIDType = combo; comboIDType.setRequired(true); arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); cCompany.addComponent(combo); tF = new TextField("ID No."); tF.setValue("001"); tFIDNo = tF; tFIDNo.setRequired(true); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cCompany.addComponent(tF); tF = new TextField("Issuer"); tFIssuer = tF; tFIssuer.setValue("Republic of Uganda"); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cCompany.addComponent(tF); dF = new PopupDateField("Issue Date"); // cal = Calendar.getInstance(); cal.set(12, 12, 12); dF.setValue(cal.getTime()); dFDoI = dF; arrLAllFormFields.add(dF); arrLAllEditableFields.add(dF); arrLTfEditableVals.add(dF.getValue().toString()); cCompany.addComponent(dF); dF = new PopupDateField("Expiry Date"); // cal = Calendar.getInstance(); cal.set(14, 12, 12); dF.setValue(cal.getTime()); dF.setValue(cal.getTime()); dFDoE = dF; dFDoE.setRequired(true); dFDoE.setImmediate(true); arrLAllFormFields.add(dF); arrLAllEditableFields.add(dF); arrLTfEditableVals.add(dF.getValue().toString()); cCompany.addComponent(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); tF = new TextField("Mobile Phone No."); tF.setValue("+256704191152"); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); tFPMNo = tF; pC.addComponent(tF); tF = new TextField("Alt. Phone No."); tF.setValue("+1704191152"); tFPANo = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); pC.addComponent(tF); tF = new TextField("Email Address"); tF.setValue("pwndz172@gmail.com"); tFPEmail = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); pC.addComponent(tF); cC.addComponent(pC); 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); sC.addComponent(cLbc); tF = new TextField("Mobile Phone No."); tF.setValue("+256804191152"); tFSMNo = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); sC.addComponent(tF); tF = new TextField("Alt. Phone No."); tF.setValue("+1804191152"); tFSANo = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); sC.addComponent(tF); tF = new TextField("E-mail Address"); tF.setValue("pkigozi@swifta.com"); tFSEmail = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); sC.addComponent(tF); 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); tF = new TextField("Street"); tF.setValue("Yusuf Lule Rd."); tFStreet = tF; tFStreet.setRequired(true); physicalC.addComponent(tF); tF = new TextField("Postal Code"); tF.setValue("23"); tFPostalCode = tF; physicalC.addComponent(tF); tF = new TextField("City"); tF.setValue("Kampala"); tFCity = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); tFCity.setRequired(true); physicalC.addComponent(tF); tF = new TextField("Province"); tF.setValue("Central"); tFProv = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); physicalC.addComponent(tF); cC.addComponent(physicalC); /* * || strUserType.equals("BA"))) { tF = new TextField("Fax"); * cC.addComponent(tF); // strAccTypeCaption = Hierarch } */ /* * tF = new TextField("E-mail Address"); cC.addComponent(tF); * * tF = new TextField("Physical Address"); cC.addComponent(tF); */ 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); arrLAllFormFields.add(comboProfile); arrLAllEditableFields.add(comboProfile); arrLTfEditableVals.add((comboProfile.getValue() == null) ? "" : comboProfile.getValue().toString()); cAcc.addComponent(comboHierarchy); final VerticalLayout cLBody = new VerticalLayout(); tF = new TextField("Username"); tF.setValue("Livepwndz"); tFUN = tF; tFUN.setRequired(true); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cLBody.addComponent(tF); tF = new TextField("MSISDN"); tF.setValue("+256774191152"); tFMSISDN = tF; tFMSISDN.setRequired(true); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cLBody.addComponent(tF); // / tF = new TextField("PIN"); // / cLBody.addComponent(tF); tF = new TextField("Email"); tFAccEmail = tF; tFAccEmail.setRequired(true); tFAccEmail.setValue("ppounds1@gmail.com"); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cLBody.addComponent(tF); combo = new ComboBox("Bank Domain"); combo.addItem("Stanbic Bank"); combo.select("Stanbic Bank"); comboBDomain = combo; arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); cLBody.addComponent(combo); combo = new ComboBox("Bank Code ID"); combo.addItem("001"); combo.select("001"); comboBID = combo; arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); cLBody.addComponent(combo); tF = new TextField("Bank Account"); tF.setValue("00232333452315"); tFBAcc = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); // tFBAcc.setValidationVisible(true); // tFBAcc.addValidator(new NoNull()); cLBody.addComponent(tF); combo.addItem(1); combo.setItemCaption(1, "US Dollars"); combo.select(1); comboCur = combo; arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); cLBody.addComponent(combo); tF = new TextField("Clearing Number"); tF.setValue("00212"); tFClrNo = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); cLBody.addComponent(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; arrLAllFormFields.add(combo); arrLAllEditableFields.add(combo); arrLTfEditableVals.add((combo.getValue() == null) ? "" : combo.getValue().toString()); // cLBody.addComponent(combo); tF = new TextField("Answer"); tF.setValue("Mrs. X"); tFSecAns = tF; arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); // cLBody.addComponent(tF); CheckBox chk = new CheckBox("I accept the terms" + " and conditons."); chcTAndC = chk; chk.setStyleName("check_t_and_c"); chk.addValueChangeListener(new ValueChangeListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { // Notification.show(event.getProperty().getValue().toString()); } }); 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 = (Entry<Integer, String>) 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); arrLAllFormFields.add(tF); arrLAllEditableFields.add(tF); arrLTfEditableVals.add(tF.getValue()); 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); final String btnSaveId = "save"; final String btnEditId = "edit"; final Button btnEdit = new Button(); btnEdit.setIcon(FontAwesome.SAVE); btnEdit.setId(btnSaveId); btnEdit.setStyleName("btn_link"); final Button btnCancel = new Button(); btnCancel.setVisible(true); btnCancel.setIcon(FontAwesome.UNDO); btnCancel.setStyleName("btn_link"); final HorizontalLayout cBtnSR = new HorizontalLayout(); cBtnSR.addComponent(btnEdit); cBtnSR.addComponent(btnCancel); // cBtnEditCancel cAcc.addComponent(cBtnSR); btnEdit.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -935880570210949227L; @Override public void buttonClick(ClickEvent event) { /* * Prepare all Editable fields (Entire form) for editing. */ if (event.getButton().getId().equals(btnEditId)) { /* * By Default, btnCancel is not visible, until btnEdit is * clicked. Only until then is it added and visible. */ if (!btnCancel.isVisible()) { event.getButton().setId(btnSaveId); event.getButton().setIcon(FontAwesome.SAVE); btnCancel.setVisible(true); cBtnSR.addComponent(btnCancel); } enableEditableFormFields(arrLAllEditableFields); } else { if (event.getButton().getId().equals(btnSaveId)) { /* * * * * * commit (save) changes i.e, send changes back to the * server. */ try { validateAndSave(); // cUPersonalDetails.removeAllComponents(); // cUPersonalDetails.addComponent(getUDContainer()); // Notification.show("Details successfully saved.", // Notification.Type.WARNING_MESSAGE); } catch (Exception e) { // Notification.show("Hello"); return; } // Remove undo button (btnCancel) btnCancel.setVisible(false); // Reset all Editable fields to readOnly after saving to // the server // disableEditableFields(arrLAllEditableFields); // Reset btnEdit id to btnIdEdit and caption(icon) to // FontAwesome.EDIT btnEdit.setId(btnEditId); btnEdit.setIcon(FontAwesome.EDIT); btnEdit.setVisible(false); // Reset Edit status to false uDetailsEditStatus = false; } } } }); btnCancel.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = -8179030387969880920L; @Override public void buttonClick(ClickEvent event) { resetForm(arrLAllEditableFields, arrLTfEditableVals); btnEdit.setId(btnEditId); btnEdit.setIcon(FontAwesome.EDIT); btnEdit.setVisible(false); btnCancel.setVisible(false); } }); return cAgentInfo; }
From source file:com.tapas.evidence.fe.main.MainPresenter.java
License:Apache License
private void componentLocation() { final HorizontalLayout buttonBar = this.view.getButtonBar(); buttonBar.setExpandRatio(this.getView().getExpander(), 0.5f); buttonBar.setExpandRatio(this.getView().getTitle(), 0.5f); buttonBar.setMargin(true); }
From source file:cz.zcu.pia.social.network.frontend.components.posts.ComponentPost.java
/** * Adds click listeners to the buttons//from w w w. j a va2s . c o m */ private void addClickListeners() { this.likes.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Post post = componentPostService.updateLikeRating(postId); numberOfLikes = post.getLikeCount(); numberOfDisagrees = post.getHateCount(); updateHateLike(); } }); this.disagrees.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Post post = componentPostService.updateDisagreeRating(postId); numberOfLikes = post.getLikeCount(); numberOfDisagrees = post.getHateCount(); updateHateLike(); } }); this.tags.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("post.tags")); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(110, Unit.PIXELS); subWindow.setResizable(false); Panel panel = new Panel(); panel.setSizeFull(); HorizontalLayout tagsWrapper = new HorizontalLayout(); tagsWrapper.setStyleName("margin-left-big"); panel.setContent(tagsWrapper); tagsWrapper.setSpacing(true); tagsWrapper.setMargin(true); tagsWrapper.setSizeUndefined(); for (Tag t : postService.getPostTags(postId)) { CustomLayout tag = new CustomLayout("tag"); Button tagLabel = new Button(t.getTagName()); tag.addComponent(tagLabel, "button"); tagsWrapper.addComponent(tag); } subWindow.setContent(panel); UI.getCurrent().addWindow(subWindow); } }); this.comments.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("post.comments")); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(600, Unit.PIXELS); subWindow.setResizable(true); ComponentPostComments componentPostComments = applicationContext .getBean(ComponentPostComments.class, postId); subWindow.setContent(componentPostComments); UI.getCurrent().addWindow(subWindow); } }); this.name.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Window subWindow = new Window(msgs.getMessage("header.profile") + "- " + name.getCaption()); subWindow.setModal(true); subWindow.center(); subWindow.setWidth(400, Unit.PIXELS); subWindow.setHeight(350, Unit.PIXELS); subWindow.setResizable(true); Users user = postService.getPostById(postId).getUser(); ComponentProfilePost profilePost = applicationContext.getBean(ComponentProfilePost.class, user); subWindow.setContent(profilePost); UI.getCurrent().addWindow(subWindow); } }); }
From source file:de.catma.CatmaApplication.java
License:Open Source License
@Override public void init() { Properties properties = loadProperties(); backgroundService = new BackgroundService(this); final Window mainWindow = new Window("CATMA 4.1 - CLA " + VERSION); mainWindow.addParameterHandler(this); HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setSizeUndefined();/*from w w w.j a va2 s . c o m*/ mainLayout.setMargin(true); mainLayout.setSpacing(true); mainWindow.addStyleName("catma-mainwindow"); mainWindow.setContent(mainLayout); MenuFactory menuFactory = new MenuFactory(); try { initTempDirectory(properties); tagManager = new TagManager(); repositoryManagerView = new RepositoryManagerView(new RepositoryManager(this, tagManager, properties)); tagManagerView = new TagManagerView(tagManager); taggerManagerView = new TaggerManagerView(); analyzerManagerView = new AnalyzerManagerView(); visualizationManagerView = new VisualizationManagerView(); defaultProgressIndicator = new ProgressIndicator(); defaultProgressIndicator.setIndeterminate(true); defaultProgressIndicator.setEnabled(false); defaultProgressIndicator.setPollingInterval(500); progressWindow = new ProgressWindow(defaultProgressIndicator); menu = menuFactory.createMenu(mainLayout, new MenuFactory.MenuEntryDefinition("Repository Manager", new RepositoryManagerWindow(repositoryManagerView)), new MenuFactory.MenuEntryDefinition("Tag Manager", new TagManagerWindow(tagManagerView)), new MenuFactory.MenuEntryDefinition("Tagger", new TaggerManagerWindow(taggerManagerView)), new MenuFactory.MenuEntryDefinition("Analyzer", new AnalyzerManagerWindow(analyzerManagerView)), new MenuFactory.MenuEntryDefinition("Visualizer", new VisualizationManagerWindow(visualizationManagerView))); Link aboutLink = new Link("About", new ExternalResource("http://www.catma.de")); aboutLink.setTargetName("_blank"); mainLayout.addComponent(aboutLink); mainLayout.setComponentAlignment(aboutLink, Alignment.TOP_RIGHT); mainLayout.setExpandRatio(aboutLink, 1.0f); Link helpLink = new Link("Help", new ExternalResource(getURL() + "manual/")); helpLink.setTargetName("_blank"); mainLayout.addComponent(helpLink); mainLayout.setComponentAlignment(helpLink, Alignment.TOP_RIGHT); Label helpLabel = new Label(); helpLabel.setIcon(new ClassResource("ui/resources/icon-help.gif", this)); helpLabel.setWidth("20px"); helpLabel.setDescription( "<h3>Hints</h3>" + "<p>Watch out for these little question mark icons while navigating " + "through CATMA. They provide useful hints for managing the first " + "steps within a CATMA component.</p>" + "<h4>Login</h4>" + "Once you're logged in, you will see the Repository Manager, " + "which will explain the first steps to you. " + "Just hover your mouse over the question mark icons!"); VerticalLayout helpWrapper = new VerticalLayout(); helpWrapper.addComponent(helpLabel); helpWrapper.setComponentAlignment(helpLabel, Alignment.TOP_RIGHT); Animator helpAnimator = new Animator(helpWrapper); helpAnimator.setFadedOut(true); mainLayout.addComponent(helpAnimator); mainLayout.setComponentAlignment(helpAnimator, Alignment.TOP_RIGHT); helpAnimator.fadeIn(2000, 300); MenuBar loginLogoutMenu = new MenuBar(); LoginLogoutCommand loginLogoutCommand = new LoginLogoutCommand(menu, repositoryManagerView, this); MenuItem loginLogoutitem = loginLogoutMenu.addItem("Login", loginLogoutCommand); loginLogoutCommand.setLoginLogoutItem(loginLogoutitem); mainLayout.addComponent(loginLogoutMenu); mainLayout.setComponentAlignment(loginLogoutMenu, Alignment.TOP_RIGHT); mainLayout.setWidth("100%"); } catch (Exception e) { showAndLogError("The system could not be initialized!", e); } setMainWindow(mainWindow); setTheme("cleatheme"); }
From source file:de.catma.ui.repository.wizard.LocationPanel.java
License:Open Source License
private void initComponents() { setSpacing(true);// w ww . j a v a2s . c o m setMargin(true, false, false, false); setSizeFull(); HorizontalLayout remoteLayout = new HorizontalLayout(); remoteLayout.setMargin(true); remoteLayout.setSpacing(true); remoteLayout.setSizeFull(); remoteURIInputPanel = new Panel(remoteLayout); remoteURIInput = new TextField(); remoteURIInput.setCaption("Enter an URI that is accessible over the internet:"); remoteURIInput.setWidth("100%"); remoteURIInput.setTextChangeEventMode(TextChangeEventMode.EAGER); remoteURIInputPanel.addComponent(remoteURIInput); remoteLayout.setExpandRatio(remoteURIInput, 2); addComponent(remoteURIInputPanel); Label localFileLabel = new Label("or upload a local file from your computer:"); addComponent(localFileLabel); uploadPanel = new UploadPanel(); addComponent(uploadPanel); }
From source file:de.datenhahn.vaadin.componentrenderer.demo.StaticCustomerDetailsGenerator.java
License:Apache License
@Override public Component getDetails(Grid.RowReference rowReference) { rowReference.getGrid().scrollTo(rowReference.getItemId()); StaticCustomer customer = (StaticCustomer) rowReference.getItemId(); HorizontalLayout layout = new HorizontalLayout(); layout.setHeight(300, Sizeable.Unit.PIXELS); layout.setMargin(true); layout.setSpacing(true);//from w ww.ja v a2 s . c om Image image = new Image("", customer.getPhoto()); image.setHeight(200, Sizeable.Unit.PIXELS); image.setWidth(200, Sizeable.Unit.PIXELS); layout.addComponent(image); Label nameLabel = new Label("<h1>" + customer.getFirstName() + " " + customer.getLastName() + "</h1>", ContentMode.HTML); layout.addComponent(nameLabel); layout.setExpandRatio(nameLabel, 1.0f); return layout; }
From source file:de.escidoc.admintool.view.MainView.java
License:Open Source License
private void show(final Button button) { final HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/*w w w. j ava 2 s.c om*/ layout.setMargin(true); layout.addComponent(new Label("eSciDoc AdminTool " + "1.1.2-SNAPSHOT", Label.CONTENT_XHTML)); layout.addComponent(new Label("|", Label.CONTENT_XHTML)); layout.addComponent( new Label("<b>User: " + currentUser.getProperties().getLoginName() + "</b>", Label.CONTENT_XHTML)); layout.addComponent(new Label("|", Label.CONTENT_XHTML)); layout.addComponent(button); toolbar = factory.createToolbar(layout); }