Пример #1
0
  private void userChanged() {
    if (users == null) {
      return;
    }
    ClientUser user = null;
    if (users.getSelectedIndex() > 0) {
      final String email = users.getValue(users.getSelectedIndex());
      if (userInfo.containsKey(email)) {
        user = userInfo.get(email);
      }

      Cookies.setCookie(
          "email",
          users.getValue(users.getSelectedIndex()),
          ParamSetSelectionController.getCookieExpirationDate(),
          null,
          "/",
          false);
    }

    // Figure out whether this user can edit parameters or not
    final boolean editorEnabled = user != null && user.isParameterEditorEnabled();
    if (paramsEditor != null) {
      paramsEditor.setEditorEnabled(editorEnabled, user);
    }
    setOutputPathChangeEnabled(user != null && user.isOutputPathChangeEnabled());
  }
Пример #2
0
    public void initLayout() {
      lang = new ListBox();
      lang =
          Convert.makeSelectedLanguageListBox(
              (ArrayList<String[]>) MainApp.getLanguage(), tObj.getLang());
      lang.setWidth("100%");
      lang.setEnabled(false);

      term = new TextBox();
      term.setText(tObj.getLabel());
      term.setWidth("100%");

      main = new CheckBox(constants.conceptPreferredTerm());
      if (tObj.isMainLabel()) {
        main.setValue(tObj.isMainLabel());
        // main.setEnabled(false);
      }

      Grid table = new Grid(2, 2);
      table.setWidget(0, 0, new HTML(constants.conceptTerm()));
      table.setWidget(1, 0, new HTML(constants.conceptLanguage()));
      table.setWidget(0, 1, term);
      table.setWidget(1, 1, lang);
      table.setWidth("100%");
      table.getColumnFormatter().setWidth(1, "80%");

      VerticalPanel vp = new VerticalPanel();
      vp.add(GridStyle.setTableConceptDetailStyleleft(table, "gslRow1", "gslCol1", "gslPanel1"));
      vp.add(main);
      vp.setSpacing(0);
      vp.setWidth("100%");
      vp.setCellHorizontalAlignment(main, HasHorizontalAlignment.ALIGN_RIGHT);

      addWidget(vp);
    }
Пример #3
0
  private void createGUI() {
    optionsPanel = new FlowPanel();
    optionsPanel.setStyleName("algebraOptions");
    lblShow = new Label();
    lblShow.addStyleName("panelTitle");
    showAuxiliaryObjects = new CheckBox();
    showAuxiliaryObjects.addClickHandler(this);
    lblSortMode = new Label();
    lblSortMode.addStyleName("panelTitle");
    lblDescriptionMode = new Label();
    lblDescriptionMode.addStyleName("panelTitle");
    sortMode = new ListBox();
    description = new ListBox();

    optionsPanel.add(lblShow);
    optionsPanel.add(LayoutUtil.panelRowIndent(showAuxiliaryObjects));
    optionsPanel.add(lblSortMode);
    optionsPanel.add(LayoutUtil.panelRowIndent(sortMode));
    optionsPanel.add(lblDescriptionMode);
    optionsPanel.add(LayoutUtil.panelRowIndent(description));
    sortMode.addChangeHandler(this);
    description.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            app.getKernel().setAlgebraStyle(description.getSelectedIndex());
            app.getKernel().updateConstruction();
          }
        });
    // updateSortMode(); done by setLabels
    // updateDescription(); done by set labels
    setLabels();
  }
 private void copySelected(final ListBox from, final ListBox to) {
   int selected;
   while ((selected = from.getSelectedIndex()) != -1) {
     to.addItem(from.getItemText(selected));
     from.removeItem(selected);
   }
 }
Пример #5
0
 @Test
 public void checkVisible() {
   ListBox listBox = new ListBox(false);
   Assert.assertEquals(true, listBox.isVisible());
   listBox.setVisible(false);
   Assert.assertEquals(false, listBox.isVisible());
 }
  private void submitMatch() {
    Match m =
        new Match(
            league.getId(),
            new Date(),
            league.getSports().get(sportBox.getSelectedIndex()),
            league.getPlayers().get(player1Box.getSelectedIndex() - 1),
            league.getPlayers().get(player2Box.getSelectedIndex() - 1));
    for (int i = 0; i < player1Score.size(); i++) {
      try {
        if (!player1Score.get(i).getText().equals("")
            && !player2Score.get(i).getText().equals("")) {
          m.addSet(
              new Set(
                  m.getSport(),
                  Integer.parseInt(player1Score.get(i).getText()),
                  Integer.parseInt(player2Score.get(i).getText())));
        }
      } catch (NumberFormatException e) {
        Window.alert("Failed to parse number: " + e.getMessage());
      }
    }
    AsyncCallback<Void> callback =
        new AsyncCallback<Void>() {
          public void onFailure(Throwable caught) {
            Window.alert("Failed to save match.");
          }

          public void onSuccess(Void arg) {
            Spelstegen.showMessage("Match sparad.", false);
            resetPanel();
          }
        };
    ServiceManager.getInstance().saveMatch(m, loggedInPlayer, league, callback);
  }
  /** Pops up the fact selector. */
  @Override
  protected void showFactTypeSelector(final Widget w) {
    final ListBox box = new ListBox();
    AsyncPackageDataModelOracle oracle = this.getModeller().getDataModelOracle();
    String[] facts = oracle.getFactTypes();

    box.addItem(GuidedRuleEditorResources.CONSTANTS.Choose());

    for (int i = 0; i < facts.length; i++) {
      box.addItem(facts[i]);
    }
    box.setSelectedIndex(0);

    final FormStylePopup popup =
        new FormStylePopup(GuidedRuleEditorResources.CONSTANTS.NewFactPattern());
    popup.addAttribute(GuidedRuleEditorResources.CONSTANTS.chooseFactType(), box);
    box.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            pattern.setFactPattern(new FactPattern(box.getItemText(box.getSelectedIndex())));
            setModified(true);
            getModeller().refreshWidget();
            popup.hide();
          }
        });
    popup.show();
  }
Пример #8
0
  private Widget addWidget(AddRecord recordTable) {
    Widget widget = new Widget();
    if (recordTable.getFieldType().equals(SQL_TYPE_STRING)) {
      widget = new TextBox();
      if (recordTable.getFieldType() != null) {
        ((TextBox) widget).setValue(recordTable.getFieldValue());
        ((TextBox) widget).setEnabled(recordTable.isEditable());
      }
    } else if (recordTable.getFieldType().equals(SQL_TYPE_DATE)) {
      widget = new DateBox();
      ((DateBox) widget).setEnabled(recordTable.isEditable());
    } else if (recordTable.getFieldType().equals(SQL_TYPE_LIST_STRING)) {
      final ListBox listBox = new ListBox();
      listBox.setEnabled(recordTable.isEditable());
      for (RefRecord rec : recordTable.getListRefRecord()) {
        listBox.addItem(rec.getValue(), String.valueOf(rec.getKey()));
      }

      widget = listBox;
    } else {
      widget = new TextBox();
      if (recordTable.getFieldValue() != null) {
        ((TextBox) widget).setValue(recordTable.getFieldValue());
        ((TextBox) widget).setEnabled(recordTable.isEditable());
      }
    }
    return widget;
  }
Пример #9
0
  public DeviceDiskViewImpl() {
    initWidget(uiBinder.createAndBindUi(this));

    for (String pageSize : DevicePageSize.getPageSizeList()) {
      pageSizeList.addItem(pageSize);
    }
    pageSizeList.setSelectedIndex(DevicePageSize.getPageSizeSelectedIndex());
    pageSizeList.addChangeHandler(
        new ChangeHandler() {

          @Override
          public void onChange(ChangeEvent event) {
            DevicePageSize.setPageSizeSelectedIndex(pageSizeList.getSelectedIndex());
            if (table != null) {
              table.setPageSize(DevicePageSize.getPageSize());
            }
          }
        });

    selection = new MultiSelectionModel<SearchResultRow>(SearchResultRow.KEY_PROVIDER);
    selection.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            updateSearchResultButtonStatus();
            presenter.onSelectionChange(selection.getSelectedSet());
          }
        });
    updateSearchResultButtonStatus();

    popup.setAutoHideEnabled(true);
  }
 public void selectInListBox(String index, String objectLocalization) {
   ListBox listBox = getObject(ListBox.class, objectLocalization);
   checkWidgetVisibleAndEnable(listBox, objectLocalization);
   listBox.setSelectedIndex(Integer.parseInt(index));
   WidgetUtils.click(listBox);
   WidgetUtils.change(listBox);
 }
Пример #11
0
  public void updateBosses() {
    int index = instances.getSelectedIndex();
    if (index < 0) return;

    final String inst_key = instances.getValue(index);

    GoteFarm.goteService.getInstanceBosses(
        inst_key,
        new AsyncCallback<List<JSBoss>>() {
          public void onSuccess(List<JSBoss> results) {
            bosses.clear();

            for (JSBoss ib : results) {
              bosses.addItem(ib.name, ib.key);
              if (et != null && inst_key.equals(et.instance_key)) {
                for (String eb : et.boss_keys) {
                  if (ib.key.equals(eb)) {
                    bosses.setItemSelected(bosses.getItemCount() - 1, true);
                    break;
                  }
                }
              }
            }
          }

          public void onFailure(Throwable caught) {}
        });
  }
Пример #12
0
 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;
 }
Пример #13
0
  @Override
  public void onModuleLoad() {
    addList();

    mainPanel.setLeftWidget(listbox);
    setListitems();
    listbox.setWidth("100%");
    listbox.setHeight("100%");

    listbox.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            String testcaseName = listbox.getItemText(listbox.getSelectedIndex());
            TestcaseWrapper widget = map.get(testcaseName);
            widget.show();
            panel.clear();
            panel.add(widget);
          }
        });

    mainPanel.setSplitPosition("300px");
    mainPanel.setRightWidget(panel);

    RootPanel.get().add(mainPanel);
  }
  /** Pops up the fact selector. */
  protected void showFactTypeSelector(final Widget w) {
    PackageDataModelOracle completions = this.getModeller().getSuggestionCompletions();
    final ListBox box = new ListBox();
    String[] facts = completions.getFactTypes();

    box.addItem(Constants.INSTANCE.Choose());

    for (int i = 0; i < facts.length; i++) {
      box.addItem(facts[i]);
    }
    box.setSelectedIndex(0);

    final FormStylePopup popup = new FormStylePopup();
    popup.setTitle(Constants.INSTANCE.NewFactPattern());
    popup.addAttribute(Constants.INSTANCE.chooseFactType(), box);
    box.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            pattern.setFactPattern(new FactPattern(box.getItemText(box.getSelectedIndex())));
            setModified(true);
            getModeller().refreshWidget();
            popup.hide();
          }
        });

    popup.show();
  }
Пример #15
0
  private Widget getHeaderWidget() {
    FlexTable widget = new FlexTable();

    widget.setHTML(0, 0, DashboardMessages.MSG.office());
    officesLB = new ListBox();
    officesLB.setWidth("250px");
    widget.setWidget(0, 1, officesLB);

    widget.setHTML(0, 2, DashboardMessages.MSG.broker());
    brokersLB = new ListBox();
    brokersLB.setWidth("250px");
    widget.setWidget(0, 3, brokersLB);

    widget.setHTML(0, 4, DashboardMessages.MSG.userStatus());
    estateStatusLB = new ListBox();
    for (EstateStatusSearchType status : EstateStatusSearchType.values()) {
      estateStatusLB.addItem(status.getTitle(), "" + status.getId());
    }
    widget.setWidget(0, 5, estateStatusLB);

    findButton = new Button();
    findButton.setText(BaseMessages.MSG.find());
    widget.setWidget(0, 6, findButton);
    return widget;
  }
Пример #16
0
 @SuppressWarnings("deprecation")
 private void showCreationDate(Date d) {
   // TODO(jgw): Use non-deprecated date methods for this.
   dateYear.setSelectedIndex(d.getYear() - 100);
   dateMonth.setSelectedIndex(d.getMonth());
   dateDay.setSelectedIndex(d.getDate() - 1);
 }
 private void populatePlayerBox(ListBox playerBox) {
   playerBox.clear();
   playerBox.addItem("Välj en spelare");
   for (Player player : league.getPlayers()) {
     playerBox.addItem(player.getPlayerName());
   }
 }
    private void configureOnChangeHandler() {
      final MonthlyRecurrenceEditor localThis = this;

      KeyboardListener keyboardListener =
          new KeyboardListener() {
            public void onKeyDown(Widget sender, char keyCode, int modifiers) {}

            public void onKeyPress(Widget sender, char keyCode, int modifiers) {}

            public void onKeyUp(Widget sender, char keyCode, int modifiers) {
              localThis.changeHandler();
            }
          };

      ClickListener clickListener =
          new ClickListener() {
            public void onClick(Widget sender) {
              localThis.changeHandler();
            }
          };

      ChangeListener changeListener =
          new ChangeListener() {
            public void onChange(Widget sender) {
              localThis.changeHandler();
            }
          };
      dayNOfMonthRb.addClickListener(clickListener);
      dayNOfMonthRb.addKeyboardListener(keyboardListener);
      nthDayNameOfMonthRb.addClickListener(clickListener);
      nthDayNameOfMonthRb.addKeyboardListener(keyboardListener);
      dayOfMonthTb.addKeyboardListener(keyboardListener);
      whichWeekLb.addChangeListener(changeListener);
      dayOfWeekLb.addChangeListener(changeListener);
    }
 private void resetPanel() {
   player1Box.setSelectedIndex(0);
   player2Box.setSelectedIndex(0);
   sportBox.setSelectedIndex(0);
   oneSet.setValue(true);
   setScoreBoxes(1);
 }
Пример #20
0
  public FolderSelectionWidget(
      final Map<String, String> batchClassesNameMap, final HandlerManager eventBus) {
    super();
    initWidget(BINDER.createAndBindUi(this));
    mainPanel.addStyleName(FolderManagementConstants.OPTIONS_BOX);
    batchClassSelectionListBox.setWidth(_150PX);
    batchClassSelectionListBox.addStyleName(FolderManagementConstants.CUSTOM_LIST_BOX);
    if (null != batchClassesNameMap && !batchClassesNameMap.isEmpty()) {
      Set<Entry<String, String>> entrySet = batchClassesNameMap.entrySet();
      for (Entry<String, String> entry : entrySet) {
        batchClassSelectionListBox.addItem(entry.getKey());
      }
      fireEventForFolderSelection(batchClassesNameMap, eventBus);
      batchClassSelectionListBox.addChangeHandler(
          new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
              fireEventForFolderSelection(batchClassesNameMap, eventBus);
            }
          });
    } else {
      eventBus.fireEvent(new BatchClassChangeEvent());
    }
  }
Пример #21
0
      public void onChange(Widget sender) {
        ListBox ss = (ListBox) sender;
        final String logLevel = ss.getValue(ss.getSelectedIndex());

        class LevelChangeCallBack implements AsyncCallback {

          public void onFailure(Throwable caught) {
            Logger.error(
                "Could not set logger level for logger ["
                    + info.getFullName()
                    + "] due to["
                    + caught.getMessage()
                    + "]");
          }

          public void onSuccess(Object result) {
            if (logLevel.equals(LogTreeNode._LEVEL_OFF)) {
              node.turnOff();
            } else {
              node.turnOn();
            }
          }
        }

        ServerConnection.logServiceAsync.setLoggerLevel(
            info.getFullName(), logLevel, new LevelChangeCallBack());
      }
  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();*/
    }
  }
Пример #23
0
 protected ListBox createDropDown() {
   ListBox dropDown = new ListBox();
   for (Medal medal : _medals) {
     dropDown.addItem(medal.name);
   }
   return dropDown;
 }
Пример #24
0
 private void showFieldChange() {
   final FormStylePopup pop = new FormStylePopup();
   pop.setModal(false);
   String[] fields =
       this.sce.getFieldCompletions(
           FieldAccessorsAndMutators.MUTATOR, this.editingCol.getFactType());
   final ListBox box = new ListBox();
   for (int i = 0; i < fields.length; i++) {
     box.addItem(fields[i]);
   }
   pop.addAttribute(constants.Field(), box);
   Button b = new Button(constants.OK());
   pop.addAttribute("", b);
   b.addClickHandler(
       new ClickHandler() {
         public void onClick(ClickEvent w) {
           editingCol.setFactField(box.getItemText(box.getSelectedIndex()));
           editingCol.setType(
               sce.getFieldType(editingCol.getFactType(), editingCol.getFactField()));
           makeLimitedValueWidget();
           doFieldLabel();
           pop.hide();
         }
       });
   pop.show();
 }
Пример #25
0
  @Test
  public void checkSelected() {
    ListBox listBox = getListBox();

    listBox.setSelectedIndex(1);
    Assert.assertEquals("item 1", listBox.getItemText(listBox.getSelectedIndex()));
  }
Пример #26
0
  protected void showNewPatternDialog() {
    final FormStylePopup pop = new FormStylePopup();
    pop.setTitle(constants.NewFactSelectTheType());
    final ListBox types = new ListBox();
    for (int i = 0; i < sce.getFactTypes().length; i++) {
      types.addItem(sce.getFactTypes()[i]);
    }
    pop.addAttribute(constants.FactType(), types);
    final TextBox binding = new TextBox();
    pop.addAttribute(constants.Binding(), binding);

    Button ok = new Button(constants.OK());
    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent w) {
            editingCol.setBoundName(binding.getText());
            editingCol.setFactType(types.getItemText(types.getSelectedIndex()));
            editingCol.setFactField(null);
            makeLimitedValueWidget();
            doPatternLabel();
            doFieldLabel();
            pop.hide();
          }
        });
    pop.addAttribute("", ok);

    pop.show();
  }
Пример #27
0
  private ListBox createScheduleCombo() {
    final ScheduleEditor localThis = this;
    ListBox lb = new ListBox();
    lb.setVisibleItemCount(1);
    // lb.setStyleName("scheduleCombo"); //$NON-NLS-1$
    lb.addChangeHandler(
        new ChangeHandler() {

          @Override
          public void onChange(ChangeEvent event) {
            localThis.handleScheduleChange();
          }
        });

    // add all schedule types to the combobox
    for (ScheduleType schedType : EnumSet.range(ScheduleType.RUN_ONCE, ScheduleType.CRON)) {
      if (!isBlockoutDialog
          || (schedType != ScheduleType.CRON
              && schedType != ScheduleType.SECONDS
              && schedType != ScheduleType.MINUTES
              && schedType != ScheduleType.HOURS)) {
        lb.addItem(schedType.toString());
      }
    }
    lb.setItemSelected(0, true);

    return lb;
  }
Пример #28
0
  protected void showAddFieldPopup(ClickEvent w) {
    final DataModelOracle completions = this.getModeller().getSuggestionCompletions();
    final FormStylePopup popup =
        new FormStylePopup(
            GuidedRuleEditorImages508.INSTANCE.Wizard(), Constants.INSTANCE.AddAField());

    final ListBox box = new ListBox();
    box.addItem("...");

    for (int i = 0; i < fieldCompletions.length; i++) {
      box.addItem(fieldCompletions[i]);
    }

    box.setSelectedIndex(0);

    popup.addAttribute(Constants.INSTANCE.AddField(), box);
    box.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            String fieldName = box.getItemText(box.getSelectedIndex());

            String fieldType = completions.getFieldType(variableClass, fieldName);
            model.addFieldValue(new ActionFieldValue(fieldName, "", fieldType));
            setModified(true);
            getModeller().refreshWidget();
            popup.hide();
          }
        });

    popup.show();
  }
  private void showSetCellAlignmentDialog(final ListBox listBox, final IAlignment iAlignment) {
    final DialogBox origDialog = new DialogBox();
    DOM.setStyleAttribute(origDialog.getElement(), "zIndex", Integer.toString(Integer.MAX_VALUE));
    final VerticalPanel dialog = new VerticalPanel();
    origDialog.add(dialog);
    origDialog.setText("Cell Alignment Dialog");
    dialog.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

    dialog.add(new Label("Please choose the Widget :"));
    final ListBox widgetIndexLb = new ListBox();
    for (Iterator<Widget> iterator = iterator(); iterator.hasNext(); ) {
      Widget next = iterator.next();
      widgetIndexLb.addItem(
          ((IVkWidget) next).getWidgetName() + " - at index - " + getWidgetIndex(next));
    }

    widgetIndexLb.setWidth("300px");
    dialog.add(widgetIndexLb);
    widgetIndexLb.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            iAlignment.doAlignment(
                widgetIndexLb.getSelectedIndex(), listBox.getValue(listBox.getSelectedIndex()));
          }
        });
    dialog.add(new Label("Please choose Alignment"));
    dialog.add(listBox);
    listBox.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            iAlignment.doAlignment(
                widgetIndexLb.getSelectedIndex(), listBox.getValue(listBox.getSelectedIndex()));
          }
        });
    HorizontalPanel buttonsPanel = new HorizontalPanel();
    dialog.add(buttonsPanel);
    Button saveButton = new Button("OK");
    buttonsPanel.add(saveButton);
    saveButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            // iAlignment.doAlignment(widgetIndexLb.getSelectedIndex(),
            // listBox.getValue(listBox.getSelectedIndex()));
            origDialog.hide();
          }
        });
    Button cancelButton = new Button("Cancel");
    buttonsPanel.add(cancelButton);
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            origDialog.hide();
          }
        });
    origDialog.center();
  }
Пример #30
0
  /**
   * @param assignment the assignment for which the Listbox should set the fraction
   * @param res the result of the assignment for which the Listbox should set the fraction
   * @return a single select ListBox containing all possible fractions as defined in {@link
   *     Assignment#FRACTIONS} setting the fraction for a result in this assignment when they are
   *     changed
   */
  ListBox getFractionsLB(final Assignment assignment, final Result res) {
    final ListBox fractions = new ListBox();
    fractions.setMultipleSelect(false);
    for (int j = 0; j < Assignment.FRACTIONS.length; j++) {
      fractions.addItem(
          app.getKernel().format(Assignment.FRACTIONS[j] * 100, StringTemplate.defaultTemplate));
    }

    fractions.addChangeHandler(
        new ChangeHandler() {

          public void onChange(ChangeEvent event) {
            assignment.setFractionForResult(
                res, Assignment.FRACTIONS[fractions.getSelectedIndex()]);
          }
        });

    fractions.addAttachHandler(
        new Handler() {

          public void onAttachOrDetach(AttachEvent event) {
            fractions.setSelectedIndex(
                Arrays.binarySearch(Assignment.FRACTIONS, assignment.getFractionForResult(res)));
          }
        });

    return fractions;
  }