public void onValueChange(ValueChangeEvent<Boolean> event) { if (event.getSource() == regularRolesBtn) { if (regularRolesBtn.getValue()) { showRoles(REGULAR_ROLES_TYPE); } } else if (event.getSource() == systemRolesBtn) { if (systemRolesBtn.getValue()) { showRoles(SYSTEM_ROLES_TYPE); } } else { if (rolesListBox.getSelectedIndex() >= 0) { ArrayList<String> selectedLogicalRoles = new ArrayList<String>(); for (LogicalRoleInfo logicalRoleInfo : logicalRoles.values()) { if (logicalRoleInfo.checkBox.getValue()) { selectedLogicalRoles.add(logicalRoleInfo.roleName); } } String runtimeRole = rolesListBox.getItemText(rolesListBox.getSelectedIndex()); List<String> originalRoles = masterRoleMap.get(runtimeRole); if (((originalRoles == null) || (originalRoles.size() == 0)) && (selectedLogicalRoles.size() == 0)) { newRoleAssignments.remove(runtimeRole); } else if ((originalRoles != null) && (originalRoles.containsAll(selectedLogicalRoles)) && selectedLogicalRoles.containsAll(originalRoles)) { newRoleAssignments.remove(runtimeRole); } else { newRoleAssignments.put(runtimeRole, selectedLogicalRoles); } } } }
public void edit(RecipeTO pRecipe) { nameTextBox.setText(pRecipe.getName()); nameTextBox.setReadOnly(false); for (int i = 0; i < category.getItemCount(); i++) { if (pRecipe.getCategory().equals(category.getItemText(i))) { category.setSelectedIndex(i); } } for (int i = 0; i < cuisine.getItemCount(); i++) { if (pRecipe.getCuisine().equals(cuisine.getItemText(i))) { cuisine.setSelectedIndex(i); } } for (int i = 0; i < occasion.getItemCount(); i++) { if (pRecipe.getOccasion().equals(occasion.getItemText(i))) { occasion.setSelectedIndex(i); } } for (int i = 0; i < serves.getItemCount(); i++) { if (pRecipe.getServes().equals(serves.getItemText(i))) { serves.setSelectedIndex(i); } } ingredients.setText(pRecipe.getIngredients()); directions.setText(pRecipe.getDirections()); }
private void updateWorkspace() { String name = availableWorkspacesListBox.getItemText(availableWorkspacesListBox.getSelectedIndex()); List<String> selectedModulesList = new ArrayList<String>(selectedModulesListBox.getItemCount()); for (int i = 0; i < selectedModulesListBox.getItemCount(); i++) { selectedModulesList.add(selectedModulesListBox.getItemText(i)); } List<String> availableModuleList = new ArrayList<String>(availableModulesListBox.getItemCount()); for (int i = 0; i < availableModulesListBox.getItemCount(); i++) { availableModuleList.add(availableModulesListBox.getItemText(i)); } availableModuleList.removeAll(selectedModulesList); LoadingPopup.showMessage(constants.LoadingStatuses()); repositoryService.updateWorkspace( name, selectedModulesList.toArray(new String[selectedModulesList.size()]), availableModuleList.toArray(new String[availableModuleList.size()]), new GenericCallback<java.lang.Void>() { public void onSuccess(Void v) { Window.alert(constants.WorkspaceUpdated()); refreshWorkspaceList(); } }); }
@UiHandler("done") public void onDoneClick(ClickEvent event) { // 验证路由工单列表 if (!verifyRouteWorkListInfo()) { Window.alert("产生的路由工单表有误,请检查..."); return; } // 保存路由工单列表 String jobOrderCode = jobOrder.getCode(); int length = previewA.getItemCount(); for (int i = 0; i < length; i++) { ExecuteOrder executeOrder = new ExecuteOrder(); String tempPreviewA = previewA.getItemText(i); // 设备名称,设备编码,板卡编码,端口编码,type String tempPreviewZ = previewZ.getItemText(i); // 设备名称,设备编码,板卡编码,端口编码,type String[] apreivew = tempPreviewA.split(","); // String[] zpreview = tempPreviewZ.split(","); executeOrder.setName(jobOrderCode + "_" + i++); executeOrder.setJobOderCode(jobOrderCode); executeOrder.setAmeCode(apreivew[1]); executeOrder.setAcard(apreivew[2]); // 板卡编码:。。/。。 executeOrder.setAportCode(apreivew[3]); // 端口编码:./././. executeOrder.setZmeCode(zpreview[1]); executeOrder.setZcard(zpreview[2]); executeOrder.setZportCode(zpreview[3]); executeOrder.setType(apreivew[4]); executeOrder.setStatus((short) 1); businessListService.addExecuteOrder(executeOrder, addExecuteOrderCallback); } businessListService.updateJobOrderStatus( jobOrderCode, 2, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert("更新业务工单状态失败!!!"); } @Override public void onSuccess(Void result) {} }); // 已创建路由 // if (businessWorkListManagerTable != null) { businessWorkListManagerTable.updateBusinessWorkList(); if (businessWorkListDetail == null) { this.businessWorkListDetail = businessWorkListManagerTable.getBusinessWorkListDetail(); } } // 更新业务工单详细信息,业务工单的路由工单列表 businessWorkListDetail.setJobOrder(jobOrder); businessListService.getAllExecuteOrderByJobOrder(jobOrder.getCode(), allExecuteOrdersCallBack); this.hide(); }
public void onChange(ChangeEvent event) { Object sender = event.getSource(); if (sender == instances) { updateBosses(); } else if (sender == roles) { addRole(roles.getItemText(roles.getSelectedIndex())); } else if (sender == badges) { addBadge(badges.getItemText(badges.getSelectedIndex())); } }
public String getSelectedTariff() { int selected = tariffListBox.getSelectedIndex(); String temp = tariffListBox.getItemText(selected); temp = temp.substring((temp.indexOf("-") + 1), temp.length() - 2); System.out.println("temp= " + temp); return temp; }
private void copySelected(final ListBox from, final ListBox to) { int selected; while ((selected = from.getSelectedIndex()) != -1) { to.addItem(from.getItemText(selected)); from.removeItem(selected); } }
public void onClick(ClickEvent event) { Widget source = (Widget) event.getSource(); if (source == btnSubmit) { if (currentUser != null) { txtLogin.setValue(currentUser.getUsername()); txtProject.setValue(lbProjects.getItemText(lbProjects.getSelectedIndex())); form.submit(); } } if (source == hlBack) { if (currentUser.getUsertype().equalsIgnoreCase("user")) { History.newItem("userJobList"); } else { if (tab == 0) { History.newItem("adminJobList"); } else { History.newItem("jobList"); } // AdminPage adminPage = new AdminPage(tab); // RootPanel.get("content").add(adminPage); } /*UserHistory userHistory = new UserHistory(); userHistory.history();*/ } }
@Test public void checkSelected() { ListBox listBox = getListBox(); listBox.setSelectedIndex(1); Assert.assertEquals("item 1", listBox.getItemText(listBox.getSelectedIndex())); }
private void fireEventForFolderSelection( final Map<String, String> batchClassesNameMap, final HandlerManager eventBus) { String itemText = batchClassSelectionListBox.getItemText(batchClassSelectionListBox.getSelectedIndex()); if (eventBus != null) { eventBus.fireEvent(new BatchClassChangeEvent(itemText, batchClassesNameMap.get(itemText))); } }
@Override public Map<String, String> getItems() { Map<String, String> items = new HashMap<String, String>(); for (int index = 0; index < listBox.getItemCount(); index++) { items.put(listBox.getItemText(index), listBox.getValue(index)); } return items; }
private String getRoleKey(String name) { for (int i = 0; i < roles.getItemCount(); ++i) { if (roles.getItemText(i).equals(name)) { return roles.getValue(i); } } return null; }
private String getBadgeKey(String name) { for (int i = 0; i < badges.getItemCount(); ++i) { if (badges.getItemText(i).equals(name)) { return badges.getValue(i); } } return null; }
@UiHandler("lstAvailableBindings") void lstAvailableBindingsOnChange(ChangeEvent event) { int index = lstAvailableBindings.getSelectedIndex(); if (index > 0) { ((PortableObjectParameterDefinition) ppd).setBinding(lstAvailableBindings.getItemText(index)); } else { ((PortableObjectParameterDefinition) ppd).setBinding(""); } }
@Test public void checkListBox() { ListBox listBox = getListBox(); Assert.assertEquals(2, listBox.getVisibleItemCount()); Assert.assertEquals(2, listBox.getItemCount()); Assert.assertEquals("item 0", listBox.getItemText(0)); Assert.assertEquals("item 1", listBox.getItemText(1)); }
public String removeSelected() { int idx = listBox.getSelectedIndex(); String value = listBox.getItemText(idx); listBox.removeItem(idx); if (listBox.getItemCount() > 0) { listBox.setSelectedIndex(0); } return value; }
public boolean addItem(String value) { for (int i = 0; i < listBox.getItemCount(); i++) { String item = listBox.getItemText(i); if (item.equals(value)) { return false; } } listBox.addItem(value); return true; }
public void setScheduleType(ScheduleType scheduleType) { int itemCount = scheduleCombo.getItemCount(); for (int i = 0; i < itemCount; i++) { String itemText = scheduleCombo.getItemText(i); if (itemText.equals(scheduleType.toString())) { scheduleCombo.setSelectedIndex(i); } } selectScheduleTypeEditor(scheduleType); }
private List<String> getActiveCBCs() { List<String> _cbcNames = new ArrayList<String>(); for (int i = 0; i < cbcList_.getItemCount(); i++) { if (cbcList_.isItemSelected(i)) { _cbcNames.add(cbcList_.getItemText(i)); } } return _cbcNames; }
/* (non-Javadoc) * @see com.google.gwt.user.client.ui.ClickHandler#onClick(com.google.gwt.user.client.ui.Widget) */ @Override public void onClick(ClickEvent p_event) { if (getTrigger() == null) { return; } if (p_event.getSource() == m_btnNewCondition) { AnCondition condition = ConditionClass.valueOf( m_lstConditionsClass.getItemText(m_lstConditionsClass.getSelectedIndex())) .newCondition(); getTrigger().getConditions().add(condition); refreshConditions(); } else if (p_event.getSource() == m_btnNewAction) { AnAction action = ActionClass.valueOf(m_lstActionsClass.getItemText(m_lstActionsClass.getSelectedIndex())) .newAction(); getTrigger().getActions().add(action); refreshActions(); } }
@UiHandler("lstAvailableBindings") void lstAvailableBindingsOnChange(ChangeEvent event) { int index = lstAvailableBindings.getSelectedIndex(); parameterEditor.setEnabled(index == 0); if (index > 0) { ((PortableFloatParameterDefinition) ppd).setValue(null); ((PortableFloatParameterDefinition) ppd).setBinding(lstAvailableBindings.getItemText(index)); } else { ((PortableFloatParameterDefinition) ppd).setBinding(""); } }
@EventHandler("updateButton") public void updateTaskButton(ClickEvent e) { presenter.updateTask( Long.parseLong(taskIdText.getText()), taskNameText.getText(), taskDescriptionTextArea.getText(), userText.getText(), subTaskStrategyListBox.getItemText(subTaskStrategyListBox.getSelectedIndex()), dueDate.getValue(), taskPriorityListBox.getSelectedIndex()); }
public void fillForm(Member member) { header.setText("Mitglied bearbeiten"); importantDisclosurePanel.setOpen(true); additionalDisclosurePanel.setOpen(true); forenameTextBox.setText(member.getForename()); surnameTextBox.setText(member.getSurname()); barcodeTextBox.setText("" + member.getBarcodeID()); createMemberPanel.remove(barcodeInputPanel); streetTextBox.setText(member.getStreet()); zipcodeTextBox.setText("" + member.getZipcode()); cityTextBox.setText(member.getCity()); birthTextBox1.setSelectedIndex(Integer.parseInt("" + member.getBirthDay())); birthTextBox2.setSelectedIndex(Integer.parseInt("" + member.getBirthMonth())); int temp = Integer.parseInt("" + (member.getBirthYear())) - 2009; birthTextBox3.setSelectedIndex(-temp); phoneTextBox.setText(member.getPhone()); // TODO for (int i = 0; i < beltsizeListBox.getItemCount(); i++) { if (beltsizeListBox.getItemText(i).equals(member.getBeltsize())) { beltsizeListBox.setSelectedIndex(i); } } // beltsizeListBox.setSelectedIndex(i); // beltsizeTextBox.setText(member.getBeltsize()); mobilephoneTextBox.setText(member.getMobilephone()); faxTextBox.setText(member.getFax()); emailTextBox.setText(member.getEmail()); homepageTextBox.setText(member.getHomepage()); diseasesTextBox.setText(member.getDiseases()); noteTextBox.setText(member.getNote()); imageUrl = member.getPicture(); if (member.getAccountForename().equals(member.getForename())) { accountOwnerForenameTextBox.setText(constants.likeAbove()); accountOwnerForenameTextBox.setReadOnly(true); likeAbove.setValue(true); } else { accountOwnerForenameTextBox.setText(member.getAccountForename()); } if (member.getAccountSurname().equals(member.getSurname())) { accountOwnerSurnameTextBox.setText(constants.likeAbove()); accountOwnerSurnameTextBox.setReadOnly(true); likeAbove2.setValue(true); } else { accountOwnerSurnameTextBox.setText(member.getAccountSurname()); } accountNumberTextBox.setText(member.getAccountNumber()); bankNameTextBox.setText(member.getBankName()); bankNumberTextBox.setText(member.getBankNumber()); }
@Override public void userOnlineStatusChanged(int userId, boolean online) { if (online) { usersOnline.addItem(String.valueOf(userId)); } else { for (int i = 0; i < usersOnline.getItemCount(); ++i) { if (usersOnline.getItemText(i).equals(String.valueOf(userId))) { usersOnline.removeItem(i); } } } }
private void removeWorkspace() { String name = availableWorkspacesListBox.getItemText(availableWorkspacesListBox.getSelectedIndex()); repositoryService.removeWorkspace( name, new GenericCallback<java.lang.Void>() { public void onSuccess(Void v) { Window.alert(constants.WorkspaceRemoved()); refreshWorkspaceList(); } }); }
// 对路由工单预览列表进行检查 private boolean verifyRouteWorkListInfo() { if (previewA.getItemCount() != previewZ.getItemCount()) { return false; } int length = previewA.getItemCount(); String zDevice = previewZ.getItemText(0); for (int i = 1; i < length; i++) { String tempPreviewA = previewA.getItemText(i); String tempPreviewZ = previewZ.getItemText(i); if (!tempPreviewA.split(",")[4].equals(tempPreviewZ.split(",")[4])) { Window.alert("工单类型有误!!!"); return false; } if (!tempPreviewA.equals(zDevice)) { return false; } zDevice = tempPreviewZ; } // if (!zDevice.equals(routeZName.getText())) { // return false; // } return true; }
public void onChange(ChangeEvent event) { int selectedIndex = rolesListBox.getSelectedIndex(); if (selectedIndex >= 0) { String roleName = rolesListBox.getItemText(selectedIndex); List<String> logicalRoleAssignments = newRoleAssignments.get(roleName); if (logicalRoleAssignments == null) { logicalRoleAssignments = masterRoleMap.get(roleName); } for (LogicalRoleInfo logicalRoleInfo : logicalRoles.values()) { logicalRoleInfo.checkBox.setValue( (logicalRoleAssignments != null) && logicalRoleAssignments.contains(logicalRoleInfo.roleName)); } } }
@Override public void deleteItem(String label) { if (label != null) { items.remove(label); int size = 0; do { size = listBox.getItemCount(); for (int index = 0; index < listBox.getItemCount(); index++) { if (listBox.getItemText(index).equals(label)) { listBox.removeItem(index); break; } } } while (size != listBox.getItemCount()); } }
/** * Select a given item in the drop-down * * @param operator The DRL operator, not the HumanReadable form */ public void selectItem(String operator) { String currentOperator = box.getValue(box.getSelectedIndex()); if (currentOperator.equals(operator)) { return; } for (int i = 0; i < box.getItemCount(); i++) { String op = box.getValue(i); if (op.equals(operator)) { box.setSelectedIndex(i); break; } } String selected = box.getValue(box.getSelectedIndex()); String selectedText = box.getItemText(box.getSelectedIndex()); OperatorSelection selection = new OperatorSelection(selected, selectedText); operatorChanged(selection); }
private void clearCurrentSelection(FlexTable table, int row, int col) { if (row == curRow && col == curCol) return; if (curCol == 3 || curCol == 4) { Widget w = table.getWidget(curRow, curCol); if (w instanceof TextBox) { TextBox t = (TextBox) w; updateField(table, curRow, curCol, t); table.setText(curRow, curCol, t.getText()); } } else if (curCol == 2) { Widget w = table.getWidget(curRow, curCol); if (w instanceof ListBox) { ListBox l = (ListBox) w; updateField(table, curRow, curCol, l); table.setText(curRow, curCol, l.getItemText(l.getSelectedIndex())); } } curRow = -1; curCol = -1; }