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.GwtClientUtils.java
License:Open Source License
public static HTML buildDownloadURLWidget(String spaceUname, String filename, String nodeUuid, String version) { String url = buildAttachmentURL(spaceUname, filename, nodeUuid, version, true); //Must use double quote for URL, single quote may appear in spaceUname even aftere encoding... return new HTML( "<a href=\"" + url + "\" title='" + Msg.consts.download_attachment() + "'>" + filename + "</a>"); }
From source file:com.edgenius.wiki.gwt.client.GwtClientUtils.java
License:Open Source License
public static Widget createUserPortrait(String portraitUrl) { return new HTML(GwtUtils.getUserPortraitHTML(portraitUrl, null, -1)); }
From source file:com.edgenius.wiki.gwt.client.GwtClientUtils.java
License:Open Source License
public static Widget createUserSmallPortrait(String portraitUrl, String fullname, int size) { return new HTML(GwtUtils.getUserPortraitHTML(portraitUrl, fullname, size)); }
From source file:com.edgenius.wiki.gwt.client.GwtClientUtils.java
License:Open Source License
public static Widget createUserSmallPortrait(String portraitUrl, int size) { return new HTML(GwtUtils.getUserPortraitHTML(portraitUrl, null, size)); }
From source file:com.edgenius.wiki.gwt.client.GwtClientUtils.java
License:Open Source License
/** * @param largeLogoUrl/*from ww w. j a v a2 s. c o m*/ * @return */ public static Widget createSpaceLogo(String imgUrl) { return new HTML("<img src=\"" + imgUrl + "\"" + " title=\"logo\">"); }
From source file:com.edgenius.wiki.gwt.client.instance.InstanceDashboardPanel.java
License:Open Source License
public InstanceDashboardPanel() { render.addRenderContentListener(this); render.registerPortalVistor(new InstancePortalVisitor()); previewBtn.addClickHandler(this); publishBtn.addClickHandler(this); cancelBtn.addClickHandler(this); defaultBtn.addClickHandler(this); editLink.addClickHandler(this); VerticalPanel barPanel = new VerticalPanel(); barPanel.setSpacing(5);/*from w w w . j a v a 2s . com*/ barPanel.add(previewBtn); barPanel.add(publishBtn); barPanel.add(cancelBtn); barPanel.add(defaultBtn); editPanel.add(editor); editPanel.add(barPanel); //This panel is just because deck make its children to 100% width, which enlarge the indicator icon FlowPanel busyPanel = new FlowPanel(); busyPanel.add(IconBundle.I.indicator()); deck.insert(renderPanel, DECK_RENDER); deck.insert(busyPanel, DECK_BUSY); FlowPanel titleBar = new FlowPanel(); HTML l2 = new HTML("<span class='" + Css.HEADING2 + "'>" + Msg.consts.dashboard_preview() + "</span>"); titleBar.add(l2); titleBar.add(new HTML(" - ")); titleBar.add(editLink); VerticalPanel main = new VerticalPanel(); main.setSpacing(10); main.add(message); main.add(editPanel); main.add(titleBar); main.add(new Hr()); main.add(deck); this.setWidget(main); barPanel.setStyleName(Css.BUTTONS); barPanel.addStyleName(Css.EQUALS_WIDTH_BUTTON); renderPanel.removeStyleName(Css.RENDER_CONTENT); DOM.setElementAttribute(main.getElement(), "width", "98%"); editor.setStyleName(Css.DASHMARKUP_TEXTBOX); //get dashboard markup to render service side editPanel.setVisible(false); deck.showWidget(DECK_BUSY); }
From source file:com.edgenius.wiki.gwt.client.page.EditPanel.java
License:Open Source License
/** * Only put value to panel, does not change visible attribute of this panel. * @param model//from w w w . j ava 2 s. c o m */ private void fillPanel(final PageModel model) { setCurrentToken(GwtClientUtils.getToken()); functionBtnBar.loadEditFunc(model == null ? 0 : model.attribute); draftStatusBar.setText(""); draftStatusBar.removeStyleName(Css.ERROR); titleBox.removeStyleName(Css.ERROR); dirty = false; //always hide print button as it maybe a new page main.setPrintBtnVisible(false); if (model == null) { //clear all fields titleBox.setText(""); tagBox.setText(""); contentArea.setText(""); } else { if (model.autoSaveUid != null) { HorizontalPanel messagePanel = new HorizontalPanel(); HTML m1 = new HTML( Msg.params.resume_auto_draft(GwtClientUtils.toDisplayDate(model.autoSaveDate)) + " "); ClickLink resumeDraftButton = new ClickLink(Msg.consts.resume_auto_draft()); messagePanel.add(m1); messagePanel.add(resumeDraftButton); messagePanel.add(new HTML("?")); autoSaveMsgUuid = message.info(messagePanel, -1, true); resumeDraftButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { autoSaveMsgUuid = null; message.cleanMessage(); PageControllerAsync action = ControllerFactory.getPageController(); //get this user's draft and its attachments action.editDraft(model.autoSaveUid, PageType.AUTO_DRAFT, true, new LoadDraftAsync(PageType.AUTO_DRAFT)); } }); } if (model.editingUserFullname != null) { HorizontalPanel messagePanel = new HorizontalPanel(); HTML m1 = new HTML(Msg.params.page_editing_warn(model.editingTime <= 1 ? Msg.consts.just_now() : Msg.params.in_minutes_ago(model.editingTime + ""))); UserProfileLink userButton = new UserProfileLink(model.editingUserFullname, main.getSpaceUname(), model.editingUsername, model.editingUserPortrait); messagePanel.add(userButton); messagePanel.add(m1); messagePanel.add(new HTML(".")); message.warning(messagePanel, 100000, true); } //update page info : if user refresh page during edit, those info be catch back. main.setCurrentPageTitle(model.title); PageMain.setParentPageUuid(model.parentPageUuid); main.setPageAttribute(model.attribute); main.setNewPageType(model.newPageType); main.setSpaceUname(model.spaceUname); main.setPageVersion(model.pageVersion); main.setPageUuid(model.pageUuid == null ? "" : model.pageUuid.toString()); //put fields into edit box titleBox.setText(model.title == null ? "" : (model.title.length() > TITLE_MAX_LEN ? model.title.substring(0, TITLE_MAX_LEN) : model.title)); tagBox.setText(model.tagString == null ? "" : model.tagString); tagBox.setSpaceUname(model.spaceUname); //must call before setText(), so that content could point to correct editor contentArea.enableRich(model.isRichContent); contentArea.setText(model.content == null ? "" : model.content); contentArea.resize(); if (templatePanel != null) { templatePanel.initPanel(); } if (!GwtUtils.contains(model.attribute, PageAttribute.NO_ATTACHMENT)) { attachmentBtn.setVisible(true); attPanel.mergeAttachments(model.attachmentJson); if (GwtUtils.isAnonymous(main.getLoginUser())) attPanel.setReadonly(true); else attPanel.setReadonly(false); } else { //hide all attachment and panel... setAttachmentCount(0); attachmentBtn.setVisible(false); attPanel.setVisible(false); attPanel.setReadonly(false); attPanel.reset(); } main.fillEditNavBar(model); if (model.draftUid != null) { HorizontalPanel messagePanel = new HorizontalPanel(); HTML m1 = new HTML( Msg.params.resume_draft(GwtClientUtils.toDisplayDate(model.draftDate)) + " "); ClickLink resumeDraftButton = new ClickLink(Msg.consts.resume_draft()); messagePanel.add(m1); messagePanel.add(resumeDraftButton); messagePanel.add(new HTML("?")); message.info(messagePanel, -1, true); resumeDraftButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { autoSaveMsgUuid = null; message.cleanMessage(); PageControllerAsync action = ControllerFactory.getPageController(); //get this user's draft and its attachments action.editDraft(model.draftUid, PageType.MANUAL_DRAFT, true, new LoadDraftAsync(PageType.MANUAL_DRAFT)); } }); final MessageDialog confirmDraftDlg = new MessageDialog(MessageDialog.TYPE_CONFIRM, Msg.consts.confirm() + " " + Msg.consts.resume_draft(), Msg.params.resume_manual_draft(GwtClientUtils.toDisplayDate(model.draftDate))); confirmDraftDlg.addMessageListener(new MessageDialogListener() { public void cancelled() { } public void confirmed() { autoSaveMsgUuid = null; message.cleanMessage(); PageControllerAsync action = ControllerFactory.getPageController(); //get this user's draft and its attachments action.editDraft(model.draftUid, PageType.MANUAL_DRAFT, true, new LoadDraftAsync(PageType.MANUAL_DRAFT)); } }); confirmDraftDlg.showbox(); } } }
From source file:com.edgenius.wiki.gwt.client.page.EditSidebarPanel.java
License:Open Source License
public EditSidebarPanel(PageMain main) { this.main = main; main.addPanelSwitchListener(this); contentArea = new Editor(main, false); main.editorRegistry.register(contentArea); ContentChangeListener changeListener = new ContentChangeListener(); contentArea.addKeyPressHandler(changeListener); contentArea.addChangeHandler(changeListener); functionBtnBar = new FunctionWidget(main); VerticalPanel optionPanel = new VerticalPanel(); optionPanel.add(new Label(Msg.consts.stick_sidebar_editing())); optionPanel.add(radio1);//from w ww .j a va 2 s. c om optionPanel.add(radio2); optionPanel.add(radio3); optionPanel.add(new HTML(Msg.consts.sidebar_tip())); FlexTable mainPanel = new FlexTable(); mainPanel.setWidget(0, 0, contentArea); mainPanel.setWidget(0, 1, optionPanel); mainPanel.getColumnFormatter().setStyleName(1, Css.SIDEBAR_OPTIONS); FlexTable headerPanel = new FlexTable(); headerPanel.setWidget(0, 0, title); headerPanel.setWidget(0, 1, functionBtnBar); title.setStyleName(Css.RENDER_TITLE); mainPanel.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP); mainPanel.getCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP); //main VerticalPanel panel = new VerticalPanel(); headerPanel.setWidth("100%"); mainPanel.setWidth("100%"); optionPanel.setSize("100%", "100%"); panel.setWidth("100%"); panel.add(message); panel.add(headerPanel); panel.add(mainPanel); this.setWidget(panel); }
From source file:com.edgenius.wiki.gwt.client.page.HistoryPanel.java
License:Open Source License
public void onSuccess(PageItemListModel model) { showBusy(false);// w w w . j a v a 2 s . co m moreBtn.busy(false); if (!GwtClientUtils.preSuccessCheck(model, message)) { return; } int start; if (model.itemList.size() > 0 && model.itemList.get(0).isCurrent) { //must call before next sentence: historyList will clean here. this.clear(); //build header start = buildTableHeader(); historyList = model.itemList; } else { //this is pagination - after 1 page, then don't clear old data. start = table.getRowCount(); //double check if current return is current page's contiguous history list if (historyList.size() == 0 || model.itemList.size() == 0) { //if return empty, then assume no more history. //historyList never be zero here actually, because history table assume always has current version record as first. moreBtn.setVisible(false); return; } if (!StringUtil.equals(model.itemList.get(0).uuid, main.getPageUuid())) { //this response is not for current page, discard response Log.info("Unaccpted history as pageUuid different:" + model.itemList.get(0).uuid); return; } if (model.itemList.get(0).version != historyList.get(historyList.size() - 1).version - 1) { //this response doesn't return contiguous history list, discard. Log.info("Unaccpted history as version different with exist:" + historyList.get(historyList.size() - 1).version); return; } historyList.addAll(model.itemList); } int size = model.itemList.size(); for (int idx = 0; idx < size; idx++) { final PageItemModel history = (PageItemModel) model.itemList.get(idx); CheckBox check = new CheckBox(); check.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { history.checked = ((CheckBox) event.getSource()).getValue(); } }); HTML rev; Hyperlink title; if (history.isCurrent) { rev = new HTML("<b>" + Msg.consts.current() + "</b>"); title = new Hyperlink(history.title, GwtUtils.getSpacePageToken(history.spaceUname, history.title)); } else { rev = new HTML("<b>" + Integer.valueOf(history.version).toString() + "</b>"); title = new Hyperlink(history.title, GwtUtils.buildToken(PageMain.TOKEN_HISTORY, history.spaceUname, String.valueOf(history.uid))); } rev.setStyleName(Css.NOWRAP); UserProfileLink modifier = new UserProfileLink(history.modifier, main.getSpaceUname(), history.modifierUsername, history.modifierPortrait); Label modifiedDate = new Label(GwtClientUtils.toDisplayDate(history.modifiedDate)); int row = start + idx; int col = 0; table.setWidget(row, col++, check); table.setWidget(row, col++, rev); table.setWidget(row, col++, title); table.setWidget(row, col, modifier); table.getFlexCellFormatter().setStyleName(row, col++, Css.NOWRAP); table.setWidget(row, col, modifiedDate); table.getFlexCellFormatter().setStyleName(row, col++, Css.NOWRAP); if (idx == (size - 1)) { if (history.version > 1) { moreBtn.setVisible(true); //always hide "less" button, page number is useless. moreBtn.setPaginationInfo(false, true, 0); } else { moreBtn.setVisible(false); } } } }
From source file:com.edgenius.wiki.gwt.client.page.PageTabPanel.java
License:Open Source License
public PageTabPanel(PageMain main) { this.main = main; historyPanel = new HistoryPanel(main); commentPanel = new CommentPanel(main, this); childrenPanel = new ChildrenPanel(main); historyPanel.addPinPanelListener(this); commentPanel.addPinPanelListener(this); childrenPanel.addPinPanelListener(this); tabPanel.addBeforeSelectionHandler(this); tabPanel.addSelectionHandler(this); //style:/* w ww . j a v a 2 s. c o m*/ tabPanel.setStyleName(Css.PAGE_TAB_BAR); //deselect all, it also will hide all panel tabPanel.setSelected(-1, false); FlowPanel panel = new FlowPanel(); panel.add(tabPanel); panel.add(new HTML("<a href=\"#\" id=\"" + TABS_ANCHOR_NAME + "\"></a>")); this.setWidget(panel); }