List of usage examples for com.google.gwt.user.client.ui HorizontalPanel HorizontalPanel
public HorizontalPanel()
From source file:com.edgenius.wiki.gwt.client.page.ViewPanel.java
License:Open Source License
private void historyDiffMessage(final PageModel model) { String spaceUname = model.spaceUname; String currentTitle = model.currentTitle; message.cleanMessage();//from w w w. j av a2s . c o m String id1 = HTMLPanel.createUniqueId(); String id2 = HTMLPanel.createUniqueId(); StringBuffer buf = new StringBuffer("<div class='historyAction'><div class='msg' id='").append(id1) .append("'></div><div class='return' id='").append(id2).append("'></div>"); buf.append("<div class='action'>"); String idp1 = null, idp2 = null, idp3 = null, idp4 = null, idn1 = null, idn2 = null, idn3 = null, idn4 = null; if (model.nextHistoryItem != null) { idn1 = HTMLPanel.createUniqueId(); idn2 = HTMLPanel.createUniqueId(); idn3 = HTMLPanel.createUniqueId(); idn4 = HTMLPanel.createUniqueId(); buf.append("<div class='round next'><div class='version' id='").append(idn1) .append("'></div><div class='author' id='").append(idn2) .append("'></div><div class='date' id='").append(idn3).append("'></div><div class='diff' id='") .append(idn4).append("'></div></div>"); } buf.append("<div class='current'>").append(Msg.consts.revision()).append(" ").append(model.pageVersion) .append("</div>"); if (model.prevHistoryItem != null) { idp1 = HTMLPanel.createUniqueId(); idp2 = HTMLPanel.createUniqueId(); idp3 = HTMLPanel.createUniqueId(); idp4 = HTMLPanel.createUniqueId(); buf.append("<div class='round prev'><div class='version' id='").append(idp1) .append("'></div><div class='author' id='").append(idp2) .append("'></div><div class='date' id='").append(idp3).append("'></div><div class='diff' id='") .append(idp4).append("'></div></div>"); } buf.append("</div></div>"); HTMLPanel msgPanel = new HTMLPanel(buf.toString()); Hyperlink retCurrentVerBtn = new Hyperlink(Msg.consts.return_latest_version(), GwtUtils.getSpacePageToken(spaceUname, currentTitle)); msgPanel.add(new Label(Msg.consts.view_history()), id1); msgPanel.add(retCurrentVerBtn, id2); if (model.prevHistoryItem != null) { historyNextPrevMsg(msgPanel, model.prevHistoryItem, model.uid, idp1, idp2, idp3, idp4); } if (model.nextHistoryItem != null) { historyNextPrevMsg(msgPanel, model.nextHistoryItem, model.uid, idn1, idn2, idn3, idn4); } HorizontalPanel panel = new HorizontalPanel(); panel.add(msgPanel); message.warning(panel, false); }
From source file:com.edgenius.wiki.gwt.client.page.widgets.ExportDialog.java
License:Open Source License
public ExportDialog(PageMain pageMain) { this.pageMain = pageMain; this.setIcon(new Image(IconBundle.I.get().export())); this.setText(Msg.consts.export()); ButtonBar btnPanel = getButtonBar(); btnPanel.add(cancelBtn);//from ww w . j av a 2s.c o m btnPanel.add(okBtn); okBtn.addClickHandler(this); cancelBtn.addClickHandler(this); Label l1 = new Label(Msg.consts.format()); Label l2 = new Label(Msg.consts.scope()); pdfF.setText("PDF"); //NON-i18n htmlF.setText("HTML"); //NON-i18n scopeS.setText(Msg.consts.whole_space()); scopeP.setText(Msg.consts.current_page()); l1.setStyleName(Css.FORM_LABEL); l2.setStyleName(Css.FORM_LABEL); FlexTable main = new FlexTable(); main.setWidget(0, 0, l1); main.setWidget(0, 1, htmlF); //TODO: temporary comment as PDF is not ready... // main.setWidget(0, 2, pdfF); main.setWidget(1, 0, l2); main.setWidget(1, 1, scopeS); main.setWidget(1, 2, scopeP); main.getFlexCellFormatter().setWidth(0, 0, "130px"); main.getFlexCellFormatter().setWidth(0, 1, "130px"); htmlF.setValue(true); scopeS.setValue(true); HorizontalPanel busy = new HorizontalPanel(); Image busyImg = new Image(IconBundle.I.get().loadingBar()); busy.add(busyImg); busy.setCellHorizontalAlignment(busyImg, HasHorizontalAlignment.ALIGN_CENTER); busy.setCellVerticalAlignment(busyImg, HasVerticalAlignment.ALIGN_BOTTOM); busy.setHeight("200px"); deck.insert(main, MAIN_DECK); deck.insert(busy, BUSY_DECK); deck.setSize("98%", "100%"); deck.showWidget(MAIN_DECK); VerticalPanel panel = new VerticalPanel(); panel.setCellHorizontalAlignment(message, HasHorizontalAlignment.ALIGN_CENTER); panel.setCellHorizontalAlignment(deck, HasHorizontalAlignment.ALIGN_CENTER); panel.setWidth("100%"); panel.add(message); panel.add(deck); this.setWidget(panel); }
From source file:com.edgenius.wiki.gwt.client.page.widgets.HelpButton.java
License:Open Source License
public HelpButton(boolean showText) { HorizontalPanel panel = new HorizontalPanel(); // Image tree = new Image(IconBundle.I.get().help()); // tree.addClickHandler(this); // /*from w w w .java 2 s.co m*/ // panel.add(tree); if (showText) { ClickLink locationBtn = new ClickLink(Msg.consts.help()); locationBtn.addClickHandler(this); panel.add(locationBtn); } // panel.setCellVerticalAlignment(tree, HasVerticalAlignment.ALIGN_BOTTOM); this.setWidget(panel); }
From source file:com.edgenius.wiki.gwt.client.page.widgets.LocationButton.java
License:Open Source License
public LocationButton(PageMain main, boolean showText) { this.main = main; HorizontalPanel panel = new HorizontalPanel(); this.showText = showText; if (!showText) { Image tree = new Image(IconBundle.I.get().tree()); tree.addClickHandler(this); panel.add(tree);//from www. j a v a 2s . co m panel.setCellVerticalAlignment(tree, HasVerticalAlignment.ALIGN_BOTTOM); } else { ClickLink locationBtn = new ClickLink(Msg.consts.view_page_tree()); locationBtn.setStyleName(Css.LARGE_LINK_BTN); locationBtn.addClickHandler(this); panel.add(locationBtn); } pageTreePanel = new PageTreePanel(main); main.setSideMenuPanel(ClientConstants.LEFT, pageTreePanel); main.setSidebarButtonVisible(ClientConstants.LEFT, true); this.setWidget(panel); }
From source file:com.edgenius.wiki.gwt.client.page.widgets.PageTreeWidget.java
License:Open Source License
/** * Create HorizontalPanel for expand, collapse, etc. functions * @return/*from ww w. jav a 2 s . c om*/ */ public HorizontalPanel getFunctionButtons() { HorizontalPanel panel = new HorizontalPanel(); Image expand = new Image(IconBundle.I.get().expand()); expand.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { expand(); } }); Image collapse = new Image(IconBundle.I.get().collapse()); collapse.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { collapse(); } }); Image refresh = new Image(IconBundle.I.get().refresh()); refresh.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { String selected = null; if (rootItem != null) selected = (String) rootItem.getUserObject(); for (Iterator<TreeItem> iter = tree.treeItemIterator(); iter.hasNext();) { TreeItem item = iter.next(); if (item.isSelected()) { selected = (String) item.getUserObject(); break; } } refreshTree(spaceUname, selected); } }); panel.add(expand); panel.add(collapse); panel.add(refresh); return panel; }
From source file:com.edgenius.wiki.gwt.client.page.widgets.PrintButton.java
License:Open Source License
public PrintButton(PageMain pageMain, boolean showText) { this.main = pageMain; HorizontalPanel panel = new HorizontalPanel(); if (showText) { ClickLink locationBtn = new ClickLink(Msg.consts.print()); locationBtn.addClickHandler(this); panel.add(locationBtn);/* ww w . ja va 2 s .c om*/ } Image print = new Image(IconBundle.I.get().printer()); print.addClickHandler(this); panel.add(print); panel.setCellVerticalAlignment(print, HasVerticalAlignment.ALIGN_BOTTOM); this.setWidget(panel); }
From source file:com.edgenius.wiki.gwt.client.page.widgets.TemplatesPanel.java
License:Open Source License
public TemplatesPanel(PageMain main, EditPanel editPanel) { this.editPanel = editPanel; closeBtn.addClickHandler(this); HorizontalPanel header = new HorizontalPanel(); header.add(new HTML("<b>" + Msg.consts.templates() + "</b>")); header.add(message);/*from www .ja va 2s . co m*/ header.add(closeBtn); header.setCellHorizontalAlignment(closeBtn, HasHorizontalAlignment.ALIGN_RIGHT); VerticalPanel panel = new VerticalPanel(); panel.setWidth("100%"); content.setWidth("100%"); header.setWidth("100%"); panel.add(header); panel.add(content); this.setWidget(panel); this.setStyleName(Css.ATTACHMNET_PANEL); }
From source file:com.edgenius.wiki.gwt.client.portal.PortletCreateDialog.java
License:Open Source License
public PortletCreateDialog(final String key) { if (key == null) { this.setText(Msg.consts.create_widget()); } else {/*from w w w . j a va 2 s . c om*/ this.setText(Msg.consts.edit_widget()); } this.setIcon(new Image(IconBundle.I.get().star())); FlexTable plinkerPanel = new FlexTable(); pTitle.addFocusHandler(new FocusHandler() { public void onFocus(FocusEvent event) { String spaceUname = StringUtil.trim(pSpace.getText()); if (!StringUtil.isBlank(spaceUname) && !StringUtil.equalsIgnoreCase(currSpaceUname, spaceUname)) { pTitle.request(spaceUname); currSpaceUname = spaceUname; } } }); Label l1 = new Label(Msg.consts.space_uname()); plinkerPanel.setWidget(0, 0, l1); plinkerPanel.setWidget(0, 1, pSpace); Label l2 = new Label(Msg.consts.page_title()); plinkerPanel.setWidget(1, 0, l2); plinkerPanel.setWidget(1, 1, pTitle); FlexTable markupPanel = new FlexTable(); Label l3 = new Label(Msg.consts.title()); markupPanel.setWidget(0, 0, l3); markupPanel.setWidget(0, 1, title); title.setStyleName(Css.LONG_INPUT); Label l4 = new Label(Msg.consts.content()); markupPanel.setWidget(1, 0, l4); markupPanel.setWidget(1, 1, markup); markup.setStyleName(Css.LONG_TEXTBOX); okBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { WidgetModel widget = new WidgetModel(); widget.key = key; widget.description = desc.getText(); widget.shared = !keepPrivate.getValue(); String error = null; String spaceUname = null; if (typeMarkup.getValue()) { widget.type = WidgetModel.TYPE_MARKUP_RENDER; widget.title = title.getText(); widget.content = markup.getText(); if (StringUtil.isBlank(widget.title)) { error = "Title "; } if (StringUtil.isBlank(widget.content)) { if (error != null) error += " or Content"; else error = "Content "; } } else { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //page link widget widget.type = WidgetModel.TYPE_PAGE_LINKER; spaceUname = StringUtil.trimToEmpty(pSpace.getText()); widget.title = StringUtil.trimToEmpty(pTitle.getText()); //build content - whatever spaceUname or title is correct as this widget object is saved into ValidPageAsync() and save immediately if no errors. widget.content = "{include:src=" + EscapeUtil.escapeMacroParam(widget.title) + "@" + EscapeUtil.escapeMacroParam(spaceUname) + "}"; //it is bad idea if title is blank, then point to home page: it need lots hack to get back Home title etc. and in exception case, widget even can be blank title //this cause user have no chance to delete it anymore --- left rubbish widget on DB. if (StringUtil.isBlank(widget.title)) { error = "Title "; } if (StringUtil.isBlank(spaceUname)) { if (error != null) error += " or Space"; else error = "Space "; } } if (error != null) { error += " can not be blank."; message.error(error); return; } okBtn.setEnabled(false); if (typeMarkup.getValue()) { //for markup content widget, create immediately PortalControllerAsync portalController = ControllerFactory.getPortalController(); portalController.saveOrUpdateWidget(widget, PortletCreateDialog.this); } else { //for pagelink widget, valid from server side first, then save //valid if page exist or not? Valid from server side rather than just use suggest box, this is more exactly PageControllerAsync pageController = ControllerFactory.getPageController(); pageController.exist(spaceUname, widget.title, new ValidPageAsync(widget)); } } }); Button cancelBtn = new Button(Msg.consts.cancel(), ButtonIconBundle.crossImage()); cancelBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { hidebox(); } }); typePageLinker.addClickHandler(typeChangeListener); typeMarkup.addClickHandler(typeChangeListener); getButtonBar().add(cancelBtn); getButtonBar().add(okBtn); deck.insert(plinkerPanel, PAGE_LINER_INDEX); deck.insert(markupPanel, MARKUP_RENDER_INDEX); fillPanel(); int row = 0; FlexTable main = new FlexTable(); main.getColumnFormatter().setWidth(0, "120px"); main.setWidget(row, 0, message); main.getFlexCellFormatter().setColSpan(row, 0, 4); row++; Label l6 = new Label(Msg.consts.introduction()); main.setWidget(row, 0, l6); main.setWidget(row, 1, desc); desc.setMaxLength(250); desc.setStyleName(Css.LONG_INPUT); Label l5 = new Label(Msg.consts.keep_private()); main.setWidget(row, 2, l5); main.getFlexCellFormatter().setAlignment(row, 2, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE); main.setWidget(row, 3, keepPrivate); row++; HorizontalPanel chooser = new HorizontalPanel(); Label l7 = new Label(Msg.consts.page_linker()); Label l8 = new Label(Msg.consts.markup_render()); chooser.add(typePageLinker); chooser.add(l7); chooser.add(new HTML(" ")); chooser.add(typeMarkup); chooser.add(l8); chooser.setCellWidth(typePageLinker, "20px"); chooser.setCellWidth(typeMarkup, "20px"); main.setWidget(row, 0, chooser); main.getFlexCellFormatter().setColSpan(row, 0, 4); main.getFlexCellFormatter().setAlignment(row, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); row++; main.getFlexCellFormatter().setColSpan(row, 0, 4); main.getFlexCellFormatter().setHeight(row, 0, "3px"); row++; main.setWidget(row, 0, deck); main.getFlexCellFormatter().setColSpan(row, 0, 4); row++; main.setStyleName(Css.FORM); title.setStyleName(Css.FORM_INPUT); desc.setStyleName(Css.FORM_INPUT); pTitle.setStyleName(Css.FORM_INPUT); pSpace.setStyleName(Css.FORM_INPUT); l1.setStyleName(Css.FORM_LABEL); l2.setStyleName(Css.FORM_LABEL); l3.setStyleName(Css.FORM_LABEL); l4.setStyleName(Css.FORM_LABEL); // l5.setStyleName(Css.FORM_LABEL); l6.setStyleName(Css.FORM_LABEL); l7.setStyleName(Css.FORM_LABEL); DOM.setElementAttribute(l7.getElement(), "style", "text-align:left"); l8.setStyleName(Css.FORM_LABEL); DOM.setElementAttribute(l8.getElement(), "style", "text-align:left"); main.setSize("100%", "100%"); deck.setSize("100%", "100%"); VerticalPanel busyPanel = new VerticalPanel(); busyPanel.add(busyMessage); busyPanel.add(busyImg); mainDeck.insert(main, DECK_MAIN); mainDeck.insert(busyPanel, DECK_BUSY); if (key == null) mainDeck.showWidget(DECK_MAIN); else { //edit, loading widget info mainDeck.showWidget(DECK_BUSY); PortalControllerAsync portalController = ControllerFactory.getPortalController(); portalController.getWidget(key, new LoadingAsync()); } this.setWidget(mainDeck); }
From source file:com.edgenius.wiki.gwt.client.portal.PortletListDialogue.java
License:Open Source License
public PortletListDialogue(boolean anonymousLogin) { this.setText(Msg.consts.more_space_dialog_title()); this.setIcon(new Image(IconBundle.I.get().application_add())); FlexTable topPanel = new FlexTable(); Label label1 = new Label(Msg.consts.search_space_widget()); label1.setStyleName(Css.FORM_LABEL); topPanel.setWidget(0, 0, label1);/*from ww w . j ava 2 s .co m*/ label1.setWordWrap(false); filter.setStyleName(Css.SEARCH_INPUT); topPanel.setWidget(0, 1, filter); 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; searchBusyImg.setVisible(true); SearchControllerAsync action = ControllerFactory.getSearchController(); //first page, return 10 action.searchWidgetSpace(keyword, 0, SPACE_LIST_SIZE, new SpaceSearchAsync()); tabPanel.selectTab(TAB_SEARCH); } } }); topPanel.getFlexCellFormatter().setWidth(0, 0, "1%"); topPanel.getFlexCellFormatter().setWordWrap(0, 0, false); topPanel.getFlexCellFormatter().setWidth(0, 1, "97%"); int topPanelColume = 2; if (!anonymousLogin) { //so far, don't allow anonyomus to create widgets ClickLink newWidgetLn = new ClickLink(Msg.consts.create_widget()); newWidgetLn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { PortletCreateDialog dia = new PortletCreateDialog(null); //inherent all listener from parent, so that new portlet can add to dashboard for (ListDialogueListener listener : listeners) { dia.addListDialogueListener(listener); } //close PortletListDialog -- don't ask 2 dialog open at same time hidebox(); dia.showbox(); } }); topPanel.setWidget(0, 2, new Image(IconBundle.I.get().star())); topPanel.setWidget(0, 3, newWidgetLn); topPanel.getFlexCellFormatter().setWidth(0, 2, "1%"); topPanel.getFlexCellFormatter().setWidth(0, 3, "1%"); topPanel.getFlexCellFormatter().setWordWrap(0, 3, false); topPanelColume = 4; } //candidate list after user chooses topPanel.setWidget(1, 0, candidatePanel); topPanel.getFlexCellFormatter().setColSpan(1, 0, topPanelColume); Button okBtn = new Button(Msg.consts.ok(), ButtonIconBundle.tickImage()); okBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { hidebox(); //collect data(PortletModel) from candidate panel List values = candidatePanel.getCandidates(); //reverse value: because the portlet insert before the one which has same row number, //so far all portlets row are all 0. So, reverse them, so that first chosen portlet will display ahead others List portlets = new ArrayList(); int size = values.size(); for (int idx = size - 1; idx >= 0; idx--) { portlets.add(values.get(idx)); } //fire event, tell observer to update portlet for (Iterator<ListDialogueListener> iter = listeners.iterator(); iter.hasNext();) { ListDialogueListener lis = iter.next(); lis.dialogClosed(PortletListDialogue.this, portlets); } } }); Button cancelBtn = new Button(Msg.consts.cancel(), ButtonIconBundle.crossImage()); cancelBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { PortletListDialogue.this.hidebox(); } }); getButtonBar().add(cancelBtn); getButtonBar().add(okBtn); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Popular Tab VerticalPanel pPanel = new VerticalPanel(); pPanel.add(popularBusyImg); popularBusyImg.setVisible(true); pPanel.add(popularTable); initTable(popularTable, false); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Search Tab VerticalPanel rPanel = new VerticalPanel(); HorizontalPanel h1 = new HorizontalPanel(); pagination.addPaginationListener(new SearchPaginationCallback()); pagination.setPageSize(SPACE_LIST_SIZE); h1.add(pagination); h1.add(summary); h1.setSpacing(5); rPanel.add(searchBusyImg); searchBusyImg.setVisible(false); rPanel.add(searchRsTable); rPanel.add(rsMessage); rPanel.add(h1); initTable(widgetTable, true); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Widget Tab VerticalPanel wPanel = new VerticalPanel(); widgetBusyImg.setVisible(false); wPanel.add(widgetBusyImg); wPanel.add(widgetTable); initTable(widgetTable, false); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Tab panel tabPanel.add(pPanel, Msg.consts.popular_spaces()); tabPanel.add(wPanel, Msg.consts.widgets()); tabPanel.add(rPanel, Msg.consts.search_result()); tabPanel.selectTab(TAB_POPULAR); VerticalPanel panel = new VerticalPanel(); panel.add(message); panel.add(topPanel); panel.add(tabPanel); pPanel.setHeight("1%"); wPanel.setHeight("1%"); rPanel.setHeight("1%"); tabPanel.setWidth("100%"); panel.setSize("100%", "98%"); panel.setCellHeight(tabPanel, "100%"); topPanel.setStyleName(Css.BOX); tabPanel.addSelectionHandler(this); panel.setSpacing(5); this.addStyleName(Css.PORTLET_DIALOG_BOX); this.setWidget(panel); SpaceControllerAsync spaceController = ControllerFactory.getSpaceController(); spaceController.getSpacesInfo(null, SPACE_LIST_SIZE, null, new PopularCallback()); }
From source file:com.edgenius.wiki.gwt.client.render.SearchRenderWidget.java
License:Open Source License
public void initContentPanel() { pagination.addPaginationListener(this); pagination.setPageSize(SharedConstants.PAGE_SIZE); deck.insert(loadingPanel, LOADING_PANEL); deck.insert(resultPanel, RESULT_PANEL); deck.showWidget(LOADING_PANEL);/*from w ww . j av a 2s. co m*/ HorizontalPanel sumPanel = new HorizontalPanel(); sumPanel.add(pagination); sumPanel.add(summary); VerticalPanel leftPanel = new VerticalPanel(); leftPanel.add(message); leftPanel.add(deck); leftPanel.add(new HTML("<br>")); leftPanel.add(sumPanel); FlowPanel rightPanel = new FlowPanel(); rightPanel.add(advSearchPanel); HorizontalPanel mainPanel = new HorizontalPanel(); mainPanel.add(leftPanel); mainPanel.add(rightPanel); mainPanel.setCellWidth(rightPanel, AdvSearchPanel.WIDTH); mainPanel.setWidth("100%"); sumPanel.setWidth("100%"); leftPanel.setWidth("100%"); deck.setWidth("98%"); sumPanel.setWidth("98%"); sumPanel.setCellHorizontalAlignment(summary, HasHorizontalAlignment.ALIGN_RIGHT); sumPanel.setCellVerticalAlignment(summary, HasVerticalAlignment.ALIGN_MIDDLE); sumPanel.setCellVerticalAlignment(pagination, HasVerticalAlignment.ALIGN_MIDDLE); sumPanel.setStyleName(Css.SUMMARY); mainPanel.setStyleName(Css.SEARCH_RESULT); advSearchPanel.setKeyword(this.keyword); this.setWidget(mainPanel); }