private void populatePlayerBox(ListBox playerBox) {
   playerBox.clear();
   playerBox.addItem("Välj en spelare");
   for (Player player : league.getPlayers()) {
     playerBox.addItem(player.getPlayerName());
   }
 }
  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);
    }
  }
 private void resetUI() {
   dbInstructionArea.setText("");
   dbInstructionArea.setVisible(false);
   includeDbScriptBox.setValue(false);
   selectionListbox.clear();
   selectionWidget.reset();
   notificationEmailBox.setText("");
 }
  private void updateSortMode() {
    sortMode.clear();
    for (SortMode mode : supportedModes) {
      sortMode.addItem(app.getPlain(mode.toString()));
    }

    SortMode selectedMode = app.getAlgebraView().getTreeMode();
    sortMode.setSelectedIndex(supportedModes.indexOf(selectedMode));
  }
 private void refreshActions() {
   m_lstActions.clear();
   if (getTrigger() == null) {
     return;
   }
   for (AnAction action : getTrigger().getActions()) {
     m_lstActions.addItem(action.toString());
   }
 }
 private void refreshConditions() {
   m_lstConditions.clear();
   if (getTrigger() == null) {
     return;
   }
   for (AnCondition condition : getTrigger().getConditions()) {
     m_lstConditions.addItem(condition.toString());
   }
 }
 @Override
 public void setValue(List<String> value) {
   Set<String> sortedChoices = new TreeSet<String>(value);
   listBox.clear();
   for (String c : sortedChoices) {
     listBox.addItem(c);
   }
   listBox.setSelectedIndex(-1);
 }
示例#8
0
 /** langRefresh */
 public void langRefresh() {
   setText(GeneralComunicator.i18nExtension("dropbox.search"));
   cancelButton.setHTML(GeneralComunicator.i18n("button.cancel"));
   importButton.setHTML(GeneralComunicator.i18nExtension("button.import"));
   typeList.clear();
   typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.all"), "");
   typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.document"), CATEGORY_DOCUMENT);
   typeList.addItem(GeneralComunicator.i18nExtension("dropbox.type.folder"), CATEGORY_FOLDER);
 }
示例#9
0
 public void setTariffList(ArrayList<CourseTariff> tariffList) {
   tariffListBox.clear();
   tariffListBox.insertItem("<" + constants.select() + ">", 0);
   for (int j = 0; j < tariffList.size(); j++) {
     tariffListBox.insertItem(
         tariffList.get(j).getName() + " - " + tariffList.get(j).getCosts() + " €", j + 1);
   }
   gradeListBox.setItemSelected(0, true);
 }
 /** This method is used to set default data. */
 void setData() {
   collectionSummaryText.setText(i18n.GL1587());
   collectionSummaryText.getElement().getStyle().setPaddingBottom(15, Unit.PX);
   collectionSummaryText.addStyleName("collectionSummaryText");
   printWidget.add(collectionSummaryText);
   teacherTabContainer =
       new AnalyticsTabContainer() {
         @Override
         public void onTabClick(String tabClicked) {
           if (SCORED.equalsIgnoreCase(tabClicked)) {
             hideAllPanels();
             teacherScoredDatapnl.setVisible(true);
           } else if (OPENENDED.equalsIgnoreCase(tabClicked)) {
             hideAllPanels();
             teacherOpenendedData.setVisible(true);
           } else if (BREAKDOWN.equalsIgnoreCase(tabClicked)) {
             hideAllPanels();
             teacherResourceBreakdownDatapnl.setVisible(true);
           } else if (PRINT.equalsIgnoreCase(tabClicked)) {
             Element printElement = collectionSummaryText.getElement();
             printElement.appendChild(collectionSummaryWidget.getElement());
             printElement.appendChild(scoredQuestionHeading.getElement());
             printElement.appendChild(scoredPrintWidget.getElement());
             printElement.appendChild(opendedQuestionHeading.getElement());
             printElement.appendChild(printOpendedData.getElement());
             printElement.appendChild(collectionOverViewWidget.getElement());
             printElement.appendChild(printResourceData.getElement());
             scoredPrintWidget.setVisible(true);
             Print.it(style, printElement);
             scoredPrintWidget.setVisible(false);
           } else {
             scoredPrintWidget.setVisible(true);
             Element printElement = collectionSummaryText.getElement();
             printElement.appendChild(collectionSummaryWidget.getElement());
             printElement.appendChild(scoredQuestionHeading.getElement());
             printElement.appendChild(scoredPrintWidget.getElement());
             printElement.appendChild(opendedQuestionHeading.getElement());
             printElement.appendChild(printOpendedData.getElement());
             printElement.appendChild(collectionOverViewWidget.getElement());
             printElement.appendChild(printResourceData.getElement());
             getUiHandlers()
                 .setHtmltopdf(
                     style.toString().replaceAll("'", "\\\\\"")
                         + printElement.getInnerHTML().toString().replaceAll("\"", "\\\\\""),
                     collectionMetaData.getTitle() != null ? collectionMetaData.getTitle() : "");
             scoredPrintWidget.setVisible(false);
           }
         }
       };
   teacherTabContainer.getEmailButton().setVisible(false);
   tabContainer.add(teacherTabContainer);
   filterDropDown.clear();
   filterDropDown.addItem("All", "All");
   filterDropDown.addItem("Questions", "Questions");
   filterDropDown.addItem("Resources", "Resources");
 }
 @Override
 public void setCountryList(LinkedHashMap<String, String> cl) {
   countryCode.clear();
   if (cl != null) {
     countryCode.addItem("--Select a country--", "");
     for (final String it : cl.keySet()) {
       countryCode.addItem(cl.get(it), it);
     }
   }
 }
 @Override
 public void setStateList(LinkedHashMap<String, String> sl) {
   stateCode.clear();
   if (sl != null) {
     stateCode.addItem("--Select a state--", "");
     for (final String it : sl.keySet()) {
       stateCode.addItem(sl.get(it), it);
     }
   }
 }
 public void activate() {
   masterRoleMap.clear();
   newRoleAssignments.clear();
   rolesListBox.clear();
   userRoles.clear();
   for (LogicalRoleInfo logicalRoleInfo : logicalRoles.values()) {
     logicalRoleInfo.checkBox.setValue(false);
   }
   initializeAvailUserRoles();
   initializeLogicalRoleMappings();
 }
  private void populateListItems(ListBox listBox, String[] arr, int startIndex, int howMany) {

    // Clear items
    listBox.clear();

    // Add itesm
    int endIndex = startIndex + howMany;
    for (int i = startIndex; i < endIndex; i++) {
      listBox.addItem(arr[i]);
    }
  }
示例#15
0
  /** Populates the locale drop down with a list of locales supported by the form designer. */
  public void populateLocales() {
    cbLanguages.clear();

    List<Locale> locales = Context.getLocales();
    if (locales == null) return;

    for (Locale locale : locales) cbLanguages.addItem(locale.getName(), locale.getKey());

    Locale locale = Context.getLocale();
    if (locale != null) cbLanguages.setSelectedIndex(getLocaleIndex(locale.getKey()));
  }
示例#16
0
 private void setListBoxOptions(
     ListBox input, List<? extends HasListBox> itemList, String defaultText) {
   input.clear();
   if (defaultText != null) {
     input.addItem(defaultText, "");
   }
   if (itemList != null) {
     for (HasListBox listBoxContent : itemList) {
       input.addItem(listBoxContent.getItem(), "" + listBoxContent.getValue());
     }
   }
 }
示例#17
0
    public void setBeltList(ArrayList<String> beltList) {
      gradeListBox.clear();
      gradeListBox.insertItem("<" + constants.select() + ">", 0);
      Iterator<String> itr = beltList.iterator();
      int i = 1;
      while (itr.hasNext()) {
        gradeListBox.insertItem(itr.next(), i);
        i++;
      }
      // gradeListBox.setItemSelected(0, true);

    }
示例#18
0
 void resetApplications(List<Application> apps) {
   if (apps != null && !apps.isEmpty()) {
     applications.clear();
     for (Application a : apps) {
       applications.addItem(a.toDisplay(), a.getId() + "");
     }
     for (int index = 0; index < applications.getItemCount(); index++) {
       int id = Integer.parseInt(applications.getValue(index));
       applications.setItemSelected(index, group.getApplicationIds().contains(id));
     }
   }
   adjustListBox(box.getValue());
 }
 @Override
 public void setVarsWeight(ArrayList<String> names, ArrayList<Long> ids) {
   var_names = names;
   var_ids = ids;
   weights.clear();
   weights.addItem("Без взвешивания");
   for (String name : var_names) {
     weights.addItem(name);
   }
   if (weight_var_ids != null)
     for (Long selid : weight_var_ids) {
       weights.setSelectedIndex(var_ids.indexOf(selid) + 1);
     }
 }
 private void showRoles(int roleType) {
   regularRolesBtn.setValue(roleType == REGULAR_ROLES_TYPE);
   systemRolesBtn.setValue(roleType == SYSTEM_ROLES_TYPE);
   for (LogicalRoleInfo logicalRoleInfo : logicalRoles.values()) {
     logicalRoleInfo.checkBox.setValue(false);
   }
   rolesListBox.clear();
   for (String role : userRoles) {
     if (((roleType == SYSTEM_ROLES_TYPE) && systemRoles.contains(role))
         || ((roleType != SYSTEM_ROLES_TYPE) && !systemRoles.contains(role))) {
       rolesListBox.addItem(role);
     }
   }
 }
示例#21
0
  private void updateDescription() {
    // ignoreActions = true;
    String[] modes =
        new String[] {app.getPlain("Value"), app.getPlain("Definition"), app.getPlain("Command")};
    description.clear();

    for (int i = 0; i < modes.length; i++) {
      description.addItem(app.getPlain(modes[i]));
    }

    int descMode = app.getKernel().getAlgebraStyle();
    description.setSelectedIndex(descMode);
    // ignoreActions = false;
  }
  public void addDefaultUsers() {
    usersListBox.clear();
    for (Map.Entry<String, String[]> entry : defaultUsers.entrySet()) {
      usersListBox.addItem(entry.getKey());
    }
    usersListBox.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            String key = usersListBox.getValue(usersListBox.getSelectedIndex());
            userTextBox.setText(defaultUsers.get(key)[0]);
            passwordTextBox.setText(defaultUsers.get(key)[1]);
          }
        });
  }
示例#23
0
  /** Fetch categories */
  private void fetchCategories() {
    btnApply.setEnabled(false);
    lstParent.clear();
    lstParent.setEnabled(false);
    lstParent.addItem("Fetching items ... ");
    ICategory.Util.getInstance()
        .getAllCategories(
            new AsyncCallback<List<XCategory>>() {

              @Override
              public void onSuccess(List<XCategory> result) {
                if (result == null) {
                  onFailure(new IllegalArgumentException("Null returned"));
                }
                lstParent.clear();

                for (XCategory cat : result) lstParent.addItem(cat.name);

                selectCategory();

                lstParent.setEnabled(true);
                btnApply.setEnabled(true);
              }

              /** Select category if */
              private void selectCategory() {
                if (original == null) return;

                int max = lstParent.getItemCount();
                for (int i = 0; i < max; i++)
                  if (lstParent.getItemText(i).equals(original.name)) {
                    lstParent.setSelectedIndex(i);
                    return;
                  }
                lstParent.addItem(original.name);
                lstParent.setSelectedIndex(max);
              }

              @Override
              public void onFailure(Throwable caught) {
                lstParent.clear();
                lstParent.setEnabled(false);
                lstParent.addItem("Error fetching categories");
                btnApply.setEnabled(false);
              }
            });
  }
示例#24
0
  private void showCategory(ListBox listBox, final int category) {
    listBox1 = listBox;
    listBox1.clear();
    String[] listData = null;

    switch (category) {
      case 0:
        listData = nutrition;

        break;
      case 1:
        listData = fitness;
        break;
      case 2:
        listData = dating;
        break;
      case 3:
        listData = fashion;
        break;
      case 4:
        listData = career;
        break;
      case 5:
        listData = admission;
        break;
    }
    for (int i = 0; i < listData.length; i++) {
      listBox1.addItem(listData[i]);
    }
    goalPanel.clear();
    goalPanel.add(goalLable);
    goalPanel.add(listBox1, vdropBox.getAbsoluteLeft(), goalLable.getAbsoluteTop());
    vendorTable.setWidget(3, 0, new HTML("Product or Service Type"));
    vendorTable.setWidget(3, 1, product);

    listBox.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            showBudget(budgetDropBox, category, vmultiBox.getSelectedIndex());
            budgetDropBox.ensureDebugId("vcwListBox-budgetDropBox");
          }
        });
  }
  /** Creates the ListBox that selects display type */
  private void createDisplayTypeComboBox() {

    if (lbDisplayType == null) {
      lbDisplayType = new ListBox();
      lbDisplayType.addChangeHandler(
          new ChangeHandler() {

            public void onChange(ChangeEvent event) {
              actionPerformed(lbDisplayType);
            }
          });
      plotTypes = new ArrayList<PlotType>();

    } else {
      lbDisplayType.clear();
    }

    getModel().fillDisplayTypes();
  }
示例#26
0
  public void updateBadgeRoles() {
    final int role_rows = roleft.getRowCount() - 2;
    final int badge_rows = badgeft.getRowCount() - 1;

    for (int i = 0; i < badge_rows; ++i) {
      ListBox broles = (ListBox) badgeft.getWidget(i + 1, 2);
      String selected = broles.getItemText(broles.getSelectedIndex());

      broles.clear();

      broles.addItem(ALL_ROLES);

      int selected_index = 0;

      for (int j = 0; j < role_rows; ++j) {
        String role = roleft.getText(j + 1, 0);
        broles.addItem(role);
        if (role.equals(selected)) {
          selected_index = j + 1;
        }
      }

      broles.setSelectedIndex(selected_index);

      // should num slots be enabled?
      boolean enable = false;

      if (selected_index > 0) {
        CheckBox cb = (CheckBox) badgeft.getWidget(i + 1, 1);
        if (cb.getValue()) {
          enable = true;
        }
      }

      TextBox tb = (TextBox) badgeft.getWidget(i + 1, 3);
      tb.setEnabled(enable);
      if (!enable) {
        tb.setText("0");
      }
    }
  }
  private ListBox loadBoundFacts(String binding) {
    ListBox listBox = new ListBox();
    listBox.addItem(GuidedDecisionTableConstants.INSTANCE.Choose());
    List<String> factBindings = rm.getLHSBoundFacts();

    for (int index = 0; index < factBindings.size(); index++) {
      String boundName = factBindings.get(index);
      if (!"".equals(boundName)) {
        listBox.addItem(boundName);
        if (boundName.equals(binding)) {
          listBox.setSelectedIndex(index + 1);
        }
      }
    }

    listBox.setEnabled(listBox.getItemCount() > 1);
    if (listBox.getItemCount() == 1) {
      listBox.clear();
      listBox.addItem(GuidedDecisionTableConstants.INSTANCE.NoPatternBindingsAvailable());
    }
    return listBox;
  }
  public WorkItemObjectParameterWidget(
      PortableObjectParameterDefinition ppd, IBindingProvider bindingProvider, boolean isReadOnly) {
    super(ppd, bindingProvider);

    // Setup widget to use bindings
    this.parameterName.setText(ppd.getName());
    Set<String> bindings = bindingProvider.getBindings(ppd.getClassName());
    if (bindings.size() > 0) {
      lstAvailableBindings.clear();
      lstAvailableBindings.addItem(Constants.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);
    }
  }
示例#29
0
    GroupPanel(CheckBoxItem box, Group group, List<Application> apps, List<Region> regions) {
      this.group = group;
      this.box = box;
      box.addValueChangeHandler(
          new ValueChangeHandler<Boolean>() {

            public void onValueChange(ValueChangeEvent<Boolean> event) {
              adjustListBox(event.getValue());
            }
          });

      add(box);
      if (group.hasApplications()) {
        add(new Label("applications"));
        add(applications);
        if (apps != null && !apps.isEmpty()) {
          applications.clear();
          for (Application a : apps) {
            applications.addItem(a.toDisplay(), a.getId() + "");
          }
        } else {
          applications.addItem("loading . . .");
        }
        applications.setEnabled(false);
      }
      if (group.hasRegions()) {
        add(new Label("regions"));
        add(this.regions);
        if (regions != null && !regions.isEmpty()) {
          regions.clear();
          for (Region a : regions) {
            this.regions.addItem(a.toDisplay(), a.getId() + "");
          }
        } else {
          this.regions.addItem("loading . . .");
        }
        this.regions.setEnabled(false);
      }
    }
 /**
  * Sets the contents of the name drop-down.
  *
  * @param newOptions the options to include
  */
 public void setNameOptions(String[] newOptions) {
   Arrays.sort(newOptions);
   boolean good = true;
   if (lastOptions != null && newOptions.length == lastOptions.length) {
     for (int i = 0; i < newOptions.length; ++i) {
       if (!newOptions[i].equals(lastOptions[i])) {
         good = false;
         break;
       }
     }
   } else {
     good = false;
   }
   if (!good) {
     options.clear();
     for (int i = 0; i < newOptions.length; ++i) {
       options.addItem(newOptions[i]);
       if (newOptions[i].equals(name.getText())) {
         options.setSelectedIndex(i);
       }
     }
   }
   lastOptions = newOptions;
 }