List of usage examples for com.vaadin.ui TextField TextField
public TextField()
TextField
with no caption. From source file:com.klwork.explorer.ui.task.ProcessInstanceEventsPanel.java
License:Apache License
public void initAddEventInput(HorizontalLayout hLayout) { Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be // attached to panels or windows textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT); VerticalLayout textFieldPanelLayout = new VerticalLayout(); textFieldPanel.setContent(textFieldPanelLayout); textFieldPanel.setWidth(100, Unit.PERCENTAGE); hLayout.addComponent(textFieldPanel); hLayout.setExpandRatio(textFieldPanel, 1.0f); commentInputField = new TextField(); commentInputField.setWidth(100, Unit.PERCENTAGE); textFieldPanelLayout.addComponent(commentInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { public void handleAction(Action action, Object sender, Object target) { addNewComment(commentInputField.getValue().toString()); }//from w w w . j a v a 2s . c o m public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) }; } }); }
From source file:com.klwork.explorer.ui.task.SubTaskComponent.java
License:Apache License
protected void initAddButton() { addSubTaskButton = new Button(); addSubTaskButton.addStyleName(ExplorerLayout.STYLE_ADD); addToSubTaskPanel(addSubTaskButton); addSubTaskButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { // Remove button //addSubTaskPanel.removeAllComponents(); clearPanelAllComponents();//from w w w . j a v a 2 s . c om // And add textfield Label createSubTaskLabel = new Label("Create new subtask:"); createSubTaskLabel.addStyleName(Reindeer.LABEL_SMALL); addToSubTaskPanel(createSubTaskLabel); newTaskTextField = new TextField(); newTaskTextField.focus(); //addSubTaskPanel.addComponent(newTaskTextField); addToSubTaskPanel(newTaskTextField); } }); }
From source file:com.klwork.explorer.ui.task.TaskEventsPanel.java
License:Apache License
public void initAddEventInput(HorizontalLayout hLayout) { Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be attached to panels or windows textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT); VerticalLayout textFieldPanelLayout = new VerticalLayout(); textFieldPanel.setContent(textFieldPanelLayout); textFieldPanel.setWidth(100, Unit.PERCENTAGE); hLayout.addComponent(textFieldPanel); hLayout.setExpandRatio(textFieldPanel, 1.0f); commentInputField = new TextField(); commentInputField.setWidth(100, Unit.PERCENTAGE); textFieldPanelLayout.addComponent(commentInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { public void handleAction(Action action, Object sender, Object target) { addNewComment(commentInputField.getValue().toString()); }/*from ww w . j a v a2s . c o m*/ public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) }; } }); }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected void initAboutSection() { // Header//w ww .ja v a2s . co m HorizontalLayout header = new HorizontalLayout(); header.setWidth(100, Unit.PERCENTAGE); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); infoPanelLayout.addComponent(header); Label aboutLabel = createProfileHeader(i18nManager.getMessage(Messages.PROFILE_ABOUT)); header.addComponent(aboutLabel); header.setExpandRatio(aboutLabel, 1.0f); // only show edit/save buttons if current user matches if (isCurrentLoggedInUser) { Button actionButton = null; if (!editable) { actionButton = initEditProfileButton(); } else { actionButton = initSaveProfileButton(); } header.addComponent(actionButton); header.setComponentAlignment(actionButton, Alignment.MIDDLE_RIGHT); } // 'About' fields GridLayout aboutLayout = createInfoSectionLayout(2, 4); // Name if (!editable && (isDefined(user.getFirstName()) || isDefined(user.getLastName()))) { addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_NAME), user.getFirstName() + " " + user.getLastName()); } else if (editable) { firstNameField = new TextField(); firstNameField.focus(); addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_FIRST_NAME), firstNameField, user.getFirstName()); lastNameField = new TextField(); addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LAST_NAME), lastNameField, user.getLastName()); } // Job title if (!editable && isDefined(jobTitle)) { addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitle); } else if (editable) { jobTitleField = new TextField(); addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitleField, jobTitle); } // Birthdate if (!editable && isDefined(birthDate)) { addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDate); } else if (editable) { birthDateField = new DateField(); birthDateField.setDateFormat(Constants.DEFAULT_DATE_FORMAT); birthDateField.setResolution(DateField.RESOLUTION_DAY); try { birthDateField.setValue(new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT).parse(birthDate)); } catch (Exception e) { } // do nothing addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDateField, null); } // Location if (!editable && isDefined(location)) { addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), location); } else if (editable) { locationField = new TextField(); addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), locationField, location); } }
From source file:com.klwork.explorer.ui.user.ProfilePanel.java
License:Apache License
protected void initContactSection() { Label header = createProfileHeader(i18nManager.getMessage(Messages.PROFILE_CONTACT)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); infoPanelLayout.addComponent(header); GridLayout contactLayout = createInfoSectionLayout(2, 4); // Email/*w ww . j a va 2s. c om*/ if (!editable && isDefined(user.getEmail())) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), user.getEmail()); } else if (editable) { emailField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_EMAIL), emailField, user.getEmail()); } // Phone if (!editable && isDefined(phone)) { addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phone); } else if (editable) { phoneField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_PHONE), phoneField, phone); } // Twitter if (!editable && isDefined(twitterName)) { Link twitterLink = new Link(twitterName, new ExternalResource("http://www.twitter.com/" + twitterName)); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterLink); } else if (editable) { twitterField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_TWITTER), twitterField, twitterName); } // Skype if (!editable && isDefined(skypeId)) { // The skype entry shows the name + skype icon, laid out in a small grid GridLayout skypeLayout = new GridLayout(2, 1); skypeLayout.setSpacing(true); skypeLayout.setSizeUndefined(); Label skypeIdLabel = new Label(skypeId); skypeIdLabel.setSizeUndefined(); skypeLayout.addComponent(skypeIdLabel); addProfileEntry(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeLayout); } else if (editable) { skypeField = new TextField(); addProfileInputField(contactLayout, i18nManager.getMessage(Messages.PROFILE_SKYPE), skypeField, skypeId); } }
From source file:com.liferay.mail.vaadin.Composer.java
License:Open Source License
private FormLayout buildRecipientsLayout() { // common part: create layout recipientsLayout = new FormLayout(); recipientsLayout.setSpacing(true);// w ww. ja va 2s . c o m toField = new TextField(); toField.setImmediate(false); toField.setHeight("-1px"); toField.setWidth("100.0%"); toField.setCaption(Lang.get("to")); recipientsLayout.addComponent(toField); ccField = new TextField(); ccField.setImmediate(false); ccField.setHeight("-1px"); ccField.setWidth("100.0%"); ccField.setCaption(Lang.get("cc")); recipientsLayout.addComponent(ccField); bccField = new TextField(); bccField.setImmediate(false); bccField.setHeight("-1px"); bccField.setWidth("100.0%"); bccField.setCaption(Lang.get("bcc")); recipientsLayout.addComponent(bccField); return recipientsLayout; }
From source file:com.liferay.mail.vaadin.Composer.java
License:Open Source License
private HorizontalLayout buildSubjectLayout() { // common part: create layout subjectLayout = new HorizontalLayout(); // subject/*from ww w . j a v a2s.c om*/ subject = new TextField(); subject.setImmediate(false); subject.setHeight("-1px"); subject.setWidth("100.0%"); subjectLayout.addComponent(subject); return subjectLayout; }
From source file:com.liferay.mail.vaadin.FolderTree.java
License:Open Source License
public void handleAccountAction(AccountAction action) { final Long accountId = action.getAccountId(); if (accountId == null) { return;/*from ww w. j a v a2 s . co m*/ } if (Lang.get("create-folder").equals(action.getCaption())) { String title = Lang.get("create-folder"); String message = Lang.get("please-enter-a-folder-name"); final ConfirmDialog confirm = new ConfirmDialog(Lang.get("confirm"), title, message); final TextField newNameField = new TextField(); newNameField.setNullRepresentation(""); newNameField.setValue("new folder"); confirm.addExtraComponent(newNameField); confirm.addConfirmButtonListener(new ClickListener() { public void buttonClick(ClickEvent event) { String newName = (String) newNameField.getValue(); if (newName != null && !"".equals(newName)) { confirm.closeDialog(); addFolder(accountId, newName); synchronizeAccount(accountId, Controller.get()); refresh(); } else { Controller.get().showError(Lang.get("please-enter-a-folder-name")); } } }); Controller.get().getApplication().getMainWindow().addWindow(confirm); } }
From source file:com.liferay.mail.vaadin.FolderTree.java
License:Open Source License
public void handleFolderAction(FolderAction action) { final Folder folder = action.getFolder(); if (folder == null) { return;// w ww. j a v a 2 s .co m } if (Lang.get("rename-folder").equals(action.getCaption())) { String title = Lang.get("rename-folder"); String message = Lang.get("please-enter-a-new-folder-name"); final ConfirmDialog confirm = new ConfirmDialog(Lang.get("confirm"), title, message); final TextField newNameField = new TextField(); newNameField.setNullRepresentation(""); newNameField.setValue(folder.getDisplayName()); confirm.addExtraComponent(newNameField); confirm.addConfirmButtonListener(new ClickListener() { public void buttonClick(ClickEvent event) { String newName = (String) newNameField.getValue(); if (newName != null && !"".equals(newName)) { confirm.closeDialog(); renameFolder(folder.getFolderId(), newName); synchronizeAccount(folder.getAccountId(), Controller.get()); refresh(); } else { Controller.get().showError(Lang.get("please-enter-a-new-folder-name")); } } }); Controller.get().getApplication().getMainWindow().addWindow(confirm); } else if (Lang.get("delete-folder").equals(action.getCaption())) { final ConfirmDialog confirm = new ConfirmDialog(Lang.get("confirm"), Lang.get("delete-folder"), Lang.get("are-you-sure-you-want-to-delete-this-folder")); confirm.addConfirmButtonListener(new ClickListener() { public void buttonClick(ClickEvent event) { confirm.closeDialog(); deleteFolder(folder.getFolderId()); synchronizeAccount(folder.getAccountId(), Controller.get()); refresh(); } }); Controller.get().getApplication().getMainWindow().addWindow(confirm); } }
From source file:com.logicbomb.newschool.pages.masterpages.PrimaryMasterPage.java
public PrimaryMasterPage() { //ContextWidget c= new ContextWidget(); HorizontalLayout iHorizontalLayout = new HorizontalLayout(); //addComponent(iHorizontalLayout,"top:0px;left:0px"); iHorizontalLayout.setWidth(String.valueOf(Page.getCurrent().getBrowserWindowWidth())); iHorizontalLayout.setHeight(String.valueOf(Page.getCurrent().getBrowserWindowHeight())); iHorizontalLayout.setStyleName("backColorBlack"); //String[] captions1 = {"Logo Here", "My Cool School", "Third"}; //Layout A and its sub components Panel AP = new Panel(); iHorizontalLayout.addComponent(AP);//from www . j a v a 2 s . com AP.setSizeFull(); AP.setStyleName("backColorBlack"); VerticalLayout A1 = new VerticalLayout(); AP.setContent(A1); //A.setSizeFull(); A1.setSpacing(true); iHorizontalLayout.setExpandRatio(AP, 1); A1.setStyleName("backColorBlack"); A1.setMargin(new MarginInfo(true, true, true, true)); Button logoImage = new Button(); logoImage.setIcon(FontAwesome.PICTURE_O); logoImage.setWidth("80px"); logoImage.setHeight(logoImage.getWidth(), Unit.PIXELS); //logoImage.setWidth("100px"); A1.addComponent(logoImage); A1.setComponentAlignment(logoImage, Alignment.TOP_CENTER); Label schoolName = new Label("The School Of Future"); schoolName.setStyleName("v-label-big"); A1.addComponent(schoolName); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); Label schoolMinorName = new Label("Random Branch"); schoolMinorName.setStyleName("v-label-small"); A1.addComponent(schoolMinorName); VerticalLayout A2 = new VerticalLayout(); A1.addComponent(A2); MainMenuWidget iMainMenuWidget = new MainMenuWidget(); A2.addComponent(iMainMenuWidget); //A.setComponentAlignment(schoolName,Alignment.TOP_CENTER); //Layout B ContextWidgetTop c = new ContextWidgetTop(); c = ContextWidgetTop.ContextWidgetTransformer(c, new UserDetailsWidget(), SliderMode.TOP, SliderPanelStyles.COLOR_RED); VerticalLayout B = new VerticalLayout(); B.setSizeFull(); //B.setSpacing(true); iHorizontalLayout.addComponent(c); c.addComponent(B); iHorizontalLayout.setExpandRatio(c, 7); //Layout B1 and its sub Components HorizontalLayout B1 = new HorizontalLayout(); B.addComponent(B1); //B.setExpandRatio(B1, 1); //B1.setHeight("70px"); B1.setSizeFull(); //B1=ContextWidget.ContextWidgetTransformer(B1, new SliderMasterPage(),SliderMode.RIGHT,SliderPanelStyles.COLOR_RED); HorizontalLayout B11 = new HorizontalLayout(); B1.addComponent(B11); B1.setStyleName("backColorBlack"); B11.setSizeFull(); B1.setHeight("45px"); //B1.setStyleName("backColorWhite"); //B1.setMargin(new MarginInfo(false, true, false, true)); TextField iTextField = new TextField(); iTextField.setWidth("200px"); iTextField.setInputPrompt("Search!"); iTextField.setStyleName("v-text-type-search"); iTextField.focus(); B11.addComponent(iTextField); B11.setComponentAlignment(iTextField, Alignment.MIDDLE_LEFT); //Layout B2 and its Sub Components ContextWidget B2 = new ContextWidget(); B2.setSizeFull(); B.addComponent(B2); B.setExpandRatio(B2, 10); B2 = ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(), SliderMode.RIGHT, SliderPanelStyles.COLOR_BLUE); //B2=ContextWidget.ContextWidgetTransformer(B2, new SliderMasterPage(),SliderMode.TOP,SliderPanelStyles.COLOR_RED); VerticalLayout v = new VerticalLayout(); B2.addComponent(v); Button b1111 = new Button( "Put all the inner components like this Put all the inner components like this Put all the inner components like this Put all the inner components like this"); v.addComponent(b1111); Button b1112 = new Button("Put all the inner components like this"); v.addComponent(b1112); /* Panel p = new Panel(); VerticalLayout v= new VerticalLayout(); v.addComponent(new TextField("Name")); v.addComponent(new TextField("Street address")); v.addComponent(new TextField("Postal code")); p.setContent(v); B2.addComponent(p); v.setWidth(String.valueOf(B2.getWidth()*10)+"px"); //v.setSizeFull();// <- This will cause issues. Don't do this p.setSizeFull(); */ //ContextWidget iContextPanel= new ContextWidget(p); //B2.addComponent(iContextPanel); //setPosition(p, iComponentPositionPanel); addComponent(iHorizontalLayout); }