List of usage examples for com.google.gwt.user.client.ui CheckBox CheckBox
public CheckBox()
From source file:com.ikon.frontend.client.widget.security.SecurityPanel.java
License:Open Source License
/** * SecurityPanel/* www .j a v a 2 s .c o m*/ */ public SecurityPanel() { vPanel = new VerticalPanel(); securityUser = new SecurityUser(); securityRole = new SecurityRole(); tabPanel = new TabLayoutPanel(TAB_HEIGHT, Unit.PX); tabPanel.add(securityUser, Main.i18n("security.users")); tabPanel.add(securityRole, Main.i18n("security.roles")); tabPanel.selectTab(TAB_USERS); tabPanel.setWidth(String.valueOf(width)); tabPanel.setHeight("385"); // 365 +20 tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { Timer timer; switch (event.getSelectedItem().intValue()) { case TAB_USERS: groupsFilter = filter.getText(); filter.setText(usersFilter); filterText.setHTML(Main.i18n("security.filter.by.users")); timer = new Timer() { @Override public void run() { securityUser.fillWidth(); } }; timer.schedule(50); // Fill width must be done after really it'll be visible break; case TAB_GROUPS: usersFilter = filter.getText(); filter.setText(groupsFilter); filterText.setHTML(Main.i18n("security.filter.by.roles")); timer = new Timer() { @Override public void run() { securityRole.fillWidth(); } }; timer.schedule(50); // Fill width must be done after really it'll be visible break; } } }); filterPanel = new HorizontalPanel(); filterPanel.setVisible(false); checkBoxFilter = new CheckBox(); checkBoxFilter.setValue(false); checkBoxFilter.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { securityUser.resetUnassigned(); securityRole.resetUnassigned(); Widget sender = (Widget) event.getSource(); if (((CheckBox) sender).getValue()) { filter.setText(""); filter.setEnabled(true); } else { filter.setText(""); filter.setEnabled(false); usersFilter = ""; groupsFilter = ""; refreshUnassigned(); } } }); filter = new TextBox(); filterText = new HTML(Main.i18n("security.filter.by.users")); filterPanel.add(checkBoxFilter); filterPanel.add(new HTML(" ")); filterPanel.add(filterText); filterPanel.add(new HTML(" ")); filterPanel.add(filter); filterPanel.add(new HTML(" ")); filterPanel.setCellVerticalAlignment(checkBoxFilter, HasAlignment.ALIGN_MIDDLE); filterPanel.setCellVerticalAlignment(filterText, HasAlignment.ALIGN_MIDDLE); filterPanel.setCellVerticalAlignment(filter, HasAlignment.ALIGN_MIDDLE); filter.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (filter.getText().length() >= 3) { int selected = tabPanel.getSelectedIndex(); switch (selected) { case TAB_USERS: securityUser.getFilteredUngrantedUsers(filter.getText()); break; case TAB_GROUPS: securityRole.getFilteredUngrantedRoles(filter.getText()); break; } } else { securityUser.resetUnassigned(); securityRole.resetUnassigned(); } } }); vPanel.add(filterPanel); vPanel.add(tabPanel); vPanel.setCellHorizontalAlignment(filterPanel, VerticalPanel.ALIGN_RIGHT); vPanel.addStyleName("okm-DisableSelect"); tabPanel.addStyleName("okm-Border-Bottom"); filter.setStyleName("okm-Input"); tabPanel.setWidth(String.valueOf(width)); initWidget(vPanel); }
From source file:com.ikon.frontend.client.widget.security.UserScrollTable.java
License:Open Source License
/** * Adds new username permission row/*from w w w . j a v a 2 s . c om*/ * * @param userName The user name value * @param permission The permission value * @param modified If the permission has been modified */ public void addRow(GWTUser user, Integer permission, boolean modified) { final int rows = dataTable.getRowCount(); dataTable.insertRow(rows); dataTable.setHTML(rows, 0, user.getUsername()); if (modified) { dataTable.getCellFormatter().addStyleName(rows, 0, "bold"); } CheckBox checkReadPermission = new CheckBox(); CheckBox checkWritePermission = new CheckBox(); CheckBox checkDeletePermission = new CheckBox(); CheckBox checkSecurityPermission = new CheckBox(); ClickHandler checkBoxReadListener = new ClickHandler() { @Override public void onClick(ClickEvent event) { flag_property = PROPERTY_READ; Widget sender = (Widget) event.getSource(); // Actions are inverse to check value because before user // perform check on checkbox // it has inverse value if (((CheckBox) sender).getValue()) { grant(dataTable.getText(rows, numberOfColumns - 1), GWTPermission.READ, Main.get().securityPopup.recursive.getValue()); } else { revoke(dataTable.getText(rows, numberOfColumns - 1), GWTPermission.READ, Main.get().securityPopup.recursive.getValue()); } } }; ClickHandler checkBoxWriteListener = new ClickHandler() { @Override public void onClick(ClickEvent event) { flag_property = PROPERTY_WRITE; Widget sender = (Widget) event.getSource(); // Actions are inverse to check value because before user // perform check on checkbox // it has inverse value if (((CheckBox) sender).getValue()) { grant(dataTable.getText(rows, numberOfColumns - 1), GWTPermission.WRITE, Main.get().securityPopup.recursive.getValue()); } else { revoke(dataTable.getText(rows, numberOfColumns - 1), GWTPermission.WRITE, Main.get().securityPopup.recursive.getValue()); } } }; ClickHandler checkBoxDeleteListener = new ClickHandler() { @Override public void onClick(ClickEvent event) { flag_property = PROPERTY_DELETE; Widget sender = (Widget) event.getSource(); // Actions are inverse to check value because before user // perform check on checkbox // it has inverse value if (((CheckBox) sender).getValue()) { grant(dataTable.getText(rows, numberOfColumns - 1), GWTPermission.DELETE, Main.get().securityPopup.recursive.getValue()); } else { revoke(dataTable.getText(rows, numberOfColumns - 1), GWTPermission.DELETE, Main.get().securityPopup.recursive.getValue()); } } }; ClickHandler checkBoxSecurityListener = new ClickHandler() { @Override public void onClick(ClickEvent event) { flag_property = PROPERTY_SECURITY; Widget sender = (Widget) event.getSource(); // Actions are inverse to check value because before user // perform check on checkbox // it has inverse value if (((CheckBox) sender).getValue()) { grant(dataTable.getText(rows, numberOfColumns - 1), GWTPermission.SECURITY, Main.get().securityPopup.recursive.getValue()); } else { revoke(dataTable.getText(rows, numberOfColumns - 1), GWTPermission.SECURITY, Main.get().securityPopup.recursive.getValue()); } } }; checkReadPermission.addClickHandler(checkBoxReadListener); int col = 0; col++; // Name if ((permission & GWTPermission.READ) == GWTPermission.READ) { checkReadPermission.setValue(true); dataTable.setWidget(rows, col, checkReadPermission); dataTable.getCellFormatter().setHorizontalAlignment(rows, col++, HasAlignment.ALIGN_CENTER); } else { checkReadPermission.setValue(false); dataTable.setWidget(rows, col, checkReadPermission); dataTable.getCellFormatter().setHorizontalAlignment(rows, col++, HasAlignment.ALIGN_CENTER); } checkWritePermission.addClickHandler(checkBoxWriteListener); if ((permission & GWTPermission.WRITE) == GWTPermission.WRITE) { checkWritePermission.setValue(true); dataTable.setWidget(rows, col, checkWritePermission); dataTable.getCellFormatter().setHorizontalAlignment(rows, col++, HasAlignment.ALIGN_CENTER); } else { checkWritePermission.setValue(false); dataTable.setWidget(rows, col, checkWritePermission); dataTable.getCellFormatter().setHorizontalAlignment(rows, col++, HasAlignment.ALIGN_CENTER); } checkDeletePermission.addClickHandler(checkBoxDeleteListener); if ((permission & GWTPermission.DELETE) == GWTPermission.DELETE) { checkDeletePermission.setValue(true); dataTable.setWidget(rows, col, checkDeletePermission); dataTable.getCellFormatter().setHorizontalAlignment(rows, col++, HasAlignment.ALIGN_CENTER); } else { checkDeletePermission.setValue(false); dataTable.setWidget(rows, col, checkDeletePermission); dataTable.getCellFormatter().setHorizontalAlignment(rows, col++, HasAlignment.ALIGN_CENTER); } checkSecurityPermission.addClickHandler(checkBoxSecurityListener); if ((permission & GWTPermission.SECURITY) == GWTPermission.SECURITY) { checkSecurityPermission.setValue(true); dataTable.setWidget(rows, col, checkSecurityPermission); dataTable.getCellFormatter().setHorizontalAlignment(rows, col++, HasAlignment.ALIGN_CENTER); } else { checkSecurityPermission.setValue(false); dataTable.setWidget(rows, col, checkSecurityPermission); dataTable.getCellFormatter().setHorizontalAlignment(rows, col++, HasAlignment.ALIGN_CENTER); } dataTable.setHTML(rows, col, user.getId()); dataTable.getCellFormatter().setVisible(rows, col++, false); }
From source file:com.ikon.frontend.client.widget.upload.FileUploadForm.java
License:Open Source License
/** * FileUploadForm/*from ww w. ja v a2 s . c om*/ */ public FileUploadForm(FileUpload fileUpload, String size) { this.fileUpload = fileUpload; fileUpload.setStyleName("okm-Input"); fileUpload.getElement().setAttribute("size", size); // Set the name of the upload file form element fileUpload.setName("uploadFormElement"); uploadForm = new FormPanel(); vPanel = new VerticalPanel(); inputPath = new TextBox(); inputAction = new TextBox(); inputRenameDocument = new TextBox(); notifyToUser = new CheckBox(); importZip = new CheckBox(); versionComment = new TextArea(); users = new TextBox(); roles = new TextBox(); message = new TextArea(); // Set Form details // Set the action to call on submit uploadForm.setAction(RPCService.FileUploadService); // Set the form encoding to multipart to indicate a file upload uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART); // Set the method to Post uploadForm.setMethod(FormPanel.METHOD_POST); inputPath.setName("path"); inputPath.setVisible(false); vPanel.add(inputPath); inputAction.setName("action"); inputAction.setVisible(false); vPanel.add(inputAction); inputRenameDocument.setName("rename"); inputRenameDocument.setVisible(false); vPanel.add(inputRenameDocument); notifyToUser.setName("notify"); notifyToUser.setVisible(false); vPanel.add(notifyToUser); importZip.setName("importZip"); importZip.setVisible(false); vPanel.add(importZip); versionComment.setName("comment"); versionComment.setVisible(false); vPanel.add(versionComment); users.setName("users"); users.setVisible(false); vPanel.add(users); roles.setName("roles"); roles.setVisible(false); vPanel.add(roles); message.setName("message"); message.setVisible(false); vPanel.add(message); vPanel.add(fileUpload); uploadForm.setWidget(vPanel); initWidget(uploadForm); }
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 . j av a 2 s . 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();/*from w ww . j av a 2 s. 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.jitlogic.zico.client.views.admin.UserEditDialog.java
License:Open Source License
public UserEditDialog(UserService userService, UserInfo user, UserManagementPanel panel, List<String> availableHosts, MessageDisplay md) { window = new PopupWindow(ourUiBinder.createAndBindUi(this)); this.userService = userService; this.editedUser = user != null ? user : new UserInfo(); this.newUser = user == null; this.panel = panel; this.md = md; window.setCaption(user != null ? "Edit user: " + user.getUserName() : "New user"); if (user != null) { txtUsername.setText(user.getUserName()); txtUsername.setEnabled(false);/*from w w w .j av a 2 s .c o m*/ txtRealName.setText(user.getRealName()); chkIsAdmin.setValue(user.isAdmin()); } Set<String> hosts = new HashSet<String>(); if (user != null && user.getAllowedHosts() != null) { hosts.addAll(user.getAllowedHosts()); } for (String host : availableHosts) { CheckBox chkHost = new CheckBox(); chkHost.setValue(hosts.contains(host)); selectedHosts.put(host, chkHost); HorizontalPanel hp = new HorizontalPanel(); hp.add(chkHost); hp.add(new Label(host)); hostList.add(hp); } window.resizeAndCenter(250, 350); }
From source file:com.linkcorp.mvp.client.view.ContactsView.java
License:Apache License
@Override public void setData(List<String> data) { this.contactTable.removeAllRows(); for (int i = 0; i < data.size(); i++) { this.contactTable.setWidget(i, 0, new CheckBox()); this.contactTable.setText(i, 1, data.get(i)); }/* ww w . j a v a 2 s .c om*/ }
From source file:com.mcherm.zithiacharsheet.client.ZithiaSkillsTable.java
License:Apache License
/** * Called to wipe out the full table and repopulate it. */// w w w . jav a 2 s . c o m private void repopulateSkillTable(final SkillList skills) { int row; // -- Remove existing rows -- for (row = getRowCount() - 1; row > 0; row--) { removeRow(row); } if (rowsDisposer != null) { rowsDisposer.dispose(); } // -- Re-insert all skills as rows -- row = 1; rowsDisposer = new Disposer(); for (final SkillValue skillValue : skills) { //---Checkbox for row selection--// getFlexCellFormatter().addStyleName(row, 0, "checkBoxCol"); setWidget(row, 0, new CheckBox()); // -- Name -- getFlexCellFormatter().addStyleName(row, 2, "nameCol"); setText(row, 2, skillValue.getSkill().getName()); // -- Cost -- getFlexCellFormatter().addStyleName(row, 1, "costCol"); setWidget(row, 1, rowsDisposer.track(new TweakableIntField(skillValue.getCost()))); // -- Roll -- getFlexCellFormatter().addStyleName(row, 4, "rollCol"); if (skillValue.getSkill().hasRoll()) { setWidget(row, 4, rowsDisposer.track(new TweakableIntField(skillValue.getRoll()))); } else { setText(row, 4, "n/a"); } // -- Value -- getFlexCellFormatter().addStyleName(row, 3, "levelsCol"); setWidget(row, 3, rowsDisposer.track(new SettableIntField(skillValue.getLevels()))); // -- Continue loop -- row++; } }
From source file:com.mynotes.client.view.NotesViewImpl.java
License:Open Source License
@Override public void setData(List<String> data) { notesTable.removeAllRows();/*from w ww. j a v a 2s . c om*/ HTMLTable.CellFormatter cf = notesTable.getCellFormatter(); for (int i = 0; i < data.size(); ++i) { // Set data notesTable.setWidget(i, CHECKBOX_COLUMN, new CheckBox()); notesTable.setText(i, TEXT_COLUMN, data.get(i)); // Set style cf.addStyleName(i, CHECKBOX_COLUMN, "rowFContainer"); cf.addStyleName(i, TEXT_COLUMN, "rowContainer"); } }
From source file:com.openkm.extension.frontend.client.widget.openmeetings.invite.InvitationPanel.java
License:Open Source License
/** * NotifyPanel/*from www. ja v a 2 s.co m*/ */ public InvitationPanel() { vPanel = new VerticalPanel(); inviteUser = new InviteUser(); inviteRole = new InviteRole(); tabPanel = new TabLayoutPanel(TAB_HEIGHT, Unit.PX); tabPanel.add(inviteUser, GeneralComunicator.i18nExtension("openmeetings.invitate.users")); tabPanel.add(inviteRole, GeneralComunicator.i18nExtension("openmeetings.invitate.groups")); tabPanel.selectTab(TAB_USERS); tabPanel.setWidth("374"); tabPanel.setHeight("140"); tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { switch (event.getSelectedItem().intValue()) { case TAB_USERS: groupsFilter = filter.getText(); filter.setText(usersFilter); filterText.setHTML(GeneralComunicator.i18nExtension("security.filter.by.users")); break; case TAB_GROUPS: usersFilter = filter.getText(); filter.setText(groupsFilter); filterText.setHTML(GeneralComunicator.i18nExtension("security.filter.by.roles")); break; } } }); filterPanel = new HorizontalPanel(); filterPanel.setVisible(false); checkBoxFilter = new CheckBox(); checkBoxFilter.setValue(false); checkBoxFilter.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { inviteUser.resetAvailableUsersTable(); inviteRole.resetAvailableRolesTable(); Widget sender = (Widget) event.getSource(); if (((CheckBox) sender).getValue()) { filter.setText(""); filter.setEnabled(true); } else { filter.setText(""); filter.setEnabled(false); usersFilter = ""; groupsFilter = ""; getAll(); } } }); filter = new TextBox(); filterText = new HTML(GeneralComunicator.i18nExtension("security.filter.by.users")); filterPanel.add(checkBoxFilter); filterPanel.add(new HTML(" ")); filterPanel.add(filterText); filterPanel.add(new HTML(" ")); filterPanel.add(filter); filterPanel.setCellVerticalAlignment(checkBoxFilter, HasAlignment.ALIGN_MIDDLE); filterPanel.setCellVerticalAlignment(filterText, HasAlignment.ALIGN_MIDDLE); filterPanel.setCellVerticalAlignment(filter, HasAlignment.ALIGN_MIDDLE); filter.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (filter.getText().length() >= 3) { int selected = tabPanel.getSelectedIndex(); switch (selected) { case TAB_USERS: inviteUser.resetAvailableUsersTable(); inviteUser.getFilteredAllUsers(filter.getText()); break; case TAB_GROUPS: inviteRole.resetAvailableRolesTable(); inviteRole.getFilteredAllRoles(filter.getText()); break; } } else { inviteUser.resetAvailableUsersTable(); inviteRole.resetAvailableRolesTable(); } } }); vPanel.add(filterPanel); vPanel.add(tabPanel); vPanel.setCellHorizontalAlignment(filterPanel, VerticalPanel.ALIGN_RIGHT); vPanel.addStyleName("okm-DisableSelect"); tabPanel.addStyleName("okm-Border-Bottom"); filter.setStyleName("okm-Input"); initWidget(vPanel); }