private void checkVisibility() {
   if (compList.getSelectedIndex() == 0) {
     srcLangList.setVisible(false);
     trgLangList.setVisible(false);
     srcLangLabel.setVisible(false);
     trgLangLabel.setVisible(false);
     settingsPanel.setWidth("180px");
   } else {
     srcLangList.setVisible(true);
     trgLangList.setVisible(true);
     srcLangLabel.setVisible(true);
     trgLangLabel.setVisible(true);
     settingsPanel.setWidth("450px");
   }
 }
Example #2
0
 @Test
 public void checkVisible() {
   ListBox listBox = new ListBox(false);
   Assert.assertEquals(true, listBox.isVisible());
   listBox.setVisible(false);
   Assert.assertEquals(false, listBox.isVisible());
 }
  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);
    }
  }
Example #4
0
  @Override
  public void init() {
    initWidget(uiBinder.createAndBindUi(this));

    boundWidgets =
        new Widget[] {
          starsListBox, extraTextBox, extraListBox, number, name, length, grade, text, fa
        };

    starsListBox.addItem("");
    starsListBox.addItem("*");
    starsListBox.addItem("**");
    starsListBox.addItem("***");

    type = ((XmlSimpleModel) this.getModel()).getXml().getNodeName();

    if (type.equals("climb")) extraListBox.setVisible(false);
    else {
      WidgetUtil.setVisible(lengthSpan, false);
      extraTextBox.setVisible(false);

      extraListBox.addItem("");
      extraListBox.addItem("(SDS)");
      extraListBox.addItem("(Stand)");
      extraListBox.addItem("(Hang)");
      extraListBox.addItem("(Highball)");
      extraListBox.addItem("(Highball, Stand)");
      extraListBox.addItem("(Highball, SDS)");
    }

    super.init();
  }
  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);
    }
  }
Example #6
0
  @Override
  public void onPlaceChange(PlaceChangeEvent event) {
    Place newPlace = event.getNewPlace();

    // select the link corresponding to the place
    for (Link link : links) {
      if (link.isPlaceMatchLink(newPlace)) {
        link.getLink().addStyleName(res.style().menuLinkSelected());
      } else {
        link.getLink().removeStyleName(res.style().menuLinkSelected());
      }
    }

    // clear the source list because we are going to update it with the raw source file
    // corresponding to the new
    // place
    sourceList.clear();

    if (newPlace instanceof PlaceWithSources) {
      exampleLink.setVisible(true);
      sourceLink.setVisible(true);

      PlaceWithSources<?> place = (PlaceWithSources<?>) newPlace;

      sourceList.addItem("Example", place.getSourceFilename());

      String[] rawFilenames = place.getRawSourceFilenames();

      if (null != rawFilenames && rawFilenames.length > 0) {
        // add the raw source files to the list and show the list
        String text = sourceLink.getText();
        if (!text.endsWith(":")) {
          sourceLink.setText(text + ":");
        }
        sourceList.setVisible(true);
        int indexRawSource = 0;
        // starting at 1 because the first item is the example
        int i = 1;
        for (String filename : rawFilenames) {
          sourceList.addItem(filename, filename);
          if (place.isRawSource() && filename.equals(place.getFilename())) {
            indexRawSource = i;
          }
          i++;
        }
        sourceList.setSelectedIndex(indexRawSource);
      } else {
        // no raw source file, we hide the list
        String text = sourceLink.getText();
        if (text.endsWith(":")) {
          sourceLink.setText(text.substring(0, text.length() - 1));
        }
        sourceList.setVisible(false);
      }

      if (null == place.getFilename()) {
        sourceLink.removeStyleName(res.style().sourceLinkSelected());
        exampleLink.addStyleName(res.style().sourceLinkSelected());
        container.getElement().getStyle().clearBackgroundColor();
        container.getElement().getStyle().clearProperty("border");
      } else {
        exampleLink.removeStyleName(res.style().sourceLinkSelected());
        sourceLink.addStyleName(res.style().sourceLinkSelected());
        container.getElement().getStyle().setBackgroundColor("#eee");
        container.getElement().getStyle().setProperty("border", "1px solid #c3c3c3");
      }
    } else {
      // should not happen
      exampleLink.setVisible(false);
      sourceLink.setVisible(false);
      sourceList.setVisible(false);
    }
  }
Example #7
0
  public DialogCarma(KarmaHome home, KarmaUser user) {
    super(false, true);
    this.homeParent = home;
    this.user = user;

    setHTML(CONSTANTS.this_html());

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(verticalPanel);
    verticalPanel.setWidth("100%");

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(5);
    verticalPanel.add(horizontalPanel);
    horizontalPanel.setWidth("100%");

    VerticalPanel verticalPanel_2 = new VerticalPanel();
    horizontalPanel.add(verticalPanel_2);
    verticalPanel_2.setSize("260", "110");

    Grid grid_1 = new Grid(3, 2);
    verticalPanel_2.add(grid_1);
    grid_1.setSize("", "100");

    Label label_10 = new Label(CONSTANTS.label_10_text());
    grid_1.setWidget(0, 0, label_10);
    grid_1.getCellFormatter().setWidth(0, 0, "100");

    listTypes = new ListBox();
    grid_1.setWidget(0, 1, listTypes);
    grid_1.getCellFormatter().setWidth(0, 1, "150");
    listTypes.setWidth("100%");
    ClientUtils.fillTypes(listTypes);

    Label label_11 = new Label(CONSTANTS.label_11_text());
    grid_1.setWidget(1, 0, label_11);

    tbPlate = new TextBox();
    tbPlate.setVisibleLength(10);
    grid_1.setWidget(1, 1, tbPlate);
    tbPlate.setWidth("100%");

    cbxForeign = new CheckBox(CONSTANTS.cbxForeign_text());
    grid_1.setWidget(2, 0, cbxForeign);
    cbxForeign.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            showCountries();
          }
        });

    listCountry = new ListBox();
    grid_1.setWidget(2, 1, listCountry);
    listCountry.setWidth("100%");
    listCountry.setVisible(false);
    ClientUtils.fillCountries(listCountry);

    VerticalPanel verticalPanel_6 = new VerticalPanel();
    horizontalPanel.add(verticalPanel_6);
    verticalPanel_6.setSize("260", "110");

    Grid grid_2 = new Grid(3, 2);
    verticalPanel_6.add(grid_2);
    grid_2.setSize("", "100");

    Label label_15 = new Label(CONSTANTS.label_15_text());
    grid_2.setWidget(0, 0, label_15);
    grid_2.getCellFormatter().setWidth(0, 0, "50");

    date = new DateBox();
    date.setFormat(new DefaultFormat(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm")));
    grid_2.setWidget(0, 1, date);
    grid_2.getCellFormatter().setWidth(0, 1, "200");
    date.setWidth("100%");
    date.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          @Override
          public void onValueChange(ValueChangeEvent<Date> event) {
            Date d = event.getValue();
            if (d.after(new Date())
                || d.before(new Date(System.currentTimeMillis() - 31536000000L))) {
              date.setValue(new Date());
              MsgMan.getInstance().showError(CONSTANTS.error_date1(), date);
            }
          }
        });

    Label label_16 = new Label(CONSTANTS.label_16_text());
    grid_2.setWidget(1, 0, label_16);

    taNotes = new TextArea();
    taNotes.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            updateCounter();
          }
        });
    taNotes.setSize("100%", "50");
    grid_2.setWidget(1, 1, taNotes);

    lblCounter = new Label("New label");
    lblCounter.addStyleName("counter");
    grid_2.setWidget(2, 1, lblCounter);
    grid_2.getCellFormatter().setHorizontalAlignment(2, 1, HasHorizontalAlignment.ALIGN_RIGHT);

    HorizontalPanel horizontalPanel_3 = new HorizontalPanel();
    horizontalPanel_3.setSpacing(5);
    horizontalPanel_3.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    verticalPanel.add(horizontalPanel_3);
    verticalPanel.setCellHorizontalAlignment(
        horizontalPanel_3, HasHorizontalAlignment.ALIGN_CENTER);

    btnPuntuar = new Button("New button");
    horizontalPanel_3.add(btnPuntuar);
    btnPuntuar.setText(CONSTANTS.btnPuntuar_text());
    btnPuntuar.setWidth("100");

    Button btnCancel = new Button("New button");
    horizontalPanel_3.add(btnCancel);
    btnCancel.setText(CONSTANTS.btnCancel_text());
    btnCancel.setWidth("100");
    btnPuntuar.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            makeKarma();
          }
        });
    btnCancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            DialogCarma.this.hide();
          }
        });

    updateCounter();
  }
Example #8
0
 private void showCountries() {
   listCountry.setVisible(cbxForeign.getValue());
 }