public SearchForm(DataSource userDS) { setDataSource(userDS); setTop(20); setCellPadding(6); setNumCols(7); setStyleName("defaultBorder"); findUser = new ButtonItem("Find"); findUser.setIcon("silk/find.png"); findUser.setWidth(70); findUser.setEndRow(false); TextItem searchWord = new TextItem("searchWord", "Search Word"); searchWord.setEndRow(false); searchWord.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (event.getKeyName().equals("Enter")) { findUser.fireEvent(new ClickEvent(null)); } } }); searchCondition = new ComboBoxItem("searchCondition", "Select"); LinkedHashMap<String, String> data = new LinkedHashMap<String, String>(); data.put("userId", "User ID"); data.put("userName", "User Name"); searchCondition.setValueMap(data); searchCondition.setValue("userId"); setItems(findUser, searchCondition, searchWord); }
public void setDocTypeId(int docType) { this.docTypeId = docType; bashConfirm.setDisabled(docType < 0); bashConfirm.setVisible( DocFlow.hasPermition(PermissionNames.CAN_CONFIRM_BASH) || (docType == 30 && DocFlow.hasPermition(PermissionNames.CAN_CONFIRM_BASH_COEF))); }
private void setResults(HashMap<String, ArrayList<ClSelectionItem>> result) { result = result == null ? new HashMap<String, ArrayList<ClSelectionItem>>() : result; addrComp = new AddressComponent(true, true, result.get("" + ClSelection.T_REGION)); setSelectItems(siCustomerType, result.get("" + ClSelection.T_CUST_TYPE)); addrComp.getSiRegion().setTitle("Region"); addrComp.getSiSubregion().setTitle("Sub Region"); addrComp.getSiCity().setTitle("City"); addrComp.getSiStreet().setTitle("Street"); biSaveData.setStartRow(false); biSaveData.setEndRow(false); FormItem[] items = new FormItem[] { addrComp.getSiRegion(), addrComp.getSiSubregion(), addrComp.getSiCity(), addrComp.getSiStreet(), siZones, siCustomerType, tiNewZone, biSaveData }; dmCriteria.setFields(items); ChangedHandler addressChange = new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { if (event.getItem().equals(addrComp.getSiRegion()) || event.getItem().equals(addrComp.getSiSubregion())) { setZoneValue(); } creteriaChanged(); } }; addrComp.getSiRegion().addChangedHandler(addressChange); addrComp.getSiSubregion().addChangedHandler(addressChange); addrComp.getSiCity().addChangedHandler(addressChange); addrComp.getSiStreet().addChangedHandler(addressChange); Criteria cr = new Criteria(); addZoneCriteria(cr, addrComp.getSiRegion(), "regionid"); cr.addCriteria("uniq", SC.generateID()); siZones.setOptionCriteria(cr); setZoneValue(); biSaveData.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { saveData(); } }); }
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); }
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 void addFindListener(ClickHandler handler) { findUser.addClickHandler(handler); }
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(); }
public void onModuleLoad() { topTabSet = new TabSet(); topTabSet.setTabBarPosition(Side.TOP); topTabSet.setWidth(1024); topTabSet.setHeight(768); topTabSet.setTabBarThickness(50); Tab tTab1 = new Tab("Menu", "assets/mainMenu.png"); Img tImg1 = new Img("pieces/48/pawn_blue.png", 96, 96); topTabSet.addTab(tTab1); Tab lTab1 = new Tab(); lTab1.setIcon("pieces/16/pawn_blue.png", 16); Img lImg1 = new Img("pieces/48/pawn_blue.png", 48, 48); lTab1.setPane(lImg1); HLayout buttons = new HLayout(); buttons.setMembersMargin(15); VLayout vLayout = new VLayout(); vLayout.setMembersMargin(15); vLayout.addMember(topTabSet); vLayout.addMember(buttons); // vLayout.addMember(leftTabSet); vLayout.setHeight("*"); vLayout.draw(); final HLayout hLayout = new HLayout(); hLayout.setWidth100(); hLayout.setHeight100(); hLayout.setLayoutMargin(20); // tree menu TreeGrid tree = new TreeGrid(); tree.setShowConnectors(true); tree.setShowResizeBar(true); Tree dataTree = new Tree(); dataTree.setModelType(TreeModelType.CHILDREN); dataTree.setRoot( new TreeNode( "root", new TreeNode("Aluno"), new TreeNode("Funcionario"), new TreeNode("Contato"), new TreeNode("Veiculo"), new TreeNode("Disciplina"))); tree.setData(dataTree); TreeGridField fieldTree = new TreeGridField("Navegacao"); fieldTree.setCellFormatter( new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { return record.getAttribute("name"); } }); tree.setFields(fieldTree); // layout esquerda SectionStack leftSideLayout = new SectionStack(); leftSideLayout.setWidth(200); leftSideLayout.setShowResizeBar(true); leftSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE); leftSideLayout.setAnimateSections(true); leftSideLayout.setMembers(tree); // UIs final AlunoUI alunoUI = new AlunoUI(); final FuncionarioUI funcionarioUI = new FuncionarioUI(); final ContatoUI contatoUI = new ContatoUI(); final VeiculoUI veiculoUI = new VeiculoUI(); final DisciplinaUI disciplinaUI = new DisciplinaUI(); // layout direita final SectionStack rightSideLayout = new SectionStack(); rightSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE); rightSideLayout.setAnimateSections(true); grid = alunoUI.getGrid(); formBotoes = alunoUI.getFormBotoes(); menuItens = new DynamicForm(); menuItens.setWidth(100); menuItens.setAlign(Alignment.RIGHT); ButtonItem aluno = new ButtonItem("Aluno"); aluno.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { newTabCustomAluno("Aluno"); } }); ButtonItem disc = new ButtonItem("Disciplina"); disc.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { newTabCustomDisciplina("Disciplina"); } }); ButtonItem curso = new ButtonItem("Curso"); curso.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { newTabCustomCurso("Curso"); } }); ButtonItem matric = new ButtonItem("Matricula"); matric.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { newTabCustomMatricula("Matricula"); } }); menuItens.setFields(aluno, disc, curso, matric); rightSideLayout.setMembers(menuItens); rightSideLayout.setWidth(200); // seleciona tree tree.addNodeClickHandler( new NodeClickHandler() { public void onNodeClick(NodeClickEvent event) { String node = event.getNode().getAttribute("name"); if (node.equals("Aluno")) { // rightSideLayout.removeMembers(formBotoes,grid); // Tab tab = new Tab(node); newTabCustomAluno(node); } else { if (node.equals("Disciplina")) { newTabCustomDisciplina(node); } else { if (node.equals("Curso")) { // newTabCustom(node); } else { if (node.equals("Matricula")) { // newTabCustom(node); } else { if (node.equals("Disciplina")) { rightSideLayout.removeMembers(formBotoes, grid); grid = disciplinaUI.getGrid(); formBotoes = disciplinaUI.getFormBotoes(); rightSideLayout.setMembers(formBotoes, grid); } } } } } } }); // hLayout hLayout.addMember(leftSideLayout); hLayout.addMember(rightSideLayout); hLayout.draw(); tTab1.setPane(hLayout); }
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); }
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 DynamicForm buildEditForm() { editForm = new LocatableDynamicForm(extendLocatorId("Editor")); editForm.setMargin(5); editForm.setAutoWidth(); editForm.setNumCols(canEditName() ? 12 : 10); TextItem nameItem = null; if (dashboardContainer.supportsDashboardNameEdit()) { nameItem = new TextItem("name", MSG.common_title_dashboard_name()); nameItem.setValue(storedDashboard.getName()); nameItem.setLength(200); nameItem.setWrapTitle(false); nameItem.addBlurHandler( new BlurHandler() { public void onBlur(BlurEvent blurEvent) { FormItem nameItem = blurEvent.getItem(); String name = (String) nameItem.getValue(); String trimmedName = (name == null) ? "" : name.trim(); if (dashboardContainer.isValidDashboardName(trimmedName)) { storedDashboard.setName(trimmedName); save(); dashboardContainer.updateDashboardNames(); } else { // TODO: i18n Message message = new Message( "There is already a dashboard named '" + trimmedName + "'. Please specify a name that is not already in use.", Message.Severity.Error, EnumSet.of(Message.Option.Transient)); CoreGUI.getMessageCenter().notify(message); nameItem.setValue(storedDashboard.getName()); } } }); } final StaticTextItem numColItem = new StaticTextItem(); numColItem.setTitle(MSG.common_title_columns()); numColItem.setValue(storedDashboard.getColumns()); ButtonItem addColumn = new ButtonItem("addColumn", MSG.common_title_add_column()); addColumn.setAutoFit(true); addColumn.setStartRow(false); addColumn.setEndRow(false); final ButtonItem removeColumn = new ButtonItem("removeColumn", MSG.common_title_remove_column()); removeColumn.setAutoFit(true); removeColumn.setStartRow(false); removeColumn.setEndRow(false); removeColumn.setDisabled(storedDashboard.getColumns() == 1); addColumn.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { portalLayout.addMember(new PortalColumn()); numColItem.setValue(storedDashboard.getColumns() + 1); storedDashboard.setColumns(storedDashboard.getColumns() + 1); removeColumn.setDisabled(storedDashboard.getColumns() == 1); save(); } }); removeColumn.addClickHandler( new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { Canvas[] columns = portalLayout.getMembers(); int numColumns = columns.length; if (numColumns > 0) { PortalColumn lastColumn = (PortalColumn) columns[numColumns - 1]; for (Canvas portletWindow : lastColumn.getMembers()) { storedDashboard.removePortlet(((PortletWindow) portletWindow).getStoredPortlet()); } portalLayout.removeMember(lastColumn); numColItem.setValue(numColumns - 1); storedDashboard.setColumns(storedDashboard.getColumns() - 1); removeColumn.setDisabled(storedDashboard.getColumns() == 1); save(); } } }); // build the menu of valid portlets for this context, sorted by portlet name final Menu addPortletMenu = new LocatableMenu(editForm.extendLocatorId("PortletMenu")); LinkedHashMap<String, String> valueMap; switch (context.getType()) { case SubsystemView: valueMap = PortletFactory.getGlobalPortletMenuMap(); break; case ResourceGroup: valueMap = processPortletNameMapForGroup(this.groupComposite); // In addition to the group-specific portlets, make the global portlets available valueMap.putAll(PortletFactory.getGlobalPortletMenuMap()); break; case Resource: valueMap = processPortletNameMapForResource(this.resourceComposite); // In addition to the resource-specific portlets, make the global portlets available valueMap.putAll(PortletFactory.getGlobalPortletMenuMap()); break; default: throw new IllegalStateException("Unsupported context [" + context + "]"); } for (Iterator<String> i = valueMap.keySet().iterator(); i.hasNext(); ) { String portletKey = i.next(); String portletName = valueMap.get(portletKey); MenuItem menuItem = new MenuItem(portletName); menuItem.setAttribute("portletKey", portletKey); addPortletMenu.addItem(menuItem); } addPortlet = new LocatableIMenuButton( editForm.extendLocatorId("AddPortlet"), MSG.common_title_add_portlet(), addPortletMenu); addPortlet.setIcon("[skin]/images/actions/add.png"); addPortlet.setAutoFit(true); addPortletMenu.addItemClickHandler( new ItemClickHandler() { public void onItemClick(ItemClickEvent itemClickEvent) { String key = itemClickEvent.getItem().getAttribute("portletKey"); String name = itemClickEvent.getItem().getTitle(); addPortlet(key, name); } }); CanvasItem addCanvas = new CanvasItem(); addCanvas.setShowTitle(false); addCanvas.setCanvas(addPortlet); addCanvas.setStartRow(false); addCanvas.setEndRow(false); ColorButtonItem picker = new ColorButtonItem("colorButton", MSG.common_title_background()); picker.setStartRow(false); picker.setEndRow(false); picker.setCurrentColor( storedDashboard.getConfiguration().getSimpleValue(Dashboard.CFG_BACKGROUND, "white")); picker.setColorSelectedHandler( new ColorSelectedHandler() { @Override public void onColorSelected(ColorSelectedEvent event) { String selectedColor = event.getColor(); if (selectedColor != null) { setBackgroundColor(selectedColor); storedDashboard .getConfiguration() .put(new PropertySimple(Dashboard.CFG_BACKGROUND, selectedColor)); save(); } } }); // refresh interval LocatableMenu refreshMenu = new LocatableMenu("AutoRefreshMenu"); refreshMenu.setShowShadow(true); refreshMenu.setShadowDepth(10); refreshMenu.setAutoWidth(); refreshMenu.setHeight(15); ClickHandler menuClick = new ClickHandler() { @Override public void onClick(MenuItemClickEvent event) { String selection = event.getItem().getTitle(); refreshInterval = 0; if (selection != null) { if (selection.equals(STOP)) { refreshInterval = STOP_VALUE; } else if (selection.equals(REFRESH1)) { refreshInterval = REFRESH1_VALUE; } else if (selection.equals(REFRESH5)) { refreshInterval = REFRESH5_VALUE; } else if (selection.equals(REFRESH10)) { refreshInterval = REFRESH10_VALUE; } else { // unable to locate value disable refresh refreshInterval = STOP_VALUE; // } UserSessionManager.getUserPreferences() .setPageRefreshInterval(refreshInterval, new UpdatePortletRefreshCallback()); } } }; String[] refreshIntervals = {STOP, REFRESH1, REFRESH5, REFRESH10}; Integer[] refreshValues = {STOP_VALUE, REFRESH1_VALUE, REFRESH5_VALUE, REFRESH10_VALUE}; refreshMenuMappings = new HashMap<Integer, String>(); refreshMenuItems = new MenuItem[refreshIntervals.length]; int retrievedRefreshInterval = REFRESH1_VALUE; if (null != UserSessionManager.getUserPreferences()) { retrievedRefreshInterval = UserSessionManager.getUserPreferences().getPageRefreshInterval(); } for (int i = 0; i < refreshIntervals.length; i++) { MenuItem item = new MenuItem(refreshIntervals[i], ""); item.addClickHandler(menuClick); refreshMenuMappings.put(refreshValues[i], refreshIntervals[i]); if (retrievedRefreshInterval == refreshValues[i]) { item.setIcon(ImageManager.getAvailabilityIcon(true)); } refreshMenuItems[i] = item; } refreshMenu.setItems(refreshMenuItems); refreshMenuButton = new LocatableIMenuButton( "AutoRefreshButton", MSG.common_title_change_refresh_time(), refreshMenu); refreshMenu.setAutoHeight(); refreshMenuButton.getMenu().setItems(refreshMenuItems); refreshMenuButton.setWidth(140); refreshMenuButton.setShowTitle(true); refreshMenuButton.setTop(0); refreshMenuButton.setIconOrientation("left"); CanvasItem refreshCanvas = new CanvasItem(); refreshCanvas.setShowTitle(false); refreshCanvas.setCanvas(refreshMenuButton); refreshCanvas.setStartRow(false); refreshCanvas.setEndRow(false); if (null != nameItem) { editForm.setItems( nameItem, addCanvas, numColItem, addColumn, removeColumn, picker, refreshCanvas); } else { editForm.setItems(addCanvas, numColItem, addColumn, removeColumn, picker, refreshCanvas); } updateRefreshMenu(); this.refreshMenuButton.markForRedraw(); markForRedraw(); // attempt to initialize editForm.markForRedraw(); markForRedraw(); return editForm; }
public ListaVentas(final Sgc_capa_web mainWindow) { String PATH_IMG = "/sgc_capa_web/images/"; VLayout layout = new VLayout(10); layout.setBackgroundColor("#006633"); final ListGrid facturaGrid = new ListGrid(); facturaGrid.setWidth(500); facturaGrid.setHeight(224); facturaGrid.setShowAllRecords(true); facturaGrid.setAlternateRecordStyles(true); facturaGrid.setShowEdges(true); facturaGrid.setBorder("0px"); facturaGrid.setBodyStyleName("normal"); facturaGrid.setLeaveScrollbarGap(false); facturaGrid.setBackgroundColor("#99ffcc"); /*-Buscar ------------------------------*/ DynamicForm buscarFields = new DynamicForm(); // buscarFields.setBackgroundColor("#99ffcc"); buscarFields.setItemLayout(FormLayoutType.ABSOLUTE); final TextItem codigoText = new TextItem("codigo"); codigoText.setWrapTitle(false); codigoText.setLeft(10); codigoText.setWidth(43); codigoText.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if ("Enter".equals(event.getKeyName())) { /* buscar por el campo correspondiente */ if (codigoText.getValue() != null) { Factura factura = new Factura(); factura.setId(Integer.parseInt(codigoText.getValue().toString())); listar(facturaGrid, factura, "codigo"); } } } }); ButtonItem buscarButton = new ButtonItem("find", ""); buscarButton.setIcon("view.png"); buscarButton.setWidth(50); buscarButton.setLeft(443); buscarButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { /* buscar por el campo correspondiente */ Factura factura = new Factura(); if (codigoText.getValue() != null) factura.setId(Integer.parseInt(codigoText.getValue().toString())); /*if(nombreusuarioText.getValue() != null) cliente.setNombreusuario(nombreusuarioText.getValue().toString());*/ listar(facturaGrid, factura, "nombre"); } }); buscarFields.setFields(codigoText, buscarButton); /*--------------------------------------*/ ListGridField codigoField = new ListGridField("codigo", "Codigo"); ListGridField fechaField = new ListGridField("fecha", "Fecha"); ListGridField numeroField = new ListGridField("numero", "Numero"); ListGridField pendienteField = new ListGridField("pendiente", "Pendiente"); ListGridField saldoField = new ListGridField("saldo", "Saldo"); ListGridField editarField = new ListGridField("edit", "Editar"); ListGridField borrarField = new ListGridField("remove", "Borrar"); codigoField.setAlign(Alignment.CENTER); editarField.setAlign(Alignment.CENTER); borrarField.setAlign(Alignment.CENTER); editarField.setType(ListGridFieldType.IMAGE); borrarField.setType(ListGridFieldType.IMAGE); editarField.setImageURLPrefix(PATH_IMG); borrarField.setImageURLPrefix(PATH_IMG); editarField.setImageURLSuffix(".png"); borrarField.setImageURLSuffix(".png"); facturaGrid.addCellClickHandler( new CellClickHandler() { @Override public void onCellClick(CellClickEvent event) { ListGridRecord record = event.getRecord(); int col = event.getColNum(); if (col > 4) { Factura factura = new Factura(); factura.setId(record.getAttributeAsInt("codigo")); factura.setFecha(record.getAttributeAsDate("fecha")); factura.setNumero(Integer.parseInt(record.getAttribute("numero"))); factura.setPendiente(record.getAttribute("pendiente")); factura.setSaldo(Double.parseDouble(record.getAttribute("saldo"))); if (col == 5) { /* Editar */ new VentaDetalle(factura, mainWindow); } else { /* Borrar */ FacturaServiceAsync service = GWT.create(FacturaService.class); ServiceDefTarget serviceDef = (ServiceDefTarget) service; serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() + "facturaService"); try { service.eliminar( record.getAttributeAsInt("codigo"), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert( "Ocurrio un error y no se puedo eliminar (objeto referenciado)"); // " // + // caught.getClass().getName() + " " + caught.getMessage()) ; } @Override public void onSuccess(Void result) { new ListaVentas(mainWindow); } }); } catch (NumberFormatException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } } }); codigoField.setWidth(50); fechaField.setWidth(180); numeroField.setWidth(50); pendienteField.setWidth(50); saldoField.setWidth(50); facturaGrid.setFields( codigoField, fechaField, numeroField, pendienteField, saldoField, editarField, borrarField); facturaGrid.setCanResizeFields(true); ButtonItem button = new ButtonItem("add", "Agregar"); button.setStartRow(false); button.setWidth(80); button.setIcon("add.png"); button.setAlign(Alignment.CENTER); button.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { new VentaDetalle(mainWindow); } }); listar(facturaGrid, new Factura(), "nombre"); 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>Lista de Ventas</b></div>"); layout.addMember(label); layout.addMember(buscarFields); layout.addMember(facturaGrid); DynamicForm form = new DynamicForm(); // form.setBackgroundColor("#99ffcc"); form.setWidth(300); form.setItems(button); layout.addMember(form); mainWindow.showDialog(layout); }
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 DocumentSearchForm() { instance = this; setTop(20); setCellPadding(6); setNumCols(5); setStyleName("defaultBorder"); setTitleOrientation(TitleOrientation.TOP); findItem = new ButtonItem("Find"); findItem.setIcon("silk/find.png"); findItem.setWidth(70); findItem.setEndRow(false); HashMap<String, String> listSqls = new HashMap<String, String>(); listSqls.put("" + ClSelection.T_REGION, "" + ClSelection.T_REGION); listSqls.put( "" + ClSelection.T_DOC_STATUS, "" + ClSelection.T_DOC_STATUS + "_" + ClSelection.T_LANGUAGE + "_" + DocFlow.language_id); siDocStatus = new SelectItem("siDocStatus", "Doc Status"); diStart = new CurrentTimeItem("diStart", "Start"); diStart.setUseTextField(false); diEnd = new CurrentTimeItem("diEnd", "End"); diEnd.setUseTextField(false); setCurrentDate(); tiUserName = new TextItem("tiUserName", "User Name"); iiZona = new IntegerItem("iiZona", "Zona"); iiCustomer = new IntegerItem("iiCustomer", "Customer"); tiContent = new TextItem("tiContent", "Content"); tiDocId = new IntegerItem("tiDocId", "Doc ID"); tiCancelary = new IntegerItem("tiCancelary", "Cancelary"); 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); } }); findItem.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { search(false); } }); stDocCount = new StaticTextItem("stDocCount", "Result Count"); if (true) { showStatusItem = new ButtonItem("showStatusItem", "Report"); showStatusItem.setStartRow(false); showStatusItem.setEndRow(false); showStatusItem.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Date dtStart = diStart.getValueAsDate(); Date dtEnd = diEnd.getValueAsDate(); int language = DocFlow.language_id; int doctype = docTypeId; long startdate = dtStart.getTime(); long enddate = dtEnd.getTime(); int userid = DocFlow.hasPermition(PermissionNames.VIEW_ALL_DOCUMENTS) ? 0 : DocFlow.user_id; String _url = "reportgenerator.jsp?language=" + language + "&doctype=" + doctype + "&startdate=" + startdate + "&enddate=" + enddate + "&userid=" + userid; ArrayList<String> criterias = createCriteria(); String ret = ""; Document doc = XMLParser.createDocument(); Element rootElem = doc.createElement("DocDef"); doc.appendChild(rootElem); for (String key : criterias) { Element val = doc.createElement("Val"); val.setAttribute("V", key); rootElem.appendChild(val); } ret = doc.toString(); _url += "&xml=" + URL.encode(ret); Window.open( _url, "yourWindowName", "location=yes,resizable=yes,scrollbars=yess,status=yes"); } }); bashConfirm = new ButtonItem("bashConfirm", "Bash Confirm"); bashConfirm.setStartRow(false); bashConfirm.setEndRow(false); bashConfirm.setDisabled(true); bashConfirm.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { WBashConfirmDocuments.showWindow(docTypeId); } }); } }