public Canvas getViewPanel() { VLayout layout = new VLayout(); layout.setMembersMargin(10); final Canvas cubeBin = new Canvas("cubeBin"); cubeBin.setTop(40); cubeBin.setWidth(400); cubeBin.setHeight(300); cubeBin.setShowEdges(true); IButton button = new IButton(); button.setTitle("Create"); button.setIcon("pieces/16/cube_blue.png"); button.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { final Img img = new Img(); img.setLeft(Random.nextInt(340)); img.setTop(Random.nextInt(240)); img.setWidth(48); img.setHeight(48); img.setParentElement(cubeBin); img.setSrc("pieces/48/cube_blue.png"); img.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { img.destroy(); } }); img.draw(); } }); layout.addMember(button); layout.addMember(cubeBin); return layout; }
public Canvas getSearchCanvas() { final VLayout mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.setPadding(5); Label titleBar = new Label(MESSAGES.geometricSearchWidgetFreeDrawingSearchTitle()); titleBar.setBackgroundColor("#E0E9FF"); titleBar.setWidth100(); titleBar.setHeight(20); titleBar.setPadding(5); HLayout geomsButtonBar = new HLayout(); geomsButtonBar.setWidth100(); geomsButtonBar.setAutoHeight(); geomsButtonBar.setMembersMargin(10); HLayout actionsButtonBar = new HLayout(); actionsButtonBar.setWidth100(); actionsButtonBar.setAutoHeight(); actionsButtonBar.setMembersMargin(10); btnPoint = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPoint()); btnPoint.setIcon(WidgetLayout.iconPointCreate); btnPoint.setWidth( btnPoint.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnPoint.setActionType(SelectionType.RADIO); btnPoint.setRadioGroup("drawType"); btnPoint.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onDrawPoint(); } }); btnLine = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingLine()); btnLine.setIcon(WidgetLayout.iconLineCreate); btnLine.setWidth( btnLine.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnLine.setActionType(SelectionType.RADIO); btnLine.setRadioGroup("drawType"); btnLine.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onDrawLine(); } }); btnPolygon = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingPolygon()); btnPolygon.setIcon(WidgetLayout.iconPolygonCreate); btnPolygon.setWidth( btnPolygon.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnPolygon.setActionType(SelectionType.RADIO); btnPolygon.setRadioGroup("drawType"); btnPolygon.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onDrawPolygon(); } }); btnUndo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingUndo()); btnUndo.setIcon(WidgetLayout.iconUndo); btnUndo.setWidth( btnUndo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnUndo.setDisabled(true); btnUndo.setShowDisabledIcon(false); btnUndo.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onUndo(); } }); btnRedo = new IButton(MESSAGES.geometricSearchWidgetFreeDrawingRedo()); btnRedo.setIcon(WidgetLayout.iconRedo); btnRedo.setWidth( btnRedo.getTitle().length() * GsfLayout.buttonFontWidth + GsfLayout.buttonOffset); btnRedo.setDisabled(true); btnRedo.setShowDisabledIcon(false); btnRedo.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { onRedo(); } }); frmBuffer = new DynamicForm(); frmBuffer.setWidth100(); spiBuffer = new SpinnerItem(); spiBuffer.setTitle(MESSAGES.geometricSearchWidgetBufferLabel()); spiBuffer.setDefaultValue(5); spiBuffer.setMin(0); spiBuffer.setWidth(60); spiBuffer.addChangedHandler( new ChangedHandler() { public void onChanged(ChangedEvent event) { updateView(); } }); frmBuffer.setFields(spiBuffer); // ---------------------------------------------------------- geomsButtonBar.addMember(btnPoint); geomsButtonBar.addMember(btnLine); geomsButtonBar.addMember(btnPolygon); actionsButtonBar.addMember(btnUndo); actionsButtonBar.addMember(btnRedo); mainLayout.addMember(titleBar); mainLayout.addMember(geomsButtonBar); mainLayout.addMember(actionsButtonBar); mainLayout.addMember(frmBuffer); return mainLayout; }
public teamsInClass_Team_Widget( final Criteria criteria, final UserDetailsReceivedEvent userDetails) { this.userDetails = userDetails; final TeamModelMessages targetMessages = (TeamModelMessages) GWT.create(TeamModelMessages.class); BoatTypeModelMessages boatTypeMessages = (BoatTypeModelMessages) GWT.create(BoatTypeModelMessages.class); setPadding(10); setIsGroup(true); setGroupTitle( classMessages.richFormView_teamsInClass_coupling_with_Team( targetMessages.tab_name_TeamModel())); // all elements from the target reference, to be picked from to make a connection setWidth100(); setHeight100(); this.grid.setWidth100(); // grid.setHeight(150); //automatically ought to use all the space // grid.setHeight("*"); this.grid.setAlternateRecordStyles(false); this.grid.setCellHeight(32); this.grid.setDataSource(dataSource); this.grid.setAutoFetchData(false); this.grid.setCanEdit(true); this.grid.setModalEditing(true); this.grid.setShowFilterEditor(true); this.grid.setDoubleClickDelay(100); this.grid.setEditEvent(ListGridEditEvent.DOUBLECLICK); this.grid.setListEndEditAction(RowEndEditAction.DONE); this.grid.setCanRemoveRecords(true); this.grid.setAutoSaveEdits(true); this.grid.setCanSelectText(true); this.grid.setAllowFilterExpressions(true); this.grid.setCanDragSelectText(true); this.grid.setCanRemoveRecords( false); // we have our own delete button, with extra functionality /* */ ListGridField idField = new ListGridField("Team_id", "Team id"); ListGridField sailNumberField = new ListGridField("sailNumber", targetMessages.sailNumber()); sailNumberField.setAlign(Alignment.LEFT); sailNumberField = TeamRichTableView.setFormatterForsailNumber(sailNumberField); ListGridField teamNameField = new ListGridField("teamName", targetMessages.teamName()); teamNameField.setAlign(Alignment.LEFT); teamNameField = TeamRichTableView.setFormatterForteamName(teamNameField); ListGridField nameCaptainField = new ListGridField("nameCaptain", targetMessages.nameCaptain()); nameCaptainField.setAlign(Alignment.LEFT); nameCaptainField = TeamRichTableView.setFormatterFornameCaptain(nameCaptainField); ListGridField streetField = new ListGridField("street", targetMessages.street()); streetField.setAlign(Alignment.LEFT); streetField = TeamRichTableView.setFormatterForstreet(streetField); ListGridField zipcodeField = new ListGridField("zipcode", targetMessages.zipcode()); zipcodeField.setAlign(Alignment.LEFT); zipcodeField = TeamRichTableView.setFormatterForzipcode(zipcodeField); ListGridField cityField = new ListGridField("city", targetMessages.city()); cityField.setAlign(Alignment.LEFT); cityField = TeamRichTableView.setFormatterForcity(cityField); ListGridField emailField = new ListGridField("email", targetMessages.email()); emailField.setAlign(Alignment.LEFT); emailField = TeamRichTableView.setFormatterForemail(emailField); ListGridField phoneField = new ListGridField("phone", targetMessages.phone()); phoneField.setAlign(Alignment.LEFT); phoneField = TeamRichTableView.setFormatterForphone(phoneField); ListGridField numPersonsField = new ListGridField("numPersons", targetMessages.numPersons()); numPersonsField.setAlign(Alignment.LEFT); numPersonsField = TeamRichTableView.setFormatterFornumPersons(numPersonsField); ListGridField toerField = new ListGridField("toer", targetMessages.toer()); toerField = TeamRichTableView.setFormatterFortoer(toerField); ListGridField spinField = new ListGridField("spin", targetMessages.spin()); spinField = TeamRichTableView.setFormatterForspin(spinField); ListGridField waitinglistField = new ListGridField("waitinglist", targetMessages.waitinglist()); waitinglistField = TeamRichTableView.setFormatterForwaitinglist(waitinglistField); ListGridField femaleTeamField = new ListGridField("femaleTeam", targetMessages.femaleTeam()); femaleTeamField = TeamRichTableView.setFormatterForfemaleTeam(femaleTeamField); ListGridField remark_Field = new ListGridField("remark_", targetMessages.remark_()); remark_Field.setAlign(Alignment.LEFT); remark_Field = TeamRichTableView.setFormatterForremark_(remark_Field); ListGridField teamStartTimeField = new ListGridField("teamStartTime", targetMessages.teamStartTime()); teamStartTimeField.setAlign(Alignment.LEFT); teamStartTimeField = TeamRichTableView.setFormatterForteamStartTime(teamStartTimeField); teamStartTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME); // call to a custom field, this class should be created customly teamStartTimeField = nl.sytematic.projects.BrioRaceSystem.client.custom.TeamTeamStartTimeCustomFieldFactory .getCustomField(grid, teamStartTimeField, userDetails); ListGridField endTimeField = new ListGridField("endTime", targetMessages.endTime()); endTimeField.setAlign(Alignment.LEFT); endTimeField = TeamRichTableView.setFormatterForendTime(endTimeField); endTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME); ListGridField sailingTimeField = new ListGridField("sailingTime", targetMessages.sailingTime()); sailingTimeField.setAlign(Alignment.LEFT); sailingTimeField = TeamRichTableView.setFormatterForsailingTime(sailingTimeField); sailingTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME); // call to a custom field, this class should be created customly sailingTimeField = nl.sytematic.projects.BrioRaceSystem.client.custom.TeamSailingTimeCustomFieldFactory .getCustomField(grid, sailingTimeField, userDetails); ListGridField swTimeField = new ListGridField("swTime", targetMessages.swTime()); swTimeField.setAlign(Alignment.LEFT); swTimeField = TeamRichTableView.setFormatterForswTime(swTimeField); swTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME); // call to a custom field, this class should be created customly swTimeField = nl.sytematic.projects.BrioRaceSystem.client.custom.TeamSwTimeCustomFieldFactory .getCustomField(grid, swTimeField, userDetails); ListGridField registrationDateTimeField = new ListGridField("registrationDateTime", targetMessages.registrationDateTime()); registrationDateTimeField.setAlign(Alignment.LEFT); registrationDateTimeField = TeamRichTableView.setFormatterForregistrationDateTime(registrationDateTimeField); // registrationDateTimeField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME); DateTimeItem registrationDateTimeEditor = new DateTimeItem(); registrationDateTimeEditor.setUseTextField(true); registrationDateTimeEditor.setUseMask(true); // registrationDateTimeEditor.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME); registrationDateTimeField.setEditorType(registrationDateTimeEditor); // registrationDateTimeField.setFilterEditorType(registrationDateTimeEditor); // call to a custom field, this class should be created customly registrationDateTimeField = nl.sytematic.projects.BrioRaceSystem.client.custom .TeamRegistrationDateTimeCustomFieldFactory.getCustomField( grid, registrationDateTimeField, userDetails); ListGridField payDateField = new ListGridField("payDate", targetMessages.payDate()); payDateField.setAlign(Alignment.LEFT); payDateField = TeamRichTableView.setFormatterForpayDate(payDateField); // payDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE); DateItem payDateEditor = new DateItem(); payDateEditor.setUseTextField(true); payDateEditor.setUseMask(true); // payDateEditor.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE); payDateField.setEditorType(payDateEditor); // payDateField.setFilterEditorType(payDateEditor); ListGridField payOrderField = new ListGridField("payOrder", targetMessages.payOrder()); payOrderField.setAlign(Alignment.LEFT); payOrderField = TeamRichTableView.setFormatterForpayOrder(payOrderField); ListGridField payIdField = new ListGridField("payId", targetMessages.payId()); payIdField.setAlign(Alignment.LEFT); payIdField = TeamRichTableView.setFormatterForpayId(payIdField); ListGridField acceptedField = new ListGridField("accepted", targetMessages.accepted()); acceptedField = TeamRichTableView.setFormatterForaccepted(acceptedField); ListGridField payStatusField = new ListGridField("payStatus", targetMessages.payStatus()); payStatusField.setAlign(Alignment.LEFT); payStatusField = TeamRichTableView.setFormatterForpayStatus(payStatusField); ListGridField BoatTypeField = new ListGridField("BoatType_id", boatTypeMessages.name_single()); ListGridField ClassField = new ListGridField("Class_id", classMessages.name_single()); final SelectItem BoatTypeSelectItem = new SelectItem("BoatType_id", boatTypeMessages.name_single()); BoatTypeSelectItem.setOptionDataSource(DataSource.get("BoatType")); BoatTypeSelectItem.setValueField("BoatType_id"); BoatTypeSelectItem.setAlign(Alignment.LEFT); BoatTypeSelectItem.setTextAlign(Alignment.LEFT); BoatTypeSelectItem.setTitleAlign(Alignment.LEFT); ListGrid BoatTypeListGrid = new ListGrid(); BoatTypeListGrid.setShowFilterEditor(true); BoatTypeListGrid.setFilterOnKeypress(true); SortSpecifier BoatTypeSort = new SortSpecifier("typeName", SortDirection.ASCENDING); SortSpecifier[] BoatTypeSorts = new SortSpecifier[] {BoatTypeSort}; BoatTypeListGrid.setInitialSort(BoatTypeSorts); BoatTypeSelectItem.setDisplayField("typeName"); BoatTypeSelectItem.setAllowEmptyValue(true); BoatTypeSelectItem.setPickListWidth(800); BoatTypeSelectItem.setPickListFields( new ListGridField("typeName", boatTypeMessages.typeName()), new ListGridField("SW_value", boatTypeMessages.SW_value())); BoatTypeSelectItem.setPickListProperties(BoatTypeListGrid); BoatTypeField.setAlign(Alignment.LEFT); BoatTypeField.setEditorType(BoatTypeSelectItem); BoatTypeField.setOptionDataSource(DataSource.get("BoatType")); BoatTypeField.setDisplayField("typeName"); BoatTypeField.setFilterEditorType(BoatTypeSelectItem); // reusing this is okay appareantly ButtonItem newBoatType = new ButtonItem("newBoatType", boatTypeMessages.new_window()); newBoatType.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { BoatTypeNewEntryWindow w = new BoatTypeNewEntryWindow( null, new DSCallback() { @Override public void execute( DSResponse response, Object rawData, DSRequest request) { RecordList rl = response.getDataAsRecordList(); if (rl.getLength() > 0) { Record r = rl.get(0); Log.debug("Record found in callback"); Integer id = r.getAttributeAsInt("BoatType_id"); Log.debug("ID is " + id); BoatTypeSelectItem.setValue(id); // select the just added value } } }); w.show(); w.bringToFront(); } }); final SelectItem ClassSelectItem = new SelectItem("Class_id", classMessages.name_single()); ClassSelectItem.setOptionDataSource(DataSource.get("Class")); ClassSelectItem.setValueField("Class_id"); ClassSelectItem.setAlign(Alignment.LEFT); ClassSelectItem.setTextAlign(Alignment.LEFT); ClassSelectItem.setTitleAlign(Alignment.LEFT); ListGrid ClassListGrid = new ListGrid(); ClassListGrid.setShowFilterEditor(true); ClassListGrid.setFilterOnKeypress(true); SortSpecifier ClassSort = new SortSpecifier("className", SortDirection.ASCENDING); SortSpecifier[] ClassSorts = new SortSpecifier[] {ClassSort}; ClassListGrid.setInitialSort(ClassSorts); ClassSelectItem.setDisplayField("className"); ClassSelectItem.setAllowEmptyValue(true); ClassSelectItem.setPickListWidth(800); ClassSelectItem.setPickListFields( new ListGridField("className", classMessages.className()), new ListGridField("startTime", classMessages.startTime())); ClassSelectItem.setPickListProperties(ClassListGrid); ClassField.setAlign(Alignment.LEFT); ClassField.setEditorType(ClassSelectItem); ClassField.setOptionDataSource(DataSource.get("Class")); ClassField.setDisplayField("className"); ClassField.setFilterEditorType(ClassSelectItem); // reusing this is okay appareantly ButtonItem newClass = new ButtonItem("newClass", classMessages.new_window()); newClass.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { ClassNewEntryWindow w = new ClassNewEntryWindow( null, new DSCallback() { @Override public void execute( DSResponse response, Object rawData, DSRequest request) { RecordList rl = response.getDataAsRecordList(); if (rl.getLength() > 0) { Record r = rl.get(0); Log.debug("Record found in callback"); Integer id = r.getAttributeAsInt("Class_id"); Log.debug("ID is " + id); ClassSelectItem.setValue(id); // select the just added value } } }); w.show(); w.bringToFront(); } }); ListGridField deleteField = new ListGridField("deleteField", "-"); deleteField.setShouldPrint(false); deleteField.setCellIcon( GWT.getHostPageBaseURL() + "images/icons/32/woofunction/remove_32.png"); deleteField.setType(ListGridFieldType.ICON); deleteField.setTitle(""); deleteField.setWidth(32); deleteField.setIconSize(24); deleteField.setCanDragResize(false); deleteField.setCanSort(false); deleteField.setCanEdit(false); deleteField.setCanGroupBy(false); deleteField.setCanFreeze(false); deleteField.setCanFilter(false); deleteField.setCanHide(false); deleteField.setCanReorder(false); this.grid.addRecordClickHandler( new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { ListGridField clicked = event.getField(); final Record r = event.getRecord(); if ("deleteField".equals(clicked.getName())) { SC.confirm( radosMessages.delete_confirm_coupling(), new BooleanCallback() { public void execute(Boolean confirmed) { if (confirmed != null && confirmed) { grid.removeData(r); } else { // Cancel } } }); } } }); ArrayList<ListGridField> fields = new ArrayList<ListGridField>(); fields.add(idField); fields.add(sailNumberField); fields.add(teamNameField); fields.add(nameCaptainField); fields.add(streetField); fields.add(zipcodeField); fields.add(cityField); fields.add(emailField); fields.add(phoneField); fields.add(numPersonsField); fields.add(toerField); fields.add(spinField); fields.add(waitinglistField); fields.add(femaleTeamField); fields.add(remark_Field); fields.add(teamStartTimeField); fields.add(endTimeField); fields.add(sailingTimeField); fields.add(swTimeField); fields.add(registrationDateTimeField); fields.add(payDateField); fields.add(payOrderField); fields.add(payIdField); fields.add(acceptedField); fields.add(payStatusField); fields.add(BoatTypeField); if (userDetails.hasAuthority("CAN_DELETE_TEAM")) { fields.add(deleteField); } ListGridField[] fieldsArr = fields.toArray(new ListGridField[fields.size()]); this.grid.setFields(fieldsArr); this.grid.fetchData(criteria); buttonPanel.setMargin(2); grid.hideField("Team_id"); // newButton.setSize(32); newButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/add_32.png"); newButton.setIconOrientation("right"); newButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Map<String, Object> defaultValues = new HashMap<String, Object>(); defaultValues.put("Class_id", criteria.getAttribute("Class_id")); grid.startEditingNew(defaultValues); } }); buttonPanel.addMember(newButton); /*IButton printButton = new IButton(radosMessages.richTableView_print_button());*/ IButton printButton = new IButton(radosMessages.richTableView_print_button()); printButton.setShowRollOver(false); printButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/printer_32.png"); printButton.setIconOrientation("right"); // Img printButton = new // Img(GWT.getHostPageBaseURL()+"images/icons/32/woofunction/printer_32.png"); // printButton.setSize(32); // printButton.setAltText(radosMessages.richTableView_print_button()); printButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Canvas.showPrintPreview(grid); } }); buttonPanel.addMember(printButton); EmailGridButtonWidget email = new EmailGridButtonWidget(new Canvas[] {grid}); email.setDefaultMessage(targetMessages.name_single() + "overzicht"); email.setDefaultSubject(targetMessages.name_single() + "overzicht"); email.setDefaultFrom(BrioRaceSystemApplicationPanel.getUserdetails().getEmail()); buttonPanel.addMember(email); ExportButtonWidget exportButton = new ExportButtonWidget(grid, dataSource); buttonPanel.addMember(exportButton); buttonPanel.setHeight(30); this.addMember(buttonPanel); this.addMember(grid); handleRights(); }
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); }
public Canvas getViewPanel() { VLayout layout = new VLayout(15); layout.addMember( new Label( "This is a full-screen example - click the \"Show Example\" button to show fullscreen.")); final IButton button = new IButton("Show Example"); button.setWidth(140); button.setIcon("silk/layout_content.png"); button.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Rectangle rect = button.getPageRect(); final Canvas animateOutline = new Canvas(); animateOutline.setBorder("2px solid black"); animateOutline.setTop(rect.getTop()); animateOutline.setLeft(rect.getLeft()); animateOutline.setWidth(rect.getLeft()); animateOutline.setHeight(rect.getHeight()); animateOutline.show(); animateOutline.animateRect( 0, 0, Page.getWidth(), Page.getHeight(), new AnimationCallback() { public void execute(boolean earlyFinish) { animateOutline.hide(); final FullScreenApplication appWindow = new FullScreenApplication(); appWindow.addCloseClickHandler( new CloseClickHandler() { public void onCloseClick(CloseClientEvent event) { animateOutline.setRect(0, 0, Page.getWidth(), Page.getHeight()); animateOutline.show(); appWindow.destroy(); Rectangle targetRect = button.getPageRect(); animateOutline.animateRect( targetRect.getLeft(), targetRect.getTop(), targetRect.getWidth(), targetRect.getHeight(), new AnimationCallback() { public void execute(boolean earlyFinish) { animateOutline.hide(); } }, 500); } }); appWindow.show(); } }, 500); } }); layout.addMember(button); return layout; }
private void build() { final VLayout layout = new VLayout(); layout.setMargin(5); final VStack infraLayout = new VStack(); infraLayout.setHeight(26); final Label infraLabel = new Label("Updating available Infrastructures and Policies"); infraLabel.setIcon("loading.gif"); infraLabel.setHeight(26); infraLabel.setAlign(Alignment.CENTER); infraLayout.addMember(infraLabel); final DynamicForm infraForm = new DynamicForm(); infraForm.setEncoding(Encoding.MULTIPART); infraForm.setMethod(FormMethod.POST); infraForm.setAction(GWT.getModuleBaseURL() + "createnodesource"); infraForm.setTarget("__hiddenFrame"); infraLayout.addMember(infraForm); final Label label = new Label( "A Node Source is a combination of an Infrastructure, which defines how resources" + " will be acquired, and a Policy, that dictates when resources can be acquired."); label.setHeight(40); final HashMap<String, List<FormItem>> allForms = new HashMap<String, List<FormItem>>(); controller.fetchSupportedInfrastructuresAndPolicies( new Runnable() { public void run() { infraSelect = new SelectItem("infra", "Infrastructure"); infraSelect.setRequired(true); policySelect = new SelectItem("policy", "Policy"); policySelect.setRequired(true); infraSelect.setWidth(300); policySelect.setWidth(300); HiddenItem name = new HiddenItem("nsName"); HiddenItem callback = new HiddenItem("nsCallback"); HiddenItem session = new HiddenItem("sessionId"); ArrayList<FormItem> tmpAll = new ArrayList<FormItem>(); tmpAll.add(name); tmpAll.add(callback); tmpAll.add(session); tmpAll.add(infraSelect); LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(); for (PluginDescriptor inf : controller.getModel().getSupportedInfrastructures().values()) { String shortName = inf.getPluginName().substring(inf.getPluginName().lastIndexOf('.') + 1); values.put(inf.getPluginName(), shortName); List<Field> configurableFields = inf.getConfigurableFields(); ArrayList<FormItem> forms = new ArrayList<FormItem>(configurableFields.size()); for (Field f : configurableFields) { FormItem infra = null; if (f.isPassword()) { infra = new PasswordItem(inf.getPluginName() + f.getName(), f.getName()); } else if (f.isFile() || f.isCredential()) { infra = new UploadItem(inf.getPluginName() + f.getName(), f.getName()); if (f.isCredential()) { PickerIcon cred = new PickerIcon( new Picker(Images.instance.key_16().getSafeUri().asString()), new FormItemClickHandler() { @Override public void onFormItemClick(FormItemIconClickEvent event) { CredentialsWindow win = new CredentialsWindow(); win.show(); } }); cred.setPrompt("Create a Credential file"); cred.setWidth(16); cred.setHeight(16); cred.setAttribute("hspace", 6); infra.setIcons(cred); } } else { infra = new TextItem(inf.getPluginName() + f.getName(), f.getName()); } infra.setValue(f.getValue()); infra.setWidth(250); infra.setHint("<nobr>" + f.getDescription() + "</nobr>"); forms.add(infra); tmpAll.add(infra); } allForms.put(inf.getPluginName(), forms); } infraSelect.setValueMap(values); tmpAll.add(new SpacerItem()); values.clear(); tmpAll.add(policySelect); for (PluginDescriptor inf : controller.getModel().getSupportedPolicies().values()) { String shortName = inf.getPluginName().substring(inf.getPluginName().lastIndexOf('.') + 1); values.put(inf.getPluginName(), shortName); List<Field> configurableFields = inf.getConfigurableFields(); ArrayList<FormItem> forms = new ArrayList<FormItem>(configurableFields.size()); for (Field f : configurableFields) { FormItem pol = null; if (f.isPassword()) { pol = new PasswordItem(inf.getPluginName() + f.getName(), f.getName()); } else if (f.isFile() || f.isCredential()) { pol = new UploadItem(inf.getPluginName() + f.getName(), f.getName()); if (f.isCredential()) { PickerIcon cred = new PickerIcon( new Picker(Images.instance.key_16().getSafeUri().asString()), new FormItemClickHandler() { @Override public void onFormItemClick(FormItemIconClickEvent event) { CredentialsWindow win = new CredentialsWindow(); win.show(); } }); cred.setPrompt("Create a Credential file"); cred.setWidth(16); cred.setHeight(16); cred.setAttribute("hspace", 6); pol.setIcons(cred); } } else { pol = new TextItem(inf.getPluginName() + f.getName(), f.getName()); } pol.setValue(f.getValue()); pol.setWidth(250); pol.setHint("<nobr>" + f.getDescription() + "</nobr>"); forms.add(pol); tmpAll.add(pol); } allForms.put(inf.getPluginName(), forms); } policySelect.setValueMap(values); infraSelectChanged = new Runnable() { @Override public void run() { if (policySelect.getValueAsString() == null) { return; } String nsName = infraSelect.getValueAsString(); if (oldInfra != null) { for (FormItem f : allForms.get(oldInfra)) { f.hide(); } } for (FormItem f : allForms.get(nsName)) { f.show(); } if (oldInfra == null) { oldInfra = nsName; policySelectChanged.run(); } else { oldInfra = nsName; } } }; policySelectChanged = new Runnable() { @Override public void run() { if (infraSelect.getValueAsString() == null) { return; } String policy = policySelect.getValueAsString(); if (oldPolicy != null) { for (FormItem f : allForms.get(oldPolicy)) { f.hide(); } } for (FormItem f : allForms.get(policy)) { f.show(); } if (oldPolicy == null) { oldPolicy = policy; infraSelectChanged.run(); } else { oldPolicy = policy; } } }; infraSelect.addChangedHandler( new ChangedHandler() { public void onChanged(ChangedEvent event) { infraSelectChanged.run(); } }); policySelect.addChangedHandler( new ChangedHandler() { public void onChanged(ChangedEvent event) { policySelectChanged.run(); } }); infraForm.setFields(tmpAll.toArray(new FormItem[tmpAll.size()])); infraLabel.hide(); infraForm.show(); for (List<FormItem> li : allForms.values()) { for (FormItem it : li) { it.hide(); } } } }, new Runnable() { @Override public void run() { window.hide(); } }); final TextItem nameItem = new TextItem("nsName", "Name"); DynamicForm nameForm = new DynamicForm(); nameForm.setFields(nameItem); HLayout buttons = new HLayout(); buttons.setWidth100(); buttons.setHeight(22); buttons.setMargin(5); buttons.setAlign(Alignment.RIGHT); buttons.setMembersMargin(5); final IButton okButton = new IButton("Ok"); okButton.setIcon(Images.instance.ok_16().getSafeUri().asString()); okButton.setShowDisabledIcon(false); final IButton cancelButton = new IButton("Cancel"); cancelButton.setIcon(Images.instance.cancel_16().getSafeUri().asString()); cancelButton.setShowDisabledIcon(false); okButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { infraForm.setValue("infra", infraSelect.getValueAsString()); infraForm.setValue("nsName", nameItem.getValueAsString()); infraForm.setValue("policy", policySelect.getValueAsString()); infraForm.setValue("sessionId", LoginModel.getInstance().getSessionId()); infraForm.setCanSubmit(true); /* this smartGWT form looks nice but cannot do callbacks ; * we register a native JS function to the document, send it to * the servlet so that it writes it back when returning * when the browser reads the return value and interprets it as JS, * the callback is called */ infraForm.setValue( "nsCallback", JSUtil.register( new JSUtil.JSCallback() { public void execute(JavaScriptObject obj) { JSONObject js = new JSONObject(obj); if (js.containsKey("result") && js.get("result").isBoolean().booleanValue()) { window.hide(); LogModel.getInstance() .logMessage( "Successfully created nodesource: " + nameItem.getValueAsString()); } else { String msg; if (js.get("errorMessage").isString() != null) { msg = js.get("errorMessage").isString().stringValue(); } else { msg = js.toString(); } label.setContents( "<span style='color:red'>Failed to create Node Source :<br>" + msg + "</span>"); LogModel.getInstance() .logImportantMessage( "Failed to create nodesource " + nameItem.getValueAsString() + ": " + msg); layout.scrollToTop(); } infraLabel.hide(); infraForm.show(); okButton.setDisabled(false); cancelButton.setDisabled(false); } })); infraForm.submitForm(); cancelButton.setDisabled(true); okButton.setDisabled(true); infraLabel.setContents("Node Source creation requested..."); infraLabel.show(); infraForm.hide(); } }); cancelButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { window.hide(); } }); buttons.setMembers(okButton, cancelButton); VLayout scroll = new VLayout(); scroll.setHeight100(); scroll.setWidth100(); scroll.setMembers(infraLayout); scroll.setOverflow(Overflow.AUTO); scroll.setBorder("1px solid #ddd"); scroll.setBackgroundColor("#fafafa"); layout.addMember(label); layout.addMember(nameForm); layout.addMember(scroll); layout.addMember(buttons); int winWidth = com.google.gwt.user.client.Window.getClientWidth() * 80 / 100; int winHeight = com.google.gwt.user.client.Window.getClientHeight() * 80 / 100; winWidth = Math.min(1000, winWidth); winHeight = Math.min(1000, winHeight); this.window = new Window(); this.window.setTitle("Create Node Source"); this.window.setShowMinimizeButton(false); this.window.setIsModal(true); this.window.setShowModalMask(true); this.window.addItem(layout); this.window.setWidth(winWidth); this.window.setHeight(winHeight); this.window.setCanDragResize(true); this.window.setCanDragReposition(true); this.window.centerInPage(); }
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); }
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); } }); }
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; }
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(); }
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(); }