public EventViewerWindow() { super(); setTitle(AppMessages.EVENT_VIEWER_LABEL); setShortcutIcon(AppImages.EVENT_DETAIL_SHORTCUT); setHeaderIcon(AppImages.EVENT_DETAIL_ICON); stack = new SectionStack(); stack.setVisibilityMode(VisibilityMode.MULTIPLE); SectionStackSection findSection = new SectionStackSection("Find"); findSection.setExpanded(true); final DynamicForm form = new SearchForm(); form.setNumCols(7); form.setHeight(35); form.setTop(15); form.setCellPadding(10); TextItem actIdItem = new TextItem(); actIdItem.setTitle("Activity ID"); TextItem contextItem = new TextItem(); contextItem.setTitle("Context"); ButtonItem findBtn = new ButtonItem("Search"); findBtn.setStartRow(false); findBtn.setIcon(AppImages.SEARCH_ICON); findBtn.setWidth("125px"); form.setFields(actIdItem, contextItem, findBtn); findSection.addItem(form); SectionStackSection resultSection = new SectionStackSection("Activities"); resultSection.setExpanded(true); grid = new ListGrid(); grid.setShowAllRecords(true); grid.setHeight(300); ListGridField actId = new ListGridField("activityId", "ID", 40); ListGridField actDate = new ListGridField("activityDate", "Date", 150); ListGridField actCtx = new ListGridField("activityContext", "Context", 220); ListGridField actDesc = new ListGridField("activityDescription", "Description"); grid.setFields(actId, actCtx, actDesc, actDate); grid.setData(getData()); resultSection.addItem(grid); SectionStackSection detailSection = new SectionStackSection("Activity Detail"); detailSection.setExpanded(true); stack.addSection(findSection); stack.addSection(resultSection); stack.addSection(detailSection); this.addItem(stack); }
private Tab fullTextSearchTab(JcrExplorer jackrabbitExplorer) { Tab searchFullTextTab = new Tab(); searchFullTextTab.setTitle("Full Text Search"); final DynamicForm searchFullTextForm = new DynamicForm(); searchFullTextForm.setID("searchFullTextForm"); searchFullTextForm.setNumCols(3); searchFullTxt.setName("searchFullTxt"); searchFullTxt.setTitle("Full Text Search"); searchFullTxt.setWidth(250); searchFullTxt.setRequired(true); // RegExpValidator regExpValidator = new RegExpValidator(); // regExpValidator.setExpression("^[\\w\\d\\_\\.]{1,}$"); // searchFullTxt.setValidateOnChange(true); // searchFullTxt.setValidators(regExpValidator); SubmitItem searchFullTextSubmitItem = new SubmitItem("searchFullTextSubmitItem"); searchFullTextSubmitItem.setTitle("Search"); searchFullTextSubmitItem.setWidth(100); class SearchFullTextSubmitValuesHandler implements SubmitValuesHandler { private JcrExplorer jackrabbitExplorer; public SearchFullTextSubmitValuesHandler(JcrExplorer jackrabbitExplorer) { this.jackrabbitExplorer = jackrabbitExplorer; } public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) { if (searchFullTextForm.validate()) { JcrExplorer.showLoadingImg(); JcrExplorer.service.fullTextSearch( searchFullTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer)); } } }; searchFullTextForm.addSubmitValuesHandler( new SearchFullTextSubmitValuesHandler(jackrabbitExplorer)); searchFullTextForm.setSaveOnEnter(true); searchFullTxt.setStartRow(true); searchFullTxt.setEndRow(false); searchFullTextSubmitItem.setStartRow(false); searchFullTextSubmitItem.setEndRow(true); searchFullTextForm.setItems(searchFullTxt, searchFullTextSubmitItem); searchFullTextTab.setPane(searchFullTextForm); return searchFullTextTab; }
public Canvas getViewPanel() { final TabSet tabSet = new TabSet(); tabSet.setTabBarPosition(Side.TOP); // required so that the select item doesnt touch the tab pane tabSet.setTabBarThickness(25); tabSet.setTabBarAlign(Side.LEFT); tabSet.setWidth(400); tabSet.setHeight(200); final Tab statusTab = new Tab("Status"); final Canvas statusPane = new Canvas(); statusTab.setPane(statusPane); tabSet.addTab(statusTab); SelectItem selectItem = new SelectItem(); selectItem.setValueMap("Development", "Staging", "Production"); selectItem.setShowTitle(false); selectItem.setDefaultValue("Development"); selectItem.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { statusPane.setContents( event.getValue() + ": <span style='color:green;font-weight:bold'>Normal</span><br>"); } }); DynamicForm form = new DynamicForm(); // form.setHeight(1); form.setPadding(0); form.setMargin(0); form.setCellPadding(1); form.setNumCols(1); form.setFields(selectItem); tabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, form); return tabSet; }
private Tab xpathSearchTab(JcrExplorer jackrabbitExplorer) { Tab searchXpathTab = new Tab(); searchXpathTab.setTitle("Xpath Search"); final DynamicForm searchXpathForm = new DynamicForm(); searchXpathForm.setID("searchXpathForm"); searchXpathForm.setNumCols(3); searchXpathTxt.setName("searchXpathTxt"); searchXpathTxt.setTitle("Xpath Search"); searchXpathTxt.setWidth(250); searchXpathTxt.setRequired(true); SubmitItem searchXpathSubmitItem = new SubmitItem("searchXpathSubmitItem"); searchXpathSubmitItem.setTitle("Search"); searchXpathSubmitItem.setWidth(100); class SearchXpathSubmitValuesHandler implements SubmitValuesHandler { private JcrExplorer jackrabbitExplorer; public SearchXpathSubmitValuesHandler(JcrExplorer jackrabbitExplorer) { this.jackrabbitExplorer = jackrabbitExplorer; } public void onSubmitValues(com.smartgwt.client.widgets.form.events.SubmitValuesEvent event) { if (searchXpathForm.validate()) { JcrExplorer.showLoadingImg(); JcrExplorer.service.xpathSearch( searchXpathTxt.getValue().toString(), new SearchServiceCallback(jackrabbitExplorer)); } } }; searchXpathForm.addSubmitValuesHandler(new SearchXpathSubmitValuesHandler(jackrabbitExplorer)); searchXpathForm.setSaveOnEnter(true); searchXpathTxt.setStartRow(true); searchXpathTxt.setEndRow(false); searchXpathSubmitItem.setStartRow(false); searchXpathSubmitItem.setEndRow(true); searchXpathForm.setItems(searchXpathTxt, searchXpathSubmitItem); searchXpathTab.setPane(searchXpathForm); return searchXpathTab; }
private DynamicForm createSummaryForm() { DynamicForm form = new DynamicForm(); form.setWidth100(); form.setColWidths("20%", "40%", "40%"); form.setNumCols(3); form.setAutoHeight(); form.setWrapItemTitles(false); form.setExtraSpace(10); form.setIsGroup(true); form.setGroupTitle(MSG.common_title_summary()); form.setPadding(5); CanvasItem actionItem = new CanvasItem("actions"); actionItem.setColSpan(1); actionItem.setRowSpan(4); actionItem.setShowTitle(false); actionItem.setCanvas(getActionLayout()); StaticTextItem versionItem = new StaticTextItem("version", MSG.common_title_version()); versionItem.setValue(version.getVersion()); StaticTextItem liveDeploymentsItem = new StaticTextItem("deployments", MSG.view_bundle_deployments()); liveDeploymentsItem.setValue(version.getBundleDeployments().size()); StaticTextItem filesItems = new StaticTextItem("files", MSG.view_bundle_files()); filesItems.setValue(version.getBundleFiles().size()); StaticTextItem descriptionItem = new StaticTextItem("description", MSG.common_title_description()); descriptionItem.setValue(version.getDescription()); form.setFields(versionItem, actionItem, liveDeploymentsItem, filesItems, descriptionItem); return form; }
private DynamicForm getConnectionForm() { connectionForm = new DynamicForm(); connectionForm.setNumCols(4); connectionForm.setWrapItemTitles(false); connectionForm.setColWidths("130", "450", "110"); connectionForm.setExtraSpace(15); connectionForm.setWidth(790); connectionForm.setPadding(5); connectionForm.setIsGroup(true); connectionForm.setGroupTitle(MSG.view_remoteAgentInstall_connInfo()); final int textFieldWidth = 440; TextItem host = new TextItem("host", MSG.common_title_host()); host.setRequired(true); host.setWidth(textFieldWidth); host.setPrompt(MSG.view_remoteAgentInstall_promptHost()); host.setHoverWidth(300); host.setEndRow(true); host.addChangedHandler( new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { hostAuthorized = false; // if the host changes, we need to make sure the user authorizes it if needed } }); TextItem port = new TextItem("port", MSG.common_title_port()); port.setRequired(false); port.setWidth(textFieldWidth); port.setPrompt(MSG.view_remoteAgentInstall_promptPort()); port.setHoverWidth(300); port.setEndRow(true); IntegerRangeValidator portValidator = new IntegerRangeValidator(); portValidator.setMin(1); portValidator.setMax(65535); port.setValidators(new IsIntegerValidator(), portValidator); TextItem username = new TextItem("username", MSG.common_title_user()); username.setRequired( false); // if not specified, the server will attempt to use the default ssh user defined in // system settings username.setWidth(textFieldWidth); username.setPrompt(MSG.view_remoteAgentInstall_promptUser()); username.setHoverWidth(300); username.setEndRow(true); PasswordItem password = new PasswordItem("password", MSG.common_title_password()); password.setRequired( false); // if not specified, the server will attempt to use the default ssh pw defined in // system settings password.setWidth(textFieldWidth); password.setPrompt(MSG.view_remoteAgentInstall_promptPassword()); password.setHoverWidth(300); password.setEndRow(true); password.setAttribute("autocomplete", "off"); rememberMeCheckbox = new CheckboxItem("rememberme", MSG.view_remoteAgentInstall_rememberMe()); rememberMeCheckbox.setRequired(false); rememberMeCheckbox.setPrompt(MSG.view_remoteAgentInstall_promptRememberMe()); rememberMeCheckbox.setHoverWidth(300); rememberMeCheckbox.setColSpan(2); rememberMeCheckbox.setEndRow(true); agentInstallPath = new TextItem("agentInstallPath", MSG.view_remoteAgentInstall_installPath()); agentInstallPath.setWidth(textFieldWidth); agentInstallPath.setPrompt(MSG.view_remoteAgentInstall_promptInstallPath()); agentInstallPath.setHoverWidth(300); agentInstallPath.setStartRow(true); agentInstallPath.setEndRow(false); agentInstallPath.setValidators( absPathValidator); // we will "turn this on" when needed - this is to ensure we create paths // properly and it doesn't go in places user isn't expecting findAgentInstallPathButton = new ButtonItem("findAgentInstallPathButton", MSG.view_remoteAgentInstall_buttonFindAgent()); findAgentInstallPathButton.setStartRow(false); findAgentInstallPathButton.setEndRow(true); if (findAgentInstallPathButton.getTitle().length() < 15) { // i18n may prolong the title findAgentInstallPathButton.setWidth(100); } findAgentInstallPathButton.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { public void onClick( com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) { // we only want to validate host if (connectionForm.getValueAsString("host") == null || connectionForm.getValueAsString("host").trim().isEmpty()) { final HashMap<String, String> errors = new HashMap<String, String>(1); errors.put("host", CoreGUI.getSmartGwtMessages().validator_requiredField()); connectionForm.setErrors(errors, true); return; } new CheckSSHConnectionCallback() { @Override protected void doActualWork() { findAgentInstallPath(); } }.execute(); } }); createAgentStatusTextItem(); statusCheckButton = new ButtonItem("updateStatus", MSG.common_title_updateStatus()); statusCheckButton.setStartRow(false); statusCheckButton.setEndRow(true); if (findAgentInstallPathButton.getTitle().length() < 15) { // i18n may prolong the title statusCheckButton.setWidth(100); } statusCheckButton.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { public void onClick( com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) { if (connectionForm.validate()) { new CheckSSHConnectionCallback() { @Override protected void doActualWork() { agentStatusCheck(); } }.execute(); } } }); if (initialAgentInstall != null) { host.setValue(initialAgentInstall.getSshHost()); if (initialAgentInstall.getSshPort() != null) { port.setValue(String.valueOf(initialAgentInstall.getSshPort())); } username.setValue(initialAgentInstall.getSshUsername()); password.setValue(initialAgentInstall.getSshPassword()); agentInstallPath.setValue(initialAgentInstall.getInstallLocation()); // if it was already saved, assume they want it to stay remembered // however, because the uninstall page is getting rid of the agent, we don't need or want to // remember the credentials anymore if (!this.showUninstallButton) { rememberMeCheckbox.setValue(initialAgentInstall.getSshPassword() != null); } } // disable some form elements if we don't want the user changing them - they should have been // filled in by who ever created this view if (this.showUninstallButton || this.showStartButton || this.showStopButton) { host.setDisabled(true); port.setDisabled(true); agentInstallPath.setDisabled(true); findAgentInstallPathButton.setDisabled(true); } if (this.showUninstallButton) { // don't show rememberMe checkbox - we're getting rid of this agent so there won't be a record // to store the creds connectionForm.setFields( host, port, username, password, agentInstallPath, findAgentInstallPathButton, agentStatusText, statusCheckButton); } else { connectionForm.setFields( host, port, username, password, rememberMeCheckbox, agentInstallPath, findAgentInstallPathButton, agentStatusText, statusCheckButton); } return connectionForm; }
public TabFindAbonent() { setTitle(CallCenter.constants.findAbonent()); setCanClose(true); datasource = DataSource.get("AbonentsDS"); mainLayout = new VLayout(5); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.setMargin(5); searchForm = new DynamicForm(); searchForm.setAutoFocus(true); searchForm.setWidth(750); searchForm.setNumCols(3); searchForm.setTitleOrientation(TitleOrientation.TOP); mainLayout.addMember(searchForm); firstNameItem = new TextItem(); firstNameItem.setTitle(CallCenter.constants.name()); firstNameItem.setWidth(250); firstNameItem.setName("firstNameItem"); lastNameItem = new TextItem(); lastNameItem.setTitle(CallCenter.constants.lastName()); lastNameItem.setWidth(250); lastNameItem.setName("lastNameItem"); phoneItem = new TextItem(); phoneItem.setTitle(CallCenter.constants.phone()); phoneItem.setWidth(250); phoneItem.setName("phone"); streetItem = new TextItem(); streetItem.setTitle(CallCenter.constants.street()); streetItem.setName("street_name_geo"); streetItem.setWidth(250); citiesItem = new ComboBoxItem(); citiesItem.setTitle(CallCenter.constants.city()); citiesItem.setName("city_name_geo"); citiesItem.setWidth(250); citiesItem.setFetchMissingValues(true); citiesItem.setFilterLocally(false); citiesItem.setAddUnknownValues(false); DataSource cityDS = DataSource.get("CityDS"); citiesItem.setOptionOperationId("searchCitiesFromDBForCombos"); citiesItem.setOptionDataSource(cityDS); citiesItem.setValueField("city_id"); citiesItem.setDisplayField("city_name_geo"); citiesItem.setOptionCriteria(new Criteria()); citiesItem.setAutoFetchData(false); citiesItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { Criteria criteria = citiesItem.getOptionCriteria(); if (criteria != null) { String oldAttr = criteria.getAttribute("city_id"); if (oldAttr != null) { Object nullO = null; criteria.setAttribute("city_id", nullO); } } } }); regionItem = new ComboBoxItem(); regionItem.setTitle(CallCenter.constants.cityRegion()); regionItem.setName("city_region_name_geo"); regionItem.setWidth(250); regionItem.setFetchMissingValues(true); regionItem.setFilterLocally(false); regionItem.setAddUnknownValues(false); DataSource streetsDS = DataSource.get("CityRegionDS"); regionItem.setOptionOperationId("searchCityRegsFromDBForCombos"); regionItem.setOptionDataSource(streetsDS); regionItem.setValueField("city_region_id"); regionItem.setDisplayField("city_region_name_geo"); Criteria criteria = new Criterion(); regionItem.setOptionCriteria(criteria); regionItem.setAutoFetchData(false); regionItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { Criteria criteria = regionItem.getOptionCriteria(); if (criteria != null) { String oldAttr = criteria.getAttribute("city_region_id"); if (oldAttr != null) { Object nullO = null; criteria.setAttribute("city_region_id", nullO); } } } }); searchForm.setFields( lastNameItem, firstNameItem, phoneItem, streetItem, citiesItem, regionItem); HLayout buttonLayout = new HLayout(5); buttonLayout.setWidth(750); buttonLayout.setHeight(30); buttonLayout.setAlign(Alignment.RIGHT); clearButton = new IButton(); clearButton.setTitle(CallCenter.constants.clear()); findButton = new IButton(); findButton.setTitle(CallCenter.constants.find()); buttonLayout.setMembers(findButton, clearButton); mainLayout.addMember(buttonLayout); listGrid = new ListGrid() { protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) { ListGridRecord countryRecord = (ListGridRecord) record; if (countryRecord == null) { return super.getCellCSSText(record, rowNum, colNum); } Integer deleted = countryRecord.getAttributeAsInt("deleted"); if (deleted != null && !deleted.equals(0)) { return "color:red;"; } else { return super.getCellCSSText(record, rowNum, colNum); } }; }; listGrid.setWidth(1000); listGrid.setHeight100(); listGrid.setAlternateRecordStyles(true); listGrid.setDataSource(datasource); listGrid.setAutoFetchData(false); listGrid.setShowFilterEditor(false); listGrid.setCanEdit(false); listGrid.setCanRemoveRecords(false); listGrid.setFetchOperation("customSearchForCC"); listGrid.setCanSort(false); listGrid.setCanResizeFields(false); listGrid.setCanSelectText(true); listGrid.setCanDragSelectText(true); listGrid.setShowFilterEditor(true); listGrid.setFilterOnKeypress(true); ListGridField firstname = new ListGridField("firstname", CallCenter.constants.name(), 120); firstname.setCanFilter(true); ListGridField lastname = new ListGridField("lastname", CallCenter.constants.lastName(), 150); lastname.setCanFilter(true); ListGridField city = new ListGridField("city", CallCenter.constants.city(), 140); city.setCanFilter(false); ListGridField address = new ListGridField("address", CallCenter.constants.address()); address.setCanFilter(true); ListGridField phone = new ListGridField("phone", CallCenter.constants.phone(), 100); phone.setCanFilter(true); firstname.setAlign(Alignment.LEFT); lastname.setAlign(Alignment.LEFT); city.setAlign(Alignment.LEFT); address.setAlign(Alignment.LEFT); phone.setAlign(Alignment.CENTER); listGrid.setFields(lastname, firstname, city, address, phone); mainLayout.addMember(listGrid); clearButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { firstNameItem.clearValue(); lastNameItem.clearValue(); phoneItem.clearValue(); streetItem.clearValue(); citiesItem.clearValue(); regionItem.clearValue(); } }); findButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { search(); } }); citiesItem.addChangedHandler( new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { String value = citiesItem.getValueAsString(); if (value == null) { return; } regionItem.clearValue(); fillCityRegionCombo(new Integer(value)); } }); firstNameItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); lastNameItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); phoneItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); streetItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); listGrid.addRecordDoubleClickHandler( new RecordDoubleClickHandler() { @Override public void onRecordDoubleClick(RecordDoubleClickEvent event) { DlgViewAbonent dlgViewAbonent = new DlgViewAbonent(listGrid, datasource, listGrid.getSelectedRecord()); dlgViewAbonent.show(); } }); setPane(mainLayout); }
private void prepareDetailsSection(SectionStack stack, ServerPlugin plugin) { DynamicForm form = new DynamicForm(); form.setMargin(10); form.setWidth100(); form.setWrapItemTitles(false); form.setNumCols(4); StaticTextItem nameItem = new StaticTextItem("name", MSG.common_title_name()); nameItem.setValue(plugin.getName()); StaticTextItem displayNameItem = new StaticTextItem("displayName", MSG.common_title_display_name()); displayNameItem.setValue(plugin.getDisplayName()); StaticTextItem versionItem = new StaticTextItem("version", MSG.common_title_version()); versionItem.setValue(plugin.getVersion()); StaticTextItem md5Item = new StaticTextItem("MD5", "MD5"); md5Item.setValue(plugin.getMD5()); StaticTextItem pathItem = new StaticTextItem("path", MSG.common_title_path()); pathItem.setValue(plugin.getPath()); StaticTextItem ampsItem = new StaticTextItem("ampsVersion", "AMPS " + MSG.common_title_version()); ampsItem.setValue(plugin.getAmpsVersion()); StaticTextItem descItem = new StaticTextItem("desc", MSG.common_title_description()); descItem.setValue(plugin.getDescription()); StaticTextItem mtimeItem = new StaticTextItem("mtime", MSG.common_title_lastUpdated()); mtimeItem.setValue( TimestampCellFormatter.format( Long.valueOf(plugin.getMtime()), TimestampCellFormatter.DATE_TIME_FORMAT_MEDIUM)); StaticTextItem kindItem = new StaticTextItem("kind", MSG.common_title_kind()); switch (plugin.getDeployment()) { case AGENT: kindItem.setValue(MSG.view_admin_plugins_agent()); break; case SERVER: kindItem.setValue(MSG.view_admin_plugins_server()); break; } CanvasItem enabledItem = new CanvasItem("enabled", MSG.common_title_enabled()); Img img = new Img(ImageManager.getAvailabilityIcon(plugin.isEnabled()), 16, 16); enabledItem.setCanvas(img); StaticTextItem typeItem = new StaticTextItem("type", MSG.common_title_type()); typeItem.setValue(plugin.getType()); form.setItems( displayNameItem, nameItem, versionItem, ampsItem, md5Item, kindItem, descItem, pathItem, mtimeItem, enabledItem, typeItem); SectionStackSection section = new SectionStackSection(MSG.common_title_details()); section.setExpanded(true); section.setItems(form); detailsSection = section; ++initSectionCount; return; }
private void initNewWindow() { this.setAutoSize(true); this.setTitle("新书入库"); this.setCanDragReposition(true); this.setCanDragResize(false); this.setAutoCenter(true); this.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); VLayout vLayout; HLayout hLayout; HLayout buttonLayout; vLayout = new VLayout(); vLayout.setWidth(WINDOW_WIDTH); vLayout.setHeight(WINDOW_HEIGHT); vLayout.setBorder("2px solid #7598C7"); vLayout.setMargin(12); vLayout.setPadding(14); hLayout = new HLayout(); hLayout.setWidth(WINDOW_WIDTH); // HLayout // --------------------------------------------------------------------------------------- imgVLayout = new VLayout(); imgVLayout.setWidth(IMG_WIDTH); bookPicUrlItem = new Img("/images/upload/" + strBookPicUrl, IMG_WIDTH, IMG_HEIGHT); // bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT); // bookPicUrlItem.setPrefix("/images/upload/"); uploadPicButton = new IButton("上传封面"); uploadPicButton.setIcon("actions/plus.png"); uploadPicButton.setWidth(IMG_WIDTH); imgVLayout.setMembers(bookPicUrlItem, uploadPicButton); imgVLayout.setMembersMargin(10); // Form // 1----------------------------------------------------------------------------------------- bookForm1 = new DynamicForm(); bookForm1.setNumCols(4); bookForm1.setWidth("*"); bookForm1.setColWidths(100, "*", 100, "*"); bookForm1.setCellPadding(5); TextItem bookNameItem = new TextItem("bookName", "书名"); bookNameItem.setColSpan(4); bookNameItem.setWidth("100%"); bookNameItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookNameItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); TextItem bookAuthorItem = new TextItem("bookAuthor", "作者"); bookAuthorItem.setColSpan(4); bookAuthorItem.setWidth("100%"); bookAuthorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookAuthorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); TextItem bookISBNItem = new TextItem("bookISBN", "ISBN"); bookISBNItem.setColSpan(4); bookISBNItem.setWidth("100%"); bookISBNItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookISBNItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookISBNItem.setShowIcons(true); FormItemIcon fetchBookInfoBut = new FormItemIcon(); fetchBookInfoBut.setSrc("/images/actions/approve.png"); bookISBNItem.setIcons(fetchBookInfoBut); bookISBNItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { fetchDataFromDouban(); } } }); fetchBookInfoBut.addFormItemClickHandler( new FormItemClickHandler() { @Override public void onFormItemClick(FormItemIconClickEvent event) { fetchDataFromDouban(); } }); bookISBNItem.setIconPrompt("从豆瓣获取书籍信息"); TextItem bookPublisherItem = new TextItem("bookPublisher", "出版社"); bookPublisherItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookPublisherItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); DateItem bookPublishDateItem = new DateItem("bookPublishDate", "出版日期"); bookPublishDateItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookPublishDateItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookPublishDateItem.setUseTextField(true); bookPublishDateItem.setDefaultChooserDate(new Date()); SelectItem bookClassItem = new SelectItem("bookClass", "类别"); bookClassItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookClassItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookClassItem.setValueMap( "计算机/网络", "小说/文学", "哲学/文化", "经济/管理", "政治/军事", "励志/成长", "儿童/育儿", "心理", "法律", "历史", "其他"); bookClassItem.setDefaultToFirstOption(true); SelectItem bookLanguageItem = new SelectItem("bookLanguage", "语言"); bookLanguageItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookLanguageItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookLanguageItem.setValueMap("中文", "英语", "法语", "德语", "日语", "俄语", "韩语"); bookLanguageItem.setDefaultToFirstOption(true); TextItem bookContributorItem = new TextItem("bookContributor", "贡献者"); bookContributorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookContributorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); TextItem bookPriceItem = new TextItem("bookPrice", "价格"); bookPriceItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookPriceItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookForm1.setFields( bookNameItem, bookAuthorItem, bookISBNItem, bookPublisherItem, bookPublishDateItem, bookClassItem, bookLanguageItem, bookContributorItem, bookPriceItem); // Form // 2----------------------------------------------------------------------------------------- bookForm2 = new DynamicForm(); bookForm2.setNumCols(3); bookForm2.setWidth(WINDOW_WIDTH); bookForm2.setColWidths("*", "*", "*"); bookForm2.setCellPadding(3); bookForm2.setCellBorder(1); bookForm2.setTitleOrientation(TitleOrientation.TOP); StaticTextItem bookTotalQuantityItemTitle = new StaticTextItem("bookTotalQuantityTitle", ""); bookTotalQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header"); bookTotalQuantityItemTitle.setShowTitle(false); StaticTextItem bookInStoreQuantityitemTitle = new StaticTextItem("bookInStoreQuantityTitle", ""); bookInStoreQuantityitemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header"); bookInStoreQuantityitemTitle.setShowTitle(false); StaticTextItem bookAvailableQuantityItemTitle = new StaticTextItem("bookAvailableQuantityTitle", ""); bookAvailableQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header"); bookAvailableQuantityItemTitle.setShowTitle(false); TextItem bookTotalQuantityItem = new TextItem("bookTotalQuantity", ""); bookTotalQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookTotalQuantityItem.setShowTitle(false); TextItem bookInStoreQuantityitem = new TextItem("bookInStoreQuantity", ""); bookInStoreQuantityitem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookInStoreQuantityitem.setShowTitle(false); TextItem bookAvailableQuantityItem = new TextItem("bookAvailableQuantity", ""); bookAvailableQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookAvailableQuantityItem.setShowTitle(false); bookForm2.setFields( bookTotalQuantityItemTitle, bookInStoreQuantityitemTitle, bookAvailableQuantityItemTitle, bookTotalQuantityItem, bookInStoreQuantityitem, bookAvailableQuantityItem); // Form // 3----------------------------------------------------------------------------------------- bookForm3 = new DynamicForm(); bookForm3.setWidth(WINDOW_WIDTH); bookForm3.setCellPadding(3); // bookForm2.setNumCols(2); bookForm3.setTitleOrientation(TitleOrientation.TOP); StaticTextItem bookIntroItemTitle = new StaticTextItem("bookIntroTitle", ""); bookIntroItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_text_title"); bookIntroItemTitle.setShowTitle(false); TextAreaItem bookIntroItem = new TextAreaItem("bookIntro", ""); bookIntroItem.setTextBoxStyle("alex_bookdisplaywindow_form_intro_content"); bookIntroItem.setShowTitle(false); bookIntroItem.setColSpan(2); bookIntroItem.setWidth("100%"); bookForm3.setFields(bookIntroItemTitle, bookIntroItem); // buttonLayout // -------------------------------------------------------------------------------------- buttonLayout = new HLayout(); newButton = new IButton("添加图书"); newButton.setIcon("actions/approve.png"); buttonLayout.setMembers(newButton); buttonLayout.setAlign(Alignment.RIGHT); hLayout.setMembers(imgVLayout, bookForm1); vLayout.setMembers(hLayout, bookForm2, bookForm3, buttonLayout); vLayout.setMembersMargin(20); bookForm1.setValue("bookPublishDate", new Date()); bookForm1.setValue("bookClass", "计算机/网络"); bookForm1.setValue("bookLanguage", "中文"); bookForm1.setValue("bookPrice", "0.00"); bookForm1.setValue("bookContributor", "公司采购"); bookForm2.setValue("bookTotalQuantity", "1"); bookForm2.setValue("bookInStoreQuantity", "1"); bookForm2.setValue("bookAvailableQuantity", "1"); bookForm2.setValue("bookTotalQuantityTitle", "总数"); bookForm2.setValue("bookInStoreQuantityTitle", "库中数量"); bookForm2.setValue("bookAvailableQuantityTitle", "可借数量"); bookForm3.setValue("bookIntroTitle", "简介:"); this.addItem(vLayout); bind(); }
public UserDetailTabPane(DataSource userDS, final ItemListGrid userListGrid) { this.userListGrid = userListGrid; setStyleName("defaultBorder"); userViewer = new DetailViewer(); userViewer.setDataSource(userDS); userViewer.setWidth100(); userViewer.setMargin(25); userViewer.setEmptyMessage("Select an user to view its details"); editorLabel = new Label(); editorLabel.setWidth100(); editorLabel.setHeight100(); editorLabel.setAlign(Alignment.CENTER); editorLabel.setContents("Select an user to edit, or insert a new user into"); insertLabel = new Label(); insertLabel.setWidth100(); insertLabel.setHeight100(); insertLabel.setAlign(Alignment.CENTER); insertLabel.setContents("Insert a new user into"); // update form editorForm = new DynamicForm(); editorForm.setWidth(650); editorForm.setMargin(25); editorForm.setNumCols(4); editorForm.setCellPadding(5); editorForm.setAutoFocus(false); editorForm.setDataSource(userDS); editorForm.setUseAllDataSourceFields(true); userId = new StaticTextItem("userId", "User ID"); userName = new TextItem("userName", "User Name"); password = new PasswordItem("password", "Password"); enabled = new CheckboxItem("enabled", "Enabled"); userName.setRequired(true); password.setRequired(true); ButtonItem saveButton = new ButtonItem("saveUser", "Update user info."); saveButton.setAlign(Alignment.CENTER); saveButton.setWidth(100); saveButton.setColSpan(4); saveButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // editorForm.saveData(); if (userId.getValue() == null) { return; } if (!editorForm.validate(false)) { return; } User user = new User(); user.setUserId((String) userId.getValue()); user.setUserName(userName.getValueAsString()); user.setPassword(password.getValueAsString()); user.setEnabled(enabled.getValueAsBoolean()); userService.updateUser( user, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { SC.say("Error", "Server side error occured. Contact your administrator."); } public void onSuccess(Void noAnswer) { SC.say("Updated", "User info. is updated."); userListGrid.invalidateCache(); } }); } }); editorForm.setFields(userId, userName, password, enabled, saveButton); editorForm.setColWidths(100, 200, 100, 200); // insert form insertForm = new DynamicForm(); insertForm.setWidth(650); insertForm.setMargin(25); insertForm.setNumCols(4); insertForm.setCellPadding(5); insertForm.setAutoFocus(false); insertForm.setDataSource(userDS); insertForm.setUseAllDataSourceFields(true); userId4add = new TextItem("userId", "User ID"); userName4add = new TextItem("userName", "User Name"); password4add = new PasswordItem("password", "Password"); enabled4add = new CheckboxItem("enabled", "Enabled"); enabled4add.setValue(true); userId4add.setRequired(true); userName4add.setRequired(true); password4add.setRequired(true); ButtonItem addButton = new ButtonItem("addUser", "Add user info."); addButton.setAlign(Alignment.CENTER); addButton.setWidth(100); addButton.setColSpan(4); addButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (!insertForm.validate(false)) { return; } User user = new User(); user.setUserId(userId4add.getValueAsString()); user.setUserName(userName4add.getValueAsString()); user.setPassword(password4add.getValueAsString()); user.setEnabled(enabled4add.getValueAsBoolean()); userService.addUser( user, new AsyncCallback<Void>() { public void onFailure(Throwable caught) { SC.say("Error", "Server side error occured. Contact your administrator."); } public void onSuccess(Void noAnswer) { SC.say("Added", "User info. is added."); userListGrid.invalidateCache(); insertForm.clearValues(); } }); } }); insertForm.setFields(userId4add, userName4add, password4add, enabled4add, addButton); insertForm.setColWidths(100, 200, 100, 200); // tab Tab viewTab = new Tab("View"); viewTab.setIcon("silk/application_form.png"); viewTab.setWidth(70); viewTab.setPane(userViewer); Tab editTab = new Tab("Edit"); editTab.setIcon("demoApp/icon_edit.png"); editTab.setWidth(70); editTab.setPane(editorForm); Tab insertTab = new Tab("Add"); insertTab.setIcon("demoApp/icon_add.png"); insertTab.setWidth(70); insertTab.setPane(insertForm); setTabs(viewTab, editTab, insertTab); addTabSelectedHandler( new TabSelectedHandler() { public void onTabSelected(TabSelectedEvent event) { updateDetails(); } }); }
public DeliveryOrderLayout(final User currentUser) { // Tab reviseTab = new Tab("ข้อมูลใบแจ้งหนี้", "icons/16/search-good-icon.png"); // VLayout reviseLayout = new VLayout(); // reviseLayout. setWidth(750); // reviseLayout. setHeight100(); HLayout searchLayout = new HLayout(); searchLayout.setHeight(20); final DynamicForm searchForm = new DynamicForm(); searchForm.setWidth(450); searchForm.setHeight(30); searchForm.setMargin(5); searchForm.setNumCols(4); searchForm.setCellPadding(2); searchForm.setAutoFocus(true); searchForm.setSelectOnFocus(true); searchForm.setIsGroup(true); searchForm.setDataSource(DeliveryDS.getInstance()); searchForm.setUseAllDataSourceFields(false); searchForm.setGroupTitle("ค้นหารายการนำส่งสินค้า"); final TextItem deliveryText = new TextItem("delivery_id", "รหัสรายการนำส่งสินค้า"); deliveryText.setWrapTitle(false); deliveryText.setOperator(OperatorId.REGEXP); final TextItem saleText = new TextItem("sale_id", "รหัสรายการขาย"); saleText.setWrapTitle(false); saleText.setOperator(OperatorId.REGEXP); final SelectItem statusSelected = new SelectItem("issued_status", "สถานะ"); statusSelected.setWrapTitle(false); // statusSelected.setValueMap("กำลังนำส่ง", "นำส่งแล้ว"); statusSelected.setValueMap(DeliveryStatus.getIssueValueMap()); statusSelected.setAllowEmptyValue(true); statusSelected.setEmptyDisplayValue("ทั้งหมด"); statusSelected.setOperator(OperatorId.EQUALS); final TextItem cidText = new TextItem("cid", "รหัสลูกค้า"); cidText.setWrapTitle(false); cidText.setOperator(OperatorId.REGEXP); final DynamicForm dateForm = new DynamicForm(); dateForm.setWidth(300); dateForm.setHeight(30); dateForm.setMargin(5); dateForm.setNumCols(2); dateForm.setCellPadding(2); dateForm.setSelectOnFocus(true); dateForm.setIsGroup(true); // dateForm.setGroupTitle("วันที่นำส่งสินค้า"); dateForm.setGroupTitle("วันที่ออกใบนำส่งสินค้า"); DateRange dateRange = new DateRange(); dateRange.setRelativeStartDate(new RelativeDate("-7d")); dateRange.setRelativeEndDate(RelativeDate.TODAY); // final DateItem from = new DateItem("delivery_from" , "ตั้งแต่"); // final DateItem to = new DateItem("delivery_to" , "ถึง"); final DateItem from = new DateItem("created_from", "ตั้งแต่"); final DateItem to = new DateItem("created_to", "ถึง"); from.setDefaultChooserDate(dateRange.getStartDate()); from.setDefaultValue(dateRange.getStartDate()); from.setUseTextField(true); to.setDefaultChooserDate(dateRange.getEndDate()); to.setDefaultValue(dateRange.getEndDate()); to.setUseTextField(true); FromToValidate.addValidator(from, to); searchForm.setItems(deliveryText, statusSelected, saleText, cidText); // searchForm.setItems(Text, cidText, cnameText); dateForm.setItems(from, to); // final ListGrid deliveryListGrid = new EditorListGrid(new RequestViewWindow(), currentUser); final ListGrid deliveryListGrid = new ListGrid(); deliveryListGrid.setAutoFetchData(true); deliveryListGrid.setCanMultiSort(true); // deliveryListGrid.setCriteria(new Criterion("status", OperatorId.NOT_EQUAL, "ยกเลิก")); deliveryListGrid.setDataSource(DeliveryDS.getInstance()); deliveryListGrid.setInitialSort( new SortSpecifier[] { new SortSpecifier("issued_status", SortDirection.ASCENDING), new SortSpecifier("delivery", SortDirection.DESCENDING) }); deliveryListGrid.setUseAllDataSourceFields(false); deliveryListGrid.setGroupByField("issued_status"); deliveryListGrid.setGroupStartOpen(GroupStartOpen.ALL); ListGridField delivery_id = new ListGridField("delivery_id", 120); ListGridField sale_id = new ListGridField("sale_id", 100); // ListGridField quote_id = new ListGridField("quote_id" , 90); ListGridField cus_name = new ListGridField("cus_name", 180); ListGridField status = new ListGridField("issued_status"); // LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); // valueMap.put("3_approved", "approved"); // status.setValueMap(valueMap); ListGridField total_amount = new ListGridField("total_amount", 120); total_amount.setCellFormatter(FieldFormatter.getIntegerFormat()); total_amount.setAlign(Alignment.RIGHT); // ListGridField netInclusive = new ListGridField("netInclusive", 125); // netInclusive.setCellFormatter(FieldFormatter.getPriceFormat()); // netInclusive.setAlign(Alignment.RIGHT); ListGridField delivery_date = new ListGridField("delivery", 120); // created_date.setType(ListGridFieldType.DATE); // created_date.setCellFormatter(new CellFormatter() { // // @Override // public String format(Object arg0, ListGridRecord arg1, int arg2, int arg3) { // DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy"); // return fmt.format(arg1.getAttributeAsDate("created_date")); // } // }); // ListGridField iconField = new ListGridField("viewDeliveryField", "เรียกดูรายการ", 80); deliveryListGrid.setFields(status, delivery_id, sale_id, cus_name, total_amount, delivery_date); searchLayout.addMembers(searchForm, dateForm); // reviseLayout. addMember(searchLayout); HLayout buttonLayout = new HLayout(); buttonLayout.setMargin(10); buttonLayout.setMembersMargin(5); buttonLayout.setHeight(30); IButton searchButton = new IButton("ค้นหารายการนำส่งสินค้า"); searchButton.setIcon("icons/16/icon_view.png"); searchButton.setWidth(150); searchButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Criterion search = new Criterion(); search.addCriteria(searchForm.getValuesAsCriteria()); AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { // new Criterion("delivery", OperatorId.BETWEEN_INCLUSIVE, // from.getValueAsDate(), to.getValueAsDate()), new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), to.getValueAsDate()), search }); deliveryListGrid.fetchData(criteria); deliveryListGrid.deselectAllRecords(); } }); IButton listAllButton = new IButton("แสดงรายการทั้งหมด"); listAllButton.setIcon("[SKIN]actions/refresh.png"); listAllButton.setWidth(150); listAllButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { // new Criterion("delivery", OperatorId.BETWEEN_INCLUSIVE, // from.getValueAsDate(), to.getValueAsDate()) new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), to.getValueAsDate()) }); searchForm.reset(); deliveryListGrid.fetchData(criteria); deliveryListGrid.deselectAllRecords(); } }); HLayout empty = new HLayout(); empty.setWidth("*"); IButton viewButton = new IButton("เรียกดูรายการ"); viewButton.setIcon("icons/16/icon_view.png"); viewButton.setWidth(150); viewButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { ListGridRecord selected = deliveryListGrid.getSelectedRecord(); if (selected == null) { SC.warn("กรุณาเลือกรายการเบิกสินค้า"); return; } RequestViewWindow deliveryWindow = new RequestViewWindow(); deliveryWindow.show(selected, false, currentUser, 1); } }); IButton receiveOrderButton = new IButton("เบิกจ่ายสินค้า"); receiveOrderButton.setIcon("icons/16/actions-receive-icon.png"); receiveOrderButton.setWidth(100); receiveOrderButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { ListGridRecord selected = deliveryListGrid.getSelectedRecord(); if (selected == null) { SC.warn("กรุณาเลือกรายการเบิกสินค้า"); return; } if (selected .getAttributeAsString("issued_status") .equalsIgnoreCase("0_product_request")) { RequestViewWindow deliveryWindow = new RequestViewWindow(); deliveryWindow.show(selected, true, currentUser, 2); } else { SC.warn("จ่ายสินค้าแล้ว"); } } }); buttonLayout.addMembers(searchButton, listAllButton, empty, viewButton, receiveOrderButton); // buttonLayout.addMembers(searchButton, listAllButton); // reviseLayout. addMember(buttonLayout); VLayout gridLayout = new VLayout(); gridLayout.setWidth100(); gridLayout.setHeight(355); gridLayout.addMember(deliveryListGrid); // reviseLayout. addMember(gridLayout); // reviseTab.setPane(reviseLayout); // return reviseTab; }
public ReferralLayerBlock(Layer<?> referral) { super(referral); this.layer = (VectorLayer) referral; final ChangedHandler filterChangedHandler = new FilterChangedHandler(); dateForm1 = new ReferralDateFilterForm(filterChangedHandler); dateForm2 = new ReferralDateFilterForm(filterChangedHandler); FeatureInfo featureInfo = layer.getLayerInfo().getFeatureInfo(); AssociationAttributeInfo statusInfo = (AssociationAttributeInfo) featureInfo.getAttributesMap().get(KtunaxaConstant.ATTRIBUTE_STATUS); AssociationAttributeInfo agencyTypeInfo = (AssociationAttributeInfo) featureInfo.getAttributesMap().get(KtunaxaConstant.ATTRIBUTE_EXTERNAL_AGENCY_TYPE); AssociationAttributeInfo typeInfo = (AssociationAttributeInfo) featureInfo.getAttributesMap().get(KtunaxaConstant.ATTRIBUTE_TYPE); clearStatus.setStartRow(false); clearStatus.setEndRow(false); clearStatus.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { status.clearValue(); filterChangedHandler.onChanged(null); } }); clearAgency.setStartRow(false); clearAgency.setEndRow(false); clearAgency.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { agency.clearValue(); filterChangedHandler.onChanged(null); } }); clearType.setStartRow(false); clearType.setEndRow(false); clearType.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { type.clearValue(); filterChangedHandler.onChanged(null); } }); form.setWidth100(); status.getItem().setTitle("Status"); status.getItem().addChangedHandler(filterChangedHandler); status.init(statusInfo, new DefaultAttributeProvider(layer, statusInfo.getName())); agency.getItem().setTitle("External Agency Type"); agency.getItem().addChangedHandler(filterChangedHandler); agency.init(agencyTypeInfo, new DefaultAttributeProvider(layer, agencyTypeInfo.getName())); type.getItem().setTitle("Type"); type.getItem().addChangedHandler(filterChangedHandler); type.init(typeInfo, new DefaultAttributeProvider(layer, typeInfo.getName())); form.setNumCols(4); form.setFields( status.getItem(), clearStatus, agency.getItem(), clearAgency, type.getItem(), clearType); addMember(form); addMember(dateForm1); addMember(dateForm2); }
private void initEditWindow() { String strBookName = theBook.getBookName(); this.setAutoSize(true); this.setTitle("《" + strBookName + "》" + "修改信息"); this.setCanDragReposition(true); this.setCanDragResize(false); this.setAutoCenter(true); this.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); VLayout vLayout; HLayout hLayout; HLayout buttonLayout; vLayout = new VLayout(); vLayout.setWidth(WINDOW_WIDTH); vLayout.setHeight(WINDOW_HEIGHT); vLayout.setBorder("2px solid #7598C7"); vLayout.setMargin(12); vLayout.setPadding(14); hLayout = new HLayout(); hLayout.setWidth(WINDOW_WIDTH); // HLayout // --------------------------------------------------------------------------------------- strBookPicUrl = theBook.getBookPicUrl(); imgVLayout = new VLayout(); imgVLayout.setWidth(IMG_WIDTH); bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT); // bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT); // bookPicUrlItem.setPrefix("/images/upload/"); uploadPicButton = new IButton("上传封面"); uploadPicButton.setIcon("actions/plus.png"); uploadPicButton.setWidth(IMG_WIDTH); imgVLayout.setMembers(bookPicUrlItem, uploadPicButton); imgVLayout.setMembersMargin(10); // Form // 1----------------------------------------------------------------------------------------- SLBookDS theDataSource = new SLBookDS(); Record theRecord = theBook.toRecord(); theDataSource.addData(theRecord); bookForm1 = new DynamicForm(); bookForm1.setDataSource(theDataSource); bookForm1.setNumCols(4); bookForm1.setWidth("*"); bookForm1.setColWidths(100, "*", 100, "*"); bookForm1.setCellPadding(5); TextItem bookNameItem = new TextItem("bookName", "书名"); bookNameItem.setColSpan(4); bookNameItem.setWidth("100%"); bookNameItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookNameItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); TextItem bookAuthorItem = new TextItem("bookAuthor", "作者"); bookAuthorItem.setColSpan(4); bookAuthorItem.setWidth("100%"); bookAuthorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookAuthorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); TextItem bookISBNItem = new TextItem("bookISBN", "ISBN"); bookISBNItem.setColSpan(4); bookISBNItem.setWidth("100%"); bookISBNItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookISBNItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookISBNItem.setDisabled(true); TextItem bookPublisherItem = new TextItem("bookPublisher", "出版社"); bookPublisherItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookPublisherItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); DateItem bookPublishDateItem = new DateItem("bookPublishDate", "出版日期"); bookPublishDateItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookPublishDateItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookPublishDateItem.setUseTextField(true); SelectItem bookClassItem = new SelectItem("bookClass", "类别"); bookClassItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookClassItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookClassItem.setValueMap( "计算机/网络", "小说/文学", "哲学/文化", "经济/管理", "政治/军事", "励志/成长", "儿童/育儿", "心理", "法律", "历史", "其他"); bookClassItem.setDefaultToFirstOption(true); SelectItem bookLanguageItem = new SelectItem("bookLanguage", "语言"); bookLanguageItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookLanguageItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookLanguageItem.setValueMap("中文", "英语", "法语", "德语", "日语", "俄语", "韩语"); bookLanguageItem.setDefaultToFirstOption(true); TextItem bookContributorItem = new TextItem("bookContributor", "贡献者"); bookContributorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookContributorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); TextItem bookPriceItem = new TextItem("bookPrice", "价格"); bookPriceItem.setTitleStyle("alex_bookdisplaywindow_form_text_title"); bookPriceItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookForm1.setFields( bookNameItem, bookAuthorItem, bookISBNItem, bookPublisherItem, bookPublishDateItem, bookClassItem, bookLanguageItem, bookContributorItem, bookPriceItem); bookForm1.selectRecord(theRecord); bookForm1.fetchData(); // Form // 2----------------------------------------------------------------------------------------- bookForm2 = new DynamicForm(); bookForm2.setDataSource(theDataSource); bookForm2.setNumCols(3); bookForm2.setWidth(WINDOW_WIDTH); bookForm2.setColWidths("*", "*", "*"); bookForm2.setCellPadding(3); bookForm2.setCellBorder(1); bookForm2.setTitleOrientation(TitleOrientation.TOP); StaticTextItem bookTotalQuantityItemTitle = new StaticTextItem("bookTotalQuantityTitle", ""); bookTotalQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header"); bookTotalQuantityItemTitle.setShowTitle(false); StaticTextItem bookInStoreQuantityitemTitle = new StaticTextItem("bookInStoreQuantityTitle", ""); bookInStoreQuantityitemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header"); bookInStoreQuantityitemTitle.setShowTitle(false); StaticTextItem bookAvailableQuantityItemTitle = new StaticTextItem("bookAvailableQuantityTitle", ""); bookAvailableQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header"); bookAvailableQuantityItemTitle.setShowTitle(false); TextItem bookTotalQuantityItem = new TextItem("bookTotalQuantity", ""); bookTotalQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookTotalQuantityItem.setShowTitle(false); TextItem bookInStoreQuantityitem = new TextItem("bookInStoreQuantity", ""); bookInStoreQuantityitem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookInStoreQuantityitem.setShowTitle(false); TextItem bookAvailableQuantityItem = new TextItem("bookAvailableQuantity", ""); bookAvailableQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content"); bookAvailableQuantityItem.setShowTitle(false); bookForm2.setFields( bookTotalQuantityItemTitle, bookInStoreQuantityitemTitle, bookAvailableQuantityItemTitle, bookTotalQuantityItem, bookInStoreQuantityitem, bookAvailableQuantityItem); bookForm2.selectRecord(theRecord); bookForm2.fetchData(); // Form // 3----------------------------------------------------------------------------------------- bookForm3 = new DynamicForm(); bookForm3.setDataSource(theDataSource); bookForm3.setWidth(WINDOW_WIDTH); bookForm3.setCellPadding(3); // bookForm2.setNumCols(2); bookForm3.setTitleOrientation(TitleOrientation.TOP); StaticTextItem bookIntroItemTitle = new StaticTextItem("bookIntroTitle", ""); bookIntroItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_text_title"); bookIntroItemTitle.setShowTitle(false); TextAreaItem bookIntroItem = new TextAreaItem("bookIntro", ""); bookIntroItem.setTextBoxStyle("alex_bookdisplaywindow_form_intro_content"); bookIntroItem.setShowTitle(false); bookIntroItem.setColSpan(2); bookIntroItem.setWidth("100%"); bookForm3.setFields(bookIntroItemTitle, bookIntroItem); bookForm3.selectRecord(theRecord); bookForm3.fetchData(); // buttonLayout // -------------------------------------------------------------------------------------- buttonLayout = new HLayout(); submitButton = new IButton("提交修改"); submitButton.setIcon("actions/approve.png"); buttonLayout.setMembers(submitButton); buttonLayout.setAlign(Alignment.RIGHT); hLayout.setMembers(imgVLayout, bookForm1); vLayout.setMembers(hLayout, bookForm2, bookForm3, buttonLayout); vLayout.setMembersMargin(20); this.addItem(vLayout); bind(); }
public PZoneChange() { restrictedEdits = DocFlow.user_obj.getZoneConfiguration().getRestricted_edits(); CHARCOUNT = DocFlow.user_obj.getZoneConfiguration().getCharcount(); tsMain = new ToolStrip(); tsMain.setWidth100(); HashMap<String, String> listSqls = new HashMap<String, String>(); listSqls.put("" + ClSelection.T_REGION, "" + ClSelection.T_REGION); listSqls.put("" + ClSelection.T_CUST_TYPE, "" + ClSelection.T_CUST_TYPE); dsZoneDS = DocFlow.getDataSource("ZoneDS"); dsCustomer = DocFlow.getDataSource("CustomerDS"); miSearch = new ToolStripButton("Search"); tiNewZone = new TextItem("newzone", "New Zone"); biSaveData = new ButtonItem("saveData", "Change Zone"); tiNewZone.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { newZoneKeyPressed(event); } }); VLayout vl = new VLayout(); dmCriteria = new DynamicForm(); dmCriteria.setNumCols(4); dmCriteria.setHeight("8%"); dmCriteria.setTitleOrientation(TitleOrientation.TOP); siCustomerType = new SelectItem("custypeid", "Customer Type"); siZones = new SelectItem("zones", "Zones"); siZones.setValueField("zone"); siZones.setAutoFetchData(false); siZones.setDisplayField("zone"); siZones.setOptionDataSource(dsZoneDS); tsMain.setHeight("15"); vl.addMember(tsMain); tsMain.addButton(miSearch); vl.addMember(dmCriteria); lgCustomers = new ListGrid(); lgCustomers.setDataSource(dsCustomer); lgCustomers.setAutoFetchData(false); lgCustomers.setShowResizeBar(false); lgCustomers.setCanDragRecordsOut(true); lgCustomers.setDragDataAction(DragDataAction.COPY); lgCustomers.setHeight100(); lgCustomers.setHeight100(); DataSource dsSelectedData = new DataSource(); dsSelectedData.setClientOnly(true); DataSourceIntegerField dsfcusid = new DataSourceIntegerField("cusid", "Customer ID"); dsfcusid.setPrimaryKey(true); DataSourceTextField dsZone = new DataSourceTextField("zone", "Zone"); dsSelectedData.setFields(dsfcusid, dsZone); lgZoneCustomers = new ListGrid(); lgZoneCustomers.setDataSource(dsSelectedData); lgZoneCustomers.setAutoFetchData(false); lgZoneCustomers.setCanAcceptDroppedRecords(true); lgZoneCustomers.setCanRemoveRecords(true); lgZoneCustomers.setAutoFetchData(false); lgZoneCustomers.setPreventDuplicates(true); lgZoneCustomers.setHeight100(); lgZoneCustomers.setWidth100(); HStack hStack = new HStack(10); hStack.setWidth100(); hStack.setHeight100(); hStack.setShowEdges(true); VStack vStack = new VStack(); vStack.setHeight100(); vStack.setWidth("60%"); vStack.addMember(lgCustomers); hStack.addMember(vStack); TransferImgButton arrowImg = new TransferImgButton(TransferImgButton.RIGHT); arrowImg.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { lgZoneCustomers.transferSelectedData(lgCustomers); } }); TransferImgButton arrowImgLeft = new TransferImgButton(TransferImgButton.LEFT); arrowImgLeft.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { lgZoneCustomers.removeSelectedData(); } }); hStack.addMember(arrowImg); hStack.addMember(arrowImgLeft); VStack vStack2 = new VStack(); vStack2.setHeight100(); vStack2.setWidth("40%"); vStack2.addMember(lgZoneCustomers); hStack.addMember(vStack2); miSearch.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { search(); } }); lgCustomers.addClickHandler( new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {} }); vl.addMember(hStack); this.addMember(vl); DocFlow.docFlowService.getListTypesForDocument( listSqls, -1, new AsyncCallback<HashMap<String, ArrayList<ClSelectionItem>>>() { @Override public void onFailure(Throwable caught) { setResults(null); } @Override public void onSuccess(HashMap<String, ArrayList<ClSelectionItem>> result) { setResults(result); } }); }
public TabBillingComps() { try { setTitle(CallCenterBK.constants.billingComps()); setCanClose(true); billingCompsDS = DataSource.get("BillingCompsDS"); mainLayout = new VLayout(5); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.setMargin(5); searchForm = new DynamicForm(); searchForm.setAutoFocus(true); searchForm.setWidth(830); searchForm.setTitleWidth(250); searchForm.setNumCols(4); mainLayout.addMember(searchForm); billingCompNameItem = new TextItem(); billingCompNameItem.setTitle(CallCenterBK.constants.companyName()); billingCompNameItem.setWidth(250); billingCompNameItem.setName("billingCompNameItem"); phoneIndexItem = new TextItem(); phoneIndexItem.setTitle(CallCenterBK.constants.index()); phoneIndexItem.setWidth(250); phoneIndexItem.setName("phoneIndexItem"); hasCalcItem = new SelectItem(); hasCalcItem.setTitle(CallCenterBK.constants.hasCalculation()); hasCalcItem.setWidth(250); hasCalcItem.setName("hasCalcItem"); hasCalcItem.setDefaultToFirstOption(true); hasCalcItem.setValueMap(ClientMapUtil.getInstance().getHasCalculations()); operatorItem = new SelectItem(); operatorItem.setTitle(CallCenterBK.constants.operator()); operatorItem.setWidth(200); operatorItem.setName("operator_src"); operatorItem.setDefaultToFirstOption(true); ClientUtils.fillCombo( operatorItem, "OperatorsDS", "searchOperators", "operator_src", "operator_src_descr"); searchForm.setFields(billingCompNameItem, phoneIndexItem, hasCalcItem, operatorItem); HLayout buttonLayout = new HLayout(5); buttonLayout.setWidth(830); buttonLayout.setHeight(30); buttonLayout.setAlign(Alignment.RIGHT); clearButton = new IButton(); clearButton.setTitle(CallCenterBK.constants.clear()); findButton = new IButton(); findButton.setTitle(CallCenterBK.constants.find()); buttonLayout.setMembers(findButton, clearButton); mainLayout.addMember(buttonLayout); ToolStrip toolStrip = new ToolStrip(); toolStrip.setWidth100(); toolStrip.setPadding(5); mainLayout.addMember(toolStrip); addBtn = new ToolStripButton(CallCenterBK.constants.add(), "addIcon.png"); addBtn.setLayoutAlign(Alignment.LEFT); addBtn.setWidth(50); toolStrip.addButton(addBtn); editBtn = new ToolStripButton(CallCenterBK.constants.modify(), "editIcon.png"); editBtn.setLayoutAlign(Alignment.LEFT); editBtn.setWidth(50); toolStrip.addButton(editBtn); deleteBtn = new ToolStripButton(CallCenterBK.constants.disable(), "deleteIcon.png"); deleteBtn.setLayoutAlign(Alignment.LEFT); deleteBtn.setWidth(50); toolStrip.addButton(deleteBtn); toolStrip.addSeparator(); billingCompBillByDayBtn = new ToolStripButton(CallCenterBK.constants.telCombBillByDay(), "billing.png"); billingCompBillByDayBtn.setLayoutAlign(Alignment.LEFT); billingCompBillByDayBtn.setWidth(50); toolStrip.addButton(billingCompBillByDayBtn); billingCompBillByMonthBtn = new ToolStripButton(CallCenterBK.constants.telCombBillByMonth(), "billing.png"); billingCompBillByMonthBtn.setLayoutAlign(Alignment.LEFT); billingCompBillByMonthBtn.setWidth(50); toolStrip.addButton(billingCompBillByMonthBtn); billingCompsGrid = new ListGrid(); billingCompsGrid.setWidth100(); billingCompsGrid.setHeight100(); billingCompsGrid.setAlternateRecordStyles(true); billingCompsGrid.setDataSource(billingCompsDS); billingCompsGrid.setAutoFetchData(false); billingCompsGrid.setShowFilterEditor(false); billingCompsGrid.setCanEdit(false); billingCompsGrid.setCanRemoveRecords(false); billingCompsGrid.setFetchOperation("searchAllBillingComps"); billingCompsGrid.setShowRowNumbers(true); billingCompsGrid.setCanHover(true); billingCompsGrid.setShowHover(true); billingCompsGrid.setShowHoverComponents(true); billingCompsGrid.setWrapCells(true); billingCompsGrid.setFixedRecordHeights(false); billingCompsGrid.setCanDragSelectText(true); ListGridField billing_company_name = new ListGridField("billing_company_name", CallCenterBK.constants.companyName()); ListGridField our_percent = new ListGridField("our_percent", CallCenterBK.constants.ourPercent(), 150); ListGridField has_calculation_descr = new ListGridField("has_calculation_descr", CallCenterBK.constants.hasCalculation(), 150); ListGridField call_price = new ListGridField("call_price", CallCenterBK.constants.callPrice(), 150); our_percent.setAlign(Alignment.CENTER); has_calculation_descr.setAlign(Alignment.CENTER); call_price.setAlign(Alignment.CENTER); billingCompsGrid.setFields( billing_company_name, our_percent, has_calculation_descr, call_price); mainLayout.addMember(billingCompsGrid); findButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { search(); } }); billingCompNameItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); phoneIndexItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { search(); } } }); clearButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { billingCompNameItem.clearValue(); } }); addBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { DlgAddEditBillingComps dlgAddEditBillingComp = new DlgAddEditBillingComps(billingCompsGrid, null); dlgAddEditBillingComp.show(); } }); editBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenterBK.constants.pleaseSelrecord()); return; } DlgAddEditBillingComps dlgAddEditBillingComp = new DlgAddEditBillingComps(billingCompsGrid, listGridRecord); dlgAddEditBillingComp.show(); } }); deleteBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenterBK.constants.pleaseSelrecord()); return; } SC.ask( CallCenterBK.constants.askForDisable(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { delete(listGridRecord); } } }); } }); billingCompsGrid.addRecordDoubleClickHandler( new RecordDoubleClickHandler() { @Override public void onRecordDoubleClick(RecordDoubleClickEvent event) { ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); DlgAddEditBillingComps dlgAddEditBillingComp = new DlgAddEditBillingComps(billingCompsGrid, listGridRecord); dlgAddEditBillingComp.show(); } }); billingCompBillByDayBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenterBK.constants.pleaseSelrecord()); return; } Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id"); getBillingCompBillByDay(billing_company_id); } }); billingCompBillByMonthBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenterBK.constants.pleaseSelrecord()); return; } Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id"); getBillingCompBillByMonth(billing_company_id); } }); setPane(mainLayout); } catch (Exception e) { SC.say(e.toString()); } }
public ReportReceiveLayout_2(final User currentUser) { setWidth(950); setHeight100(); HLayout searchLayout = new HLayout(); searchLayout.setHeight(20); final DynamicForm searchForm = new DynamicForm(); searchForm.setWidth(450); searchForm.setHeight(30); searchForm.setMargin(5); searchForm.setNumCols(4); searchForm.setCellPadding(2); searchForm.setAutoFocus(true); searchForm.setSelectOnFocus(true); searchForm.setIsGroup(true); searchForm.setDataSource(TransferDS.getInstance()); searchForm.setUseAllDataSourceFields(false); searchForm.setGroupTitle("ตัวกรอง"); final SelectItem statusSelected = new SelectItem("status", "สถานะ"); statusSelected.setWrapTitle(false); // statusSelected.setValueMap("รอแก้ไข", "รออนุมัติ", "อนุมัติแล้ว"); statusSelected.setValueMap(TransferStatus.getValueMap()); statusSelected.setAllowEmptyValue(true); statusSelected.setEmptyDisplayValue("ทั้งหมด"); statusSelected.setOperator(OperatorId.EQUALS); final TextItem jidText = new TextItem("plan_id", "รหัสแผนการผลิต"); jidText.setWrapTitle(false); jidText.setOperator(OperatorId.REGEXP); // final TextItem smidText = new TextItem("smid", "รหัสช่าง"); // smidText.setWrapTitle(false); // smidText.setOperator(OperatorId.REGEXP); // final DynamicForm dateForm = new DynamicForm(); // dateForm.setWidth(300); // dateForm.setHeight(30); // dateForm.setMargin(5); // dateForm.setNumCols(2); // dateForm.setCellPadding(2); // dateForm.setSelectOnFocus(true); // dateForm.setIsGroup(true); // dateForm.setGroupTitle("วันที่ขอโอนสินค้า"); DateRange dateRange = new DateRange(); dateRange.setRelativeStartDate(new RelativeDate("-1w")); dateRange.setRelativeEndDate(RelativeDate.TODAY); final DateItem from = new DateItem("create_from", "ตั้งแต่"); final DateItem to = new DateItem("create_to", "ถึง"); from.setDefaultChooserDate(dateRange.getStartDate()); from.setDefaultValue(dateRange.getStartDate()); from.setUseTextField(true); to.setDefaultChooserDate(dateRange.getEndDate()); to.setDefaultValue(dateRange.getEndDate()); to.setUseTextField(true); searchForm.setItems(jidText, statusSelected, from, to); // searchForm.setItems(planText, jidText); // dateForm.setItems(from, to); final ListGrid orderListGrid = new ListGrid(); orderListGrid.setAutoFetchData(true); orderListGrid.setCanMultiSort(true); orderListGrid.setShowRowNumbers(true); orderListGrid.setShowGridSummary(true); AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { // new Criterion("status", OperatorId.NOT_EQUAL, "3_to_next_process"), // new Criterion("created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), // to.getValueAsDate()) new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, dateRange.getStartDate(), dateRange.getEndDate()) }); orderListGrid.setCriteria(criteria); orderListGrid.setDataSource(TransferDS.getInstance()); orderListGrid.setInitialSort( new SortSpecifier[] { new SortSpecifier("status", SortDirection.DESCENDING), new SortSpecifier("created_date", SortDirection.DESCENDING) }); orderListGrid.setUseAllDataSourceFields(false); orderListGrid.setSelectionType(SelectionStyle.NONE); ListGridField transfer_id = new ListGridField("transfer_id", 100); transfer_id.setSummaryFunction( new SummaryFunction() { public Object getSummaryValue(Record[] records, ListGridField field) { return records.length + " รายการ"; } }); transfer_id.setShowGridSummary(true); ListGridField status = new ListGridField("status", 120); ListGridField plan_id = new ListGridField("plan_id", 100); ListGridField transfer_by = new ListGridField("transfer_by"); ListGridField transfer_date = new ListGridField("transfer_date", 150); ListGridField total_weight = new ListGridField("total_sent_weight", 120); total_weight.setCellFormatter(FieldFormatter.getNumberFormat()); total_weight.setAlign(Alignment.RIGHT); total_weight.setSummaryFunction(SummaryFunctionType.SUM); total_weight.setShowGridSummary(true); ListGridField total_amount = new ListGridField("total_sent_amount", 120); total_amount.setCellFormatter(FieldFormatter.getNumberFormat()); total_amount.setAlign(Alignment.RIGHT); total_amount.setSummaryFunction(SummaryFunctionType.SUM); total_amount.setShowGridSummary(true); orderListGrid.setFields( transfer_date, transfer_id, status, plan_id, transfer_by, total_weight, total_amount); // orderListGrid.hideField("status"); HLayout buttonLayout = new HLayout(); buttonLayout.setMargin(10); buttonLayout.setMembersMargin(5); buttonLayout.setHeight(30); IButton searchButton = new IButton("ค้นหาคำขอโอนสินค้า"); searchButton.setIcon("icons/16/reports-icon.png"); searchButton.setWidth(170); searchButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Criterion search = new Criterion(); search.addCriteria(searchForm.getValuesAsCriteria()); AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), to.getValueAsDate()), search }); reportDate.setContents( "ตั้งแต่วันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(from.getValueAsDate()) + " ถึงวันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(to.getValueAsDate())); orderListGrid.fetchData(criteria); orderListGrid.deselectAllRecords(); } }); IButton listAllButton = new IButton("ล้างรายการค้นหา"); listAllButton.setIcon("[SKIN]actions/refresh.png"); listAllButton.setWidth(150); listAllButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { AdvancedCriteria criteria = new AdvancedCriteria( OperatorId.AND, new Criterion[] { new Criterion( "created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(), to.getValueAsDate()) }); searchForm.reset(); reportDate.setContents( "ตั้งแต่วันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(from.getValueAsDate()) + " ถึงวันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(to.getValueAsDate())); orderListGrid.fetchData(criteria); orderListGrid.deselectAllRecords(); } }); IButton printButton = new IButton("พิมพ์รายงาน"); printButton.setIcon("icons/16/print.png"); printButton.setWidth(120); buttonLayout.addMembers(searchButton, listAllButton, printButton); searchLayout.addMembers(searchForm); // reviseLayout. addMember(searchLayout); // reviseLayout. addMember(buttonLayout); final VLayout gridLayout = new VLayout(); gridLayout.setWidth100(); gridLayout.setHeight(500); Label text = new Label(); text.setContents("รายงานการโอนสินค้าเข้าคลังสินค้า"); text.setAlign(Alignment.CENTER); text.setHeight(10); text.setStyleName("printTitle"); reportDate = new Label(); reportDate.setContents( "ตั้งแต่วันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(from.getValueAsDate()) + " ถึงวันที่ " + DateTimeFormat.getFormat("d-M-yyyy").format(to.getValueAsDate())); reportDate.setAlign(Alignment.CENTER); reportDate.setHeight(10); reportDate.setStyleName("printDetails"); gridLayout.addMember(text); gridLayout.addMember(reportDate); gridLayout.addMember(orderListGrid); addMember(gridLayout); printButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Canvas.showPrintPreview(gridLayout); } }); }
/** This is the entry point method. */ public void onModuleLoad() { final HelpCanvas help1 = new HelpCanvas("help1"); final HelpCanvas help2 = new HelpCanvas("help2"); HLayout layout = new HLayout(); layout.setMembersMargin(20); final SectionStack sectionStack = new SectionStack(); sectionStack.setVisibilityMode(VisibilityMode.MUTEX); sectionStack.setWidth(800); sectionStack.setHeight(600); SectionStackSection section1 = new SectionStackSection("Settings for Stream Recorder"); section1.setExpanded(true); section1.setResizeable(false); // VLayout layout = new VLayout(25); layout.setAlign(Alignment.CENTER); layout.setMargin(23); layout.setWidth("93%"); final DataSource dataSource = SettingsDS.getInstance(); final DynamicForm form = new DynamicForm(); form.setIsGroup(true); form.setGroupTitle("Update"); form.setNumCols(4); form.setDataSource(dataSource); form.setMargin(1); final ListGrid listGrid = new ListGrid(); listGrid.setWidth100(); listGrid.setHeight(130); listGrid.setDataSource(dataSource); listGrid.setAutoFetchData(true); listGrid.addRecordClickHandler( new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { form.reset(); form.editSelectedData(listGrid); } }); section1.addItem(listGrid); section1.addItem(form); IButton butt = new IButton("Save"); butt.setMargin(2); butt.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { form.saveData(); } }); section1.addItem(butt); Button button = new Button("Hello from Admin"); button.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Services.getHelloService() .hello( "Admin", new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub } @Override public void onSuccess(Void result) { // TODO Auto-generated method stub } }); } }); sectionStack.addSection(section1); SectionStackSection section2 = new SectionStackSection("Help 1"); section2.setExpanded(true); section2.setCanCollapse(true); section2.addItem(help1); sectionStack.addSection(section2); // SectionStackSection section3 = new SectionStackSection("Help 2"); // section3.setExpanded(true); // section3.setCanCollapse(true); // section3.addItem(help2); // sectionStack.addSection(section3); // IButton resizeButton = new IButton("Resize Help 1"); // resizeButton.setWidth(150); // resizeButton.addClickHandler(new ClickHandler() { // public void onClick(ClickEvent event) { // help1.setHeight(200); // } // }); layout.addMember(sectionStack); // VLayout buttons = new VLayout(25); // buttons.setMembersMargin(10); // buttons.addMember(resizeButton); // layout.addMember(buttons); layout.addMember(button); layout.draw(); // RootPanel.get().add(topTabSet); }
public CargaProductoCompra(CompraDetalle compradetalle, final Sgc_capa_web mainWindow) { VLayout layout = new VLayout(10); final DynamicForm form = new DynamicForm(); form.setBackgroundColor("#006633"); form.setBorder("2px"); form.setAutoFocus(true); form.setNumCols(3); form.setWidth(500); Label label = new Label(); label.setBackgroundColor("#99ffcc"); label.setHeight(30); label.setWidth(500); label.setPadding(10); label.setAlign(Alignment.CENTER); label.setValign(VerticalAlignment.CENTER); label.setWrap(false); label.setShowEdges(true); label.setContents( "<div style='color:black;font-size:15'><b>Carga de Productos de la Compra</b></div>"); TextItem codigoText = new TextItem("codigo"); codigoText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}"); codigoText.setTitle("Codigo"); codigoText.setDisabled(true); codigoText.setWrapTitle(false); final TextItem productoText = new TextItem("producto"); productoText.setTitle("Producto"); productoText.setDefaultValue(new Date()); productoText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}"); productoText.setWrapTitle(false); final TextItem cantidadText = new TextItem("cantidad"); cantidadText.setTitle("Cantidad"); cantidadText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}"); cantidadText.setWrapTitle(false); final TextItem preciocompraText = new TextItem("preciocompra"); preciocompraText.setTitle("Precio"); preciocompraText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}"); preciocompraText.setWrapTitle(false); ButtonItem button = new ButtonItem("save", "Aceptar"); button.setStartRow(false); button.setWidth(80); button.setIcon("approve.png"); button.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { CompraDetalleServiceAsync service = GWT.create(CompraDetalleService.class); ServiceDefTarget serviceDef = (ServiceDefTarget) service; serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() + "compradetalleService"); CompraDetalle compradetalle = new CompraDetalle(); compradetalle.setId_producto(Integer.parseInt(form.getValueAsString("producto"))); compradetalle.setCantidad(Integer.parseInt(form.getValueAsString("cantidad"))); compradetalle.setPrecioCompra( Double.parseDouble(form.getValueAsString("preciocompra"))); // compra.setTotalCompra(Integer.parseInt("15000")); if (form.getValueAsString("codigo") != null) { compradetalle.setIdCompDet(Integer.valueOf(form.getValueAsString("codigo"))); } try { service.guardar( compradetalle, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert( "Ocurrio un error: " + caught.getClass().getName() + " " + caught.getMessage()); } @Override public void onSuccess(Void result) { new CargaProductoCompra(mainWindow); } }); } catch (Exception e) { e.printStackTrace(); } } }); if (compradetalle != null) { codigoText.setDefaultValue(String.valueOf(compradetalle.getIdCompDet())); productoText.setDefaultValue(compradetalle.getId_producto()); cantidadText.setDefaultValue(compradetalle.getCantidad()); preciocompraText.setDefaultValue(((Object) compradetalle.getPrecioCompra()).toString()); } form.setFields(codigoText, productoText, cantidadText, preciocompraText, button); layout.addMember(label); layout.addMember(form); mainWindow.showDialog(layout); }
private void initExportButton() { setHeight(30); exportButton.setShowRollOver(false); exportButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/export_32.png"); exportButton.setIconOrientation("right"); final DynamicForm exportForm = new DynamicForm(); exportForm.setNumCols(4); // exportForm.setWidth(300); SelectItem exportTypeItem = new SelectItem("exportType", "Exporteer als"); // exportTypeItem.setWidth(150); exportTypeItem.setDefaultToFirstOption(true); LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); valueMap.put("ooxml", "XLSX (Excel2007+/OOXML)"); valueMap.put("xls", "XLS (Excel97)"); valueMap.put("csv", "CSV (Excel)"); // valueMap.put("xml", "XML"); // valueMap.put("json", "JSON"); exportTypeItem.setValueMap(valueMap); BooleanItem showInWindowItem = new BooleanItem(); showInWindowItem.setName("showInWindow"); showInWindowItem.setTitle("Toon Export in nieuw venster"); showInWindowItem.setAlign(Alignment.LEFT); exportForm.setFields(exportTypeItem, showInWindowItem); exportButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { String exportAs = (String) exportForm.getField("exportType").getValue(); FormItem item = exportForm.getField("showInWindow"); boolean showInWindow = item.getValue() == null ? false : (Boolean) item.getValue(); DSRequest dsRequestProperties = new DSRequest(); // set all fields, also from joined models. If they don't appear in the DS.xml file, // they will be ignored. Adding foreign fields to ds.xml automatically makes them being // exported as well. // (just make sure the query does some joins correctly, as is normal!) String[] f = fields == null ? ds.getFieldNames() : fields; if (hideInvisibleFieldsFromExport) { f = ListGridUtil.getVisibleFields(grid); } dsRequestProperties.setExportFields(f); if (fetchOperation != null) { dsRequestProperties.setOperationId(fetchOperation); } if (criteria != null) { dsRequestProperties.setCriteria(criteria); dsRequestProperties.setTextMatchStyle(TextMatchStyle.EXACT); } if (exportAs.equals("json")) { // JSON exports are server-side only, so use the OperationBinding on the DataSource dsRequestProperties.setOperationId("customJSONExport"); dsRequestProperties.setExportDisplay( showInWindow ? ExportDisplay.WINDOW : ExportDisplay.DOWNLOAD); grid.exportData(dsRequestProperties); } else { // exportAs is either XML or CSV, which we can do with requestProperties dsRequestProperties.setExportAs( (ExportFormat) EnumUtil.getEnum(ExportFormat.values(), exportAs)); dsRequestProperties.setExportDisplay( showInWindow ? ExportDisplay.WINDOW : ExportDisplay.DOWNLOAD); grid.exportData(dsRequestProperties); } } }); addMember(exportButton); addMember(exportForm); }
@Override protected DynamicForm initializeForm(DynamicForm form) { form.setNumCols(4); return form; }
private void initComponents() { HLayout formsHLayout = new HLayout(); formsHLayout.setWidth100(); formsHLayout.setHeight("*"); formsHLayout.setMembersMargin(5); DynamicForm jobNamesForm = new DynamicForm(); jobNamesForm.setWidth100(); jobNamesForm.setHeight100(); jobNamesForm.setGroupTitle("Filter Jobs"); jobNamesForm.setIsGroup(true); jobNamesForm.setTitleOrientation(TitleOrientation.TOP); jobNamesForm.setNumCols(2); jobNamesForm.setValuesManager(valuesManager); jobNamesForm.setDataFetchMode(FetchMode.BASIC); CheckboxItem selectAllJobNamesChkItem = new CheckboxItem(); selectAllJobNamesChkItem.setValue(true); selectAllJobNamesChkItem.setTitle("Select All Jobs"); selectAllJobNamesChkItem.setWidth("*"); selectAllJobNamesChkItem.setName("selectAllJobNames"); selectAllJobNamesChkItem.addChangedHandler( new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { if ((Boolean) event.getValue()) { selectJobNameGrid.setDisabled(true); selectJobNameGrid.setCriterion(null); } else { selectJobNameGrid.setDisabled(false); // selectJobNameGrid.setCriterion(new Criterion().seta); } } }); selectJobNameGrid.setTitle("Select Jobs"); selectJobNameGrid.setWidth(280); selectJobNameGrid.setMultiple(true); selectJobNameGrid.setMultipleAppearance(MultipleAppearance.GRID); selectJobNameGrid.setValueMap("job", "job1", "job2", "Goat", "Marmoset", "Mouse"); selectJobNameGrid.setName("selectedJobNames"); selectJobNameGrid.setCriteriaField("selectedJobNames"); /*selectJobNameGrid.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if(event.getSource().equals(selectJobNameGrid)){ String[] values = selectJobNameGrid.getValues(); valuesManager.setAttribute("selectedJobNames", values, true); } } });*/ executionStartDate.setName("executionStartDate"); executionStartDate.setTitle("Exceution Start Date"); executionStartDate.setRequired(true); executionEndDate.setName("executionEndDate"); executionEndDate.setTitle("Exceution End Date"); executionEndDate.setRequired(true); executionStartTime.setName("executionStartTime"); executionStartTime.setTitle("Exceution Start Time"); executionStartTime.setRequired(true); executionEndTime.setName("executionEndTime"); executionEndTime.setTitle("Exceution End Time"); executionEndTime.setRequired(true); FormItem[] formItems = new FormItem[] { selectAllJobNamesChkItem, selectJobNameGrid, executionStartDate, executionStartTime, executionEndDate, executionEndTime }; jobNamesForm.setDataSource(HistoricalJobMonitorDataSource.getInstance(), formItems); jobNamesForm.setFields(formItems); formsHLayout.addMember(jobNamesForm); addMember(formsHLayout); addMember(searchButton); }
private void refresh() { form.clearValues(); form.clearErrors(false); if (form != null) form.destroy(); if (formsContainer.contains(form)) formsContainer.removeChild(form); form = new DynamicForm(); form.setNumCols(2); form.setTitleOrientation(TitleOrientation.TOP); TextItem include = ItemFactory.newTextItem("include", "include", account.getIncludes()); include.addChangedHandler(changedHandler); TextItem exclude = ItemFactory.newTextItem("exclude", "exclude", account.getExcludes()); exclude.addChangedHandler(changedHandler); TextItem folder = ItemFactory.newTextItem("mailfolder", "mailfolder", account.getMailFolder()); folder.addChangedHandler(changedHandler); SelectItem format = ItemFactory.newSelectItem("format", "format"); LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); map.put("0", I18N.message("multiplefiles")); map.put("1", I18N.message("singleeml")); format.setValueMap(map); format.addChangedHandler(changedHandler); format.setValue(Integer.toString(account.getFormat())); CheckboxItem deleteFomMailbox = new CheckboxItem(); deleteFomMailbox.setName("delete"); deleteFomMailbox.setTitle(I18N.message("deletefrommailbox")); deleteFomMailbox.setRedrawOnChange(true); deleteFomMailbox.setWidth(50); deleteFomMailbox.addChangedHandler(changedHandler); deleteFomMailbox.setValue(account.isDeleteFromMailbox()); final DateItem startDate = ItemFactory.newDateItem("startdate", "earliestdate"); startDate.addChangedHandler(changedHandler); startDate.setValue(account.getStartDate()); startDate.setUseMask(false); startDate.setShowPickerIcon(true); startDate.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE); startDate.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { if ("backspace".equals(event.getKeyName().toLowerCase()) || "delete".equals(event.getKeyName().toLowerCase())) { startDate.clearValue(); startDate.setValue((Date) null); changedHandler.onChanged(null); } else { changedHandler.onChanged(null); } } }); form.setItems(folder, format, include, exclude, startDate, deleteFomMailbox); formsContainer.addMember(form); }
public TabCalendar() { try { setTitle(CallCenter.constants.menuCalendar()); setCanClose(true); datasource = DataSource.get("CalSecDS"); mainLayout = new VLayout(5); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.setMargin(5); searchForm = new DynamicForm(); searchForm.setAutoFocus(true); searchForm.setWidth(780); searchForm.setTitleWidth(300); searchForm.setNumCols(4); mainLayout.addMember(searchForm); calendarStateItem = new ComboBoxItem(); calendarStateItem.setTitle(CallCenter.constants.type()); calendarStateItem.setWidth(300); calendarStateItem.setName("calendar_state_id"); calendarStateItem.setValueMap(ClientMapUtil.getInstance().getCalendarStates()); calendarStateItem.setAddUnknownValues(false); secCalendarTypeItem = new ComboBoxItem(); secCalendarTypeItem.setTitle(CallCenter.constants.moonPhase()); secCalendarTypeItem.setWidth(300); secCalendarTypeItem.setName("calendar_event_id"); secCalendarTypeItem.setValueMap(ClientMapUtil.getInstance().getSecCalendarTypes()); secCalendarTypeItem.setAddUnknownValues(false); calendarDayItem = new DateItem(); calendarDayItem.setTitle(CallCenter.constants.date()); calendarDayItem.setWidth(300); calendarDayItem.setValue(new Date()); calendarDayItem.setName("calendar_day"); calendarDayItem.setHint(CallCenter.constants.choose()); descriptionItem = new TextItem(); descriptionItem.setTitle(CallCenter.constants.description()); descriptionItem.setName("calendar_description"); descriptionItem.setWidth(300); commentItem = new TextItem(); commentItem.setTitle(CallCenter.constants.comment()); commentItem.setName("calendar_comment"); commentItem.setWidth(300); byCalendarDayItem = new CheckboxItem(); byCalendarDayItem.setTitle(CallCenter.constants.searchByDate()); byCalendarDayItem.setWidth(300); byCalendarDayItem.setName("buCalDaySearch"); byCalendarDayItem.setValue(false); searchForm.setFields( calendarStateItem, secCalendarTypeItem, descriptionItem, commentItem, byCalendarDayItem, calendarDayItem); HLayout buttonLayout = new HLayout(5); buttonLayout.setWidth(780); buttonLayout.setHeight(30); buttonLayout.setAlign(Alignment.RIGHT); clearButton = new IButton(); clearButton.setTitle(CallCenter.constants.clear()); findButton = new IButton(); findButton.setTitle(CallCenter.constants.find()); buttonLayout.setMembers(findButton, clearButton); mainLayout.addMember(buttonLayout); ToolStrip toolStrip = new ToolStrip(); toolStrip.setWidth(780); toolStrip.setPadding(5); mainLayout.addMember(toolStrip); addBtn = new ToolStripButton(CallCenter.constants.add(), "addIcon.png"); addBtn.setLayoutAlign(Alignment.LEFT); addBtn.setWidth(50); toolStrip.addButton(addBtn); editBtn = new ToolStripButton(CallCenter.constants.modify(), "editIcon.png"); editBtn.setLayoutAlign(Alignment.LEFT); editBtn.setWidth(50); toolStrip.addButton(editBtn); disableBtn = new ToolStripButton(CallCenter.constants.disable(), "deleteIcon.png"); disableBtn.setLayoutAlign(Alignment.LEFT); disableBtn.setWidth(50); toolStrip.addButton(disableBtn); activateBtn = new ToolStripButton(CallCenter.constants.enable(), "restoreIcon.gif"); activateBtn.setLayoutAlign(Alignment.LEFT); activateBtn.setWidth(50); toolStrip.addButton(activateBtn); toolStrip.addSeparator(); copyBtn = new ToolStripButton(CallCenter.constants.copy(), "copy.png"); copyBtn.setLayoutAlign(Alignment.LEFT); copyBtn.setWidth(50); toolStrip.addButton(copyBtn); listGrid = new ListGrid() { protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) { ListGridRecord countryRecord = (ListGridRecord) record; if (countryRecord == null) { return super.getCellCSSText(record, rowNum, colNum); } Integer deleted = countryRecord.getAttributeAsInt("deleted"); if (deleted != null && !deleted.equals(0)) { return "color:red;"; } else { return super.getCellCSSText(record, rowNum, colNum); } }; }; listGrid.setWidth(780); listGrid.setHeight(260); listGrid.setAlternateRecordStyles(true); listGrid.setDataSource(datasource); listGrid.setAutoFetchData(false); listGrid.setShowFilterEditor(false); listGrid.setCanEdit(false); listGrid.setCanRemoveRecords(false); listGrid.setFetchOperation("searchAllSecularCalendars"); listGrid.setShowRowNumbers(true); listGrid.setCanHover(true); listGrid.setShowHover(true); listGrid.setShowHoverComponents(true); datasource.getField("calendar_day").setTitle(CallCenter.constants.date()); datasource.getField("event").setTitle(CallCenter.constants.moonPhase()); datasource.getField("state").setTitle(CallCenter.constants.type()); datasource.getField("sun_rise").setTitle(CallCenter.constants.order()); datasource.getField("calendar_description").setTitle(CallCenter.constants.description()); datasource.getField("calendar_comment").setTitle(CallCenter.constants.comment()); datasource.getField("rec_date").setTitle(CallCenter.constants.recDate()); datasource.getField("rec_user").setTitle(CallCenter.constants.recUser()); datasource.getField("upd_date").setTitle(CallCenter.constants.updDate()); datasource.getField("upd_user").setTitle(CallCenter.constants.updUser()); ListGridField calendar_day = new ListGridField("calendar_day", CallCenter.constants.date(), 150); ListGridField event = new ListGridField("event", CallCenter.constants.moonPhase(), 150); ListGridField state = new ListGridField("state", CallCenter.constants.type(), 80); ListGridField sun_rise = new ListGridField("sun_rise", CallCenter.constants.sunRise(), 100); ListGridField calendar_description = new ListGridField("calendar_description", CallCenter.constants.description(), 250); calendar_day.setAlign(Alignment.LEFT); event.setAlign(Alignment.LEFT); state.setAlign(Alignment.CENTER); sun_rise.setAlign(Alignment.CENTER); listGrid.setFields(calendar_day, event, state, sun_rise, calendar_description); mainLayout.addMember(listGrid); findButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { search(); } }); clearButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { calendarStateItem.clearValue(); secCalendarTypeItem.clearValue(); calendarDayItem.clearValue(); descriptionItem.clearValue(); commentItem.clearValue(); } }); addBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, null, false); dlgEditSecCalendar.show(); } }); editBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, listGridRecord, false); dlgEditSecCalendar.show(); } }); copyBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, listGridRecord, true); dlgEditSecCalendar.show(); } }); disableBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } Integer deleted = listGridRecord.getAttributeAsInt("deleted"); if (!deleted.equals(0)) { SC.say(CallCenter.constants.recordAlrDisabled()); return; } final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id"); SC.ask( CallCenter.constants.askForDisable(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { changeStatus(calendar_id, 1); } } }); } }); activateBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } Integer deleted = listGridRecord.getAttributeAsInt("deleted"); if (deleted.equals(0)) { SC.say(CallCenter.constants.recordAlrEnabled()); return; } final Integer calendar_id = listGridRecord.getAttributeAsInt("calendar_id"); SC.ask( CallCenter.constants.askForEnable(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { changeStatus(calendar_id, 0); } } }); } }); TabSet tabSet = new TabSet(); tabSet.setWidth(780); Tab tabDetViewer = new Tab(CallCenter.constants.view()); final DetailViewer detailViewer = new DetailViewer(); detailViewer.setDataSource(datasource); detailViewer.setWidth(750); tabDetViewer.setPane(detailViewer); listGrid.addRecordClickHandler( new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { detailViewer.viewSelectedData(listGrid); } }); listGrid.addRecordDoubleClickHandler( new RecordDoubleClickHandler() { @Override public void onRecordDoubleClick(RecordDoubleClickEvent event) { ListGridRecord listGridRecord = listGrid.getSelectedRecord(); if (listGridRecord == null) { SC.say(CallCenter.constants.pleaseSelrecord()); return; } DlgAddEditSecCalendar dlgEditSecCalendar = new DlgAddEditSecCalendar(listGrid, listGridRecord, false); dlgEditSecCalendar.show(); } }); tabSet.setTabs(tabDetViewer); mainLayout.addMember(tabSet); setPane(mainLayout); } catch (Exception e) { e.printStackTrace(); SC.say(e.getMessage().toString()); } }
public SmsQueueWindow(final Integer smsInfoId, String sms, String name) { setTitle(TicketMaster.constants.sms_numbers()); setWidth(600); setHeight(500); setIsModal(true); setShowModalMask(true); setShowMaximizeButton(true); setShowMinimizeButton(false); setShowCloseButton(true); setAutoDraw(true); centerInPage(); VLayout vLayout = new VLayout(); vLayout.setWidth100(); vLayout.setHeight100(); form = new DynamicForm(); form.setPadding(15); form.setWidth100(); form.setNumCols(2); smsField = new StaticTextItem("sms", TicketMaster.constants.sms_sms()); smsField.setValue(sms); smsField.setTitleVAlign(VerticalAlignment.TOP); StaticTextItem nameField = new StaticTextItem("name", TicketMaster.constants.name()); nameField.setValue(name); form.setFields(nameField, smsField); Criteria c = new Criteria(); c.setAttribute("timestamp", new Date().getTime()); c.setAttribute("sms_info_id", smsInfoId); grid = new ListGrid(); grid.setWidth100(); grid.setHeight100(); grid.setDataSource(DataSource.get("SMSBroadcastDS")); grid.setFetchOperation("getNumbers"); grid.setCriteria(c); grid.setAutoFetchData(true); ListGridField sendDateField = new ListGridField("send_date", TicketMaster.constants.sms_sendDate(), 120); sendDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME); ListGridField deliveryDateField = new ListGridField("delivery_date", TicketMaster.constants.sms_deliveryDate(), 120); deliveryDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME); grid.setFields( new ListGridField("id", "ID", 60), new ListGridField("phone_number", TicketMaster.constants.sms_number()), new ListGridField("state", TicketMaster.constants.sms_state()), sendDateField, deliveryDateField); IButton exportBtn = new IButton(TicketMaster.constants.sms_export()); exportBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { com.google.gwt.user.client.Window.open( "./SMSBroadcast/ExportNumbers?sms_info_id=" + smsInfoId, "_self", ""); } }); exportBtn.setIcon("excel.gif"); HLayout bbar = new HLayout(); bbar.setAlign(Alignment.RIGHT); bbar.setMembersMargin(5); bbar.setPadding(5); bbar.addMembers(exportBtn); vLayout.addMembers(form, grid, bbar); addItem(vLayout); }
/** Instantiates a new digital object menu view. */ @Inject public DigitalObjectMenuView(final LangConstants lang, final EventBus eventBus) { this.lang = lang; this.eventBus = eventBus; layout = new VLayout(); layout.setHeight100(); layout.setWidth100(); layout.setOverflow(Overflow.AUTO); relatedGrid = new ListGrid(); relatedGrid.setWidth100(); relatedGrid.setHeight100(); relatedGrid.setShowSortArrow(SortArrow.CORNER); relatedGrid.setShowAllRecords(true); relatedGrid.setAutoFetchData(false); relatedGrid.setCanHover(true); relatedGrid.setCanSort(false); ListGridField field1 = new ListGridField("relation", lang.relation()); field1.setWidth("40%"); ListGridField field2 = new ListGridField("uuid", "PID"); field2.setWidth("*"); relatedGrid.setFields(field1, field2); sectionRelated = new SectionStackSection(); sectionRelated.setID(SECTION_RELATED_ID); sectionRelated.setTitle(lang.referencedBy()); sectionRelated.setResizeable(true); sectionRelated.setItems(relatedGrid); sectionRelated.setExpanded(false); sideNavGrid = new ListGrid() { @Override protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) { final ListGridRecord rollOverRecord = this.getRecord(rowNum); if (rollOverCanvas == null) { rollOverCanvas = new HLayout(); rollOverCanvas.setSnapTo("TR"); rollOverCanvas.setWidth(50); rollOverCanvas.setHeight(22); } if (rollOverCanvas.getChildren().length > 0) { rollOverCanvas.removeChild(rollOverCanvas.getChildren()[0]); } final String lockOwner = rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_OWNER); if (lockOwner != null) { ImgButton lockImg = new ImgButton(); lockImg.setShowDown(false); lockImg.setShowRollOver(false); lockImg.setLayoutAlign(Alignment.CENTER); if ("".equals(lockOwner)) { lockImg.setSrc("icons/16/lock_lock_all.png"); } else if (lockOwner.length() > 0) { lockImg.setSrc("icons/16/lock_lock_all_red.png"); } lockImg.setPrompt(lang.lockInfoButton()); lockImg.setHeight(16); lockImg.setWidth(16); lockImg.addClickHandler( new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) { EditorSC.objectIsLock( lang, new LockInfo( lockOwner, rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_DESCRIPTION), rollOverRecord.getAttributeAsStringArray( Constants.ATTR_TIME_TO_EXP_LOCK))); } }); rollOverCanvas.addChild(lockImg); } return rollOverCanvas; } }; sideNavGrid.setShowSelectionCanvas(false); sideNavGrid.setWidth100(); sideNavGrid.setHeight100(); sideNavGrid.setShowSortArrow(SortArrow.CORNER); sideNavGrid.setShowAllRecords(true); sideNavGrid.setAutoFetchData(true); sideNavGrid.setCanHover(true); sideNavGrid.setHoverOpacity(75); sideNavGrid.setHoverStyle("interactImageHover"); sideNavGrid.setShowRollOverCanvas(true); final DynamicForm form = new DynamicForm(); form.setHeight(1); form.setWidth(60); form.setNumCols(1); selectItem.setWidth(60); selectItem.setShowTitle(false); selectItem.setValueMap(lang.me(), lang.all()); selectItem.setDefaultValue(lang.me()); selectItem.setHoverOpacity(75); selectItem.setHoverStyle("interactImageHover"); selectItem.addItemHoverHandler( new ItemHoverHandler() { @Override public void onItemHover(ItemHoverEvent event) { selectItem.setPrompt( DigitalObjectMenuView.this.lang.showModifiedHint() + selectItem.getValue()); } }); selectItem.addChangedHandler( new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { getUiHandlers().refreshRecentlyModified(); } }); form.setFields(selectItem); form.setTitle("by:"); sectionRecentlyModified = new SectionStackSection(); sectionRecentlyModified.setTitle(lang.recentlyModified()); sectionRecentlyModified.setResizeable(true); sectionRecentlyModified.setItems(sideNavGrid); sectionRecentlyModified.setControls(form); sectionRecentlyModified.setExpanded(true); sectionStack = new SectionStack(); sectionStack.addSection(sectionRelated); sectionStack.addSection(sectionRecentlyModified); sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE); sectionStack.setAnimateSections(true); sectionStack.setWidth100(); sectionStack.setHeight100(); sectionStack.setOverflow(Overflow.HIDDEN); layout.addMember(sectionStack); }
public DlgAddEditTown(ListGrid cityGrid, ListGridRecord cityRecord) { super(); this.lCityRecord = cityRecord; this.cityGrid = cityGrid; setTitle(cityRecord == null ? "ახალი ქალაქის დამატება" : "ქალაქის მოდიფიცირება"); setHeight(310); setWidth(520); setShowMinimizeButton(false); setIsModal(true); setShowModalMask(true); setCanDrag(false); setCanDragReposition(false); setCanDragResize(false); setCanDragScroll(false); centerInPage(); hLayout = new VLayout(5); hLayout.setWidth100(); hLayout.setHeight100(); hLayout.setPadding(10); dynamicForm = new DynamicForm(); dynamicForm.setAutoFocus(true); dynamicForm.setWidth100(); dynamicForm.setTitleWidth(200); dynamicForm.setNumCols(2); hLayout.addMember(dynamicForm); cityNameGeoItem = new TextItem(); cityNameGeoItem.setTitle("დასახელება"); cityNameGeoItem.setWidth(300); cityNameGeoItem.setName("town_name"); cityCodeItem = new TextItem(); cityCodeItem.setTitle("ქალაქის კოდი"); cityCodeItem.setWidth(300); cityCodeItem.setName("town_code"); cityNewCodeItem = new TextItem(); cityNewCodeItem.setTitle("ქალაქის კოდი (ახალი)"); cityNewCodeItem.setWidth(300); cityNewCodeItem.setName("town_new_code"); ofGmtItem = new TextItem(); ofGmtItem.setTitle("დრო"); ofGmtItem.setWidth(300); ofGmtItem.setName("normal_gmt"); ofGmtWinterItem = new TextItem(); ofGmtWinterItem.setTitle("ზამთრის დრო"); ofGmtWinterItem.setWidth(300); ofGmtWinterItem.setName("winter_gmt"); countryItem = new ComboBoxItem(); countryItem.setWidth(300); countryItem.setTitle("ქვეყანა"); countryItem.setName("country_id"); countryItem.setFetchMissingValues(true); countryItem.setFilterLocally(false); countryItem.setAddUnknownValues(false); townTypeItem = new ComboBoxItem(); townTypeItem.setTitle("ქალაქის ტიპი"); townTypeItem.setWidth(300); townTypeItem.setName("townTypeItem"); townTypeItem.setFetchMissingValues(true); townTypeItem.setFilterLocally(false); townTypeItem.setAddUnknownValues(false); DataSource DescriptionsDS = DataSource.get("DescriptionsDS"); townTypeItem.setOptionOperationId("searchDescriptionsOrderById"); townTypeItem.setOptionDataSource(DescriptionsDS); townTypeItem.setValueField("description_id"); townTypeItem.setDisplayField("description"); Criteria criteria = new Criteria(); criteria.setAttribute("description_type_id", "59000"); townTypeItem.setOptionCriteria(criteria); townTypeItem.setAutoFetchData(false); townTypeItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { Criteria criteria = townTypeItem.getOptionCriteria(); if (criteria != null) { String oldAttr = criteria.getAttribute("town_type_id"); if (oldAttr != null) { Object nullO = null; criteria.setAttribute("town_type_id", nullO); } } } }); countryItem.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { Criteria criteria = countryItem.getOptionCriteria(); if (criteria != null) { String oldAttr = criteria.getAttribute("country_id"); if (oldAttr != null) { Object nullO = null; criteria.setAttribute("country_id", nullO); } } } }); isCapitalItem = new ComboBoxItem(); isCapitalItem.setTitle("დედაქალაქი"); isCapitalItem.setWidth(300); isCapitalItem.setName("capital_town"); isCapitalItem.setValueMap(ClientMapUtil.getInstance().getIsCapital()); dynamicForm.setFields( cityNameGeoItem, cityCodeItem, cityNewCodeItem, ofGmtItem, ofGmtWinterItem, countryItem, townTypeItem, isCapitalItem); HLayout hLayoutItem = new HLayout(5); hLayoutItem.setWidth100(); hLayoutItem.setAlign(Alignment.RIGHT); IButton saveItem = new IButton(); saveItem.setTitle("შენახვა"); saveItem.setWidth(100); IButton cancItem = new IButton(); cancItem.setTitle("დახურვა"); cancItem.setWidth(100); hLayoutItem.setMembers(saveItem, cancItem); hLayout.addMember(hLayoutItem); cancItem.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { destroy(); } }); saveItem.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { saveCountry(); } }); addItem(hLayout); fillFields(); }