List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setSpacing
public void setSpacing(int spacing)
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 .ja va 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); } }); }
From source file:com.jcommerce.gwt.client.panels.NewUsers.java
License:Apache License
/** * Initialize this example.//from ww w .j av a2 s. c o m */ public NewUsers() { add(contentPanel); contentPanel.createPanel(IUser.NAME, "??:", new TextBox()); // createPanel(SN, "SN:", new TextBox()); contentPanel.createPanel(IUser.EMAIL, "?:", new TextBox()); contentPanel.createPanel(IUser.PASSWORD, "?:", new PasswordTextBox()); contentPanel.createPanel(null, "?:", new PasswordTextBox()); ValueSelector selector = new ValueSelector(); selector.setBean(ModelNames.USERRANK); selector.setCaption("Select RANK"); selector.setMessage("Select RANK"); contentPanel.createPanel(IUser.RANK, ":", selector); ListBox listsex = new ListBox(); listsex.addItem("?", "0"); listsex.addItem("", "1"); listsex.addItem("", "2"); contentPanel.createPanel(IUser.SEX, ":", listsex); contentPanel.createPanel(IUser.BIRTHDAY, ":", new DateWidget()); contentPanel.createPanel(IUser.CREDITLINE, "?:", new TextBox()); contentPanel.createPanel(IUser.MSN, "MSN:", new TextBox()); contentPanel.createPanel(IUser.QQ, "QQ:", new TextBox()); contentPanel.createPanel(IUser.OFFICEPHONE, "?:", new TextBox()); contentPanel.createPanel(IUser.HOMEPHONE, "?:", new TextBox()); contentPanel.createPanel(IUser.MOBILEPHONE, ":", new TextBox()); HorizontalPanel panel = new HorizontalPanel(); panel.setSpacing(10); btnOK.setText(""); btnCancel.setText("?"); panel.add(btnOK); panel.add(btnCancel); contentPanel.createPanel(null, null, panel); btnOK.addClickListener(new ClickListener() { public void onClick(Widget sender) { Map<String, Object> args = contentPanel.getValues(); new CreateService().createBean(new BeanObject(ModelNames.USER, args), null); } }); btnCancel.addClickListener(new ClickListener() { public void onClick(Widget sender) { contentPanel.clearValues(); } }); }
From source file:com.jcommerce.gwt.client.panels.ShopSetup.java
protected void onRender(Element parent, int index) { super.onRender(parent, index); contentPanelGeneral.createPanel(SHOPNAME, Resources.constants.Shop_name(), new TextBox()); contentPanelGeneral.createPanel(SHOPTITLE, Resources.constants.Shop_title(), new TextBox()); contentPanelGeneral.createPanel(SHOPDESC, Resources.constants.Shop_desc(), new TextBox()); contentPanelGeneral.createPanel(SHOPKEYWORDS, Resources.constants.shop_keywords(), new TextBox()); ListBox country = new ListBox(); country.addItem(Resources.constants.select_notice(), null); country.addItem("", "1"); country.setSelectedIndex(1);//from w ww . j ava 2s . c om contentPanelGeneral.createPanel(SHOPCOUNTRY, Resources.constants.shop_country(), country); contentPanelGeneral.createPanel(SHOPPROVINCE, Resources.constants.shop_province(), province); contentPanelGeneral.createPanel(SHOPCITY, Resources.constants.shop_city(), city); contentPanelGeneral.createPanel(SHOPADDRESS, Resources.constants.shop_address(), new TextBox()); contentPanelGeneral.createPanel(QQ, Resources.constants.qq(), new TextBox()); contentPanelGeneral.createPanel(WW, Resources.constants.ww(), new TextBox()); contentPanelGeneral.createPanel(SKYPE, Resources.constants.skype(), new TextBox()); contentPanelGeneral.createPanel(YM, Resources.constants.ym(), new TextBox()); contentPanelGeneral.createPanel(MSN, Resources.constants.msn(), new TextBox()); contentPanelGeneral.createPanel(SERVICEEMAIL, Resources.constants.service_email(), new TextBox()); contentPanelGeneral.createPanel(SERVICEPHONE, Resources.constants.service_phone(), new TextBox()); ListBox closed = new ListBox(); closed.addItem(Resources.constants.no(), "0"); closed.addItem(Resources.constants.yes(), "1"); closed.setSelectedIndex(0); contentPanelGeneral.createPanel(SHOPCLOSED, Resources.constants.shop_closed(), closed); TextArea closeComment = new TextArea(); closeComment.setSize("200", "100"); contentPanelGeneral.createPanel(CLOSECOMMENT, Resources.constants.close_comment(), closeComment); contentPanelGeneral.createPanel(SHOPLOGO, Resources.constants.shop_logo(), new FileUploader()); ListBox licensed = new ListBox(); licensed.addItem(Resources.constants.no(), "0"); licensed.addItem(Resources.constants.yes(), "1"); licensed.setSelectedIndex(0); contentPanelGeneral.createPanel(LICENSED, Resources.constants.licensed(), licensed); TextArea userNotice = new TextArea(); userNotice.setSize("200", "100"); contentPanelGeneral.createPanel(USERNOTICE, Resources.constants.user_notice(), userNotice); TextArea shopNotice = new TextArea(); shopNotice.setSize("200", "100"); contentPanelGeneral.createPanel(SHOPNOTICE, Resources.constants.shop_notice(), shopNotice); btnOK.setText(Resources.constants.GoodsList_action_OK()); btnReset.setText(Resources.constants.GoodsList_reset()); HorizontalPanel panel = new HorizontalPanel(); panel.setSpacing(30); panel.add(btnOK); panel.add(btnReset); //refresh(); // Create a tab panel DecoratedTabPanel tabPanel = new DecoratedTabPanel(); tabPanel.setAnimationEnabled(true); // Add a Shop Info tab tabPanel.add(contentPanelGeneral, Resources.constants.ShopSetup_tabShopInfo()); //Add a Basic Set tab HTML basicSet = new HTML("basic Set"); tabPanel.add(basicSet, Resources.constants.ShopSetup_tabBasicSet()); //Add a View Set tab //contentPanelShow.createPanel(getName(), getDescription(), ); contentPanelShow.createPanel(SEARCHKEYWORDS, Resources.constants.search_keywords(), new TextBox()); contentPanelShow.createPanel(DATAFORMAT, Resources.constants.date_format(), new TextBox()); contentPanelShow.createPanel(TIMEFORMAT, Resources.constants.time_format(), new TextBox()); contentPanelShow.createPanel(CURRENCYFORMAT, Resources.constants.currency_format(), new TextBox()); contentPanelShow.createPanel(THUMBWIDTH, Resources.constants.thumb_width(), new TextBox()); contentPanelShow.createPanel(THUMBHEIGHT, Resources.constants.thumb_height(), new TextBox()); contentPanelShow.createPanel(IMAGEWIDTH, Resources.constants.image_width(), new TextBox()); contentPanelShow.createPanel(IMAGEHEIGHT, Resources.constants.image_height(), new TextBox()); contentPanelShow.createPanel(TOPNUMBER, Resources.constants.top_number(), new TextBox()); contentPanelShow.createPanel(HISTORYNUMBER, Resources.constants.history_number(), new TextBox()); contentPanelShow.createPanel(COMMENTSNUMBER, Resources.constants.comments_number(), new TextBox()); contentPanelShow.createPanel(BOUGHTGOODS, Resources.constants.bought_goods(), new TextBox()); contentPanelShow.createPanel(ARTICLENUMBER, Resources.constants.article_number(), new TextBox()); contentPanelShow.createPanel(GOODSNAMELENGTH, Resources.constants.goods_name_length(), new TextBox()); ListBox priceFormat = new ListBox(); priceFormat.addItem(Resources.constants.do_nothing(), "0"); priceFormat.addItem(Resources.constants.reservations_effective_mantissa(), "1"); priceFormat.addItem(Resources.constants.not_rounding_keep_1(), "2"); priceFormat.addItem(Resources.constants.not_rounding_not_keep(), "3"); priceFormat.addItem(Resources.constants.rounding_keep_1(), "4"); priceFormat.addItem(Resources.constants.rounding_not_keep(), "5"); priceFormat.setSelectedIndex(0); contentPanelShow.createPanel(PRICEFORMAT, Resources.constants.price_format(), priceFormat); contentPanelShow.createPanel(PAGESIZE, Resources.constants.page_size(), new TextBox()); ListBox sortOrderType = new ListBox(); sortOrderType.addItem(Resources.constants.sort_shelf_time(), "0"); sortOrderType.addItem(Resources.constants.sort_goods_price(), "1"); sortOrderType.addItem(Resources.constants.sort_last_update(), "2"); sortOrderType.setSelectedIndex(0); contentPanelShow.createPanel(SORTORDERTYPE, Resources.constants.sort_order_type(), sortOrderType); ListBox sortOrderMethod = new ListBox(); sortOrderMethod.addItem(Resources.constants.sort_DESC(), "0"); sortOrderMethod.addItem(Resources.constants.sort_ASC(), "1"); sortOrderType.setSelectedIndex(0); contentPanelShow.createPanel(SORTORDERMETHOD, Resources.constants.sort_order_method(), sortOrderMethod); ListBox showOrderType = new ListBox(); showOrderType.addItem(Resources.constants.show_list(), "0"); showOrderType.addItem(Resources.constants.show_grid(), "1"); showOrderType.addItem(Resources.constants.show_text(), "2"); showOrderType.setSelectedIndex(0); contentPanelShow.createPanel(SHOWORDERTYPE, Resources.constants.show_order_type(), showOrderType); contentPanelShow.createPanel(ATTRRELATEDNUMBER, Resources.constants.attr_related_number(), new TextBox()); contentPanelShow.createPanel(GOODSGALLERYNUMBER, Resources.constants.goods_gallery_number(), new TextBox()); contentPanelShow.createPanel(ARTICLETITLELENGTH, Resources.constants.article_title_length(), new TextBox()); contentPanelShow.createPanel(NAMEOFREGION1, Resources.constants.name_of_region_1(), new TextBox()); contentPanelShow.createPanel(NAMEOFREGION2, Resources.constants.name_of_region_2(), new TextBox()); contentPanelShow.createPanel(NAMEOFREGION3, Resources.constants.name_of_region_3(), new TextBox()); contentPanelShow.createPanel(NAMEOFREGION4, Resources.constants.name_of_region_4(), new TextBox()); contentPanelShow.createPanel(RELATEDGOODSNUMBER, Resources.constants.related_goods_number(), new TextBox()); ListBox helpOpen = new ListBox(); helpOpen.addItem(Resources.constants.no(), "0"); helpOpen.addItem(Resources.constants.yes(), "1"); helpOpen.setSelectedIndex(0); contentPanelShow.createPanel(HELPOPEN, Resources.constants.help_open(), helpOpen); tabPanel.add(contentPanelShow, Resources.constants.ShopSetup_tabShowSet()); //Add a Shopping Flow tab HTML shoppingFlow = new HTML("shopping Flow"); tabPanel.add(shoppingFlow, Resources.constants.ShopSetup_tabBuyFlow()); //Add a Goods show Set tab ListBox showGoodsSN = new ListBox(); showGoodsSN.addItem(Resources.constants.yes(), "1"); showGoodsSN.addItem(Resources.constants.no(), "0"); showGoodsSN.setSelectedIndex(0); contentPanelGoodsShow.createPanel(SHOWGOODSSN, Resources.constants.show_goodssn(), showGoodsSN); List<ChoicePanel.Item> brandItems = new ArrayList<ChoicePanel.Item>(); brandItems.add(new ChoicePanel.Item(Resources.constants.yes(), "1")); brandItems.add(new ChoicePanel.Item(Resources.constants.no(), "0")); ChoicePanel showBrand = new ChoicePanel("0", brandItems); contentPanelGoodsShow.createPanel(SHOWBRAND, Resources.constants.show_brand(), showBrand); List<ChoicePanel.Item> goodsWeightItems = new ArrayList<ChoicePanel.Item>(); goodsWeightItems.add(new ChoicePanel.Item(Resources.constants.yes(), "1")); goodsWeightItems.add(new ChoicePanel.Item(Resources.constants.no(), "0")); ChoicePanel showGoodsWeight = new ChoicePanel("0", goodsWeightItems); contentPanelGoodsShow.createPanel(SHOWGOODSWEIGHT, Resources.constants.show_goodsweight(), showGoodsWeight); List<ChoicePanel.Item> goodsNumberItems = new ArrayList<ChoicePanel.Item>(); goodsNumberItems.add(new ChoicePanel.Item(Resources.constants.yes(), "1")); goodsNumberItems.add(new ChoicePanel.Item(Resources.constants.no(), "0")); ChoicePanel showGoodsNumber = new ChoicePanel("0", goodsNumberItems); contentPanelGoodsShow.createPanel(SHOWGOODSNUMBER, Resources.constants.show_goodsnumber(), showGoodsNumber); List<ChoicePanel.Item> addTimeItems = new ArrayList<ChoicePanel.Item>(); addTimeItems.add(new ChoicePanel.Item(Resources.constants.yes(), "1")); addTimeItems.add(new ChoicePanel.Item(Resources.constants.no(), "0")); ChoicePanel showAddTime = new ChoicePanel("0", addTimeItems); contentPanelGoodsShow.createPanel(SHOWADDTIME, Resources.constants.show_addtime(), showAddTime); List<ChoicePanel.Item> attrStyleItems = new ArrayList<ChoicePanel.Item>(); attrStyleItems.add(new ChoicePanel.Item(Resources.constants.attr_Style_1(), "1")); attrStyleItems.add(new ChoicePanel.Item(Resources.constants.attr_Style_2(), "0")); ChoicePanel goodsAttrStyle = new ChoicePanel("0", attrStyleItems); contentPanelGoodsShow.createPanel(GOODSATTRSTYLE, Resources.constants.goodsattr_style(), goodsAttrStyle); List<ChoicePanel.Item> marketPriceItems = new ArrayList<ChoicePanel.Item>(); marketPriceItems.add(new ChoicePanel.Item(Resources.constants.yes(), "1")); marketPriceItems.add(new ChoicePanel.Item(Resources.constants.no(), "0")); ChoicePanel showMarketPrice = new ChoicePanel("0", marketPriceItems); contentPanelGoodsShow.createPanel(SHOWMARKETPRICE, Resources.constants.show_marketprice(), showMarketPrice); tabPanel.add(contentPanelGoodsShow, Resources.constants.ShopSetup_tabGoodsShow()); //Add a SMS Set tab HTML smsSet = new HTML("SMS Set"); tabPanel.add(smsSet, Resources.constants.ShopSetup_tabSMS()); //Add a WAP Set tab HTML wapSet = new HTML("WAP Set"); tabPanel.add(wapSet, Resources.constants.ShopSetup_tabWAP()); province.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { showRegion(city, province.getSelectedIndex(), "0"); } }); btnReset.addClickListener(new ClickListener() { public void onClick(Widget sender) { refresh(); } }); btnOK.addClickListener(new ClickListener() { public void onClick(Widget sender) { //save information update = contentPanelGeneral.getValues(); update.putAll(contentPanelShow.getValues()); update.putAll(contentPanelGoodsShow.getValues()); for (int index = 0; index < nameIDs.size(); index++) { object.put("value", update.get(name.get(index))); new UpdateService().updateBean((String) nameIDs.get(name.get(index)), new BeanObject(ModelNames.SHOPCONFIG, object), null); object.clear(); } } }); tabPanel.selectTab(0); tabPanel.ensureDebugId("cwTabPanel"); add(tabPanel); add(panel); }
From source file:com.konakart.client.SearchBody.java
License:Open Source License
/** * Creates the panel for the search/*from w w w .j a v a 2 s. c o m*/ */ protected void renderSearch() { // Remove the current panel removeFromDom(); // Get the container panel HTMLPanel containerPanel = getContainerPanel(); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(10); hp.add(searchTB); hp.add(searchB); containerPanel.add(hp, BODY_ID); // Finally, add the outer panel to the RootPanel, so that it will be // displayed. addToDom(containerPanel); }
From source file:com.LSH.client.LSH.java
License:Apache License
/** * ? UI// w w w.ja v a2 s. co m */ public void onModuleLoad() { /* ? ? */ String linkWidth = String.valueOf(Window.getClientWidth() / 4); // HP = HorizontalPanel; VP = VerticalPanel final HorizontalPanel simpleDataHP = new HorizontalPanel(); // ? ?? final HorizontalPanel simpleAnswerHP = new HorizontalPanel(); // ? final VerticalPanel simpleVP = new VerticalPanel(); // ? ? , simpleShortButton.addClickHandler(new SimpleClickHandler()); // ?? simpleOriginalLink.addKeyDownHandler(new EnterKeyListener(simpleShortButton)); // ?? ? Enter simpleCopyButton.addClickHandler(new CopyClickHandler("simpleAnswer")); // ?? ? simpleOriginalLink.setWidth(linkWidth); // ? ? simpleDataHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // simpleDataHP.setSpacing(5); // ? // simpleDataHP.add(simpleOriginalLink); simpleDataHP.add(simpleShortButton); // ?, ? simpleAnswerHP.setSpacing(5); simpleAnswerHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // simpleAnswerHP.add(simpleShortText); simpleAnswerHP.add(simpleShortLink); simpleAnswerHP.add(simpleCopyButton); // simpleVP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); simpleVP.setSpacing(10); simpleVP.add(simpleDataHP); simpleVP.add(simpleAnswerHP); // ? ? simpleShortText.setVisible(false); simpleCopyButton.setVisible(false); /* ? ? */ // ? ? final HorizontalPanel complexLinkHP = new HorizontalPanel(); // ? ?? final HorizontalPanel complexDataHP = new HorizontalPanel(); // final HorizontalPanel complexOptionalData = new HorizontalPanel(); // final HorizontalPanel complexAnswerHP = new HorizontalPanel(); // final VerticalPanel complexVP = new VerticalPanel(); // , final VerticalPanel complexOptionalVP = new VerticalPanel(); // , EnterKeyListener complexKey = new EnterKeyListener(complexShortButton); // ? Enter complexCopyButton.addClickHandler(new CopyClickHandler("complexAnswer")); // ? ?? complexTime.addItem("1 hour"); complexTime.addItem("12 hours"); complexTime.addItem("1 day"); complexTime.addItem("1 week"); complexTime.addItem("1 month"); complexTime.addItem("Unlimited"); complexTime.setSelectedIndex(3); // ?? ? complexOriginalLink.setWidth(linkWidth); complexCount.setWidth("40px"); complexCount.setValue(10); complexShortButton.addClickHandler(new ComplexClickHandler()); // ? // ? ? Enter ? ? complexOriginalLink.addKeyDownHandler(complexKey); complexName.addKeyDownHandler(complexKey); complexCount.addKeyDownHandler(complexKey); complexTime.addKeyDownHandler(complexKey); complexPassword.addKeyDownHandler(complexKey); // ?? ? complexLinkHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexLinkHP.setSpacing(5); complexLinkHP.add(complexText); complexLinkHP.add(complexOriginalLink); complexDataHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexDataHP.setSpacing(5); complexDataHP.add(complexTimeText); complexDataHP.add(complexTime); complexDataHP.add(complexCountText); complexDataHP.add(complexCount); complexCount.setAlignment(ValueBoxBase.TextAlignment.CENTER); // ? ? complexCount.setMaxLength(5); // ?? - ? complexOptionalData.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexOptionalData.setSpacing(5); complexOptionalData.add(complexNameText); complexOptionalData.add(complexName); complexOptionalData.add(complexPasswordText); complexOptionalData.add(complexPassword); complexAnswerHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexAnswerHP.setSpacing(5); complexAnswerHP.add(complexShortText); complexAnswerHP.add(complexShortLink); complexAnswerHP.add(complexCopyButton); complexVP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexVP.setSpacing(5); complexVP.add(complexLinkHP); complexVP.add(complexDataHP); complexOptionalVP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); complexOptionalVP.setSpacing(5); complexOptionalVP.add(complexOptionalData); complexOptionalVP.add(complexShortButton); complexOptionalVP.add(complexAnswerHP); // complexShortText.setVisible(false); complexCopyButton.setVisible(false); /* ?? ? ? */ loginButton.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { dialog.Login(); } }); logoutButton.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { // Cookies.removeCookie(cookieName); // ? // ? ? ??? loginButton.setVisible(true); loginLabel.setHTML(""); loginLabel.setVisible(false); logoutButton.setVisible(false); } }); // ?? final HorizontalPanel loginHP = new HorizontalPanel(); loginHP.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); loginHP.setSpacing(5); loginHP.add(loginLabel); loginHP.add(logoutButton); loginHP.add(loginButton); logoutButton.setVisible(false); dialog.hide(); // ? // ? ? RootPanel.get("Login").add(loginHP); RootPanel.get("SimpleShort").add(simpleVP); RootPanel.get("ComplexShort").add(complexVP); RootPanel.get("ComplexShortOptional").add(complexOptionalVP); }
From source file:com.mansi.client.board.InsertPanelExample.java
License:Apache License
public InsertPanelExample() { // addStyleName(CSS_DEMO_INSERT_PANEL_EXAMPLE); int count = 0; // use the boundary panel as this composite's widget AbsolutePanel boundaryPanel = new AbsolutePanel(); boundaryPanel.setSize("100%", "100%"); setWidget(boundaryPanel);//from ww w.j a v a 2 s . c o m // initialize our column drag controller PickupDragController columnDragController = new PickupDragController(boundaryPanel, false); columnDragController.setBehaviorMultipleSelection(false); // initialize our widget drag controller PickupDragController widgetDragController = new PickupDragController(boundaryPanel, true); widgetDragController.setBehaviorMultipleSelection(false); // initialize horizontal panel to hold our columns HorizontalPanel horizontalPanel = new HorizontalPanel(); // horizontalPanel.setSize("100%", "100%"); horizontalPanel.setSpacing(SPACING); boundaryPanel.add(horizontalPanel); // initialize our column drop controller HorizontalPanelDropController columnDropController = new HorizontalPanelDropController(horizontalPanel); columnDragController.registerDropController(columnDropController); for (int col = 1; col <= COLUMNS; col++) { // initialize a vertical panel to hold the heading and a second vertical // panel VerticalPanel columnCompositePanel = new VerticalPanel(); // initialize inner vertical panel to hold individual widgets VerticalPanel verticalPanel = new VerticalPanelWithSpacer(); verticalPanel.setStyleName("compPanel"); verticalPanel.setSpacing(SPACING); horizontalPanel.add(columnCompositePanel); VerticalPanel widgetHolder = new VerticalPanel(); // initialize a widget drop controller for the current column VerticalPanelDropController widgetDropController = new VerticalPanelDropController(verticalPanel); widgetDragController.registerDropController(widgetDropController); final Label heading = new Label(); // Put together the column pieces final EditableLabel heading_temp = new EditableLabel(""); if (headings[col - 1] != null) { heading_temp.setText(headings[col - 1]); } else { heading_temp.setText("Column " + col); } final int column = col; EditableLabelListener listener = new EditableLabelListener() { @Override public void onLabelModified(String text, EditableLabel sender) { // TODO Auto-generated method stub heading.setText(""); heading_temp.setText(text); headings[column - 1] = heading_temp.getText(); System.out.println(headings[column - 1]); } }; heading_temp.addEditableLabelListener(listener); heading.addStyleName("heading"); heading.setSize("200px", "20px"); columnCompositePanel.add(heading_temp); columnCompositePanel.add(heading); widgetHolder.add(verticalPanel); widgetHolder.setSpacing(SPACING); widgetHolder.setStyleName("columns"); columnCompositePanel.setHeight("370px"); // columnCompositePanel.setSpacing(15); columnCompositePanel.add(widgetHolder); // make the column draggable by its heading columnDragController.makeDraggable(columnCompositePanel, heading); for (int row = 1; row <= ROWS; row++) { if (row < 5) { // initialize a widget HTML widget = new HTML("ID #" + ++count); widget.addStyleName("widget"); widget.setHeight("60px"); widget.setWidth("100px"); verticalPanel.add(widget); // make the widget draggable widgetDragController.makeDraggable(widget); } } } }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.button.ButtonExample.java
License:sencha.com license
private FlowLayoutContainer createButtons(Category cat) { VerticalPanel vp = new VerticalPanel(); vp.setSpacing(10);/*w w w . j a va 2s . co m*/ vp.setWidth("400px"); for (Type type : Type.values()) { vp.add(format(type.getText())); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(5); CellButtonBase<?> small = createButton(cat, type); CellButtonBase<?> medium = createButton(cat, type); CellButtonBase<?> large = createButton(cat, type); configureButton(small, type, ButtonScale.SMALL); configureButton(medium, type, ButtonScale.MEDIUM); configureButton(large, type, ButtonScale.LARGE); hp.add(small); hp.add(medium); hp.add(large); vp.add(hp); } FlowLayoutContainer f = new FlowLayoutContainer(); f.getScrollSupport().setScrollMode(ScrollMode.AUTO); f.add(vp); con.add(f); return f; }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.dnd.BasicDndExample.java
License:sencha.com license
@Override public Widget asWidget() { FlowLayoutContainer con = new FlowLayoutContainer(); HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(10); final FlowLayoutContainer container = new FlowLayoutContainer(); container.setBorders(true);//from ww w.j ava 2s .c o m container.setPixelSize(200, 200); DropTarget target = new DropTarget(container) { @Override protected void onDragDrop(DndDropEvent event) { super.onDragDrop(event); HTML html = (HTML) event.getData(); container.add(html); } }; target.setGroup("test"); target.setOverStyle("drag-ok"); final FlowLayoutContainer sourceContainer = new FlowLayoutContainer(); sourceContainer.setWidth(100); addSources(sourceContainer); TextButton reset = new TextButton("Reset"); reset.addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { container.clear(); sourceContainer.clear(); addSources(sourceContainer); } }); hp.add(container); hp.add(sourceContainer); con.add(hp); con.add(reset, new MarginData(10)); return con; }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.misc.ToolTipsExample.java
License:sencha.com license
public Widget asWidget() { HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(5); TextButton btn = new TextButton("Basic"); btn.setToolTipConfig(new ToolTipConfig("Information", "Prints the current document")); hp.add(btn);/*from ww w .j a v a2s. c o m*/ btn = new TextButton("Closable"); ToolTipConfig config = new ToolTipConfig(); config.setTitleHtml("Information"); config.setBodyHtml("Prints the current document"); config.setCloseable(true); btn.setToolTipConfig(config); hp.add(btn); btn = new TextButton("Mouse Tracking"); config = new ToolTipConfig(); config.setTitleHtml("Information"); config.setBodyHtml("Prints the current document"); config.setTrackMouse(true); btn.setToolTipConfig(config); hp.add(btn); btn = new TextButton("Anchor"); config = new ToolTipConfig(); config.setTitleHtml("Information"); config.setBodyHtml("Prints the current document"); config.setMouseOffset(new int[] { 0, 0 }); config.setAnchor(Side.LEFT); btn.setToolTipConfig(config); hp.add(btn); btn = new TextButton("Custom"); config = new ToolTipConfig(); config.setBodyHtml("Prints the current document"); config.setTitleHtml("Template Tip"); config.setMouseOffset(new int[] { 0, 0 }); config.setAnchor(Side.LEFT); config.setRenderer(renderer); config.setCloseable(true); config.setMaxWidth(415); btn.setToolTipConfig(config); hp.add(btn); return hp; }
From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.tabs.AdvancedTabsExample.java
License:sencha.com license
public Widget asWidget() { if (vp == null) { vp = new VerticalPanel(); vp.setSpacing(10);/*from w w w. j a v a 2s . co m*/ HorizontalPanel hp = new HorizontalPanel(); hp.setSpacing(5); TextButton add = new TextButton("Add Tab"); add.addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { addTab(); advanced.setActiveWidget(advanced.getWidget(advanced.getWidgetCount() - 1)); } }); hp.add(add); ToggleButton toggle = new ToggleButton("Enable Tab Context Menu"); hp.add(toggle); vp.add(hp); advanced = new TabPanel(); advanced.setPixelSize(600, 250); advanced.setAnimScroll(true); advanced.setTabScroll(true); advanced.setCloseContextMenu(true); toggle.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { advanced.setCloseContextMenu(event.getValue()); } }); toggle.setValue(true); while (index < 7) { addTab(); } advanced.setActiveWidget(advanced.getWidget(6)); vp.add(advanced); } return vp; }