private AttributeRights getRightsFromWidgets(
      CheckBox read, CheckBox write, AttributeRights right) {

    right.setRights(read.getValue(), write.getValue());

    return right;
  }
Beispiel #2
0
    public Widget makeExtraUI(final WebLayerItem item) {

      final CheckBox cb =
          GwtUtil.makeCheckBox(
              "Offset Calculation",
              "Calculate the distance, delta(RA), delta(Dec), and PA between two points",
              _posAngle);
      cb.addValueChangeHandler(
          new ValueChangeHandler<Boolean>() {
            public void onValueChange(ValueChangeEvent<Boolean> ev) {
              _posAngle = ev.getValue();
              redraw();
            }
          });

      SimpleInputField units =
          SimpleInputField.createByProp("PrefGroup.Generic.field.DistanceReadout");
      String pref = Preferences.get(DIST_READOUT);
      units.setValue(pref == null ? DEG : pref);
      units
          .getField()
          .addValueChangeHandler(
              new ValueChangeHandler<String>() {
                public void onValueChange(ValueChangeEvent<String> ev) {
                  Preferences.set(DIST_READOUT, ev.getValue());
                  redraw();
                }
              });

      VerticalPanel vp = new VerticalPanel();
      vp.add(cb);
      vp.add(units);

      return vp;
    }
    public WeeklyRecurrenceEditor() {
      setStyleName("weeklyRecurrencePanel"); // $NON-NLS-1$

      Label l = new Label(Messages.getString("schedule.recurEveryWeek"));
      everyWeekOnLabel = new ErrorLabel(l);
      l.setStyleName("startLabel"); // $NON-NLS-1$
      add(everyWeekOnLabel);

      FlexTable gp = new FlexTable();
      gp.setCellPadding(0);
      gp.setCellSpacing(0);
      // add Sun - Wed
      final int ITEMS_IN_ROW = 4;
      for (int ii = 0; ii < ITEMS_IN_ROW; ++ii) {
        DayOfWeek day = DayOfWeek.get(ii);
        CheckBox cb = new CheckBox(Messages.getString(day.toString()));
        cb.setStylePrimaryName(DOW_CHECKBOX);
        gp.setWidget(0, ii, cb);
        dayToCheckBox.put(day, cb);
      }
      // Add Thur - Sat
      for (int ii = ITEMS_IN_ROW; ii < DayOfWeek.length(); ++ii) {
        DayOfWeek day = DayOfWeek.get(ii);
        CheckBox cb = new CheckBox(Messages.getString(day.toString()));
        cb.setStylePrimaryName(DOW_CHECKBOX);
        gp.setWidget(1, ii - 4, cb);
        dayToCheckBox.put(day, cb);
      }
      add(gp);
      configureOnChangeHandler();
    }
Beispiel #4
0
 private void initClickModeSelectionUI(IGame game) {
   DockPanel clickModePanel = new DockPanel();
   add(clickModePanel);
   clickModePanel.setWidth(
       Integer.toString(FieldCanvas.SIZE * game.getBoard().getDimension().x) + "px");
   clickModePanel.setHorizontalAlignment(DockPanel.ALIGN_CENTER);
   clickOpenButton = new RadioButton("ClickOpens", "click opens");
   clickOpenButton.setValue(true);
   clickFlagButton = new RadioButton("ClickFlags", "click flags");
   clickFlagButton.setValue(false);
   ValueChangeHandler<Boolean> checkBoxToggler =
       new ValueChangeHandler<Boolean>() {
         @Override
         public void onValueChange(ValueChangeEvent<Boolean> event) {
           CheckBox checkBox = (CheckBox) event.getSource();
           if (checkBox == clickOpenButton) clickFlagButton.setValue(!event.getValue());
           else clickOpenButton.setValue(!event.getValue());
         }
       };
   clickOpenButton.addValueChangeHandler(checkBoxToggler);
   clickFlagButton.addValueChangeHandler(checkBoxToggler);
   clickModePanel.add(clickFlagButton, DockPanel.WEST);
   clickModePanel.add(clickOpenButton, DockPanel.EAST);
   clickModePanel.setCellHorizontalAlignment(clickOpenButton, DockPanel.ALIGN_LEFT);
   clickModePanel.setCellHorizontalAlignment(clickFlagButton, DockPanel.ALIGN_RIGHT);
 }
  protected void updateSettings() {
    // gif-panel
    try { // TODO only update modified value

      // screenshot
      int sctype = screenshotTransparentBt.getValue() ? 0 : 1;
      storageControler.setValue(KEY_SCREENSHOT_BG_TYPE, sctype);
      storageControler.setValue(KEY_SCREENSHOT_BG_VALUE, screenshotColorBox.getValue());

      storageControler.setValue(KEY_GIF_WITH_BACKGROUND, backgroundCheck.getValue());
      storageControler.setValue(KEY_GIF_WITH_BONE, boneCheck.getValue());
      storageControler.setValue(KEY_GIF_WITH_IK, ikCheck.getValue());

      if (transparentBt.getValue()) {
        storageControler.setValue(KEY_GIF_BG_TYPE, 0);
      } else if (colorBt.getValue()) {
        storageControler.setValue(KEY_GIF_BG_TYPE, 1);
        storageControler.setValue(KEY_GIF_BG_VALUE, colorBox.getValue());
      } else if (imageBt.getValue()) {
        storageControler.setValue(KEY_GIF_BG_TYPE, 2);
      }

      storageControler.setValue(KEY_GIF_WIDTH, widthBox.getValue());
      storageControler.setValue(KEY_GIF_HEIGHT, heightBox.getValue());

      storageControler.setValue(KEY_GIF_QUALITY, qualityBox.getValue());
      storageControler.setValue(KEY_GIF_SPEED, speedBox.getValue());

    } catch (StorageException e) {
      // possible quote error
      PoseEditor.alert(e.getMessage());
    }
  }
 public SignalsPreferencesWidget() {
   initWidget(uiBinder.createAndBindUi(this));
   titleSignals.ensureDebugId("SignalsPreferencesWidget-titleSignals");
   incomingNotifications.ensureDebugId("SignalsPreferencesWidget-incomingNotifications");
   rosterNotifications.ensureDebugId("SignalsPreferencesWidget-rosterNotifications");
   notifierMap = new HashMap<String, CheckBox>();
 }
    private void configureOnChangeHandler() {

      final WeeklyRecurrenceEditor 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();
            }
          };
      for (DayOfWeek d : dayToCheckBox.keySet()) {
        CheckBox cb = dayToCheckBox.get(d);
        cb.addClickListener(clickListener);
        cb.addKeyboardListener(keyboardListener);
      }
    }
  /**
   * Converting ResultObject into text for preview according to checkboxes.
   *
   * @return String for preview
   */
  private String resultToText() {
    String resultString = "";

    // Adding column names:
    if (typeTB.getValue()) {
      resultString += "MoleculeType\t";
    }

    if (identifierTB.getValue()) {
      resultString += "Identifier\t";
    }

    if (nameTB.getValue()) {
      resultString += "MoleculeName\t";
    }

    // Adding line break in case there are column names
    if (resultString.length() > 0) {
      resultString += "\n";
    }

    resultString +=
        buildGroupString(chemTB, result.getChemicals(), PropertyType.CHEMICAL_COMPOUNDS.getTitle());
    resultString +=
        buildGroupString(protTB, result.getProteins(), PropertyType.PROTEINS.getTitle());
    resultString +=
        buildGroupString(sequTB, result.getSequences(), PropertyType.SEQUENCES.getTitle());
    resultString += buildGroupString(otheTB, result.getOthers(), PropertyType.OTHERS.getTitle());

    return resultString;
  }
 @Override
 public void render(
     com.google.gwt.cell.client.Cell.Context context, Boolean value, SafeHtmlBuilder sb) {
   CheckBox checkBox = new CheckBox();
   checkBox.setValue(value);
   checkBox.setEnabled(false);
   sb.append(SafeHtmlUtils.fromTrustedString(checkBox.toString()));
 }
  @Override
  public void setNotifierSelected(final String id, final boolean selected) {
    final CheckBox checkbox = notifierMap.get(id);

    if (checkbox != null) {
      checkbox.setValue(selected);
    }
  }
  @Override
  public void addNotifier(final String id, final String name) {
    final CheckBox notifierCheckbox = new CheckBox(name);
    notifierCheckbox.ensureDebugId("hablarNotifierPreferenceEnabled-" + id);

    notifierMap.put(id, notifierCheckbox);

    methodsPanel.add(notifierCheckbox);
  }
 /**
  * @param valueOfSunday int used to adjust the starting point of the weekday sequence. If this
  *     value is 0, Sun-Sat maps to 0-6, if this value is 1, Sun-Sat maps to 1-7, etc.
  * @return String comma separated list of numeric days of the week.
  */
 public void setCheckedDaysAsString(String strDays, int valueOfSunday) {
   String[] days = strDays.split(","); // $NON-NLS-1$
   for (String day : days) {
     int intDay = Integer.parseInt(day) - valueOfSunday;
     DayOfWeek dayOfWeek = DayOfWeek.get(intDay);
     CheckBox cb = dayToCheckBox.get(dayOfWeek);
     cb.setChecked(true);
   }
 }
 public List<DayOfWeek> getCheckedDays() {
   ArrayList<DayOfWeek> checkedDays = new ArrayList<DayOfWeek>();
   for (DayOfWeek d : EnumSet.range(DayOfWeek.SUN, DayOfWeek.SAT)) {
     CheckBox cb = dayToCheckBox.get(d);
     if (cb.isChecked()) {
       checkedDays.add(d);
     }
   }
   return checkedDays;
 }
 protected String searchToXML(String searchQuery) {
   String xml = "<search>\r\n";
   if (common.isChecked()) xml += "<commonName>" + searchQuery + "</commonName>\r\n";
   if (sciName.isChecked()) xml += "<sciName>" + searchQuery + "</sciName>\r\n";
   if (countryOfOcc.isChecked())
     xml += "<country>" + countryOfOccText.getText() + "</country>\r\n";
   if (assessor.isChecked()) xml += "<assessor>" + assessorText.getText() + "</assessor>\r\n";
   xml += "</search>";
   return xml;
 }
  @Override
  public boolean isNotifierSelected(final String id) {
    final CheckBox checkbox = notifierMap.get(id);

    if (checkbox != null) {
      return checkbox.getValue();
    }

    return false;
  }
 public static CheckBox addCheckBox(Panel p, String label, String infoMsg) {
   HorizontalPanel hp = new HorizontalPanel();
   CheckBox cb = new CheckBox(label);
   cb.setText(label);
   hp.add(cb);
   Image info = new Image(ImporterPlugin.RESOURCES.info());
   info.setTitle(infoMsg);
   hp.add(info);
   p.add(hp);
   return cb;
 }
Beispiel #17
0
  @Test
  public void title() {
    // Arrange
    CheckBox cb = new CheckBox();
    // Pre-Assert
    assertEquals("", cb.getTitle());

    // Act
    cb.setTitle("title");
    assertEquals("title", cb.getTitle());
  }
Beispiel #18
0
 private static void dispatchEventInternal(Widget target, Event event) {
   if (CheckBox.class.isInstance(target) && event.getTypeInt() == Event.ONCLICK) {
     CheckBox checkBox = (CheckBox) target;
     if (RadioButton.class.isInstance(target)) {
       checkBox.setValue(true);
     } else {
       checkBox.setValue(!checkBox.getValue());
     }
   }
   target.onBrowserEvent(event);
 }
  public List<Integer> getSelectedRows() {
    List<Integer> selectedRows = new ArrayList<Integer>();

    for (int i = 0; i < contactsTable.getRowCount(); ++i) {
      CheckBox checkBox = (CheckBox) contactsTable.getWidget(i, 0);
      if (checkBox.getValue()) {
        selectedRows.add(i);
      }
    }

    return selectedRows;
  }
  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());
  }
Beispiel #21
0
 /** langRefresh */
 public void langRefresh() {
   searchButton.setHTML(Main.i18n("button.search"));
   cleanButton.setHTML(Main.i18n("button.clean"));
   saveSearchButton.setHTML(Main.i18n("button.save.search"));
   advancedView.setText(Main.i18n("search.view.advanced"));
   compactResultsView.setText(Main.i18n("search.view.compact.results"));
   showPropertyGroups.setText(Main.i18n("search.view.propety.groups"));
   saveUserNews.setText(Main.i18n("search.save.as.news"));
   resultsPageText.setHTML(Main.i18n("search.page.results"));
   searchTypeText.setHTML(Main.i18n("search.type"));
   controlSearch.langRefresh();
 }
Beispiel #22
0
  /**
   * Update members.
   *
   * @return true, if successful
   */
  private boolean updateMembers() {
    boolean cansync = true;
    name.removeStyleName(errorfieldstyle);
    if (editlogin != null) {
      login.removeStyleName(errorfieldstyle);
    }
    password.removeStyleName(errorfieldstyle);

    String sometext = name.getText().trim();
    if (sometext.isEmpty()) {
      cansync = false;
      name.addStyleName(errorfieldstyle);
    }

    user.setUsername(sometext);
    if (editlogin == null) {
      sometext = login.getText().trim();
      if (sometext.isEmpty()) {
        cansync = false;
        login.addStyleName(errorfieldstyle);
      }
      user.setLogin(sometext);
    }

    sometext = password.getText();
    if ((editlogin == null) && sometext.isEmpty()) {
      cansync = false;
      password.addStyleName(errorfieldstyle);
    }

    user.setPassword(sometext);
    user.setActive(isactive.getValue());
    UserRole role = new UserRole();
    if (isadmin.getValue()) {
      role.setAdmin();
    }

    if (isdocuments.getValue()) {
      role.setDocuments();
    }

    if (isfinances.getValue()) {
      role.setFinances();
    }

    if (ismanager.getValue()) {
      role.setManager();
    }
    user.setUserrole(role);

    return cansync;
  }
  @Override
  public void setContent(Object content) {
    if (content != null) {
      if (content instanceof Boolean) {
        super.setValue((Boolean) content);
      } else {
        throw new RuntimeException("unsupported value type '" + content.getClass().getName() + "'");
      }

    } else {
      super.setValue(null);
    }
  }
Beispiel #24
0
 public void setValue(Object value) {
   if (value != null) {
     boolean b = false;
     if (value instanceof String) {
       b = Boolean.valueOf((String) value).booleanValue();
     } else if (value instanceof Boolean) {
       b = ((Boolean) value).booleanValue();
     }
     widget.setChecked(b);
   } else {
     widget.setChecked(false);
   }
 }
Beispiel #25
0
  @Test
  public void name() {
    // Arrange
    CheckBox cb = new CheckBox();
    // Pre-Assert
    assertEquals("", cb.getName());

    // Act
    cb.setName("name");

    // Assert
    assertEquals("name", cb.getName());
  }
Beispiel #26
0
  @Test
  public void formValue() {
    // Arrange
    CheckBox cb = new CheckBox();
    // Pre-Assert
    assertEquals("", cb.getFormValue());

    // Act
    cb.setFormValue("whatever");

    // Assert
    assertEquals("whatever", cb.getFormValue());
  }
Beispiel #27
0
  @Test
  public void visible() {
    // Arrange
    CheckBox cb = new CheckBox();
    // Pre-Assert
    assertEquals(true, cb.isVisible());

    // Act
    cb.setVisible(false);

    // Assert
    assertEquals(false, cb.isVisible());
  }
Beispiel #28
0
  @Test
  public void checked() {
    // Arrange
    CheckBox cb = new CheckBox();
    // Pre-Assert
    assertEquals(false, cb.getValue());

    // Act
    cb.setValue(true);

    // Assert
    assertEquals(true, cb.getValue());
  }
Beispiel #29
0
  @Test
  public void text() {
    // Arrange
    CheckBox cb = new CheckBox("foo");
    // Pre-Assert
    assertEquals("foo", cb.getText());

    // Act
    cb.setText("text");

    // Assert
    assertEquals("text", cb.getText());
  }
 private void initCheckBoxes() {
   enableBeforeDragStart.setValue(true);
   enableDragStart.setValue(true);
   enableDrop.setValue(true);
   enableDragStop.setValue(true);
   enableActivateDrop.setValue(true);
   enableDeactivateDrop.setValue(true);
   enableOverDrop.setValue(true);
   enableOutDrop.setValue(true);
   enableDrop.setValue(true);
 }