List of usage examples for com.google.gwt.user.client.ui HorizontalPanel add
@Override public void add(Widget w)
From source file:com.edgenius.wiki.gwt.client.server.utils.ErrorCode.java
License:Open Source License
private static void buildMessage(HorizontalPanel panel, String errorCode, String defaultErrorMsg, Widget[] widgets) {/*from www. j a v a 2 s .c om*/ String msg = getMessageString(errorCode); if (msg == null) msg = defaultErrorMsg; if (widgets != null && widgets.length > 0) { //parse string to find out {x} and split them int size = msg.length(); int leftIndex = -1; String str = ""; String index = ""; for (int idx = 0; idx < size; idx++) { char c = msg.charAt(idx); //always sum char to string, if it is token, the str will substract the token string str += Character.toString(c); if ('{' == c) { leftIndex = idx; } else if (leftIndex > 0 && NumberUtil.isDigit(c)) { index += Character.toString(c); } else if (leftIndex > 0 && '}' == c) { int num = new Integer(index).intValue(); if (num < widgets.length) { // a valid replace token //first adjust str to before { str = str.substring(0, str.length() - index.length() - 2); panel.add(new HTML(str)); //append space before widget, otherwise HTML will ignore last space if (str.endsWith(" ")) panel.add(new HTML(" ")); //then add widget panel.add(widgets[num]); if (idx < size - 1) { //append space after widget, otherwise HTML will ignore first space if (msg.charAt(idx + 1) == ' ') panel.add(new HTML(" ")); } str = ""; } leftIndex = -1; index = ""; } else if (leftIndex > 0) { //next char is not number, then ignore this msg token leftIndex = -1; index = ""; } } if (str.length() > 0) panel.add(new HTML(str)); } else { panel.add(new HTML(msg)); } }
From source file:com.edgenius.wiki.gwt.client.space.SpaceLogoForm.java
License:Open Source License
public SpaceLogoForm() { final FormPanel form = new FormPanel(); form.setAction(GwtClientUtils.getBaseUrl() + "space/logo.do"); form.setMethod(FormPanel.METHOD_POST); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.addSubmitHandler(this); form.addSubmitCompleteHandler(this); VerticalPanel panel = new VerticalPanel(); panel.add(message);//from w ww . j a v a2s.com panel.add(spaceUname); HorizontalPanel h1 = new HorizontalPanel(); Label uploadLabel = new Label(Msg.consts.logo()); uploadLabel.setStyleName(Css.FORM_LABEL); FileUpload upload = new FileUpload(); upload.setName("file"); h1.add(uploadLabel); h1.add(upload); panel.add(h1); form.setWidget(panel); // Button update = new Button(Msg.consts.update()); update.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); Button cancel = new Button(Msg.consts.cancel()); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { //return to link panel for (Iterator<SpaceUpdateListener> iter = listener.iterator(); iter.hasNext();) { iter.next().spaceUpdateCancelled(); } } }); ButtonBar btnBar = new ButtonBar(); btnBar.add(update); btnBar.add(cancel); VerticalPanel main = new VerticalPanel(); main.add(form); main.add(btnBar); setWidget(main); }
From source file:com.edgenius.wiki.gwt.client.user.UserInfoPanel.java
License:Open Source License
public UserInfoPanel(final Widget parent, String spaceUname, final String username, String portrait, boolean showPortrait) { this.parent = parent; this.username = username; VerticalPanel main = new VerticalPanel(); HorizontalPanel center = new HorizontalPanel(); FlowPanel profile = new FlowPanel(); this.showPortrait = showPortrait; if (showPortrait && !StringUtil.isBlank(portrait)) { portraitPanel.add(GwtClientUtils.createUserPortrait(portrait)); }// w ww .jav a 2 s . c om center.add(portraitPanel); center.add(profile); status.setStyleName(Css.STATUS_SNAP); Label lb = new Label(Msg.consts.recent_update_pages()); lb.setStyleName(Css.HEADING3); lb.addStyleName(Css.UNDERLINE); profile.add(status); profile.add(lb); profile.add(pagesPanel); profile.add(loadingImg); main.add(message); main.add(center); if (!AbstractEntryPoint.isOffline()) { func.setWidth("100%"); func.setStyleName(Css.ACTION_TABS); main.add(func); } center.setCellWidth(profile, "100%"); center.setSpacing(2); profile.setSize("100%", "100%"); center.setSize("100%", "100%"); main.setSize("100%", "100%"); center.setStyleName(Css.PROFILE); this.setWidget(main); loadingImg.setVisible(true); PageControllerAsync pageController = ControllerFactory.getPageController(); //get user recent updated pages for this space pageController.getUserPagesInSpace(spaceUname, username, 5, this); }
From source file:com.edgenius.wiki.gwt.client.widgets.FeedbackDialog.java
License:Open Source License
public FeedbackDialog() { this.setText(Msg.consts.feedback()); this.setIcon(new Image(IconBundle.I.get().email())); final FormPanel form = new FormPanel(); form.setMethod(FormPanel.METHOD_POST); form.addSubmitHandler(this); form.setStyleName(Css.FORM);/* w w w .ja v a 2 s . com*/ form.setWidget(panel); HorizontalPanel h1 = new HorizontalPanel(); Label emailLabel = new Label(Msg.consts.your_email()); h1.add(emailLabel); h1.add(emailBox); feedbackBox.valid(Msg.consts.feedback(), true, 0, 0, null); emailBox.valid(Msg.consts.email(), true, 0, 0, this); Label feedbackLabel = new Label(Msg.consts.your_feedback()); panel.add(message); panel.add(h1); panel.add(feedbackLabel); panel.add(feedbackBox); ButtonBar btnBar = getButtonBar(); Button send = new Button(Msg.consts.send(), ButtonIconBundle.tickImage()); Button cancel = new Button(Msg.consts.cancel(), ButtonIconBundle.crossImage()); send.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { form.submit(); } }); cancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { FeedbackDialog.this.hidebox(); } }); btnBar.add(cancel); btnBar.add(send); panel.setSize("100%", "100%"); emailLabel.setStyleName(Css.FORM_LABEL); feedbackLabel.setStyleName(Css.FORM_LABEL); emailBox.setStyleName(Css.FORM_INPUT); feedbackBox.setStyleName(Css.LONG_TEXTBOX); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM); panel.setCellHorizontalAlignment(feedbackBox, HasHorizontalAlignment.ALIGN_CENTER); this.setWidget(form); }
From source file:com.edgenius.wiki.gwt.client.widgets.ImageSlider.java
License:Open Source License
public ImageSlider(boolean showAltText, int sliderHeight, int imageWidth, int imageHeight, int showPerPage) { this.sliderHeight = sliderHeight; this.imageWidth = imageWidth; this.imageHeight = imageHeight; this.showCount = showPerPage; this.showAltText = showAltText; HorizontalPanel main = new HorizontalPanel(); main.add(leftBtn); main.add(rowPanel);//from w w w . ja va 2s . co m main.add(rightBtn); main.setCellHorizontalAlignment(rowPanel, HasHorizontalAlignment.ALIGN_CENTER); leftBtn.setEnable(false); rightBtn.setEnable(false); this.setWidth("100%"); this.setStyleName(Css.IMAGE_SLIDE); this.setWidget(main); }
From source file:com.edgenius.wiki.gwt.client.widgets.ListPanel.java
License:Open Source License
public ListPanel(final int type) { this.type = type; HorizontalPanel funcPanel = new HorizontalPanel(); if (type == ListDialogue.GROUP) { funcPanel.add(new Label(Msg.consts.search_groups() + " ")); } else if (type == ListDialogue.USER) { funcPanel.add(new Label(Msg.consts.search_users() + " ")); }//from w w w .j a v a 2 s. c om funcPanel.add(filter); filter.setStyleName(Css.SEARCH_INPUT); filter.setTitle(Msg.consts.input_keyword()); filter.addKeyDownHandler(new KeyDownHandler() { public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { keyword = filter.getText(); if (keyword == null || keyword.trim().length() == 0) return; if (type == ListDialogue.GROUP) { SearchControllerAsync action = ControllerFactory.getSearchController(); action.searchRoles(keyword, 0, PAGE_SIZE, new SearchAsync()); } else if (type == ListDialogue.USER) { SearchControllerAsync action = ControllerFactory.getSearchController(); action.searchUser(keyword, 0, PAGE_SIZE, new SearchAsync()); } } } }); funcPanel.add(selectedList); VerticalPanel panel = new VerticalPanel(); panel.add(message); panel.add(funcPanel); panel.add(table); panel.setSize("100%", "100%"); //To display hint, don't set focus first. // Scheduler.get().scheduleDeferred(new ScheduledCommand() { // public void execute() { // filter.setFocus(true); // } // }); this.setWidget(panel); }
From source file:com.edgenius.wiki.gwt.client.widgets.MessageWidget.java
License:Open Source License
/** * /*from w w w . j a va 2s .c om*/ * Set simple text as message content. And message will disappear after timeout. * If timeout equals -1, it will always appear. * @param msg * @param timeout * @return message UUID */ private String show(String msg, int timeout, int type, boolean append, boolean allowClose) { Label msgLabel = new Label(msg); HorizontalPanel panel = new HorizontalPanel(); panel.add(msgLabel); return show(panel, timeout, type, append, allowClose); }
From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.batch.ExportBatchClassView.java
License:Open Source License
/** * To get batch Folder List View./*from w ww. j a va 2 s . co m*/ * * @param propertyMap Map<String, String> */ public void getbatchFolderListView(Map<String, String> propertyMap) { HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.addStyleName("width100"); CheckBox checkBox = new CheckBox(propertyMap.get(BatchFolderListDTO.FOLDER_NAME)); checkBox.setName(propertyMap.get(BatchFolderListDTO.FOLDER_NAME)); checkBox.setFormValue(propertyMap.get(BatchFolderListDTO.FOLDER_NAME)); checkBox.setEnabled(Boolean.parseBoolean(propertyMap.get(BatchFolderListDTO.ENABLED))); checkBox.setChecked(Boolean.parseBoolean(propertyMap.get(BatchFolderListDTO.CHECKED))); horizontalPanel.add(checkBox); exportBatchClassViewPanel.add(horizontalPanel); }
From source file:com.ephesoft.dcma.gwt.core.client.ui.table.Table.java
License:Open Source License
private void createTableHeader(boolean isRadioButton) { Images images = GWT.create(Images.class); final TableHeader header = tableData.getHeader(); final List<HeaderColumn> columns = header.getHeaderColumns(isRadioButton); String width = null;// w ww . j av a 2 s .c o m int counter = 0; for (final HeaderColumn column : columns) { width = column.getWidth() + "%"; headerTable.getCellFormatter().setWidth(0, counter, width); headerTable.getCellFormatter().addStyleName(0, counter, "wordWrap"); HorizontalPanel headerPanel = new HorizontalPanel(); Label name = new Label(column.getName()); headerPanel.add(name); final Label sortImage = new Label(); sortImage.setWidth("5px"); sortImage.setStyleName("alignMiddle"); if (order != null && column.getDomainProperty() != null && order.getSortProperty().getProperty().equals(column.getDomainProperty().getProperty())) { if (column.isPrimaryAsc()) { DOM.setInnerHTML(sortImage.getElement(), AbstractImagePrototype.create(images.sortUp()).getHTML()); } else { DOM.setInnerHTML(sortImage.getElement(), AbstractImagePrototype.create(images.sortDown()).getHTML()); } } headerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); headerPanel.add(sortImage); if (counter == 0 && isRadioButton) { name.setText(""); } headerTable.setWidget(0, counter, headerPanel); if (column.isSortable()) { name.addStyleName("cursorHand"); name.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { order = new Order(column.getDomainProperty(), !column.isPrimaryAsc()); navBar.setOrder(order); column.setPrimaryAsc(!column.isPrimaryAsc()); navBar.getListner().onPagination(navBar.getStartIndex(), visibleRecodrCount, order); } }); } headerTable.getFlexCellFormatter().setVerticalAlignment(0, counter, HasVerticalAlignment.ALIGN_TOP); headerTable.getCellFormatter().setHorizontalAlignment(0, counter, HasHorizontalAlignment.ALIGN_LEFT); counter++; } headerTable.getRowFormatter().setStyleName(0, selectionStyle.header()); }
From source file:com.ephesoft.dcma.gwt.core.client.ui.table.Table.java
License:Open Source License
private void setNavigationBar() { navBarTable.getCellFormatter().setWidth(0, 1, "30%"); navBarTable.getCellFormatter().setWidth(0, 2, "10%"); navBarTable.getCellFormatter().setWidth(0, 3, "10%"); navBarTable.getCellFormatter().setWidth(0, 4, "22%"); navBarTable.getCellFormatter().setWidth(0, 5, "23%"); Label displayText = new Label(navBar.getCountString()); Label searchPageText = new Label( LocaleDictionary.get().getConstantValue(LocaleCommonConstants.TITLE_GO_TO_PAGE)); Label totalPageCountText = new Label(" /" + navBar.getTotalPageCount()); HorizontalPanel searchPagePanel = new HorizontalPanel(); displayText.setStyleName(selectionStyle.boldText()); searchPageText.setStyleName(selectionStyle.boldText()); totalPageCountText.setStyleName(selectionStyle.boldText()); searchPagePanel.add(searchPageText); searchPagePanel.add(navBar.getSearchPageTextBox()); searchPagePanel.add(totalPageCountText); searchPagePanel.setCellHorizontalAlignment(searchPageText, HasHorizontalAlignment.ALIGN_RIGHT); searchPagePanel.setCellHorizontalAlignment(navBar.getSearchPageTextBox(), HasHorizontalAlignment.ALIGN_RIGHT); searchPagePanel.setCellHorizontalAlignment(totalPageCountText, HasHorizontalAlignment.ALIGN_RIGHT); if (this.navBar.getOrderingListner() != null) { navBarTable.setWidget(0, 2, navBar.getOrderingPanel()); navBarTable.getCellFormatter().setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_RIGHT); }/* ww w . j a v a 2 s .co m*/ if (this.navBar.getListner() != null) { navBarTable.setWidget(0, 3, navBar.getPaginationPanel()); navBarTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT); navBarTable.setWidget(0, 4, searchPagePanel); } navBarTable.setWidget(0, 5, displayText); navBarTable.getCellFormatter().setHorizontalAlignment(0, 4, HasHorizontalAlignment.ALIGN_RIGHT); navBarTable.getCellFormatter().setHorizontalAlignment(0, 5, HasHorizontalAlignment.ALIGN_RIGHT); }