예제 #1
0
  public void setData(String[] data) {
    final int baseName = 12;
    final int basePrice = baseName + Constants.NO_OF_EXTRAS_IN_UI;
    final int basePriceValue = basePrice + Constants.NO_OF_EXTRAS_IN_UI;
    tbKeyId.setText(data[0]);
    String imageKey = data[1];
    if (imageKey != null) {
      imgItem.setUrl(GWT.getHostPageBaseURL() + "serveBlob?id=" + data[1]);
      imgItem.setVisible(true);
    }
    tbName.setText(data[2]);
    taDescription.setText(data[3]);
    editingExistingData = true;
    if (data[4] != null) {
      rbSinglePrice.setValue(true);
      rbSinglePrice.setFormValue("single");
      dbSinglePrice.setValue(Double.parseDouble(data[basePriceValue]));
    } else {
      rbMultiplePrice.setValue(true);
      rbMultiplePrice.setFormValue("multiple");
      if (data[5] != null) {
        cbSmall.setValue(true);
        dbSmallPrice.setValue(Double.parseDouble(data[basePriceValue + 1]));
      }
      if (data[6] != null) {
        cbMedium.setValue(true);
        dbMediumPrice.setValue(Double.parseDouble(data[basePriceValue + 2]));
      }
      if (data[7] != null) {
        cbLarge.setValue(true);
        dbLargePrice.setValue(Double.parseDouble(data[basePriceValue + 3]));
      }
      if (data[8] != null) {
        cbTapa.setValue(true);
        dbTapaPrice.setValue(Double.parseDouble(data[basePriceValue + 4]));
      }
      if (data[9] != null) {
        cbHalf.setValue(true);
        dbHalfPrice.setValue(Double.parseDouble(data[basePriceValue + 5]));
      }
      if (data[10] != null) {
        cbFull.setValue(true);
        dbFullPrice.setValue(Double.parseDouble(data[basePriceValue + 6]));
      }
    }
    if (data[11] != null) {
      tbExtrasName.setText(data[11]);
    }

    for (int i = 0; i < Constants.NO_OF_EXTRAS_IN_UI; i++) {
      String name = data[baseName + i];
      if (name != null) {
        tbExtras[i].setText(name);
        tbExtrasPrices[i].setText(data[basePrice + i]);
      }
    }
  }
  @Override
  public void onLoad() {

    if (preferences.isKeepTrackofBills()) {
      managingYes.setValue(true);
    } else {
      managingNo.setValue(true);
    }
    // if (preferences.isDoYouKeepTrackOfTime()) {
    // trackingTimeYes.setValue(true);
    // } else {
    // trackingNo.setValue(true);
    // }
  }
예제 #3
0
 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);
     }
   }
 }
 private void resetPanel() {
   player1Box.setSelectedIndex(0);
   player2Box.setSelectedIndex(0);
   sportBox.setSelectedIndex(0);
   oneSet.setValue(true);
   setScoreBoxes(1);
 }
  public CustomizeAlertPanel(
      TenantIdentifier tenant, JobIdentifier job, AlertDefinition alert, JobMetrics result) {
    super();

    _alert = alert;
    metricAnchor = new MetricAnchor(tenant);
    metricAnchor.setJobMetrics(result);
    metricAnchor.setMetric(_alert.getMetricIdentifier());

    initWidget(uiBinder.createAndBindUi(this));

    _severityIntelligenceRadio =
        createRadioButton("alert_severity", "Intelligence", AlertSeverity.INTELLIGENCE);
    _severitySurveillanceRadio =
        createRadioButton("alert_severity", "Surveillance", AlertSeverity.SURVEILLANCE);
    _severityWarningRadio = createRadioButton("alert_severity", "Warning", AlertSeverity.WARNING);
    _severityFatalRadio = createRadioButton("alert_severity", "Fatal", AlertSeverity.FATAL);

    if (getSelectedSeverity() == null) {
      // set default severity
      _severityIntelligenceRadio.setValue(true);
    }

    descriptionTextBox.setText(_alert.getDescription());
    minimumValueTextBox.setNumberValue(_alert.getMinimumValue());
    maximumValueTextBox.setNumberValue(_alert.getMaximumValue());
  }
 private RadioButton createRadioButton(String group, String label, AlertSeverity severity) {
   RadioButton radioButton = new RadioButton(group, label);
   radioButton.addStyleDependentName(severity.toString());
   if (_alert.getSeverity() == severity) {
     radioButton.setValue(true);
   }
   severityPanel.add(radioButton);
   return radioButton;
 }
예제 #7
0
 public void addChoice(String choice) {
   RadioButton button = new RadioButton(groupName, choice);
   if (radioButtons.isEmpty()) {
     // first button in this group
     defaultButton = button;
     button.setValue(true);
   }
   radioButtons.add(button);
   container.add(button);
 }
예제 #8
0
  public void setSelectedValue(K value) {
    RadioButton button = buttons.get(value);

    if (button != null) {
      // Reset old selected radio
      if (buttons.get(getSelectedValue()) != null) {
        buttons.get(getSelectedValue()).setValue(false);
      }

      // Initialize new selected radio
      button.setValue(true);
    }
  }
예제 #9
0
  @Test
  public void checkRadioButton() {
    // Make some radio buttons, all in one group.
    RadioButton rb0 = new RadioButton("myRadioGroup", "foo");
    RadioButton rb1 = new RadioButton("myRadioGroup", "bar");
    RadioButton rb2 = new RadioButton("myRadioGroup", "baz");

    // Check 'baz' by default.
    rb1.setValue(true);

    Assert.assertEquals(false, rb0.getValue());
    Assert.assertEquals(true, rb1.getValue());
    Assert.assertEquals(false, rb2.getValue());
  }
    public EndDatePanel(Date date) {
      final EndDatePanel localThis = this;

      noEndDateRb =
          new RadioButton(END_DATE_RB_GROUP + uniqueInstanceNumber, MSGS.noEndDateLabel());
      noEndDateRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      noEndDateRb.setValue(true);
      add(noEndDateRb);
      HorizontalPanel hp = new HorizontalPanel();
      add(hp);

      HorizontalPanel endByPanel = new HorizontalPanel();
      endByRb = new RadioButton(END_DATE_RB_GROUP + uniqueInstanceNumber, MSGS.endByLabel());
      endByRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      endByPanel.add(endByRb);
      DefaultFormat format = new DefaultFormat(DateTimeFormat.getShortDateFormat());
      endDatePicker = new DatePickerEx(format);
      endDatePicker.getDatePicker().setStyleName(END_DATE_PICKER);
      endDatePicker.getDatePicker().setEnabled(false);
      endByPanel.add(endDatePicker.getDatePicker());
      endByLabel = new ErrorLabel(endByPanel);
      hp.add(endByLabel);

      noEndDateRb.addClickListener(
          new ClickListener() {
            public void onClick(Widget sender) {
              localThis.endDatePicker.getDatePicker().setEnabled(false);
            }
          });

      endByRb.addClickListener(
          new ClickListener() {
            public void onClick(Widget sender) {
              localThis.endDatePicker.getDatePicker().setEnabled(true);
            }
          });
      reset(date);
      configureOnChangeHandler();
    }
예제 #11
0
  @Override
  public void clear() {
    rewardsName.setTitle("");
    /* 增加请选择下拉选项 */
    // rewardsType.setSelectedIndex(0);
    rewardsDefinition.setText("");
    standard.setText("");
    startTime.setValue(null);

    peopleSizeLimit.setValue("");
    frequency = null;
    settingText.setText("");
    autoCbx.setValue(false, true);
    specialCbx.setValue(false, true);
    birthRadio.setValue(false, true);

    // nextPublicTime.setValue(null);
    nextRewardsTime.setValue(null);
    // lastRewardsTime.setText("");
    // 清空设定规则为为设定
    // setIsAmountLevel("未设定");
  }
  public SymptomTreatmentResult(Treatment treatment) {
    Label symptom_name, first_label, second_label;
    FlowPanel firstRowSymptoms;
    final FlowPanel secondRowsSymptoms;
    this.treatments = treatment;
    RadioButton rb0 = new RadioButton("group_" + treatment.getSymptom().toString(), "ustapil");
    RadioButton rb1 = new RadioButton("group_" + treatment.getSymptom().toString(), "nie ustapil");
    RadioButton rb2 = new RadioButton("group_" + treatment.getSymptom().toString(), "nieokreślone");
    FlowPanel radio = new FlowPanel();
    radio.add(rb0);
    radio.add(rb1);
    radio.add(rb2);
    radio.setStyleName("details_label");
    symptom_name = new Label();
    symptom_name.setText(treatment.getSymptom().toString());
    symptom_name.setStyleName("detailsName_label");

    firstRowSymptoms = new FlowPanel();

    firstRowSymptoms.add(symptom_name);
    firstRowSymptoms.add(radio);
    firstRowSymptoms.setStyleName("firstRow");

    first_label = new Label();
    first_label.setText("po");

    second_label = new Label();
    second_label.setText("dniach");
    first_label.setStyleName("details_label_second");
    second_label.setStyleName("details_label_second");

    input = new InputField(null, InputFieldType.NUMBER);
    input.returnContent().setStyleName("details_label_second");
    secondRowsSymptoms = new FlowPanel();
    secondRowsSymptoms.add(first_label);
    secondRowsSymptoms.add(input.returnContent());
    secondRowsSymptoms.add(second_label);
    secondRowsSymptoms.setStyleName("secondRow");

    treatment_object = new FlowPanel();
    treatment_object.add(firstRowSymptoms);
    treatment_object.add(secondRowsSymptoms);
    treatment_object.setStyleName("details");
    if (treatment.getTreatmentStatus().equals(TreatmentStatus.SUCCESSFULL)) {
      rb0.setValue(true);
      secondRowsSymptoms.setVisible(true);
      input.setValue(treatment.getThreatmentLength().toString());
    } else if (treatment.getTreatmentStatus().equals(TreatmentStatus.FAILED)) {
      rb1.setValue(true);
      secondRowsSymptoms.setVisible(false);
    } else if (treatment.getTreatmentStatus().equals(TreatmentStatus.UNKNOWN)) {
      rb2.setValue(true);
      secondRowsSymptoms.setVisible(false);
    } else {
      rb2.setValue(true);
      secondRowsSymptoms.setVisible(true);
    }

    rb0.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            secondRowsSymptoms.setVisible(true);
            treatments.setTreatmentStatus(TreatmentStatus.SUCCESSFULL);
          }
        });
    rb1.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            secondRowsSymptoms.setVisible(false);
            treatments.setTreatmentStatus(TreatmentStatus.FAILED);
          }
        });
    rb2.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            secondRowsSymptoms.setVisible(false);
            treatments.setTreatmentStatus(TreatmentStatus.UNKNOWN);
          }
        });
  }
예제 #13
0
  private Widget makeWordSearch() {
    // Make some radio buttons, all in one group.
    final RadioButton standardRadio = new RadioButton("tipPretrage", "Standardna riječ");
    RadioButton dialectRadio = new RadioButton("tipPretrage", "Dijalektna riječ");
    dialectRadio.setValue(true);

    FlowPanel form = new FlowPanel();
    form.setStyleName("form-search");

    FlowPanel innerForm = new FlowPanel();
    innerForm.setStyleName("inner-form-search");

    HorizontalPanel hp = new HorizontalPanel();
    Label lblRijec = new Label("Riječ:");
    lblRijec.setStyleName("form-label");
    hp.add(lblRijec);
    rijec = new TextBox();
    rijec.setStyleName("search-query");
    hp.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    hp.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    hp.add(rijec);
    innerForm.add(hp);

    HorizontalPanel hpMisto = new HorizontalPanel();
    Label lblMisto = new Label("Lokacija:");
    lblMisto.setStyleName("form-label");
    hpMisto.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    hpMisto.add(lblMisto);
    misto = new TextBox();
    misto.setStyleName("search-query");
    hpMisto.add(misto);
    innerForm.add(hpMisto);

    form.add(innerForm);

    FlowPanel panel = new FlowPanel();
    panel.setStyleName("form-search");
    panel.add(standardRadio);
    panel.add(dialectRadio);
    panel.add(form);

    FlowPanel op = new FlowPanel();
    op.setStyleName("kontrole");
    Button searchBtn =
        new Button(
            "Traži",
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                bartInstance.table.setRowCount(0);
                if (standardRadio.getValue()) {
                  bartInstance.searchWord(rijec.getText(), 0, misto.getText());
                } else {
                  bartInstance.searchDialectWord(rijec.getText(), 0, misto.getText());
                }

                hide();
              }
            });
    op.add(searchBtn);
    Button closeBtn =
        new Button(
            "Odustani",
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                hide();
              }
            });
    op.add(closeBtn);

    searchBtn.setStyleName("btn btn-primary btn-large padded-right");
    closeBtn.setStyleName("btn btn-primary btn-large");

    panel.add(op);

    return panel;
  }
예제 #14
0
  @Override
  public void onModuleLoad() {
    RootPanel root = RootPanel.get("centerDiv");
    root.clear();

    VerticalPanel parent = new VerticalPanel();
    parent.setSize("100%", "100%");
    root.add(parent);

    final FlexTable flexTable = new FlexTable();
    flexTable.setStyleName((String) null);
    flexTable.setText(0, 0, "monetId:");

    final TextBox monetIdTextBox = new TextBox();
    monetIdTextBox.setMaxLength(12);
    monetIdTextBox.setWidth("60px");
    flexTable.setWidget(0, 1, monetIdTextBox);

    flexTable.setText(0, 2, "reason:");

    final TextBox reasonTextBox = new TextBox();
    reasonTextBox.setWidth("100px");
    flexTable.setWidget(0, 3, reasonTextBox);

    flexTable.setText(0, 4, "expire date:");

    VerticalPanel verticalPanel = new VerticalPanel();
    flexTable.setWidget(0, 5, verticalPanel);

    final RadioButton radioButton = new RadioButton("expire", "never expires");
    verticalPanel.add(radioButton);
    radioButton.setValue(true);

    final RadioButton radioButton1 = new RadioButton("expire", "select date");
    verticalPanel.add(radioButton1);

    Button saveButton = new Button("save");
    flexTable.setWidget(0, 6, saveButton);

    parent.add(flexTable);

    final DatePicker datePicker = new DatePicker();
    datePicker.setValue(new Date());
    flexTable.setWidget(1, 0, datePicker);
    flexTable.getFlexCellFormatter().setColSpan(1, 0, 7);
    flexTable.getFlexCellFormatter().setVisible(1, 0, false);
    flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT);

    radioButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            flexTable.getFlexCellFormatter().setVisible(1, 0, false);
          }
        });

    radioButton1.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            flexTable.getFlexCellFormatter().setVisible(1, 0, true);
          }
        });
    saveButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            int monetId = 0;
            try {
              monetId = Integer.parseInt(monetIdTextBox.getText());
            } catch (NumberFormatException e) {
              Window.alert("wrong monetid");
              return;
            }
            String reason = reasonTextBox.getText();
            Date expire = null;
            if (radioButton1.getValue()) {
              expire = datePicker.getValue();
            }
            if (expire != null && expire.getTime() <= System.currentTimeMillis()) {
              Window.alert("Wrong expire date");
              return;
            }

            JSONObject json = new JSONObject();
            json.put("monetId", new JSONNumber(monetId));
            json.put("reason", new JSONString(reason));
            String date = "";
            if (expire != null)
              date = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(expire);
            json.put("expire", new JSONString(date));

            service.add(
                json.toString(),
                new AsyncCallback<String>() {

                  @Override
                  public void onSuccess(String result) {
                    monetIdTextBox.setValue("");
                    reasonTextBox.setValue("");
                    flexTable.getFlexCellFormatter().setVisible(1, 0, false);
                    getList(page, size);
                    Window.alert("add blacklist success");
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    Window.alert("add black list failed");
                  }
                });
          }
        });

    Column<BlackListRowData, Number> monetColumn =
        new Column<BlackListRowData, Number>(new NumberCell()) {
          @Override
          public Number getValue(BlackListRowData object) {
            return object.getMonetId();
          }
        };
    cellTable.addColumn(monetColumn, "monetid");

    TextColumn<BlackListRowData> reasonColumn =
        new TextColumn<BlackListRowData>() {
          @Override
          public String getValue(BlackListRowData object) {
            return object.getReason();
          }
        };
    cellTable.addColumn(reasonColumn, "reason");

    Column<BlackListRowData, Date> expireColum =
        new Column<BlackListRowData, Date>(new DateCell()) {
          @Override
          public Date getValue(BlackListRowData object) {
            return object.getExpire();
          }
        };
    cellTable.addColumn(expireColum, "expire date");

    Column<BlackListRowData, String> opColumn =
        new Column<BlackListRowData, String>(new ButtonCell()) {
          @Override
          public String getValue(BlackListRowData object) {
            return "remove";
          }
        };
    cellTable.addColumn(opColumn, "");
    opColumn.setFieldUpdater(
        new FieldUpdater<BlackListRowData, String>() {
          @Override
          public void update(int index, BlackListRowData object, String value) {
            service.delete(
                object.getMonetId(),
                new AsyncCallback<String>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    Window.alert("remove blacklist failed");
                  }

                  @Override
                  public void onSuccess(String result) {
                    getList(page, size);
                    Window.alert("remove blacklist success");
                  }
                });
          }
        });
    getList(page, size);
    parent.add(cellTable);
  }
  private void populatePanel() {
    player1Box = new ListBox(false);
    populatePlayerBox(player1Box);
    Label vsLabel = new Label(" spelade mot ");
    player2Box = new ListBox(false);
    populatePlayerBox(player2Box);
    HorizontalPanel playerPanel = Spelstegen.createStandardHorizontalPanel();
    playerPanel.add(player1Box);
    playerPanel.add(vsLabel);
    playerPanel.add(player2Box);

    sportBox = new ListBox(false);
    if (league.getSports().size() > 1) {
      sportBox.addItem("Välj sport");
      for (Sport sport : league.getSports()) {
        sportBox.addItem(sport.getName());
      }
    } else {
      sportBox.addItem(league.getSports().get(0).getName());
      sportBox.setEnabled(false);
    }

    HorizontalPanel sportPanel = Spelstegen.createStandardHorizontalPanel();
    sportPanel.add(new Label("i:"));
    sportPanel.add(sportBox);

    Label setLabel = new Label("Spel om bäst av");
    oneSet = new RadioButton("setSelection", "1");
    threeSet = new RadioButton("setSelection", "3");
    fiveSet = new RadioButton("setSelection", "5");
    oneSet.setValue(true);
    SetClickHandler setClickHandler = new SetClickHandler();
    oneSet.addClickHandler(setClickHandler);
    threeSet.addClickHandler(setClickHandler);
    fiveSet.addClickHandler(setClickHandler);
    Label setLabel2 = new Label(" set");
    HorizontalPanel setPanel = Spelstegen.createStandardHorizontalPanel();
    setPanel.add(setLabel);
    setPanel.add(oneSet);
    setPanel.add(threeSet);
    setPanel.add(fiveSet);
    setPanel.add(setLabel2);

    player1Score = new ArrayList<TextBox>(5);
    player2Score = new ArrayList<TextBox>(5);
    scorePanel = new VerticalPanel();
    scorePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    setScoreBoxes(1);

    saveButton = new PushButton("Spara");
    if (loggedInPlayer != null) {
      saveButton.setEnabled(loggedInPlayer.isLeagueAdmin(league.getId()));
    }
    saveButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            submitMatch();
          }
        });

    HorizontalPanel buttonPanel = Spelstegen.createStandardHorizontalPanel();
    buttonPanel.add(saveButton);
    mainPanel.add(playerPanel);
    mainPanel.add(sportPanel);
    mainPanel.add(setPanel);
    mainPanel.add(scorePanel);
    mainPanel.add(buttonPanel);
  }
예제 #16
0
파일: Table.java 프로젝트: dematey/ephesoft
  private void update(boolean isRadioButton, int startIndex, int selectedIndexlocal) {
    selectedRowId = null;
    flexTable.removeAllRows();
    navBarTable.removeAllRows();
    createTableHeader(isRadioButton);
    int count = totalCount;
    int max = startIndex + visibleRecodrCount;
    if (max > count) {
      max = count;
    }
    navBar.update(startIndex, count, max);
    setNavigationBar();
    TableHeader header = tableData.getHeader();
    HeaderColumn[] columns = header.getHeaderColumns();
    String width = null;
    int rowCounter = 0;
    String radioName = String.valueOf(new Date().getTime());
    final List<Record> recordList = tableData.getRecordList();
    if (recordList != null) {
      if (!recordList.isEmpty()) {
        for (final Record record : recordList) {
          int colCounter = 0;
          for (; colCounter < columns.length; colCounter++) {
            width = columns[colCounter].getWidth() + "%";
            flexTable.getCellFormatter().setWidth(rowCounter, colCounter, width);
            flexTable.setWidget(rowCounter, colCounter, record.getWidget(columns[colCounter]));
            flexTable
                .getCellFormatter()
                .setHorizontalAlignment(rowCounter, colCounter, HasHorizontalAlignment.ALIGN_LEFT);
            flexTable.getCellFormatter().setWordWrap(rowCounter, colCounter, true);
            flexTable.getCellFormatter().addStyleName(rowCounter, colCounter, "wordWrap");
          }
          if (isRadioButton) {
            final RadioButton radioButton = new RadioButton(radioName);
            if (rowCounter == selectedIndexlocal) {
              radioButton.setValue(true);
              selectedRowId = record.getIdentifier();
              selectedIndex = rowCounter;
              if (null != listner && fireEventForFirstRow) {
                listner.onRowSelected(selectedRowId);
              }

              scrollIntoView(
                  flexTable.getWidget(selectedIndexlocal, FIRST_COLUMN_INDEX).getElement());
            }
            radioButton.addClickHandler(
                new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent arg0) {
                    clearRadioButtons();
                    radioButton.setValue(true);
                    selectedRowId = record.getIdentifier();
                    selectedIndex = recordList.indexOf(record);
                  }
                });
            flexTable.setWidget(rowCounter, 0, radioButton);
            RadioButtonContainer radioButtonContainer =
                new RadioButtonContainer(radioButton, record.getIdentifier());
            radioButtons.put(rowCounter, radioButtonContainer);
            flexTable
                .getCellFormatter()
                .setHorizontalAlignment(rowCounter, 0, HasHorizontalAlignment.ALIGN_CENTER);

            radioButton.addFocusHandler(
                new FocusHandler() {

                  @Override
                  public void onFocus(FocusEvent arg0) {
                    removeSelectedRowStyleFromTable();
                    for (Integer rowId : radioButtons.keySet()) {
                      if (radioButtons.get(rowId).getRadioButton().equals(radioButton)) {
                        selectedIndex = recordList.indexOf(record);
                        flexTable
                            .getRowFormatter()
                            .addStyleName(rowId, selectionStyle.rowHighlighted());
                      }
                    }
                  }
                });
          } else {
            RadioButtonContainer radioButtonContainer =
                new RadioButtonContainer(null, record.getIdentifier());
            radioButtons.put(rowCounter, radioButtonContainer);
          }
          if (rowCounter % 2 == 0) {
            flexTable.getRowFormatter().setStyleName(rowCounter, selectionStyle.oddRow());
          } else {
            flexTable.getRowFormatter().setStyleName(rowCounter, selectionStyle.evenRow());
          }
          rowCounter++;
          flexTable
              .getRowFormatter()
              .addStyleName(selectedIndexlocal, selectionStyle.rowHighlighted());
        }
      } else {
        Label label = new Label();
        label.setWidth("100%");
        label.setText("No record found.");
        flexTable.getCellFormatter().setWidth(1, 0, "100%");
        flexTable.getFlexCellFormatter().setColSpan(1, 0, 3);
        // Record record = new Record("1");
        // tableData.getRecordList().add(record);
        flexTable.setWidget(1, 0, label);
      }
    }
  }
 /** {@inheritDoc} */
 @Override
 public void setMixMode(boolean isMix) {
   mixed.setValue(isMix);
 }
예제 #18
0
  public PackageBuilderWidget(final PackageConfigData conf, ClientFactory clientFactory) {

    this.conf = conf;
    this.clientFactory = clientFactory;

    // UI above the results table
    FormStyleLayout layout = new FormStyleLayout();
    final VerticalPanel container = new VerticalPanel();
    final VerticalPanel buildResults = new VerticalPanel();

    RadioButton wholePackageRadioButton = new RadioButton("action", constants.BuildWholePackage());
    RadioButton builtInSelectorRadioButton =
        new RadioButton("action", constants.BuildPackageUsingBuiltInSelector());
    RadioButton customSelectorRadioButton =
        new RadioButton("action", constants.BuildPackageUsingCustomSelector());
    wholePackageRadioButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            buildWholePackageLayout.setVisible(true);
            builtInSelectorLayout.setVisible(false);
            customSelectorLayout.setVisible(false);
            buildMode = "buildWholePackage";
          }
        });
    builtInSelectorRadioButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            buildWholePackageLayout.setVisible(false);
            builtInSelectorLayout.setVisible(true);
            customSelectorLayout.setVisible(false);
            buildMode = "BuiltInSelector";
          }
        });
    customSelectorRadioButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            buildWholePackageLayout.setVisible(false);
            builtInSelectorLayout.setVisible(false);
            customSelectorLayout.setVisible(true);
            buildMode = "customSelector";
          }
        });

    VerticalPanel verticalPanel = new VerticalPanel();

    HorizontalPanel wholePackageRadioButtonPanel = new HorizontalPanel();
    wholePackageRadioButtonPanel.add(wholePackageRadioButton);
    wholePackageRadioButtonPanel.add(
        new InfoPopup(constants.BuildWholePackage(), constants.BuildWholePackageTip()));
    verticalPanel.add(wholePackageRadioButtonPanel);

    HorizontalPanel builtInSelectorRadioButtonPanel = new HorizontalPanel();
    builtInSelectorRadioButtonPanel.add(builtInSelectorRadioButton);
    builtInSelectorRadioButtonPanel.add(
        new InfoPopup(constants.BuiltInSelector(), constants.BuiltInSelectorTip()));
    verticalPanel.add(builtInSelectorRadioButtonPanel);

    HorizontalPanel customSelectorRadioButtonPanel = new HorizontalPanel();
    customSelectorRadioButtonPanel.add(customSelectorRadioButton);
    customSelectorRadioButtonPanel.add(
        new InfoPopup(constants.CustomSelector(), constants.SelectorTip()));
    verticalPanel.add(customSelectorRadioButtonPanel);

    layout.addAttribute("", verticalPanel);
    wholePackageRadioButton.setValue(true);

    buildWholePackageLayout.setVisible(true);
    builtInSelectorLayout.setVisible(false);
    customSelectorLayout.setVisible(false);

    // Build whole package layout
    layout.addRow(buildWholePackageLayout);

    // Built-in selector layout
    builtInSelectorLayout.addRow(
        new HTML("&nbsp;&nbsp;<i>" + constants.BuildPackageUsingFollowingAssets() + "</i>"));

    HorizontalPanel builtInSelectorStatusPanel = new HorizontalPanel();
    final CheckBox enableStatusCheckBox = new CheckBox();
    enableStatusCheckBox.setValue(false);
    builtInSelectorStatusPanel.add(enableStatusCheckBox);
    builtInSelectorStatusPanel.add(
        new HTML("&nbsp;&nbsp;<i>" + constants.BuildPackageUsingBuiltInSelectorStatus() + " </i>"));
    final ListBox statusOperator = new ListBox();
    String[] vals = new String[] {"=", "!="};
    for (int i = 0; i < vals.length; i++) {
      statusOperator.addItem(vals[i], vals[i]);
    }
    builtInSelectorStatusPanel.add(statusOperator);

    final TextBox statusValue = new TextBox();
    statusValue.setTitle(constants.WildCardsSearchTip());
    builtInSelectorStatusPanel.add(statusValue);

    builtInSelectorLayout.addRow(builtInSelectorStatusPanel);

    HorizontalPanel builtInSelectorCatPanel = new HorizontalPanel();
    final CheckBox enableCategoryCheckBox = new CheckBox();
    enableCategoryCheckBox.setValue(false);
    builtInSelectorCatPanel.add(enableCategoryCheckBox);
    builtInSelectorCatPanel.add(
        new HTML("&nbsp;&nbsp;<i>" + constants.BuildPackageUsingBuiltInSelectorCat() + " </i>"));
    final ListBox catOperator = new ListBox();
    String[] catVals = new String[] {"=", "!="};
    for (int i = 0; i < catVals.length; i++) {
      catOperator.addItem(catVals[i], catVals[i]);
    }
    builtInSelectorCatPanel.add(catOperator);
    final CategoryExplorerWidget catChooser =
        new CategoryExplorerWidget(
            new CategorySelectHandler() {
              public void selected(String selectedPath) {}
            });
    ScrollPanel catScroll = new ScrollPanel(catChooser);
    catScroll.setAlwaysShowScrollBars(true);
    catScroll.setSize("300px", "130px");

    builtInSelectorCatPanel.add(catScroll);
    builtInSelectorLayout.addRow(builtInSelectorCatPanel);

    layout.addRow(builtInSelectorLayout);

    // Custom selector layout
    customSelectorLayout.setVisible(false);
    HorizontalPanel customSelectorPanel = new HorizontalPanel();
    customSelectorPanel.add(
        new HTML(
            "&nbsp;&nbsp;<i>"
                + constants.BuildPackageUsingCustomSelectorSelector()
                + " </i>")); // NON-NLS

    final ListBox customSelector = new ListBox();
    customSelector.setTitle(constants.WildCardsSearchTip());
    customSelectorPanel.add(customSelector);
    loadCustomSelectorList(customSelector);

    customSelectorLayout.addRow(customSelectorPanel);
    layout.addRow(customSelectorLayout);

    final Button b = new Button(constants.BuildPackage());
    b.setTitle(constants.ThisWillValidateAndCompileAllTheAssetsInAPackage());
    b.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            doBuild(
                buildResults,
                statusOperator.getValue(statusOperator.getSelectedIndex()),
                statusValue.getText(),
                enableStatusCheckBox.getValue(),
                catOperator.getValue(catOperator.getSelectedIndex()),
                catChooser.getSelectedPath(),
                enableCategoryCheckBox.getValue(),
                customSelector.getSelectedIndex() != -1
                    ? customSelector.getValue(customSelector.getSelectedIndex())
                    : null);
          }
        });
    HorizontalPanel buildStuff = new HorizontalPanel();
    buildStuff.add(b);

    layout.addAttribute(constants.BuildBinaryPackage(), buildStuff);
    layout.addRow(
        new HTML("<i><small>" + constants.BuildingPackageNote() + "</small></i>")); // NON-NLS
    container.add(layout);

    // The build results
    container.add(buildResults);

    // UI below the results table
    layout = new FormStyleLayout();
    Button snap = new Button(constants.CreateSnapshotForDeployment());
    snap.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            showSnapshotDialog(conf.getName(), null);
          }
        });
    layout.addAttribute(constants.TakeSnapshot(), snap);
    container.add(layout);

    initWidget(container);
  }
예제 #19
0
  public void synchUI() {

    if (!initialized) { // do late
      initialize();
      initialized = true;
    }
    LogUtils.log(
        "sync:pos:"
            + PoseEditor.poseEditor.getRootPositionXRange()
            + ","
            + PoseEditor.poseEditor.getRootPositionYRange()
            + ","
            + PoseEditor.poseEditor.getCameraZ());

    // gif-panel
    backgroundCheck.setValue(isGifShowBackground());
    boneCheck.setValue(isGifShowBone());
    ikCheck.setValue(isGifShowIk());

    int screenshottype = getScreenshotBackgroundType();
    if (screenshottype == 0) {
      screenshotTransparentBt.setValue(true);
    } else if (screenshottype == 1) {
      screenshotColorBt.setValue(true);
      String scvalue = getScreenshotBackgroundValue();
      screenshotColorBox.setValue(scvalue);
    }

    lastBgImage = bgImage; // store for cancel
    lastBgLabel = bgImageLabel.getText();

    int bgType = storageControler.getValue(KEY_GIF_BG_TYPE, 1); // sadlly transparent not support
    String bgValue = storageControler.getValue(KEY_GIF_BG_VALUE, "#000000");

    LogUtils.log(bgType + "," + bgValue);

    if (bgType == 0) {
      transparentBt.setValue(true);
    } else if (bgType == 1) {
      colorBt.setValue(true);
      colorBox.setValue(bgValue);
    } else if (bgType == 2) {
      imageBt.setValue(true);
    }

    widthBox.setValue(Math.max(1, getGifWidth()));
    heightBox.setValue(Math.max(1, getGifHeight()));

    qualityBox.setValue(getGifQuality());
    speedBox.setValue(getGifSpeed());

    // keep value before set,if change value listener change others.
    int x = PoseEditor.poseEditor.getRootPositionXRange();
    int y = PoseEditor.poseEditor.getRootPositionYRange();
    int z = (int) (PoseEditor.poseEditor.getCameraZ() * 10);

    settingPositionXRange.setValue(x);
    settingPositionYRange.setValue(y);
    settingPositionZRange.setValue(z);

    lastRangeX = x;
    lastRangeY = y;
    lastRangeZ = z;

    updateCanvasSize();

    updatePreviewCanvas();
  }
 /** {@inheritDoc} */
 @Override
 public void setSoftMode(boolean isSoft) {
   soft.setValue(isSoft);
 }
 public void setEndBy() {
   noEndDateRb.setValue(false);
   endByRb.setValue(true);
   endDatePicker.getDatePicker().setEnabled(true);
 }
예제 #22
0
  public ColorPicker() {
    // UI Drawing
    // ------------------

    hue = 0;
    saturation = 100;
    brightness = 100;
    red = 255;
    green = 0;
    blue = 0;

    HorizontalPanel panel = new HorizontalPanel();
    FlexTable table = new FlexTable();

    // Add the large slider map
    slidermap = new SliderMap(this);
    panel.add(slidermap);
    panel.setCellWidth(slidermap, "258px");
    panel.setCellHeight(slidermap, "258px");

    // Add the small slider bar
    sliderbar = new SliderBar(this);
    panel.add(sliderbar);
    panel.setCellWidth(sliderbar, "40px");
    panel.setCellHeight(sliderbar, "258px");

    // Define the Flextable's content
    // Color preview at the top
    colorpreview = new HTML("");
    colorpreview.setWidth("50px");
    colorpreview.setHeight("50px");
    DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black");

    // Radio buttons
    rbHue = new RadioButton("color", "H:");
    rbHue.addClickHandler(this);
    rbSaturation = new RadioButton("color", "S:");
    rbSaturation.addClickHandler(this);
    rbBrightness = new RadioButton("color", "V:");
    rbBrightness.addClickHandler(this);
    rbRed = new RadioButton("color", "R:");
    rbRed.addClickHandler(this);
    rbGreen = new RadioButton("color", "G:");
    rbGreen.addClickHandler(this);
    rbBlue = new RadioButton("color", "B:");
    rbBlue.addClickHandler(this);

    // Textboxes
    tbHue = new TextBox();
    tbHue.setText(new Integer(hue).toString());
    tbHue.setMaxLength(3);
    tbHue.setVisibleLength(4);
    tbHue.addKeyPressHandler(this);
    tbHue.addChangeHandler(this);
    tbSaturation = new TextBox();
    tbSaturation.setText(new Integer(saturation).toString());
    tbSaturation.setMaxLength(3);
    tbSaturation.setVisibleLength(4);
    tbSaturation.addKeyPressHandler(this);
    tbSaturation.addChangeHandler(this);
    tbBrightness = new TextBox();
    tbBrightness.setText(new Integer(brightness).toString());
    tbBrightness.setMaxLength(3);
    tbBrightness.setVisibleLength(4);
    tbBrightness.addKeyPressHandler(this);
    tbBrightness.addChangeHandler(this);
    tbRed = new TextBox();
    tbRed.setText(new Integer(red).toString());
    tbRed.setMaxLength(3);
    tbRed.setVisibleLength(4);
    tbRed.addKeyPressHandler(this);
    tbRed.addChangeHandler(this);
    tbGreen = new TextBox();
    tbGreen.setText(new Integer(green).toString());
    tbGreen.setMaxLength(3);
    tbGreen.setVisibleLength(4);
    tbGreen.addKeyPressHandler(this);
    tbGreen.addChangeHandler(this);
    tbBlue = new TextBox();
    tbBlue.setText(new Integer(blue).toString());
    tbBlue.setMaxLength(3);
    tbBlue.setVisibleLength(4);
    tbBlue.addKeyPressHandler(this);
    tbBlue.addChangeHandler(this);
    tbHexColor = new TextBox();
    tbHexColor.setText("ff0000");
    tbHexColor.setMaxLength(6);
    tbHexColor.setVisibleLength(6);
    tbHexColor.addKeyPressHandler(this);
    tbHexColor.addChangeHandler(this);

    // Put together the FlexTable
    table.setWidget(0, 0, colorpreview);
    table.getFlexCellFormatter().setColSpan(0, 0, 3);
    table.setWidget(1, 0, rbHue);
    table.setWidget(1, 1, tbHue);
    table.setWidget(1, 2, new HTML("&deg;"));
    table.setWidget(2, 0, rbSaturation);
    table.setWidget(2, 1, tbSaturation);
    table.setText(2, 2, "%");
    table.setWidget(3, 0, rbBrightness);
    table.setWidget(3, 1, tbBrightness);
    table.setText(3, 2, "%");
    table.setWidget(4, 0, rbRed);
    table.setWidget(4, 1, tbRed);
    table.setWidget(5, 0, rbGreen);
    table.setWidget(5, 1, tbGreen);
    table.setWidget(6, 0, rbBlue);
    table.setWidget(6, 1, tbBlue);
    table.setText(7, 0, "#:");
    table.setWidget(7, 1, tbHexColor);
    table.getFlexCellFormatter().setColSpan(7, 1, 2);

    // Final setup
    panel.add(table);
    rbSaturation.setValue(true);
    setPreview("ff0000");
    DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default");

    // First event
    onClick(rbSaturation);

    initWidget(panel);
  }
예제 #23
0
  public NewPackageWizard(ClientFactory clientFactory, EventBus eventBus) {
    super(images.newexWiz(), constants.CreateANewPackage());
    this.eventBus = eventBus;
    nameBox = new TextBox();
    descBox = new TextBox();

    newPackageLayout.addAttribute(constants.NameColon(), nameBox);
    newPackageLayout.addAttribute(constants.DescriptionColon(), descBox);

    nameBox.setTitle(constants.PackageNameTip());

    RadioButton newPackage = new RadioButton("action", constants.CreateNewPackageRadio());
    RadioButton importPackage = new RadioButton("action", constants.ImportFromDrlRadio());

    newPackage.setValue(true);
    newPackageLayout.setVisible(true);

    newPackage.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent arg0) {
            newPackageLayout.setVisible(true);
            importLayout.setVisible(false);
          }
        });

    this.setAfterShow(
        new Command() {
          public void execute() {
            nameBox.setFocus(true);
          }
        });

    importLayout.setVisible(false);
    importPackage.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent arg0) {
            newPackageLayout.setVisible(false);
            importLayout.setVisible(true);
          }
        });

    VerticalPanel ab = new VerticalPanel();
    ab.add(newPackage);
    ab.add(importPackage);
    addAttribute("", ab);

    addRow(newPackageLayout);
    addRow(importLayout);

    importLayout.addAttribute(constants.DRLFileToImport(), newImportWidget(this));

    importLayout.addRow(new HTML("<br/><b>" + constants.NoteNewPackageDrlImportWarning() + "</b>"));
    importLayout.addRow(new HTML(constants.ImportDRLDesc1()));
    importLayout.addRow(new HTML(constants.ImportDRLDesc2()));
    importLayout.addRow(new HTML(constants.ImportDRLDesc3()));

    HorizontalPanel hp = new HorizontalPanel();
    Button create = new Button(constants.CreatePackage());
    create.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent arg0) {
            if (PackageNameValidator.validatePackageName(nameBox.getText())) {
              createPackageAction(nameBox.getText(), descBox.getText());
              hide();
            } else {
              nameBox.setText("");
              Window.alert(constants.PackageNameCorrectHint());
            }
          }
        });
    hp.add(create);

    Button cancel = new Button(constants.Cancel());
    cancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent arg0) {
            hide();
          }
        });
    hp.add(cancel);

    newPackageLayout.addAttribute("", hp);
  }
예제 #24
0
  public void showRewardsItem(RewardsItemClient rewardsItem, boolean isItemStore) {
    if (rewardsItem.getFrequency() != null) {
      // 显示出下次颁奖时间
      nextRewardsTime
          .getElement()
          .getParentElement()
          .getParentElement()
          .removeClassName(CssStyleConstants.hidden);
      // 把开始时间设成只读
      // startTime.setEnabled(false);

    }
    if (isItemStore == false) { // 维护按钮的状态
      saveStore.setVisible(false);
      backStore.setVisible(false);
      save.setVisible(true);
      back.setVisible(true);
    } else {
      backStore.setVisible(true);
      saveStore.setVisible(true);
      save.setVisible(false);
      back.setVisible(false);
    }
    rewardsName.setText(rewardsItem.getName());
    rewardsDefinition.setText(rewardsItem.getDefinition());
    standard.setText(rewardsItem.getStandard());
    rewardsUnit = rewardsItem.getRewardsUnit();

    showJudgeInfo(rewardsItem); // 显示要修改的提名人
    startTime.setValue(rewardsItem.getStartTime());
    nextRewardsTime.setValue(rewardsItem.getNextTime());
    nextPublicTime.setValue(rewardsItem.getNextPublishTime());
    peopleSizeLimit.setValue(StringUtil.valueOf(rewardsItem.getSizeLimit()));
    rewardsFrom.setValue(StringUtil.valueOf(rewardsItem.getRewardsFrom()));
    tmday.setValue(StringUtil.valueOf(rewardsItem.getTmdays()));
    tmdays.setValue(StringUtil.valueOf(rewardsItem.getTmdays()));
    totalJF.setValue(StringUtil.valueOf(rewardsItem.getTotalJF()));
    expectTime.setValue(rewardsItem.getNextTime());
    nextPublicTime.setValue(rewardsItem.getNextPublishTime());
    showFrequencyInfo(rewardsItem.getFrequency());
    autoCbx.setValue(rewardsItem.isAuto(), true);
    if (rewardsItem.isAuto() == false) // 隐藏提名
    chooseBtns
          .getElement()
          .getParentElement()
          .getParentElement()
          .removeClassName(CssStyleConstants.hidden);
    else
      chooseBtns
          .getElement()
          .getParentElement()
          .getParentElement()
          .addClassName(CssStyleConstants.hidden);
    specialCbx.setValue(rewardsItem.isHasSpecialCondition(), true);
    if (SpecialCondition.birth == rewardsItem.getCondition()) {
      birthRadio.setValue(true);
    } else {
      birthRadio.setValue(false);
    }
    if (rewardsItem.isPeriodEnable() == true) {
      moretimes.setValue(true, true);
    } else {
      onetimes.setValue(true, true);
    }
  }
 /** {@inheritDoc} */
 @Override
 public void setHardMode(boolean isHard) {
   hard.setValue(isHard);
 }
예제 #26
0
  public AddNewModuleDialog(
      final ApplicationModel model,
      final List<String> types,
      final NewModuleCreatedCallback callback,
      final Context errorDisplay) {
    super(false, true);
    okButton = new Button("Ok");
    okButton.addStyleName("btn");
    cancelButton = new Button("Cancel");
    okButton.addStyleName("btn");

    this.errorDisplay = errorDisplay;
    setTitle("Add new module");

    final Panel radioPanel = new HorizontalPanel();

    {
      final Panel daemonPanel;
      daemonPanel = new VerticalPanel();
      boolean wasChecked = false;
      for (final DaemonModel daemonModel : model.getDaemons()) {
        final RadioButton radio =
            new RadioButton("daemonRadioGroup", "Add to " + daemonModel.getName() + " daemon.");
        if (!wasChecked) {
          radio.setValue(true);
          wasChecked = true;
        }
        daemonPanel.add(radio);
        daemonRadios.put(daemonModel, radio);
      }

      if (daemonRadios.size() > 1) {
        radioPanel.add(daemonPanel);
      }
    }

    {
      final Panel typePanel = new VerticalPanel();
      boolean wasChecked = false;
      for (final String type : types) {
        if (!UiBuilderClient.NONE_TYPE.equals(type)) {
          final RadioButton radio =
              new RadioButton("typeRadioGroup", "Create " + type + " module.");
          if (!wasChecked) {
            radio.setValue(true);
            wasChecked = true;
          }
          typePanel.add(radio);
          typeRadios.put(type, radio);
        }
      }

      if (typeRadios.size() > 1) {
        radioPanel.add(typePanel);
      }
    }

    // If the user has no choice, just do the job
    if (skipDisplay()) {
      okClicked(callback);
      return;
    }

    final Panel buttonPanel = new HorizontalPanel();
    buttonPanel.add(okButton);
    buttonPanel.add(cancelButton);

    okButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(final ClickEvent event) {
            okClicked(callback);
          }
        });

    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(final ClickEvent event) {
            hide();
          }
        });

    final Panel allPanel = new VerticalPanel();
    allPanel.add(radioPanel);
    allPanel.add(buttonPanel);
    add(allPanel);
  }
예제 #27
0
 public void reset() {
   if (defaultButton != null) {
     defaultButton.setValue(true);
   }
 }