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();
          }
        });
  }
 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 adjustListBox(boolean value) {
   applications.setEnabled(value);
   regions.setEnabled(value);
   if (!value) {
     for (int index = 0; index < applications.getItemCount(); index++) {
       applications.setItemSelected(index, false);
     }
     for (int index = 0; index < regions.getItemCount(); index++) {
       regions.setItemSelected(index, false);
     }
   }
 }
 public List<Integer> getSelectedApplicationIds() {
   if (applications.getItemCount() == 0) {
     return group.getApplicationIds();
   }
   List<Integer> result = new ArrayList<Integer>(applications.getItemCount());
   for (int index = 0; index < applications.getItemCount(); index++) {
     if (applications.isItemSelected(index)) {
       int id = Integer.parseInt(applications.getValue(index));
       result.add(id);
     }
   }
   return result;
 }
 public List<Integer> getSelectedRegionIds() {
   GWT.log("get selected region ids");
   if (regions.getItemCount() == 0) {
     return group.getApplicationIds();
   }
   List<Integer> result = new ArrayList<Integer>(regions.getItemCount());
   for (int index = 0; index < regions.getItemCount(); index++) {
     if (regions.isItemSelected(index)) {
       int id = Integer.parseInt(regions.getValue(index));
       result.add(id);
     }
   }
   GWT.log("get selected region ids" + result);
   return result;
 }
  public WorkItemFloatParameterWidget(
      PortableFloatParameterDefinition ppd, IBindingProvider bindingProvider, boolean isReadOnly) {
    super(ppd, bindingProvider);
    this.parameterName.setText(ppd.getName());
    this.parameterEditor.setEnabled(!isReadOnly);

    // Setup widget to select a literal value
    if (ppd.getValue() != null) {
      this.parameterEditor.setText(Float.toString(ppd.getValue()));
    }

    // Setup widget to use bindings
    Set<String> bindings = bindingProvider.getBindings(ppd.getClassName());
    if (bindings.size() > 0) {
      lstAvailableBindings.clear();
      lstAvailableBindings.addItem(CommonConstants.INSTANCE.Choose());
      lstAvailableBindings.setEnabled(true && !isReadOnly);
      lstAvailableBindings.setVisible(true);
      int selectedIndex = 0;
      for (String binding : bindings) {
        lstAvailableBindings.addItem(binding);
        if (binding.equals(ppd.getBinding())) {
          selectedIndex = lstAvailableBindings.getItemCount() - 1;
        }
      }
      lstAvailableBindings.setSelectedIndex(selectedIndex);
      parameterEditor.setEnabled(selectedIndex == 0 && !isReadOnly);
    }
  }
 public List<Developper> getValues() {
   final List<Developper> developpers = new ArrayList<Developper>();
   for (int i = 0; i < listbox2.getItemCount(); i++) {
     developpers.add(developpersInProject.get(i));
   }
   return developpers;
 }
 @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());
   }
 }
 @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;
 }
Example #10
0
 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;
 }
Example #11
0
 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 void setValueType(VariableDto variableDto) {
   for (int i = 0; i < valueType.getItemCount(); i++) {
     valueType.setItemSelected(i, valueType.getValue(i).equals(variableDto.getValueType()));
   }
   if (valueType.getSelectedIndex() == -1) {
     valueType.setSelectedIndex(0);
   }
 }
Example #13
0
  @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));
  }
 private boolean hasMultiselection(ListBox listBox) {
   ArrayList<Integer> selectedIndices = new ArrayList<Integer>();
   for (int i = 0; i < listBox.getItemCount(); i++) {
     if (listBox.isItemSelected(i)) {
       selectedIndices.add(i);
     }
   }
   return selectedIndices.size() > 1;
 }
  /**
   * Set selected by value.
   *
   * @param selectedValue the selected value.
   */
  private void setSelectedByValue(final String selectedValue) {
    for (int i = 0; i < streamOptions.getItemCount(); i++) {
      if (streamOptions.getValue(i).equals(selectedValue)) {
        streamOptions.setSelectedIndex(i);
      }
    }

    scopes.setVisible(hasStreamScopes(selectedValue));
  }
 private List<Integer> getSelection() {
   List<Integer> selectedValues = new ArrayList<Integer>();
   for (int i = 0, l = listBox.getItemCount(); i < l; i++) {
     if (listBox.isItemSelected(i)) {
       selectedValues.add(i);
     }
   }
   return selectedValues;
 }
Example #17
0
  @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();
  }
Example #18
0
 public void setValue(Object value) {
   if (value instanceof Collection && widget.isMultipleSelect()) {
     for (Iterator i = ((Collection) value).iterator(); i.hasNext(); ) {
       for (int j = 0; j < widget.getItemCount(); j++) {
         if (widget.getValue(j).equals(i.next())) {
           widget.setItemSelected(j, true);
         }
       }
     }
   } else {
     for (int i = 0; i < widget.getItemCount(); i++) {
       if (widget.getValue(i).equals(value)) {
         widget.setItemSelected(i, true);
         break;
       }
     }
   }
 }
 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 LinkedList<Long> getSelectedItemsWeights() {
   LinkedList<Long> selectedItems = new LinkedList<Long>();
   for (int i = 0; i < weights.getItemCount(); i++) {
     if (weights.isItemSelected(i)) {
       selectedItems.add((long) i);
     }
   }
   return selectedItems;
 }
 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;
 }
Example #22
0
 public void reset() {
   for (int i = 0; i < widget.getItemCount(); i++) {
     widget.setItemSelected(i, false);
   }
   widget.setSelectedIndex(-1);
   if (widget.getVisibleItemCount() <= 1) {
     widget.setSelectedIndex(0);
     widget.setItemSelected(0, true);
   }
 }
 private List<String> validate() {
   List<String> errors = new ArrayList<String>();
   if (selectionListbox.getItemCount() == 0 && !ViewUtil.isTextPopulated(dbInstructionArea)) {
     errors.add(TEXT_CONSTANTS.noDBSurveyMandatory());
   }
   if (!ViewUtil.isTextPopulated(notificationEmailBox)) {
     errors.add(TEXT_CONSTANTS.emailMandatory());
   }
   return errors;
 }
Example #24
0
 public void setAllowedAuthApps(String allowedAuthApps) {
   int size = idProvider.getItemCount();
   for (int i = 0; i < size; i++) {
     idProvider.removeItem(0);
   }
   String[] options = allowedAuthApps.split(",");
   for (String option : options) {
     idProvider.addItem(option, option);
   }
 }
 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);
 }
Example #26
0
 @Override
 public void onClick(ClickEvent event) {
   int index = previewZ.getSelectedIndex();
   if (previewZ.getItemCount() == 0) {
     return;
   }
   if (-1 == index) {
     index = 0;
   }
   previewA.setItemSelected(index, true);
 }
Example #27
0
 private void selectUser(final String userEmail) {
   if (userEmail != null) {
     for (int i = 0; i < users.getItemCount(); i++) {
       if (users.getValue(i).equalsIgnoreCase(userEmail)) {
         users.setSelectedIndex(i);
         break;
       }
     }
   }
   userChanged();
 }
  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;
  }
  private LinkedList<Integer> getSelectedItems(final ListBox listBox) {
    final LinkedList<Integer> selectedItems = new LinkedList<Integer>();

    for (int i = listBox.getItemCount() - 1; i >= 0; i--) {

      if (listBox.isItemSelected(i)) {
        selectedItems.add(i);
      }
    }
    return selectedItems;
  }
Example #30
0
 @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);
       }
     }
   }
 }