List of usage examples for com.google.gwt.user.client.ui RichTextArea RichTextArea
public RichTextArea()
From source file:com.apress.progwt.client.college.gui.CollegeEntry.java
License:Apache License
/** * thoughts tab// w ww. j a va 2s.com * * @return */ private Widget getThoughts() { proConPanel = new ProConPanel(user, application, this); notesField = new RichTextArea(); notesField.setSize("30em", "15em"); notesField.setHTML(application.getNotes()); RichTextToolbar rtt = new RichTextToolbar(notesField); saveB = new Button("Save"); saveB.addClickListener(new ClickListener() { public void onClick(Widget sender) { Log.debug("CollegeEntry.bf " + application.getNotes() + " " + application.getPros().size()); bindFields(); Log.debug("CollegeEntry.af " + application.getNotes() + " " + application.getPros().size()); AbstractCommand command = new SaveApplicationCommand(application); serviceCache.executeCommand(command, new StdAsyncCallback<SiteCommand>("Save") { }); } }); VerticalPanel thoughtsP = new VerticalPanel(); thoughtsP.add(rtt); thoughtsP.add(notesField); thoughtsP.add(proConPanel); thoughtsP.add(saveB); return thoughtsP; }
From source file:com.apress.progwt.client.forum.CreatePostWidget.java
License:Apache License
public CreatePostWidget(final ForumApp app, boolean isReply, final CreatePostDialog createPostDialog, final User author, String selection) { VerticalPanel mainP = new VerticalPanel(); titleBox = new TextBox(); textArea = new RichTextArea(); textArea.setSize("35em", "15em"); RichTextToolbar toolbar = new RichTextToolbar(textArea); HorizontalPanel hp = new HorizontalPanel(); hp.add(new Label("Title:")); hp.add(titleBox);/*w w w.j a va 2 s .c om*/ mainP.add(hp); mainP.add(toolbar); mainP.add(textArea); Button cancelB = new Button("Cancel"); Button submitB = new Button("Create Thread"); if (isReply) { submitB.setText("Post Reply"); } submitB.addClickListener(new ClickListener() { public void onClick(Widget sender) { app.create(author, titleBox.getText(), textArea.getHTML()); createPostDialog.hide(); } }); cancelB.addClickListener(new ClickListener() { public void onClick(Widget sender) { createPostDialog.hide(); } }); mainP.add(cancelB); mainP.add(submitB); initWidget(mainP); setHTML(makeReplyFromString(selection)); }
From source file:com.arcbees.gquery.tooltip.client.TooltipDocumentation.java
License:Apache License
private void setupMenuTooltip() { // Create the text area and toolbar RichTextArea area = new RichTextArea(); area.setSize("100%", "30px"); RichTextToolbar toolbar = new RichTextToolbar(area); toolbar.ensureDebugId("cwRichText-toolbar"); toolbar.setWidth("100%"); RootPanel.get("widgetSample").add(toolbar); RootPanel.get("widgetSample").add(area); //apply tooltip plugin on element of the toolbar defining a title $("[title]", toolbar).as(Tooltip) .tooltip(new TooltipOptions().withDelayShow(200).withDelayHide(100).withContainer("element")); }
From source file:com.google.gwt.gears.sample.gwtnote.client.ui.RichTextWidget.java
License:Apache License
/** * Creates a new widget. This class needs access to certain fields and methods * on the application enclosing it./* w w w . j a v a 2 s . com*/ * * @param parent the host application */ public RichTextWidget(final GWTNote parent) { super(); VerticalPanel top = new VerticalPanel(); top.setWidth("100%"); HorizontalPanel header = new HorizontalPanel(); top.add(header); header.setWidth("100%"); header.add(new Label("GWT GearsNote")); header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); status = new Label("Ready"); header.add(status); this.bodyWidget = new RichTextArea(); bodyWidget.addKeyboardListener(new KeyboardListenerAdapter() { @Override public void onKeyPress(Widget sender, char keyCode, int modifiers) { String newText = bodyWidget.getText(); if (((newText == null) && (curText != null)) || ((newText != null) && !newText.equals(curText))) { curText = newText; } } }); HorizontalPanel controls = new HorizontalPanel(); RichTextToolbar tb = new RichTextToolbar(this.bodyWidget); name = new TextBox(); name.setText("default"); name.setEnabled(false); nameEdit = new PushButton("Edit"); nameEdit.addClickListener(new ClickListener() { public void onClick(Widget sender) { String curName = name.getText(); boolean doNotify = !oldName.equals(curName); if (!nameEditable) { // if becoming editable, store off current value oldName = curName; } if (nameEditable && (curName == null || "".equals(curName))) { // if becoming un-editable, check to make sure it's valid Window.alert("The note name cannot be blank. Please try again."); nameEdit.setText(oldName); return; } // if all else is good, just flip the state nameEditable = !nameEditable; name.setEnabled(nameEditable); nameEdit.getUpFace().setText((nameEditable ? "Confirm" : "Edit")); if (doNotify) { notifyNameListeners(); } } }); nameEdit.addStyleName("edit-button"); options = new ListBox(); controls.add(tb); options.addItem("default"); options.setSelectedIndex(0); options.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { String newName = options.getItemText(options.getSelectedIndex()); name.setText(newName); notifyNameListeners(); } }); HorizontalPanel tmp = new HorizontalPanel(); tmp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); tmp.add(new Label("Note name:")); tmp.add(name); tmp.add(nameEdit); tmp.add(options); controls.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); controls.setWidth("100%"); controls.add(tmp); top.add(controls); top.add(bodyWidget); this.bodyWidget.setWidth("100%"); top.setCellHeight(bodyWidget, ((int) (Window.getClientHeight() * .75)) + "px"); this.bodyWidget.setHeight("100%"); initWidget(top); }
From source file:com.google.gwt.sample.showcase.client.content.text.CwRichText.java
License:Apache License
/** * Initialize this example.//w w w. j a v a2 s . co m */ @ShowcaseSource @Override public Widget onInitialize() { // Create the text area and toolbar RichTextArea area = new RichTextArea(); area.ensureDebugId("cwRichText-area"); area.setSize("100%", "14em"); RichTextToolbar toolbar = new RichTextToolbar(area); toolbar.ensureDebugId("cwRichText-toolbar"); toolbar.setWidth("100%"); // Add the components to a panel Grid grid = new Grid(2, 1); grid.setStyleName("cw-RichText"); grid.setWidget(0, 0, toolbar); grid.setWidget(1, 0, area); return grid; }
From source file:com.google.livingstories.client.ui.RichTextEditor.java
License:Apache License
/** * Create a RichTextArea and a toolbar connected to it and add them to the VerticalPanel. *///from www.ja va 2 s .com private void populateRichTextVerticalPanel() { richTextArea = new RichTextArea(); richTextArea.setSize(EDITOR_WIDTH + "px", "300px"); RichTextToolbar richTextToolbar = new RichTextToolbar(richTextArea); richTextToolbar.setWidth(EDITOR_WIDTH + "px"); richTextVerticalPanel.clear(); richTextVerticalPanel.add(richTextToolbar); richTextVerticalPanel.add(richTextArea); }
From source file:com.ikon.frontend.client.widget.popup.NotesPopup.java
License:Open Source License
/** * NotesPopup//w w w . j a v a2 s .c o m */ public NotesPopup() { // Establishes auto-close when click outside super(false, true); setText(Main.i18n("general.menu.edit.add.note")); // Status status = new Status(this); status.setStyleName("okm-StatusPopup"); newNotePanel = new VerticalPanel(); richTextArea = new RichTextArea(); richTextArea.setSize("100%", "14em"); richTextToolbar = new RichTextToolbar(richTextArea); gridRichText = new Grid(2, 1); gridRichText.setStyleName("RichTextToolbar"); gridRichText.addStyleName("okm-Input"); gridRichText.setWidget(0, 0, richTextToolbar); gridRichText.setWidget(1, 0, richTextArea); newNotePanel.add(gridRichText); add = new Button(Main.i18n("button.add"), new ClickHandler() { @Override public void onClick(ClickEvent event) { addNote(); } }); add.setStyleName("okm-AddButton"); cancel = new Button(Main.i18n("button.cancel"), new ClickHandler() { @Override public void onClick(ClickEvent event) { reset(); hide(); } }); cancel.setStyleName("okm-NoButton"); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(add); hPanel.add(new HTML(" ")); hPanel.add(cancel); newNotePanel.add(hPanel); newNotePanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER); newNotePanel.setCellHeight(hPanel, "25"); newNotePanel.setCellVerticalAlignment(hPanel, HasAlignment.ALIGN_MIDDLE); hide(); setWidget(newNotePanel); }
From source file:com.ikon.frontend.client.widget.properties.Notes.java
License:Open Source License
/** * Notes/*from w ww.jav a2s . c o m*/ */ public Notes(int type) { this.type = type; isChrome = (Util.getUserAgent().startsWith("safari") || Util.getUserAgent().startsWith("chrome")); tableNotes = new FlexTable(); scrollPanel = new ScrollPanel(tableNotes); newNotePanel = new VerticalPanel(); addNote = new HTML("<b>" + Main.i18n("general.menu.edit.add.note") + "</b>"); richTextArea = new RichTextArea(); richTextArea.setSize("100%", "14em"); richTextToolbar = new RichTextToolbar(richTextArea); richTextArea.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { evaluateButtons(); } }); // richTextToolbar.setWidth("100%"); gridRichText = new Grid(2, 1); gridRichText.setStyleName("RichTextToolbar"); gridRichText.addStyleName("okm-Input"); gridRichText.setWidget(0, 0, richTextToolbar); gridRichText.setWidget(1, 0, richTextArea); textArea = new TextArea(); textArea.setPixelSize(550, 160); textArea.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { evaluateButtons(); } }); textArea.setStyleName("okm-Input"); addButton = new Button(Main.i18n("button.add"), new ClickHandler() { @Override public void onClick(ClickEvent event) { addNote(); } }); addButton.setEnabled(false); updateButton = new Button(Main.i18n("button.update"), new ClickHandler() { @Override public void onClick(ClickEvent event) { setNote(editedNotePath, getTextNote(), editedNoteRow); } }); updateButton.setEnabled(false); cancelButton = new Button(Main.i18n("button.cancel"), new ClickHandler() { @Override public void onClick(ClickEvent event) { reset(); } }); updateButton.setVisible(false); cancelButton.setVisible(false); newNotePanel.add(Util.vSpace("40")); newNotePanel.add(addNote); if (isChrome) { newNotePanel.add(textArea); } else { newNotePanel.add(gridRichText); } newNotePanel.add(Util.vSpace("10")); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(cancelButton); hPanel.add(new HTML(" ")); hPanel.add(addButton); hPanel.add(new HTML(" ")); hPanel.add(updateButton); newNotePanel.add(hPanel); newNotePanel.setCellHorizontalAlignment(addNote, HasAlignment.ALIGN_CENTER); if (isChrome) { newNotePanel.setCellHorizontalAlignment(textArea, HasAlignment.ALIGN_CENTER); } else { newNotePanel.setCellHorizontalAlignment(gridRichText, HasAlignment.ALIGN_CENTER); } newNotePanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER); addButton.setStyleName("okm-AddButton"); updateButton.setStyleName("okm-YesButton"); cancelButton.setStyleName("okm-NoButton"); tableNotes.setWidth("100%"); newNotePanel.setVisible(false); initWidget(scrollPanel); }
From source file:com.jcommerce.gwt.client.panels.goods.NewGoods.java
License:Apache License
protected void onRender(Element parent, int index) { super.onRender(parent, index); contentPanelGeneral.createPanel(IGoods.NAME, Resources.constants.Goods_name(), new TextBox()); contentPanelGeneral.createPanel(IGoods.SN, Resources.constants.Goods_SN(), new TextBox()); contentPanelGeneral.createPanel(IGoods.BRAND, Resources.constants.Goods_brand(), g_list); MultiValueSelector mselector = new MultiValueSelector(); mselector.setBean(ModelNames.CATEGORY); mselector.setCaption("Select Category"); mselector.setMessage("Select Category"); contentPanelGeneral.createPanel(IGoods.CATEGORIES, Resources.constants.Goods_category(), mselector); contentPanelGeneral.createPanel(IGoods.SHOPPRICE, Resources.constants.Goods_shopPrice(), new TextBox()); contentPanelGeneral.createPanel(IGoods.MARKETPRICE, Resources.constants.Goods_marketPrice(), new TextBox()); contentPanelGeneral.createPanel(IGoods.GIVEINTEGRAL, Resources.constants.Goods_giveIntegral(), new TextBox()); contentPanelGeneral.createPanel(IGoods.INTEGRAL, Resources.constants.Goods_integral(), new TextBox()); contentPanelGeneral.createPanel(IGoods.PROMOTEPRICE, Resources.constants.Goods_promotePrice(), new TextBox()); final FileUploader imageUpload = new FileUploader(); imageUpload.addAllowedTypes(new String[] { ".jpg", ".gif" }); contentPanelGeneral.createPanel(IGoods.IMAGE, Resources.constants.Goods_image(), imageUpload); final FileUploader thumbUpload = new FileUploader(); thumbUpload.addAllowedTypes(new String[] { ".jpg", ".gif" }); contentPanelGeneral.createPanel(IGoods.THUMB, Resources.constants.Goods_thumb(), thumbUpload); contentPanelOther.createPanel(IGoods.WEIGHT, Resources.constants.Goods_weight(), new TextBox()); contentPanelOther.createPanel(IGoods.NUMBER, Resources.constants.Goods_number(), new TextBox()); contentPanelOther.createPanel(IGoods.WARNNUMBER, Resources.constants.Goods_warnNumber(), new TextBox()); contentPanelOther.createPanel(IGoods.HOTSOLD, Resources.constants.Goods_hotsold(), new CheckBox()); contentPanelOther.createPanel(IGoods.NEWADDED, Resources.constants.Goods_newAdded(), new CheckBox()); contentPanelOther.createPanel(IGoods.BESTSOLD, Resources.constants.Goods_bestSold(), new CheckBox()); contentPanelOther.createPanel(IGoods.BRIEF, Resources.constants.Goods_brief(), new TextArea()); contentPanelOther.createPanel(IGoods.SELLERNOTE, Resources.constants.Goods_sellerNote(), new TextArea()); HorizontalPanel panel = new HorizontalPanel(); panel.setSpacing(10);//from w w w . ja va2s .co m btnOK.setText(""); btnCancel.setText("?"); panel.add(btnOK); panel.add(btnCancel); // Create a tab panel DecoratedTabPanel tabPanel = new DecoratedTabPanel(); tabPanel.setWidth("100%"); tabPanel.setAnimationEnabled(true); // Add a home tab tabPanel.add(contentPanelGeneral, Resources.constants.NewGoods_tabGeneral()); // Create the text area and toolbar RichTextArea area = new RichTextArea(); area.setSize("100%", "14em"); RichTextToolbar toolbar = new RichTextToolbar(area); toolbar.setWidth("100%"); //Add the components to a panel Grid grid = new Grid(2, 1); grid.setStyleName("cw-RichText"); grid.setWidget(0, 0, toolbar); grid.setWidget(1, 0, area); // Add a detail tab HTML properties2 = new HTML("properites"); tabPanel.add(grid, Resources.constants.NewGoods_tabDetail()); // Add a other tab tabPanel.add(contentPanelOther, Resources.constants.NewGoods_tabOther()); // Add a Properties tab tabPanel.add(attrPanel, Resources.constants.NewGoods_tabProperty()); // Add a Pictures tab tabPanel.add(galleryPanel, Resources.constants.NewGoods_tabGallery()); // Add a Connet other goods tab HTML conngoods = new HTML("connect goods"); tabPanel.add(conngoods, Resources.constants.NewGoods_tabLink()); // Add a Accessories tab HTML accessories = new HTML("accessories"); tabPanel.add(accessories, Resources.constants.NewGoods_tabAccessories()); // Add a Connet articles tab HTML articles = new HTML("articles"); tabPanel.add(articles, Resources.constants.NewGoods_tabArticle()); // Return the content tabPanel.selectTab(0); tabPanel.ensureDebugId("cwTabPanel"); add(tabPanel); add(panel); createList(); btnOK.addClickListener(new ClickListener() { public void onClick(Widget sender) { if (!imageUpload.submit()) { return; } if (!thumbUpload.submit()) { return; } new WaitService(new WaitService.Job() { public boolean isReady() { return imageUpload.isFinish() && thumbUpload.isFinish(); } public void run() { Date currentTime = new Date(); Timestamp nowTime = new Timestamp(currentTime.getTime()); Map<String, Object> argsLeft = contentPanelGeneral.getValues(); Map<String, Object> argsRight = contentPanelOther.getValues(); Map<String, Object> argsAttrs = attrPanel.getValues(); argsLeft.putAll(argsRight); argsLeft.putAll(argsAttrs); argsLeft.put("addTime", nowTime);//addTime information if (editting) { new UpdateService().updateBean(goodsId, new BeanObject(ModelNames.GOODS, argsLeft), null); editting = false; iShop.getInstance().displayGoodsList(); Info.display("?", "???."); } else { new CreateService().createBean(new BeanObject(ModelNames.GOODS, argsLeft), null); iShop.getInstance().displayGoodsList(); Info.display("?", "??."); } } }); } }); btnCancel.addClickListener(new ClickListener() { public void onClick(Widget sender) { contentPanelGeneral.clearValues(); contentPanelOther.clearValues(); attrPanel.updateValues(null); } }); }
From source file:com.jcommerce.gwt.client.panels.goods.NewGoodsBase.java
License:Apache License
protected void onRender(Element parent, int index) { super.onRender(parent, index); System.out.println("onRender " + hashCode() + " " + getCurState().isEditting()); BeanObject goods = getGoods();/* w w w .j ava 2 s. co m*/ boolean editting = getCurState().isEditting(); final String goodsId = goods != null ? goods.getString(IGoods.ID) : null; contentPanelGeneral.createPanel(IGoods.NAME, Resources.constants.Goods_name(), new TextBox(), new SpaceChecker(Resources.constants.Goods_name())); WidgetInfo info = new WidgetInfo(IGoods.SN, Resources.constants.Goods_SN(), new TextBox()); info.setNote("?????"); contentPanelGeneral.createPanel(info); Button btnAddBrand = new Button("?"); btnAddBrand.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { NewBrand.State state = new NewBrand.State(); state.setBackPage("" + getCurState().getMenuDisplayName(), getCurState()); state.execute(); } }); contentPanelGeneral.createPanel(IGoods.BRAND, Resources.constants.Goods_brand(), lstBrand, btnAddBrand); Button btnAddCat = new Button("?"); btnAddCat.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { NewCategory.State state = new NewCategory.State(); state.setBackPage("" + getCurState().getMenuDisplayName(), getCurState()); state.execute(); } }); info = new WidgetInfo(IGoods.MAINCATEGORY, Resources.constants.Goods_category(), lstCategory); info.setValidator(new SpaceChecker(Resources.constants.Goods_category())); info.setAppendWidget(btnAddCat); contentPanelGeneral.createPanel(info); MultiValueSelector mselector = new MultiValueSelector(); mselector.setBean(ModelNames.CATEGORY); mselector.setCaption("Select Category"); mselector.setMessage("Select Category"); contentPanelGeneral.createPanel(IGoods.CATEGORIES, Resources.constants.Goods_category_extended(), mselector); contentPanelGeneral.createPanel(IGoods.SHOPPRICE, Resources.constants.Goods_shopPrice(), new TextBox(), new PriceChecker(Resources.constants.Goods_shopPrice(), 0, false)); contentPanelGeneral.createPanel(IGoods.MARKETPRICE, Resources.constants.Goods_marketPrice(), new TextBox(), new PriceChecker(Resources.constants.Goods_marketPrice(), 0, true)); contentPanelGeneral.createPanel(IGoods.GIVEINTEGRAL, Resources.constants.Goods_giveIntegral(), new TextBox()); contentPanelGeneral.createPanel(IGoods.INTEGRAL, Resources.constants.Goods_integral(), new TextBox()); contentPanelGeneral.createPanel(IGoods.PROMOTEPRICE, Resources.constants.Goods_promotePrice(), new TextBox(), new PriceChecker(Resources.constants.Goods_promotePrice(), 0, true)); final FileUploader imageUpload = new FileUploader(); imageUpload.addAllowedTypes(new String[] { ".jpg", ".gif" }); // contentPanelGeneral.createPanel(IGoods.IMAGE, Resources.constants.Goods_image(), imageUpload); final FileUploader thumbUpload = new FileUploader(); thumbUpload.addAllowedTypes(new String[] { ".jpg", ".gif" }); if (editting) { imageUpload.setImageInfo(ModelNames.GOODS, goodsId, IGoods.IMAGE); thumbUpload.setImageInfo(ModelNames.GOODS, goodsId, IGoods.THUMB); } contentPanelGeneral.createPanel(IGoods.IMAGE, Resources.constants.Goods_image(), imageUpload); contentPanelGeneral.createPanel(IGoods.THUMB, Resources.constants.Goods_thumb(), thumbUpload); contentPanelOther.createPanel(IGoods.WEIGHT, Resources.constants.Goods_weight(), new TextBox()); contentPanelOther.createPanel(IGoods.NUMBER, Resources.constants.Goods_number(), new TextBox(), new IntegerChecker(Resources.constants.Goods_number(), 0, true)); contentPanelOther.createPanel(IGoods.WARNNUMBER, Resources.constants.Goods_warnNumber(), new TextBox(), new IntegerChecker(Resources.constants.Goods_number(), 0, true)); contentPanelOther.createPanel(IGoods.HOTSOLD, Resources.constants.Goods_hotsold(), new CheckBox()); contentPanelOther.createPanel(IGoods.NEWADDED, Resources.constants.Goods_newAdded(), new CheckBox()); contentPanelOther.createPanel(IGoods.BESTSOLD, Resources.constants.Goods_bestSold(), new CheckBox()); info = new WidgetInfo(IGoods.ONSALE, Resources.constants.Goods_onSale(), new CheckBox()); info.setNote("????"); contentPanelOther.createPanel(info); info = new WidgetInfo(IGoods.ALONESALE, "?", new CheckBox()); info.setNote("?????"); contentPanelOther.createPanel(info); info = new WidgetInfo(IGoods.KEYWORDS, Resources.constants.Goods_keywords(), new TextBox()); info.setNote(""); info.setAppendNote(true); contentPanelOther.createPanel(info); TextArea area = new TextArea(); area.setSize("600", "150"); contentPanelOther.createPanel(IGoods.BRIEF, Resources.constants.Goods_brief(), area); area = new TextArea(); area.setSize("600", "80"); info = new WidgetInfo(IGoods.SELLERNOTE, Resources.constants.Goods_sellerNote(), area); info.setNote("?"); contentPanelOther.createPanel(info); galleryPanel = new GalleryPanel(editting, goods); HorizontalPanel panel = new HorizontalPanel(); panel.setSpacing(10); btnOK.setText(""); btnCancel.setText("?"); panel.add(btnOK); panel.add(btnCancel); // Create a tab panel DecoratedTabPanel tabPanel = new DecoratedTabPanel(); tabPanel.setWidth("100%"); tabPanel.setAnimationEnabled(true); // Add a home tab tabPanel.add(contentPanelGeneral, Resources.constants.NewGoods_tabGeneral()); // Create the text area and toolbar txtDetail = new RichTextArea(); txtDetail.setSize("100%", "14em"); if (editting) { new ReadService().getBean(ModelNames.GOODS, goodsId, new ReadService.Listener() { public void onSuccess(BeanObject bean) { txtDetail.setHTML(bean.getString(IGoods.DESCRIPTION)); } }); } RichTextToolbar toolbar = new RichTextToolbar(txtDetail); // toolbar.setWidth("100%"); // Add the components to a panel Grid grid = new Grid(2, 1); grid.setStyleName("cw-RichText"); grid.setWidget(0, 0, toolbar); grid.setWidget(1, 0, txtDetail); // Add a detail tab tabPanel.add(grid, Resources.constants.NewGoods_tabDetail()); // Add a other tab tabPanel.add(contentPanelOther, Resources.constants.NewGoods_tabOther()); // Add a Properties tab tabPanel.add(attrPanel, Resources.constants.NewGoods_tabProperty()); // Add a Pictures tab tabPanel.add(galleryPanel, Resources.constants.NewGoods_tabGallery()); // Add a Connet other goods tab // HTML conngoods = new HTML("connect goods"); tabPanel.add(relatedPanel, Resources.constants.NewGoods_tabLink()); // Add a Accessories tab // HTML accessories = new HTML("accessories"); if (!virtualCard) { tabPanel.add(accessoriesPanel, Resources.constants.NewGoods_tabAccessories()); } // Add a Connet articles tab // HTML articles = new HTML("articles"); tabPanel.add(articlesPanel, Resources.constants.NewGoods_tabArticle()); if (editting) { refresh(); } // Return the content tabPanel.selectTab(0); tabPanel.ensureDebugId("cwTabPanel"); add(tabPanel); add(panel); createList(null, null); btnOK.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { imageUpload.setStoreType("img"); if (!imageUpload.submit()) { return; } thumbUpload.setStoreType("thumb"); if (!thumbUpload.submit()) { return; } List<FileUploader> fileUploaders = galleryPanel.getUploaders(); FileUploader fu = new FileUploader(); for (Iterator it = fileUploaders.iterator(); it.hasNext();) { fu = (FileUploader) it.next(); fu.setStoreType("img_thumb"); if (!fu.submit()) { return; } } new WaitService(new WaitService.Job() { public boolean isReady() { List<FileUploader> fileUploaders2 = galleryPanel.getUploaders(); FileUploader fu2 = new FileUploader(); for (Iterator it = fileUploaders2.iterator(); it.hasNext();) { fu2 = (FileUploader) it.next(); if (!fu2.isFinish()) { return false; } } return imageUpload.isFinish() && thumbUpload.isFinish(); } public void run() { if (!validate()) { return; } Date currentTime = new Date(); Map<String, Object> argsLeft = contentPanelGeneral.getValues(); Map<String, Object> argsDetail = new HashMap<String, Object>(); argsDetail.put(IGoods.DESCRIPTION, txtDetail.getHTML()); Map<String, Object> argsRight = contentPanelOther.getValues(); Map<String, Object> argsAttrs = attrPanel.getValues(); // Gallery Map<String, Object> argsGallery = galleryPanel.getValues(); argsLeft.putAll(argsDetail); argsLeft.putAll(argsRight); argsLeft.putAll(argsAttrs); argsLeft.putAll(argsGallery); argsLeft.put("addTime", currentTime.getTime());// addTime information argsLeft.put(IGoods.REALGOODS, !virtualCard + ""); argsLeft.put(IGoods.DELETED, "false"); if (getCurState().isEditting()) { new UpdateService().updateBean(goodsId, new BeanObject(ModelNames.GOODS, argsLeft), null); if (virtualCard) { VirtualCardList.State state = new VirtualCardList.State(); state.execute(); } else { GoodsList.State state = new GoodsList.State(); state.execute(); } } else { new CreateService().createBean(new BeanObject(ModelNames.GOODS, argsLeft), new CreateService.Listener() { public void onSuccess(final String id) { relatedPanel.setValues(id); if (!virtualCard) { accessoriesPanel.setValues(id); } articlesPanel.setValues(id); Map<String, Boolean> linkGoods = relatedPanel.getValue(); if (linkGoods != null) { for (Object key : linkGoods.keySet()) { boolean bidirectional = linkGoods.get(key); String linkGoodsId = (String) key; final Map<String, Object> value = new HashMap<String, Object>(); value.put(ILinkGoods.GOODS, id); value.put(ILinkGoods.LINKGOODS, linkGoodsId); value.put(ILinkGoods.BIDIRECTIONAL, bidirectional); //? Criteria c = new Criteria(); Condition goodsCon = new Condition(ILinkGoods.GOODS, Condition.EQUALS, id); Condition linkGoodsCon = new Condition(ILinkGoods.LINKGOODS, Condition.EQUALS, linkGoodsId); c.addCondition(goodsCon); c.addCondition(linkGoodsCon); new ListService().listBeans(ModelNames.LINKGOODS, c, new ListService.Listener() { public void onSuccess(List<BeanObject> beans) { if (beans.size() == 0) new CreateService().createBean( new BeanObject(ModelNames.LINKGOODS, value), null); } }); if (bidirectional) { final Map<String, Object> bidirectionalValue = new HashMap<String, Object>(); bidirectionalValue.put(ILinkGoods.GOODS, linkGoodsId); bidirectionalValue.put(ILinkGoods.LINKGOODS, id); bidirectionalValue.put(ILinkGoods.BIDIRECTIONAL, bidirectional); goodsCon.setValue(linkGoodsId); linkGoodsCon.setValue(id); new ListService().listBeans(ModelNames.LINKGOODS, c, new ListService.Listener() { public void onSuccess(List<BeanObject> beans) { if (beans.size() == 0) new CreateService().createBean( new BeanObject( ModelNames.LINKGOODS, bidirectionalValue), null); } }); } } } } }); if (virtualCard) { VirtualCardList.State state = new VirtualCardList.State(); state.execute(); } else { GoodsList.State state = new GoodsList.State(); state.execute(); } } } }); } }); btnCancel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { contentPanelGeneral.clearValues(); contentPanelOther.clearValues(); attrPanel.updateValues(null); } }); }