List of usage examples for com.google.gwt.user.client.ui DecoratedTabPanel DecoratedTabPanel
public DecoratedTabPanel()
From source file:com.apress.progwt.client.college.gui.LoginWindow.java
License:Apache License
private void setupForm() { form = new FormPanel(); form.setAction(Interactive.getRelativeURL(SECURITY_URL)); form.setMethod(FormPanel.METHOD_POST); // Create a panel to hold all of the form widgets. VerticalPanel panel = new VerticalPanel(); DecoratedTabPanel tabs = new DecoratedTabPanel(); tabs.add(getOpenIDTab(), "OpenID"); tabs.add(getUPTab(), "Username/Password"); tabs.selectTab(1);/* ww w. j a v a 2s . co m*/ panel.add(tabs); messageLabel = new Label(""); panel.add(messageLabel); form.addFormHandler(new FormHandler() { // note, this doesn't need to be perfectly secure. We just // want to know that we think we're secure. The next request // will tell us for sure public void onSubmitComplete(FormSubmitCompleteEvent event) { Log.debug("submit event results " + event.getResults()); if (event.getResults().equals("OK")) { success(); } else { Log.warn("Login Fail: " + event.getResults()); failure(); } // // TODO parse bad password etc. Super-Fragile string // comps // if (event.getResults() == null // || -1 != event.getResults().indexOf( // "not successful") // || -1 != event.getResults().indexOf( // "Bad credentials") // || -1 != event.getResults().indexOf("404")) { // Log.warn("Login Fail: " + event.getResults()); // failure(); // } else { // Log.info("Login Success"); // Log.debug(event.getResults()); // success(); // } } public void onSubmit(FormSubmitEvent event) { Log.debug("submit to " + form.getAction()); // This event is fired just before the form is submitted. // We can take // this opportunity to perform validation. // if (username.getText().length() == 0) { // AlertDialog.alert("Username cannot be empty"); // event.setCancelled(true); // } // if (password.getText().length() == 0) { // AlertDialog.alert("Password cannot be empty"); // event.setCancelled(true); // } lastNameEntered = username.getText(); } }); form.setWidget(panel); }
From source file:com.apress.progwt.client.college.gui.MyPage.java
License:Apache License
public MyPage(ToCollegeApp collegeBoundApp) { serviceCache = collegeBoundApp.getServiceCache(); mainPanel = new DecoratedTabPanel(); mainPanel.setStylePrimaryName("MainTabs"); mainPanel.getDeckPanel().setAnimationEnabled(true); myRankings = new MyRankings(serviceCache); mainPanel.add(myRankings, "My Rankings"); myApplications = new MyApplicationTimeline(serviceCache); mainPanel.add(myApplications, "My Applications"); myPriorities = new MyDecision(serviceCache); mainPanel.add(myPriorities, "My Decision"); myCollegeMap = new MyCollegeMap(serviceCache); mainPanel.add(myCollegeMap, "College Map"); mainPanel.addTabListener(this); initWidget(mainPanel);/*from w w w . j ava2s.c om*/ String initToken = History.getToken(); if (initToken.length() == 0) { initToken = myRankings.getHistoryName(); } // onHistoryChanged() is not called when the application first // runs. Call // it now in order to reflect the initial state. onHistoryChanged(initToken); History.addHistoryListener(this); }
From source file:com.edgenius.wiki.gwt.client.widgets.HelpDialog.java
License:Open Source License
public HelpDialog() { this.setText(Msg.consts.help() + " - " + Msg.consts.press() + " F1"); this.setIcon(new Image(IconBundle.I.get().help())); Frame syntax = new Frame(showHtmlPage("static/syntax.html")); Frame key = new Frame(showHtmlPage("static/keys.html")); DOM.setElementAttribute(syntax.getElement(), "frameborder", "0"); DOM.setElementAttribute(key.getElement(), "frameborder", "0"); FlowPanel sbar = new FlowPanel(); Image sImg1 = new Image(IconBundle.I.get().home_link()); sbar.add(sImg1);/*w w w .j a v a 2 s . c o m*/ HTML sHome = new HTML( "<a href='http://geniuswiki.com/page/GeniusWiki+document/GeniusWiki+document' target='_blank'> " + Msg.consts.online_help() + "</a>"); sbar.add(sHome); //the latter one display first! sbar.add(sPop); sbar.add(sImg); sbar.setWidth("100%"); sImg1.setStyleName(Css.LEFT); sHome.setStyleName(Css.LEFT); sImg.setStyleName(Css.RIGHT); sPop.setStyleName(Css.RIGHT); sImg.addClickHandler(this); sPop.addClickHandler(this); FlowPanel kbar = new FlowPanel(); Image kImg1 = new Image(IconBundle.I.get().home_link()); HTML kHome = new HTML( "<a href='http://geniuswiki.com/page/GeniusWiki+document/GeniusWiki+document' target='_blank'> " + Msg.consts.online_help() + "</a>"); kbar.add(kImg1); kbar.add(kHome); //the latter one display first! kbar.add(kPop); kbar.add(kImg); kbar.setWidth("100%"); kImg1.setStyleName(Css.LEFT); kHome.setStyleName(Css.LEFT); kImg.setStyleName(Css.RIGHT); kPop.setStyleName(Css.RIGHT); kImg.addClickHandler(this); kPop.addClickHandler(this); VerticalPanel syntaxPanel = new VerticalPanel(); syntaxPanel.add(sbar); syntaxPanel.add(syntax); syntaxPanel.setCellHeight(sbar, "30px"); syntaxPanel.setCellHeight(syntax, "100%"); VerticalPanel keyPanel = new VerticalPanel(); keyPanel.add(kbar); keyPanel.add(key); keyPanel.setCellHeight(kbar, "30px"); keyPanel.setCellHeight(key, "100%"); DecoratedTabPanel deck = new DecoratedTabPanel(); deck.add(syntaxPanel, Msg.consts.markup()); deck.add(keyPanel, Msg.consts.keyboard()); //show markup panel deck.selectTab(0); this.setWidget(deck); syntax.setSize("100%", "100%"); key.setSize("100%", "100%"); deck.addStyleName(Css.DECK); this.addStyleName(Css.HELP_DIALOG_BOX); }
From source file:com.google.gwt.gwtai.demo.client.JavaFXDemo.java
License:Apache License
public void onModuleLoad() { DecoratedTabPanel tabPanel = new DecoratedTabPanel(); tabPanel.setWidth("800px"); tabPanel.getDeckPanel().setAnimationEnabled(true); VerticalPanel panelMain = new VerticalPanel(); panelMain.setWidth("100%"); panelMain.setSpacing(4);//from ww w .j a v a2s. c om JavaFXApplet javaFxApplet = (JavaFXApplet) GWT.create(JavaFXApplet.class); Widget widgetApplet = AppletJSUtil.createAppletWidget(javaFxApplet); panelMain.add(new HTML( "This demo is featuring a " + "<a href=\"http://www.sun.com/software/javafx/\">JavaFX</a> applet " + "integrated into a <a href=\"http://code.google.com/webtoolkit/\">Goolge Web" + " Toolkit</a> application using the " + "<a href=\"http://code.google.com/p/gwtai/\">gwtai project</a>.")); panelMain.add(widgetApplet); panelMain.setCellHorizontalAlignment(widgetApplet, VerticalPanel.ALIGN_CENTER); DisclosurePanel panelCode = new DisclosurePanel("View code"); panelCode.setWidth("100%"); panelCode.setAnimationEnabled(true); panelCode.setContent(createCodeHTML()); panelMain.add(panelCode); tabPanel.add(panelMain, "JavaFXDemo"); tabPanel.selectTab(0); RootPanel.get().add(tabPanel); }
From source file:com.google.gwt.sample.showcase.client.content.panels.CwTabPanel.java
License:Apache License
/** * Initialize this example./*from w w w . jav a 2 s .c o m*/ */ @SuppressWarnings("deprecation") @ShowcaseSource @Override public Widget onInitialize() { // Create a tab panel DecoratedTabPanel tabPanel = new DecoratedTabPanel(); tabPanel.setWidth("400px"); tabPanel.setAnimationEnabled(true); // Add a home tab String[] tabTitles = constants.cwTabPanelTabs(); HTML homeText = new HTML(constants.cwTabPanelTab0()); tabPanel.add(homeText, tabTitles[0]); // Add a tab with an image VerticalPanel vPanel = new VerticalPanel(); vPanel.add(new Image(Showcase.images.gwtLogo())); tabPanel.add(vPanel, tabTitles[1]); // Add a tab HTML moreInfo = new HTML(constants.cwTabPanelTab2()); tabPanel.add(moreInfo, tabTitles[2]); // Return the content tabPanel.selectTab(0); tabPanel.ensureDebugId("cwTabPanel"); return tabPanel; }
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);/*w w w . java 2s.c om*/ 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();/*from ww w.ja v a2s . c o 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.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 w w. ja v a 2 s. c o m*/ 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.square.client.gwt.client.view.personne.morale.gestion.GestionPersonneMoraleViewImpl.java
License:Open Source License
/** * Construction du Panel.//from w w w . j av a 2 s .co m */ private void construireTabPanel() { this.gestionOnglets = new HashMap<Integer, String>(); this.tabLayoutPanel = new DecoratedTabPanel(); tabLayoutPanel.addStyleName(SquareResources.INSTANCE.css().personneMoraleGestionTabPanel()); tabLayoutPanel.setSize(AppControllerConstants.POURCENT_100, AppControllerConstants.POURCENT_100); // AJOUT DE PANEL gestionOnglets.put(GestionPersonneMoraleViewImplConstants.INDEX_TAB_COORDONNEES, constants.libelleTabCoordonnees()); gestionOnglets.put(GestionPersonneMoraleViewImplConstants.INDEX_TAB_RELATIONS, constants.libelleTabRelations()); gestionOnglets.put(GestionPersonneMoraleViewImplConstants.INDEX_TAB_ACTIONS, constants.libelleTabActions()); gestionOnglets.put(GestionPersonneMoraleViewImplConstants.INDEX_TAB_CONTRATS, constants.libelleTabContratsPM()); gestionOnglets.put(GestionPersonneMoraleViewImplConstants.INDEX_TAB_DOCUMENTS, constants.libelleTabDocuments()); // CONSTRUCTION PANEL for (Integer key : gestionOnglets.keySet()) { final BlocArrondiBleu panel = new BlocArrondiBleu(); this.tabLayoutPanel.add(panel, new HTML(gestionOnglets.get(key))); } }
From source file:com.square.composant.fusion.square.client.view.composant.fusion.ComposantFusionViewImpl.java
License:Open Source License
/** * Constructeur.//from w w w . java 2s . c o m */ public ComposantFusionViewImpl() { // Cration des onglets gestionOnglets = new HashMap<String, ScrollPanel>(); gestionIndexsOnglets = new HashMap<String, Integer>(); tabPanel = new DecoratedTabPanel(); tabPanel.setWidth(ComposantFusionPresenterConstants.POURCENT_100); int index = 0; final String[] onglets = new String[] { ComposantFusionPresenter.CONSTANTS.ongletSelectionDoublons(), ComposantFusionPresenter.CONSTANTS.ongletFusionner() }; for (String onglet : onglets) { final ScrollPanel panel = new ScrollPanel(); gestionOnglets.put(onglet, panel); gestionIndexsOnglets.put(onglet, index++); final String libelleOnglet = getLibelleOnglet(onglet); final Label lOnglet = new Label(libelleOnglet); lOnglet.setWordWrap(false); tabPanel.add(panel, lOnglet); } // Cration du panel principal final VerticalPanel pPrincipal = new VerticalPanel(); pPrincipal.addStyleName(ComposantFusionPresenter.RESOURCES.css().composantFusion()); pPrincipal.setWidth(ComposantFusionPresenterConstants.POURCENT_100); pPrincipal.setSpacing(10); pPrincipal.add(tabPanel); pPrincipal.setWidth(ComposantFusionPresenterConstants.LARGEUR_CONTENEUR); initWidget(pPrincipal); }