public PlaceBookEntryPreview(final Entry entry) {
    initWidget(uiBinder.createAndBindUi(this));

    container
        .getElement()
        .getStyle()
        .setBackgroundImage(
            "url(" + Resources.IMAGES.placebook_open().getSafeUri().asString() + ")");

    title.setText(entry.getTitle());
    description.setText(entry.getDescription());
    author.setText(entry.getOwnerName());

    if (entry.getPreviewImage() != null) {
      image.setUrl(
          PlaceBooks.getServer().getHostURL()
              + "media?hash="
              + entry.getPreviewImage()
              + "&type=imageitem");
    } else {
      image.setVisible(false);
    }

    container.addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(final ClickEvent event) {
            PlaceBooks.goTo(new PlaceBookPage(entry.getKey()));
          }
        },
        ClickEvent.getType());
  }
    NodeWidget(String nodeDesc, int index) {

      isSelected = false;
      Label lbl = new Label(nodeDesc);
      lbl.setStyleName("endpt-wdgt-lbl");

      mainPnl = new FlowPanel();
      mainPnl.setStyleName("endpt-wdgt-pnl-selected");
      // mainPnl.setStyleName("endpt-wdgt-pnl");
      mainPnl.add(lbl);

      mainPnl.addDomHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              chngeNdeWdgtToEnable();
              slctdNode = ((Label) mainPnl.getWidget(0)).getText();
              if (!isSelected) {
                isSelected = true;
                // disableEndpoint();
                mainPnl.setStyleName("endpt-wdgt-pnl");

              } else {
                // enableEndpoint();
                mainPnl.setStyleName("endpt-wdgt-pnl-selected");
              }
            }
          },
          ClickEvent.getType());

      //			if(!this.isSelected){
      //				enableEndpoint();
      //			} else {
      //				disableEndpoint();
      //			}

      initWidget(mainPnl);
    }
Exemplo n.º 3
0
  // timer for GeoGebraExam
  private FlowPanel getTimer() {
    final Label timer = new Label();
    timer.getElement().setClassName("timer");
    timer.getElement().setId("timer");
    timer.getElement().setPropertyBoolean("started", false);

    // https://groups.google.com/forum/#!msg/google-web-toolkit/VrF3KD1iLh4/-y4hkIDt5BUJ
    AnimationScheduler.get()
        .requestAnimationFrame(
            new AnimationCallback() {
              @Override
              public void execute(double timestamp) {

                if (app.getExam().isCheating()) {
                  makeRed(getElement());
                }

                timer.setText(app.getExam().timeToString(System.currentTimeMillis()));

                AnimationScheduler.get().requestAnimationFrame(this);
              }
            });
    visibilityEventMain();

    FlowPanel fp = new FlowPanel();
    fp.add(timer);
    Image info = new Image(GuiResourcesSimple.INSTANCE.dialog_info().getSafeUri());
    fp.add(info);
    info.getElement().getStyle().setMarginLeft(5, Unit.PX);
    fp.addDomHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            app.showMessage(app.getExam().getLog(app.getLocalization()));
          }
        },
        ClickEvent.getType());
    return fp;
  }
Exemplo n.º 4
0
  public AnnotationWidget(Annotation a, Labels labels) {
    this.annotation = a;

    // Construct annotation panel
    annotationPanel = new FlowPanel();
    annotationPanel.setStyleName("yuma-annotation-content");

    // Username will be undefined in server-less mode!
    InlineHTML username = null;
    if (annotation.getUserRealName() != null) {
      username = new InlineHTML(annotation.getUserRealName());
    } else if (annotation.getUsername() != null) {
      username = new InlineHTML(annotation.getUsername());
    }

    if (username != null) {
      username.setStyleName("yuma-annotation-username");
      annotationPanel.add(username);
    }

    // Timestamps will be -1 in server-less mode!
    InlineHTML timestamp = new InlineHTML();
    long modified = annotation.getModified();
    if (modified > 0) {
      timestamp.setHTML(DateTimeFormat.getFormat(DATE_FORMAT).format(new Date(modified)));
      timestamp.setStyleName("yuma-annotation-modified");
    }

    annotationPanel.add(new InlineHTML(annotation.getText() + "<br/>"));
    annotationPanel.add(timestamp);

    annotationPanel.addDomHandler(
        new MouseOverHandler() {
          public void onMouseOver(MouseOverEvent event) {
            btnEdit.removeStyleName(CSS_HIDDEN);
            btnDelete.removeStyleName(CSS_HIDDEN);
          }
        },
        MouseOverEvent.getType());

    // Construct button panel
    buttonPanel = new FlowPanel();
    buttonPanel.setStyleName("yuma-annotation-buttons");

    btnDelete = new PushButton();
    btnDelete.setStyleName("yuma-button");
    btnDelete.addStyleName("yuma-button-delete");
    btnDelete.addStyleName(CSS_HIDDEN);
    btnDelete.getElement().getStyle().setFloat(Float.RIGHT);
    btnDelete.getElement().getStyle().setCursor(Cursor.POINTER);

    btnEdit = new PushButton();
    btnEdit.setStyleName("yuma-button");
    btnEdit.addStyleName("yuma-button-edit");
    btnEdit.addStyleName(CSS_HIDDEN);
    btnEdit.getElement().getStyle().setFloat(Float.RIGHT);
    btnEdit.getElement().getStyle().setCursor(Cursor.POINTER);

    if (labels == null) {
      btnDelete.setTitle("Delete this Comment");
      btnEdit.setTitle("Edit this Comment");
    } else {
      btnDelete.setTitle(labels.deleteTooltip());
      btnEdit.setTitle(labels.editTooltip());
    }
    buttonPanel.add(btnDelete);
    buttonPanel.add(btnEdit);

    // Wrap everything into the container panel
    container = new FlowPanel();
    container.setStyleName("yuma-annotation");
    container.add(annotationPanel);
    container.add(buttonPanel);

    container.addDomHandler(
        new MouseOutHandler() {
          public void onMouseOut(MouseOutEvent event) {
            btnEdit.addStyleName(CSS_HIDDEN);
            btnDelete.addStyleName(CSS_HIDDEN);
          }
        },
        MouseOutEvent.getType());

    initWidget(container);
  }