List of usage examples for com.google.gwt.user.client.ui HTML HTML
protected HTML(Element element)
From source file:com.edgenius.wiki.gwt.client.render.TagCloudRenderWidget.java
License:Open Source License
public void onSuccess(TagListModel list) { if (!GwtClientUtils.preSuccessCheck(list, message)) { listener.onFailedLoad(componentKey, ErrorCode.getMessageText(list.errorCode, list.errorMsg)); return;/* ww w. j a va2 s .c o m*/ } int row = cloudPanel.getRowCount(); for (int idx = row - 1; idx >= 0; idx--) { cloudPanel.removeRow(idx); } boolean first = true; //go to special tag, list its pages final TagControllerAsync tagController = ControllerFactory.getTagController(); final String spaceUname = list.spaceUname; StringBuffer tagSb = new StringBuffer(); Label header; if (SharedConstants.SYSTEM_SPACEUNAME.equalsIgnoreCase(spaceUname) || StringUtil.isBlank(spaceUname)) { header = new Label(Msg.consts.space_tagcolud_title()); } else { header = new Label(Msg.consts.page_tagcolud_title()); } header.setStyleName(Css.HEADER); cloudPanel.setWidget(0, 0, header); FlowPanel cloud = new FlowPanel(); cloudPanel.setWidget(1, 0, cloud); if (list.tags != null && list.tags.size() > 0) { for (final TagModel model : list.tags) { ClickLink link = new ClickLink( "<span class='" + STYLE_TAB_SIZE_PREFIX + model.size + "'>" + model.name + "</span>", true); link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { //return all page for this tag so far. if (SharedConstants.SYSTEM_SPACEUNAME.equalsIgnoreCase(spaceUname) || StringUtil.isBlank(spaceUname)) { tagController.getTagSpaces(model.name, -1, new SpaceTagAsncy()); } else { tagController.getTagPages(spaceUname, model.name, -1, new PageTagAsncy()); } } }); cloud.add(link); //just for wrap of line, otherwise all tag will be in same line. cloud.add(new HTML(" ")); tagSb.append(model.name); //show first tag pages at initial status if (first) { first = false; if (SharedConstants.SYSTEM_SPACEUNAME.equalsIgnoreCase(spaceUname)) { tagController.getTagSpaces(model.name, -1, new SpaceTagAsncy()); } else { tagController.getTagPages(spaceUname, model.name, -1, new PageTagAsncy()); } } } } else { cloud.add(new Label(Msg.consts.none())); } listener.onSuccessLoad(componentKey, tagSb.toString()); }
From source file:com.edgenius.wiki.gwt.client.render.TemplateListRenderWidget.java
License:Open Source License
public TemplateListRenderWidget(final String spaceUname) { this.spaceUname = spaceUname; Button newTemplBtn = new Button(Msg.consts.create_template()); newTemplBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { GwtClientUtils.refreshToken(GwtUtils.buildToken(PageMain.TOKEN_EDIT_TEMPLATE, spaceUname)); }//from w ww .ja v a 2 s .c o m }); VerticalPanel panel = new VerticalPanel(); panel.add(message); panel.add(contentPanel); panel.add(new HTML(" ")); panel.add(newTemplBtn); panel.setCellHorizontalAlignment(newTemplBtn, HasHorizontalAlignment.ALIGN_CENTER); this.setWidget(panel); panel.setWidth("100%"); }
From source file:com.edgenius.wiki.gwt.client.render.UserProfileRenderWidget.java
License:Open Source License
private void refreshUserProfile(UserProfileModel model) { final UserModel user = model.profile; portrait.setWidget(GwtClientUtils.createUserPortrait(user.getPortrait())); fullname.setText(user.getFullname()); loginname.setText(user.getLoginname()); contacts.setUser(user);// ww w . ja v a2s . co m actionP.clear(); if (user.getFollowing() >= 0) { //don't allow send or follow anonymous to someone, or some to anonymous, or login and viewing user are same user ClickLink sendMsg = new ClickLink(Msg.consts.send_message()); sendMsg.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { SendMessageDialog dlg = new SendMessageDialog(user.getLoginname()); dlg.showbox(); } }); actionP.add(sendMsg); //don't allow follow anonymous actionP.add(new FollowLink(user.getFollowing(), user.getLoginname())); } status.setStyleName(Css.STATUS); status.setText(StringUtil.trimToEmpty(user.getStatus())); //following and followers int row = followingP.getRowCount(); for (int idx = row - 1; idx >= 0; idx--) { followingP.removeRow(idx); } followingP.setWidget(0, 0, new Label(Msg.consts.following())); followingP.getFlexCellFormatter().setColSpan(0, 0, 3); followingP.getFlexCellFormatter().setStyleName(0, 0, Css.HEADER); row = followerP.getRowCount(); for (int idx = row - 1; idx >= 0; idx--) { followerP.removeRow(idx); } followerP.setWidget(0, 0, new Label(Msg.consts.followers())); followerP.getFlexCellFormatter().setColSpan(0, 0, 3); followerP.getFlexCellFormatter().setStyleName(0, 0, Css.HEADER); row = 1; int col = 0; if (model.following.size() > 0) { for (UserModel fer : model.following) { Hyperlink link = new Hyperlink( GwtUtils.getUserPortraitHTML(fer.getPortrait(), fer.getFullname(), 55), true, GwtUtils.buildToken(GwtUtils.getCPageToken(SharedConstants.CPAGE_USER_PROFILE), fer.getLoginname())); followingP.setWidget(row, col, link); if (++col > 2) { row++; col = 0; } } if (row == 1 && col < 3) { //append blank for (int idx = col; idx < 3; idx++) { followingP.setWidget(row, idx, new HTML(" ")); } } followingP.getFlexCellFormatter().setWidth(1, 0, "33%"); followingP.getFlexCellFormatter().setWidth(1, 1, "33%"); followingP.getFlexCellFormatter().setWidth(1, 2, "33%"); } else { followingP.setWidget(row, 0, new Label(Msg.consts.none())); } row = 1; col = 0; if (model.followers.size() > 0) { for (UserModel fer : model.followers) { Hyperlink link = new Hyperlink( GwtUtils.getUserPortraitHTML(fer.getPortrait(), fer.getFullname(), 55), true, GwtUtils.buildToken(GwtUtils.getCPageToken(SharedConstants.CPAGE_USER_PROFILE), fer.getLoginname())); followerP.setWidget(row, col, link); if (++col > 2) { row++; col = 0; } } if (row == 1 && col < 3) { //append blank for (int idx = col; idx < 3; idx++) { followerP.setWidget(row, idx, new HTML(" ")); } } followerP.getFlexCellFormatter().setWidth(1, 0, "33%"); followerP.getFlexCellFormatter().setWidth(1, 1, "33%"); followerP.getFlexCellFormatter().setWidth(1, 2, "33%"); } else { followerP.setWidget(row, 0, new Label(Msg.consts.none())); } }
From source file:com.edgenius.wiki.gwt.client.render.UserProfileRenderWidget.java
License:Open Source License
private void refreshActivities(ArrayList<ActivityModel> activities) { activityP.removeAllRows();//from ww w . j a v a 2 s. co m int row = 0; Label l1 = new Label(Msg.consts.activity()); activityP.setWidget(row, 0, l1); if (activities != null && activities.size() > 0) { for (final ActivityModel act : activities) { activityP.setWidget(++row, 0, new HTML(act.activity)); } } else { activityP.setWidget(row, 0, new Label(Msg.consts.none())); } listP.setHeight((activityP.getOffsetHeight() + 90) + "px"); }
From source file:com.edgenius.wiki.gwt.client.render.UserProfileRenderWidget.java
License:Open Source License
private void refreshPages(List<PageItemModel> pages) { pageP.removeAllRows();//from w w w. j av a 2 s.c o m int row = 0; Label l1 = new Label(Msg.consts.page_title()); Label l2 = new Label(Msg.consts.spacekey()); Label l3 = new Label(Msg.consts.contributed_versions()); pageP.setWidget(row, 0, l1); pageP.setWidget(row, 1, l2); pageP.setWidget(row, 2, l3); pageP.getColumnFormatter().setWidth(0, "50%"); pageP.getColumnFormatter().setWidth(1, "25%"); pageP.getColumnFormatter().setWidth(2, "25%"); row++; if (pages != null && pages.size() > 0) { for (final PageItemModel item : pages) { //MUST bring space in Token, because it maybe different space with current Hyperlink link = new Hyperlink(item.title, GwtUtils.getSpacePageToken(item.spaceUname, item.title)); pageP.setWidget(row, 0, link); //space link = new Hyperlink(item.spaceUname, GwtUtils.getSpacePageToken(item.spaceUname, null)); pageP.setWidget(row, 1, link); FlowPanel versPanel = new FlowPanel(); TreeMap<Integer, PageItemModel> vers = new TreeMap<Integer, PageItemModel>( new Comparator<Integer>() { public int compare(Integer o1, Integer o2) { return o1 - o2; } }); vers.putAll(item.versionHistory); boolean creatorAndNoHistory = false; for (Entry<Integer, PageItemModel> entry : vers.entrySet()) { link = null; if (entry.getKey() == 0) { if (item.version == 1) { creatorAndNoHistory = true; //This user is creator and current page version number is 1, this mean this page no history yet. link = new Hyperlink(Msg.consts.initial(), GwtUtils.getSpacePageToken(item.spaceUname, item.title)); } } else if (entry.getKey() == Integer.MAX_VALUE) { if (!creatorAndNoHistory) { //if this page no history yet, then only display "inital" is enough - don't want to display initial and current //but point to same current page. link = new Hyperlink(Msg.consts.current().toLowerCase(), GwtUtils.getSpacePageToken(item.spaceUname, item.title)); } } else { if (entry.getValue().version == 1) { link = new Hyperlink(Msg.consts.initial(), GwtUtils.buildToken(PageMain.TOKEN_HISTORY, item.spaceUname, String.valueOf(entry.getValue().uid))); } else { link = new Hyperlink(entry.getKey() + "", GwtUtils.buildToken(PageMain.TOKEN_HISTORY, item.spaceUname, String.valueOf(entry.getValue().uid))); } } if (link != null) { link.setStyleName(Css.LIGHT_LINK); link.setTitle(Msg.consts.modified_on() + " " + GwtClientUtils.toDisplayDate(entry.getValue().modifiedDate)); versPanel.add(link); versPanel.add(new HTML(" ")); } } pageP.setWidget(row, 2, versPanel); row++; } } else { pageP.setWidget(row, 0, new Label(Msg.consts.none())); } listP.setHeight((pageP.getOffsetHeight() + 90) + "px"); }
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 w w w . j a v a2 s. c o m 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.ShellDialog.java
License:Open Source License
/** * @param url/* w w w.ja va 2 s .c o m*/ */ private void setDoneCallback(String msg) { if (!this.isShowing()) { //this call back from cancelBtn, i.e., that "link later" button return; } linkBtn.setBusy(false); if (needCallback) { //this is call from space admin -> shell JSP page, it won't display confirm panel again. themeChanged(); this.hidebox(); return; } getButtonBar().clear(); getButtonBar().add(okBtn); mainPanel.clear(); HTML html = new HTML(msg); html.setStyleName("message"); mainPanel.add(html); this.removeStyleName(Css.SHELL_DIALOG_BOX); this.addStyleName(Css.SHELL_DONE_DIALOG_BOX); this.center(); }
From source file:com.edgenius.wiki.gwt.client.user.UserInfoPanel.java
License:Open Source License
private void refresh(final PageItemListModel model) { List<PageItemModel> pages = model.itemList; pagesPanel.clear();/*from w w w .j a va2s .co m*/ status.setText(model.userStatus); //don't need update... this is just for user portrait is not input when the user portrait URL is not available when popup initial. if (this.showPortrait && portraitPanel.getWidgetCount() == 0) { portraitPanel.add(GwtClientUtils.createUserPortrait(model.userPortrait)); } if (pages != null && pages.size() > 0) { for (Iterator<PageItemModel> iter = pages.iterator(); iter.hasNext();) { PageItemModel item = iter.next(); Hyperlink link = new Hyperlink(item.title, GwtUtils.getSpacePageToken(item.spaceUname, item.title)); if (parent instanceof Popup) { link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { ((Popup) parent).hide(); } }); } ; pagesPanel.add(link); } } else { pagesPanel.add(new HTML("(" + Msg.consts.none() + ")")); } if (!AbstractEntryPoint.isOffline()) { if (model.isFollowing >= 0) { ClickLink sendMsg = new ClickLink(Msg.consts.send_message()); sendMsg.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (parent instanceof Popup) { ((Popup) parent).hide(); } //show send message dialogue SendMessageDialog msgDlg = new SendMessageDialog(username); msgDlg.showbox(); } }); func.add(sendMsg); func.add(new FollowLink(model.isFollowing, username)); } //so far, have to block profile page in offline model as the macro render logic is on MacroHandler side, it is not easy to do in //offline model. Hyperlink link = new Hyperlink(Msg.consts.goto_profile(), GwtUtils.buildToken(GwtUtils.getCPageToken(SharedConstants.CPAGE_USER_PROFILE), username)); if (parent instanceof Popup) { link.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { ((Popup) parent).hide(); } }); } func.add(link); } if (parent instanceof Popup) { ((Popup) parent).resized(); } }
From source file:com.edgenius.wiki.gwt.client.widgets.AdvSearchPanel.java
License:Open Source License
public AdvSearchPanel(SearchRenderWidget widget) { this.widget = widget; keyword.addFocusHandler(KeyCaptureListener.instance()); spaceBox.addFocusHandler(KeyCaptureListener.instance()); modifiedDate.getTextBox().addFocusHandler(KeyCaptureListener.instance()); keyword.addBlurHandler(KeyCaptureListener.instance()); spaceBox.addBlurHandler(KeyCaptureListener.instance()); modifiedDate.getTextBox().addBlurHandler(KeyCaptureListener.instance()); //so far only keyword can submit if users click enter keyword.addKeyDownHandler(submitKeyboardListener); modifiedDate.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat("yyyy/MM/dd"))); FlexTable main = new FlexTable(); FlowPanel t1 = new FlowPanel(); t1.add(new Label(Msg.consts.filter())); FlowPanel t2 = new FlowPanel(); t2.add(new Label(Msg.consts.type())); FlowPanel t3 = new FlowPanel(); t3.add(new Label(Msg.consts.from_space())); FlowPanel t4 = new FlowPanel(); t4.add(new Label(Msg.consts.sortby())); FlowPanel t5 = new FlowPanel(); t5.add(new Label(Msg.consts.modified_date())); FlowPanel t6 = new FlowPanel(); // Hr sep = new Hr(); // sep.setStyleName(Css.SEPARATOR); t6.add(new HTML("<br>")); FlexTable filterPanel = new FlexTable(); FlexTable typePanel = new FlexTable(); FlexTable spacePanel = new FlexTable(); FlexTable sortbyPanel = new FlexTable(); FlexTable modifiedPanel = new FlexTable(); filterPanel.setWidget(0, 0, keyword); filterPanel.setWidget(1, 0, anyWords); filterPanel.setWidget(2, 0, allWords); filterPanel.setWidget(3, 0, exactWords); anyWords.setValue(true);/* w ww . j a v a 2 s. c o m*/ final ClickLink toggleNoneType = new ClickLink(Msg.consts.none_upper()); toggleNoneType.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { pageType.setEnable(false); spaceType.setEnable(false); attachmentType.setEnable(false); commentType.setEnable(false); pTagType.setEnable(false); sTagType.setEnable(false); userType.setEnable(false); widgetType.setEnable(false); } }); final ClickLink toggleAllType = new ClickLink(Msg.consts.all()); toggleAllType.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { pageType.setEnable(true); spaceType.setEnable(true); attachmentType.setEnable(true); commentType.setEnable(true); pTagType.setEnable(true); sTagType.setEnable(true); userType.setEnable(true); widgetType.setEnable(true); } }); typePanel.setWidget(0, 0, pageType); typePanel.setWidget(0, 1, spaceType); typePanel.setWidget(1, 0, attachmentType); typePanel.setWidget(1, 1, commentType); typePanel.setWidget(2, 0, pTagType); typePanel.setWidget(2, 1, sTagType); typePanel.setWidget(3, 0, userType); typePanel.setWidget(3, 1, widgetType); FlowPanel togglePanel = new FlowPanel(); togglePanel.add(toggleAllType); togglePanel.add(new Label("/")); togglePanel.add(toggleNoneType); typePanel.setWidget(4, 0, togglePanel); typePanel.getFlexCellFormatter().setColSpan(4, 0, 2); typePanel.getCellFormatter().setAlignment(4, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); spacePanel.setWidget(0, 0, new Label(Msg.consts.space())); spacePanel.setWidget(0, 1, spaceBox); sortbyPanel.setWidget(0, 0, defaultSort); sortbyPanel.setWidget(0, 1, typeSort); sortbyPanel.setWidget(0, 2, spaceSort); defaultSort.addClickHandler(sortClickHandler); typeSort.addClickHandler(sortClickHandler); spaceSort.addClickHandler(sortClickHandler); defaultSort.setEnable(true); spaceSort.setEnable(false); typeSort.setEnable(false); modifiedPanel.setWidget(0, 0, new Label(Msg.consts.from())); modifiedPanel.setWidget(0, 1, modifiedDate); Button filterBtn = new Button(Msg.consts.search()); filterBtn.addClickHandler(this); int row = 0; main.setWidget(row++, 0, t1); main.setWidget(row++, 0, filterPanel); main.setWidget(row++, 0, t2); main.setWidget(row++, 0, typePanel); main.setWidget(row++, 0, t3); main.setWidget(row++, 0, spacePanel); main.setWidget(row++, 0, t4); main.setWidget(row++, 0, sortbyPanel); main.setWidget(row++, 0, t5); main.setWidget(row++, 0, modifiedPanel); main.setWidget(row++, 0, t6); main.setWidget(row, 0, filterBtn); main.getCellFormatter().setAlignment(row++, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_BOTTOM); t1.setStyleName(Css.HEADER); t2.setStyleName(Css.HEADER); t3.setStyleName(Css.HEADER); t4.setStyleName(Css.HEADER); t5.setStyleName(Css.HEADER); //t6.setStyleName(Css.HEADER); main.setStyleName(Css.ADV_SEARCH); spaceBox.setStyleName(Css.FORM_INPUT); keyword.setStyleName(Css.FORM_INPUT); modifiedDate.setStyleName(Css.FORM_INPUT); main.setWidth(WIDTH); filterPanel.setCellSpacing(4); typePanel.setCellSpacing(4); spacePanel.setCellSpacing(4); sortbyPanel.setCellSpacing(4); modifiedPanel.setCellSpacing(4); main.setCellPadding(0); main.setCellSpacing(0); this.setWidget(main); }
From source file:com.edgenius.wiki.gwt.client.widgets.CandidateListPanel.java
License:Open Source License
public void addCandidate(String text, final Object model) { for (Iterator iter = values.iterator(); iter.hasNext();) { //don't allow add same value over once. Object obj = iter.next(); if (obj.equals(model)) return; }/*from www . j av a 2 s . c o m*/ //cache value values.add(model); //UI part final ClickLink candidate = new ClickLink(text); candidate.setTitle(Msg.consts.click_remove()); if (panel.getWidgetCount() > 0) { //if there are more candidate, then add "," HTML sep = new HTML(", "); panel.add(sep); } panel.add(candidate); candidate.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { values.remove(model); Widget sep = null; //remove this candidate and its following "," if it has for (Iterator iter = panel.iterator(); iter.hasNext();) { if (iter.next() == candidate) { iter.remove(); if (iter.hasNext()) { sep = (Widget) iter.next(); } break; } } if (sep instanceof HTML) { panel.remove(sep); } else { //maybe remove last second candidate, which has not "," but before it, there are should be "," int count = panel.getWidgetCount(); if (count > 0 && (panel.getWidget(count - 1) instanceof HTML)) { panel.remove(count - 1); } } if (panel.getWidgetCount() == 0) { CandidateListPanel.this.setStyleName(Css.CANDIDATE_LIST); } else { CandidateListPanel.this.setStyleName(Css.CANDIDATE_LIST_ENALBE); } } }); if (panel.getWidgetCount() == 0) { this.setStyleName(Css.CANDIDATE_LIST); } else { this.setStyleName(Css.CANDIDATE_LIST_ENALBE); } }