/** Called when this widget is getting loaded */
  protected void onLoad() {
    if (DOM.getElementById("overlay") != null || DOM.getElementById("lightbox") != null) {
      clear();
    }
    if (image != null) {
      DOM.appendChild(getElement(), createAnchor(image, "lightbox"));
    } else if (images != null) {
      childrens = new Element[images.length];
      for (int i = 0; i < images.length; i++) {
        childrens[i] = createAnchor(images[i], "lightbox[" + imagesets + "]");

        setAttribute(childrens[i], "startslideshow", Boolean.toString(slideshow));
        setAttribute(childrens[i], "slideDuration", String.valueOf(slideshowDelayInSeconds));

        if (backgroundMusicURL != null) {
          setAttribute(childrens[i], "music", backgroundMusicURL);
        }
        if (slideshow) {
          setAttribute(childrens[i], "forever", Boolean.toString(slideshowForever));
        }
        DOM.appendChild(getElement(), childrens[i]);
      }
      imagesets++;
      if (slideshow && images.length > 0) {
        toggleImage(currentIdx);
      }
    }
    init();
  }
Ejemplo n.º 2
0
  public static int compareBoolean(Boolean o1Boolean, Boolean o2Boolean) {
    if (o1Boolean == null) o1Boolean = Boolean.FALSE;
    if (o2Boolean == null) o2Boolean = Boolean.FALSE;

    return o1Boolean.compareTo(o2Boolean);
  }
  private Grid addWalrusEntry(int row, WalrusInfoWeb walrusInfo) {
    final ArrayList<String> properties = walrusInfo.getProperties();
    int numProperties = properties.size() / 4;
    Grid g = new Grid(1 + numProperties, 2);
    g.setStyleName("euca-table");
    g.setCellPadding(4);

    int i = 0; // row 1
    g.setWidget(i, 0, new Label("Walrus host:"));
    g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    HorizontalPanel p = new HorizontalPanel();
    p.setSpacing(0);
    g.setWidget(i, 1, p);
    final TextBox walrusHost_box = new TextBox();
    walrusHost_box.addChangeListener(new ChangeCallback(this, row));
    walrusHost_box.setVisibleLength(35);
    walrusHost_box.setText(walrusInfo.getHost());
    p.add(walrusHost_box);
    p.add(new EucaButton("Deregister", new DeleteCallback(this, row)));

    for (int propIdx = 0; propIdx < numProperties; ++propIdx) {
      i++; // next row
      if ("KEYVALUE".equals(properties.get(4 * propIdx))) {
        g.setWidget(i, 0, new Label(properties.get(4 * propIdx + 1) + ": "));
        g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        final TextBox propTextBox = new TextBox();
        propTextBox.addChangeListener(new ChangeCallback(this, row));
        propTextBox.setVisibleLength(30);
        propTextBox.setText(properties.get(4 * propIdx + 2));
        propTextBox.addFocusListener(new FocusHandler(this.hint, this.warningMessage));
        g.setWidget(i, 1, propTextBox);
      } else if ("KEYVALUEHIDDEN".equals(properties.get(4 * propIdx))) {
        g.setWidget(i, 0, new Label(properties.get(4 * propIdx + 1) + ": "));
        g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        final TextBox propTextBox = new PasswordTextBox();
        propTextBox.addChangeListener(new ChangeCallback(this, row));
        propTextBox.setVisibleLength(30);
        propTextBox.setText(properties.get(4 * propIdx + 2));
        propTextBox.addFocusListener(new FocusHandler(this.hint, this.warningMessage));
        g.setWidget(i, 1, propTextBox);
      } else if ("BOOLEAN".equals(properties.get(4 * propIdx))) {
        final int index = propIdx;
        final CheckBox propCheckbox = new CheckBox();
        g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
        g.setWidget(i, 0, propCheckbox);
        if (Boolean.parseBoolean(properties.get(4 * index + 2))) {
          propCheckbox.setChecked(true);
        } else {
          propCheckbox.setChecked(false);
        }
        propCheckbox.addClickListener(
            new ClickListener() {
              public void onClick(Widget sender) {
                if (((CheckBox) sender).isChecked()) {
                  properties.set(4 * index + 2, String.valueOf(true));
                } else {
                  properties.set(4 * index + 2, String.valueOf(false));
                }
              }
            });
        g.setWidget(i, 1, new Label(properties.get(propIdx * 4 + 1)));
      }
    }
    return g;
  }
Ejemplo n.º 4
0
 public static PublicationDetailTabItem load(Map<String, String> parameters) {
   int pubId = Integer.parseInt(parameters.get("id"));
   boolean fromSelf = Boolean.parseBoolean(parameters.get("self"));
   return new PublicationDetailTabItem(pubId, fromSelf);
 }