List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter
public FlexCellFormatter getFlexCellFormatter()
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 w w w . j ava 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.PrettyUrlPanel.java
License:Open Source License
public PrettyUrlPanel() { FlexTable panel = new FlexTable(); DOM.setElementAttribute(tinyCopy.getElement(), "id", tinyID + "copyclip"); DOM.setElementAttribute(meaningCopy.getElement(), "id", meaningID + "copyclip"); DOM.setElementAttribute(shellCopy.getElement(), "id", shellID + "copyclip"); //tiny url/*from w w w .j a v a 2 s . com*/ int idx = 0; panel.setWidget(0, idx, new Label(Msg.consts.tiny_url() + ": ")); panel.getColumnFormatter().setWidth(idx, "120px"); idx++; panel.setWidget(0, idx, tinyLink); idx++; panel.setWidget(0, idx, tinyMail); panel.getColumnFormatter().setWidth(idx, "120px"); panel.getFlexCellFormatter().setHorizontalAlignment(0, idx, HasHorizontalAlignment.ALIGN_CENTER); idx++; panel.setWidget(0, idx, tinyCopy); panel.getColumnFormatter().setWidth(idx, "120px"); panel.getFlexCellFormatter().setHorizontalAlignment(0, idx, HasHorizontalAlignment.ALIGN_CENTER); //meaning url idx = 0; panel.setWidget(1, idx, new Label(Msg.consts.meaning_url() + ": ")); panel.getColumnFormatter().setWidth(idx, "120px"); idx++; panel.setWidget(1, idx, meaningLink); idx++; panel.setWidget(1, idx, meaningMail); panel.getColumnFormatter().setWidth(idx, "120px"); panel.getFlexCellFormatter().setHorizontalAlignment(1, idx, HasHorizontalAlignment.ALIGN_CENTER); idx++; panel.setWidget(1, idx, meaningCopy); panel.getColumnFormatter().setWidth(idx, "120px"); panel.getFlexCellFormatter().setHorizontalAlignment(1, idx, HasHorizontalAlignment.ALIGN_CENTER); //shell url idx = 0; panel.setWidget(2, idx, new Label(Msg.consts.shell_url() + ": ")); panel.getColumnFormatter().setWidth(idx, "120px"); idx++; panel.setWidget(2, idx, shellLink); idx++; panel.setWidget(2, idx, shellMail); panel.getColumnFormatter().setWidth(idx, "120px"); panel.getFlexCellFormatter().setHorizontalAlignment(2, idx, HasHorizontalAlignment.ALIGN_CENTER); idx++; panel.setWidget(2, idx, shellCopy); panel.getColumnFormatter().setWidth(idx, "120px"); panel.getFlexCellFormatter().setHorizontalAlignment(2, idx, HasHorizontalAlignment.ALIGN_CENTER); //panel panel.setSize("100%", "100%"); this.setWidget(panel); this.setStyleName(Css.ATTACHMNET_PANEL); //only panel initialised , the ID field is valid Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { tinyClip = initClip(tinyID + "copyclip", tinyID, PrettyUrlPanel.this); meaningClip = initClip(meaningID + "copyclip", meaningID, PrettyUrlPanel.this); shellClip = initClip(shellID + "copyclip", shellID, PrettyUrlPanel.this); if (!PrettyUrlPanel.this.isVisible()) { hideClip(tinyClip); hideClip(meaningClip); hideClip(shellClip); } } }); }
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 {// w ww. j a va2 s.co m 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 w w w . j a va 2 s. c om*/ 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.TagCloudRenderWidget.java
License:Open Source License
public TagCloudRenderWidget(final String spaceUname) { this.spaceUname = spaceUname; FlexTable panel = new FlexTable(); panel.setWidget(0, 0, message);//from w w w . j ava 2s.co m panel.getFlexCellFormatter().setColSpan(0, 0, 3); panel.setWidget(1, 0, cloudPanel); //just separator between tag cloud and its list. panel.setWidget(1, 1, new HTML(" ")); panel.setWidget(1, 2, listsPanel); panel.getCellFormatter().setWidth(1, 0, "30%"); panel.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); panel.getCellFormatter().setWidth(1, 1, "20px"); panel.getCellFormatter().setWidth(1, 2, "70%"); panel.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP); panel.setSize("100%", "100%"); this.setWidget(panel); cloudPanel.setStyleName(Css.TAGCLOUD); }
From source file:com.edgenius.wiki.gwt.client.user.PersonalProfile.java
License:Open Source License
/** * //from w w w . j a v a 2s. c o m * @param panel * @param form * @param require, 0: signup (all fields), 1:profile(except password and loginname), 2: password only */ public void userInfo(FlexTable panel, FormPanel form, int style) { KeyDownHandler enterSubmit = GwtClientUtils.createEnterSubmitListener(form); int row = 0; panel.setStyleName(Css.SIGNUP_TABLE); //signup if ((style & STYLE_SIGNUP) > 0 || (style & STYLE_ADD) > 0) { Label loginNameLabel = new Label(Msg.consts.login_name()); loginNameLabel.setStyleName(Css.FORM_LABEL); loginName.setName("user.username"); loginName.valid(Msg.consts.login_name(), true, 4, LOGIN_NAME_MAX_LEN, this); loginName.addKeyDownHandler(enterSubmit); loginName.setStyleName(Css.FORM_INPUT); panel.setWidget(row, 0, loginNameLabel); panel.setWidget(row, 1, loginName); row++; } //signup, password if ((style & STYLE_SIGNUP) > 0 || (style & STYLE_ADD) > 0 || (style & STYLE_PASSWORD) > 0) { Label passwordLabel = new Label(Msg.consts.password()); passwordLabel.setStyleName(Css.FORM_LABEL); password.setName("user.password"); password.addKeyDownHandler(enterSubmit); password.addKeyPressHandler(new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { String text = password.getText(); if (text.length() > LOGIN_PASSWORD_LEN) { text = text.substring(0, LOGIN_PASSWORD_LEN); password.setText(text); } } }); password.valid(Msg.consts.password(), true, 6, LOGIN_PASSWORD_LEN, null); password.setStyleName(Css.FORM_INPUT); Label repasswordLabel = new Label(Msg.consts.confirm_password()); repassword.setName("user.confirmPassword"); repassword.addKeyDownHandler(enterSubmit); repassword.valid(Msg.consts.password(), false, 0, LOGIN_PASSWORD_LEN, this); repassword.setStyleName(Css.FORM_INPUT); repasswordLabel.setStyleName(Css.FORM_LABEL); panel.setWidget(row, 0, passwordLabel); panel.setWidget(row, 1, password); row++; panel.setWidget(row, 0, repasswordLabel); panel.setWidget(row, 1, repassword); row++; if ((style & STYLE_PASSWORD) > 0) { Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { password.setFocus(true); } }); } } //signup, profile if ((style & STYLE_SIGNUP) > 0 || (style & STYLE_ADD) > 0) { Label fullnameLabel = new Label(Msg.consts.full_name()); fullnameLabel.setStyleName(Css.FORM_LABEL); fullname.setName("user.fullname"); fullname.addKeyDownHandler(enterSubmit); fullname.valid(Msg.consts.full_name(), true, 0, LOGIN_FULLNAME_LEN, null); fullname.setStyleName(Css.FORM_INPUT); panel.setWidget(row, 0, fullnameLabel); panel.setWidget(row, 1, fullname); row++; Label emailLabel = new Label(Msg.consts.email()); email.setName("user.contact.email"); email.addKeyDownHandler(enterSubmit); email.valid(Msg.consts.email(), true, 0, LOGIN_EMAIL_LEN, this); email.setStyleName(Css.FORM_INPUT); emailLabel.setStyleName(Css.FORM_LABEL); panel.setWidget(row, 0, emailLabel); panel.setWidget(row, 1, email); row++; } //signup if ((style & STYLE_SIGNUP) > 0) { captcha.enable(); captcha.getCaptchaInputWidget().addKeyDownHandler(enterSubmit); panel.getFlexCellFormatter().setColSpan(row, 0, 2); panel.setWidget(row, 0, captcha); row++; } panel.setWidth("100%"); }
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);//from w ww . j ava2 s . co 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.DialogBox.java
License:Open Source License
public DialogBox(UIObject parent, boolean autoHide, boolean withBackground, boolean modal) { super(autoHide, modal); if (modal && withBackground) lightbox = new Lightbox(parent, this); closeBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { hidebox();//from w w w . j a v a 2 s . c om } }); VerticalPanel panel = new VerticalPanel(); //caption part: caption focus panel(drag/drop handler) and close button captionTable.setWidget(0, 0, icon); captionTable.setWidget(0, 1, caption); captionTable.setWidget(0, 2, closeBtn); captionTable.getCellFormatter().setWidth(0, 0, "42px"); captionTable.getCellFormatter().setWidth(0, 2, "42px"); captionTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_BOTTOM); captionTable.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); captionTable.getFlexCellFormatter().setVerticalAlignment(0, 2, HasVerticalAlignment.ALIGN_BOTTOM); captionTable.getFlexCellFormatter().setStyleName(0, 0, "dlg-top-left"); captionTable.getFlexCellFormatter().setStyleName(0, 1, "dlg-border-top"); captionTable.getFlexCellFormatter().setStyleName(0, 2, "dlg-top-right"); captionTable.setCellPadding(0); captionTable.setCellSpacing(0); FlexTable bodyTable = new FlexTable(); bodyTable.getFlexCellFormatter().setStyleName(0, 0, "dlg-border-left"); bodyTable.getFlexCellFormatter().setStyleName(0, 2, "dlg-border-right"); bodyTable.setWidget(0, 1, body); bodyTable.setWidget(1, 0, buttonBar); bodyTable.setCellPadding(0); bodyTable.setCellSpacing(0); bodyTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP); bodyTable.getFlexCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_BOTTOM); bodyTable.getFlexCellFormatter().setStyleName(0, 1, Css.MAIN_BODY); bodyTable.getFlexCellFormatter().setStyleName(1, 0, Css.BUTTONS_BAR); bodyTable.getFlexCellFormatter().setRowSpan(0, 0, 2); bodyTable.getFlexCellFormatter().setRowSpan(0, 2, 2); bodyTable.getCellFormatter().setWidth(0, 0, "17px"); bodyTable.getCellFormatter().setWidth(0, 2, "17px"); FlexTable bottomTable = new FlexTable(); bottomTable.setWidget(0, 0, new HTML(" ")); //just a placeholder bottomTable.setWidget(0, 1, new HTML(" ")); //just a placeholder bottomTable.setWidget(0, 2, new HTML(" ")); //just a placeholder bottomTable.getFlexCellFormatter().setStyleName(0, 0, "dlg-bottom-left"); bottomTable.getFlexCellFormatter().setStyleName(0, 1, "dlg-border-bottom"); bottomTable.getFlexCellFormatter().setStyleName(0, 2, "dlg-bottom-right"); bottomTable.getCellFormatter().setWidth(1, 0, "34px"); bottomTable.getCellFormatter().setWidth(1, 2, "34px"); bottomTable.setCellPadding(0); bottomTable.setCellSpacing(0); panel.add(captionTable); panel.add(bodyTable); panel.add(bottomTable); //style captionTable.setWidth("100%"); bodyTable.setWidth("100%"); bottomTable.setWidth("100%"); body.setSize("100%", "100%"); caption.setWidth("100%"); panel.setStyleName(Css.DIALOG_BOX_TABLE); panel.setBorderWidth(0); caption.addMouseOutHandler(this); caption.addMouseOverHandler(this); caption.addMouseDownHandler(this); caption.addMouseUpHandler(this); caption.addMouseMoveHandler(this); // icon.addMouseOutHandler(this); // icon.addMouseOverHandler(this); // icon.addMouseDownHandler(this); // icon.addMouseUpHandler(this); // icon.addMouseMoveHandler(this); captionTable.setStyleName(Css.CAPTION); setStyleName(Css.DIALOG_BOX); windowWidth = Window.getClientWidth(); clientLeft = Document.get().getBodyOffsetLeft(); clientTop = Document.get().getBodyOffsetTop(); super.setWidget(panel); }
From source file:com.edgenius.wiki.gwt.client.widgets.MessageDialog.java
License:Open Source License
public MessageDialog(UIObject parent, int type, String caption, String message) { super(parent); if (caption != null) this.setText(caption); else {/*from w w w . j av a 2 s . c o m*/ if (type == TYPE_CONFIRM) { this.setText(Msg.consts.confirm()); this.setIcon(new Image(IconBundle.I.get().comment())); } else { this.setText(Msg.consts.alert()); this.setIcon(new Image(IconBundle.I.get().warning())); } } this.addStyleName(Css.MESSAGE_DIALOG); ButtonBar btnBar = getButtonBar(); FlexTable panel = new FlexTable(); if (type == TYPE_CONFIRM) { panel.setWidget(0, 0, new Image(LargeIconBundle.I.get().question())); Button okBtn = new Button(Msg.consts.ok(), ButtonIconBundle.tickImage()); Button cancelBtn = new Button(Msg.consts.cancel(), ButtonIconBundle.crossImage()); okBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { confirmEvent(); MessageDialog.this.hidebox(); } }); cancelBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { cancelEvent(); MessageDialog.this.hidebox(); } }); btnBar.add(cancelBtn); btnBar.add(okBtn); } else if (type == TYPE_ALERT) { panel.setWidget(0, 0, new Image(LargeIconBundle.I.get().warning())); Button okBtn = new Button(Msg.consts.ok(), ButtonIconBundle.tickImage()); okBtn.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { MessageDialog.this.hidebox(); } }); btnBar.add(okBtn); } Label lb = new Label(message); lb.setStyleName(Css.MESSAGE); panel.setWidget(0, 1, lb); panel.getCellFormatter().setWidth(0, 1, "99%"); panel.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); panel.setWidth("100%"); this.setWidget(panel); }
From source file:com.ephesoft.dcma.gwt.rv.client.view.TableExtractionView.java
License:Open Source License
public void insertNewRow(final Button button) { if (selectedRowNumber == 0) { if (checkDataPresent()) { showConfirmationDialog(/*from ww w .ja v a 2 s . c o m*/ LocaleDictionary.get().getMessageValue(ReviewValidateMessages.NO_ROW_SELECTED), LocaleDictionary.get().getMessageValue(ReviewValidateMessages.INSERT_ROW), button); } else { selectedRowNumber = 1; FlexTable flexTable = tableNameVsViewMap.get(selectedDataTableName); flexTable.getFlexCellFormatter().setColSpan(1, 0, 1); insertDeleteRow(Action.INSERT, button); } } else { createRadioOption(button); } }