/**
   * Creates new dialog.
   *
   * @param title the title for popup window
   * @param question the question that user must interact
   * @param handler the handler that call after user interact
   */
  public ProjectProblemDialog(String title, String question, final AskHandler handler) {
    this.handler = handler;
    setTitle(title);
    Widget widget = uiBinder.createAndBindUi(this);
    setWidget(widget);
    message.addStyleName(resources.centerPanelCss().label());
    message.getElement().setInnerHTML(question);

    Button configureButton =
        createButton(
            "Configure...",
            "problem-dialog-configure",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                handler.onConfigure();
                onClose();
              }
            });
    Button keepBlankButton =
        createButton(
            "Keep Blank",
            "problem-dialog-keepBlank",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                handler.onKeepBlank();
                onClose();
              }
            });
    configureButton.addStyleName(resources.centerPanelCss().blueButton());
    getFooter().add(configureButton);
    getFooter().add(keepBlankButton);
  }
  @Override
  protected Widget newPositioner(DragContext context) {
    // Use two widgets so that setPixelSize() consistently affects dimensions
    // excluding positioner border in quirks and strict modes
    SimplePanel outer = new SimplePanel();
    outer.addStyleName(DragClientBundle.INSTANCE.css().positioner());

    // place off screen for border calculation
    RootPanel.get().add(outer, -500, -500);

    // Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
    // DOMUtil.getVerticalBorders(outer)
    outer.setWidget(DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT);

    int width = 0;
    int height = 0;
    for (Widget widget : context.selectedWidgets) {
      width = Math.max(width, widget.getOffsetWidth());
      height += widget.getOffsetHeight();
    }

    SimplePanel inner = new SimplePanel();
    inner.setPixelSize(
        width - DOMUtil.getHorizontalBorders(outer), height - DOMUtil.getVerticalBorders(outer));

    outer.setWidget(inner);

    return outer;
  }
Exemplo n.º 3
0
  public void setAlgebraView(final AlgebraViewW av) {
    if (av != aview) {
      if (aview != null && simplep != null) {
        simplep.remove(aview);
        algebrap.remove(simplep);
      }

      simplep = new SimplePanel(aview = av);
      algebrap.add(simplep);
      simplep.addStyleName("algebraSimpleP");
      algebrap.addStyleName("algebraPanel");
      algebrap.addDomHandler(
          new ClickHandler() {

            public void onClick(ClickEvent event) {
              int bt = simplep.getAbsoluteTop() + simplep.getOffsetHeight();
              if (event.getClientY() > bt) {
                app.getSelectionManager().clearSelectedGeos();
                av.resetItems(true);
              }
              ;
            }
          },
          ClickEvent.getType());
    }
  }
Exemplo n.º 4
0
  /**
   * panel with a {@link #sensorOnOff "sensor-on-off" button}, a {@link #captionLabel label} with
   * the name of the sensor and a {@link #collapse button} to expand/collapse the settings for this
   * sensor. if sensor is turned off, it stops logging the data values of this sensor.
   */
  private void addCaption() {
    FlowPanel caption = new FlowPanel();
    caption.addStyleName("panelTitle");
    this.captionLabel = new Label();
    updateCaptionLabel();

    collapse =
        new ToggleButton(
            new Image(GuiResources.INSTANCE.collapse()), new Image(GuiResources.INSTANCE.expand()));
    collapse.addStyleName("collapse");
    collapse.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            dataValues.setVisible(!collapse.isDown());
          }
        });

    sensorOnOff = new SimplePanel();
    sensorON = new Image(AppResources.INSTANCE.shown());
    sensorOFF = new Image(AppResources.INSTANCE.hidden());
    sensorOnOff.add(sensorOFF);
    sensorOnOff.addStyleName("sensorOnOffButton");

    caption.add(sensorOnOff);
    caption.add(this.captionLabel);
    caption.add(collapse);
    this.add(caption);
  }
  /** Constructor. Pass null to prevent a value from being shown. */
  public ConnectionsPanel() {
    Label subheader = new Label("Connections");
    subheader.addStyleName("profile-subheader");
    this.add(subheader);

    this.add(contents);
    contents.addStyleName("connection-count-contents");

    SimplePanel simple = new SimplePanel();
    simple.addStyleName("clear");
    this.add(simple);
  }
Exemplo n.º 6
0
  public void setAlgebraView(AlgebraViewW av) {
    if (av != aview) {
      if (aview != null && simplep != null) {
        simplep.remove(aview);
        algebrap.remove(simplep);
      }

      simplep = new SimplePanel(aview = av);
      algebrap.add(simplep);
      simplep.addStyleName("algebraSimpleP");
      algebrap.addStyleName("algebraPanel");
    }
  }
  public JobStatusView(DispatchAsync dispatchAsync) {
    this.dispatchAsync = dispatchAsync;
    mainPanel = new FlowPanel();
    mainPanel.addStyleName("jobStatusPanel");

    selectionsPanel = new HorizontalPanel();
    selectionsPanel.setSpacing(20);
    mainPanel.add(selectionsPanel);
    selectedAdapterPanel = new SimplePanel();
    selectedAdapterPanel.setWidget(new Label("*"));
    selectionsPanel.add(selectedAdapterPanel);
    selectionsPanel.add(new HTML("→"));
    selectedExtractorPanel = new SimplePanel();
    selectedExtractorPanel.setWidget(new Label("*"));
    selectionsPanel.add(selectedExtractorPanel);
    selectionsPanel.add(new HTML("→"));
    selectedMeasurePanel = new SimplePanel();
    selectedMeasurePanel.setWidget(new Label("*"));
    selectionsPanel.add(selectedMeasurePanel);
    mainPanel.add(selectionsPanel);

    startPanel = new SimplePanel();
    startPanel.addStyleName("jobStatusSubPanel");
    mainPanel.add(startPanel);
    statusPanel = new SimplePanel();
    statusPanel.addStyleName("jobStatusSubPanel");
    mainPanel.add(statusPanel);
    comparisonsPanel = new FlowPanel();
    mainPanel.add(comparisonsPanel);

    disclosurePanel = new DisclosurePanel("Result");
    disclosurePanel.addStyleName("resultDisclosurePanel");
    disclosurePanel.setWidth("100%");
    disclosurePanel.setAnimationEnabled(true);
    disclosurePanel.setContent(mainPanel);

    initWidget(disclosurePanel);
  }
Exemplo n.º 8
0
 public MeasureNameLabel() {
   FlowPanel measureNamePanel = new FlowPanel();
   HTML measureLabel = new HTML("Measure:&nbsp");
   measureLabel.addStyleName("bold");
   measureLabel.addStyleName("measureLabel");
   measureName.addStyleName("measureName");
   measureNamePanel.add(measureLabel);
   measureNamePanel.add(measureName);
   SimplePanel clearBoth = new SimplePanel();
   clearBoth.addStyleName("clearBoth");
   measureNamePanel.add(clearBoth);
   measureNamePanel.add(new SpacerWidget());
   measureNamePanel.add(new SpacerWidget());
   initWidget(measureNamePanel);
 }
  /**
   * Creates a new FactPatternWidget
   *
   * @param modeller
   * @param eventBus
   * @param action
   * @param readOnly if the widget should be in RO mode. If this parameter is null, the readOnly
   *     attribute is calculated.
   */
  public GlobalCollectionAddWidget(
      RuleModeller modeller,
      EventBus eventBus,
      ActionGlobalCollectionAdd action,
      Boolean readOnly) {

    super(modeller, eventBus);

    this.isFactTypeKnown =
        modeller
            .getDataModelOracle()
            .isFactTypeRecognized(modeller.getModel().getLHSBindingType(action.getFactName()));
    if (readOnly == null) {
      this.readOnly = !this.isFactTypeKnown;
    } else {
      this.readOnly = readOnly;
    }

    ActionGlobalCollectionAdd gca = (ActionGlobalCollectionAdd) action;
    SimplePanel sp = new SimplePanel();
    sp.add(
        new SmallLabel(
            " "
                + GuidedRuleEditorResources.CONSTANTS.AddXToListY(
                    gca.getFactName(), gca.getGlobalName())));

    if (this.readOnly) {
      this.layout.addStyleName("editor-disabled-widget");
      sp.addStyleName("editor-disabled-widget");
    }

    layout.setWidget(0, 0, sp);
    initWidget(layout);

    // This widget couldn't be modified
    this.setModified(false);
  }
  public DescriptionCellEditor() {
    super();

    ensureResources();
    setStyleName("");

    addCloseHandler(
        new CloseHandler<PopupPanel>() {
          @Override
          public void onClose(CloseEvent<PopupPanel> event) {
            if (event.isAutoClosed()) {
              commit();
              hide();
            }
          }
        });

    VerticalPanel verticalPanel = new VerticalPanel();

    textArea = new RichTextArea();
    textArea.setTabIndex(0);
    textArea.addStyleName(resources.style().bDescriptionCellEditor__editor());
    textArea.addKeyDownHandler(
        new KeyDownHandler() {
          @Override
          public void onKeyDown(KeyDownEvent event) {
            int keyCode = event.getNativeKeyCode();
            if (keyCode == KeyCodes.KEY_ESCAPE) {
              cancelButton.setFocus(true); // or grid did not get back focus
              hide();
            } else if (keyCode == KeyCodes.KEY_ENTER && event.isControlKeyDown()) {
              okButton.setFocus(true); // or grid did not get back focus
              okButton.click();
            }
          }
        });
    VerticalPanel textAreaPanel = new VerticalPanel();
    textAreaPanel.add(textArea);

    HorizontalPanel buttonPanel = new HorizontalPanel();

    okButton = new Button(strings.ok());
    okButton.addStyleName(resources.style().bDescriptionCellEditor__ok());
    okButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            commit();
            hide();
          }
        });
    buttonPanel.add(okButton);

    cancelButton = new Button(strings.cancel());
    cancelButton.addStyleName(resources.style().bDescriptionCellEditor__cancel());
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
          }
        });
    buttonPanel.add(cancelButton);

    textAreaPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    textAreaPanel.add(buttonPanel);

    RichTextToolbar textToolbar = new RichTextToolbar(textArea);
    SimplePanel toolBarPanel = new SimplePanel(textToolbar);
    toolBarPanel.addStyleName(resources.style().bDescriptionCellEditor__toolbar());

    verticalPanel.add(toolBarPanel);
    verticalPanel.add(textAreaPanel);

    add(verticalPanel);
  }
Exemplo n.º 11
0
  /** Activate the control. */
  public void activate() {
    clear();
    this.setVisible(true);
    Widget avatar =
        new AvatarWidget(
            Session.getInstance().getCurrentPerson().getAvatarId(),
            EntityType.PERSON,
            Size.VerySmall);
    avatar.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatar());
    this.add(avatar);

    FlowPanel body = new FlowPanel();
    body.addStyleName(StaticResourceBundle.INSTANCE.coreCss().body());

    SimplePanel boxWrapper = new SimplePanel();
    boxWrapper.addStyleName(StaticResourceBundle.INSTANCE.coreCss().boxWrapper());
    commentBox = new ExtendedTextArea(true);
    boxWrapper.add(commentBox);
    body.add(boxWrapper);
    commentBox.setFocus(true);

    countDown = new Label(Integer.toString(MAXLENGTH));
    countDown.addStyleName(StaticResourceBundle.INSTANCE.coreCss().charactersRemaining());
    body.add(countDown);

    post = new PushButton("post");
    post.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postButton());
    post.addStyleName(StaticResourceBundle.INSTANCE.coreCss().inactive());
    body.add(post);

    final Label warning = new Label();
    warning.addStyleName(StaticResourceBundle.INSTANCE.coreCss().warning());
    warning.addStyleName(StaticResourceBundle.INSTANCE.coreCss().hidden());
    body.add(warning);

    Session.getInstance()
        .getEventBus()
        .addObserver(
            GotSystemSettingsResponseEvent.class,
            new Observer<GotSystemSettingsResponseEvent>() {
              public void update(final GotSystemSettingsResponseEvent event) {
                String text = event.getResponse().getContentWarningText();
                if (text != null && !text.isEmpty()) {
                  warning.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().hidden());
                  warning.setText(text);
                }
              }
            });

    SystemSettingsModel.getInstance().fetch(null, true);

    post.addClickHandler(
        new ClickHandler() {
          public void onClick(final ClickEvent event) {
            fullCollapse = false;
            if (!inactive) {
              unActivate();
              CommentDTO comment = new CommentDTO();
              comment.setBody(commentBox.getText());
              comment.setActivityId(messageId);
              Session.getInstance()
                  .getActionProcessor()
                  .makeRequest(
                      "postActivityCommentAction",
                      comment,
                      new AsyncCallback<CommentDTO>() {
                        /* implement the async call back methods */
                        public void onFailure(final Throwable caught) {}

                        public void onSuccess(final CommentDTO result) {
                          ActivityModel.getInstance().clearCache();
                          Session.getInstance()
                              .getEventBus()
                              .notifyObservers(new CommentAddedEvent(result, messageId));
                        }
                      });
            }
          }
        });

    this.add(body);
    commentBox.setFocus(true);
    nativeSetFocus(commentBox.getElement());

    commentBox.addBlurHandler(
        new BlurHandler() {
          public void onBlur(final BlurEvent arg0) {
            TimerFactory timerFactory = new TimerFactory();
            timerFactory.runTimer(
                BLUR_DELAY,
                new TimerHandler() {
                  public void run() {
                    if (commentBox.getText().length() == 0) {
                      unActivate();
                    }
                  }
                });
          }
        });

    commentBox.addKeyDownHandler(
        new KeyDownHandler() {
          public void onKeyDown(final KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
              unActivate();
            } else if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER && event.isControlKeyDown()) {
              post.getElement()
                  .dispatchEvent(
                      Document.get().createClickEvent(1, 0, 0, 0, 0, false, false, false, false));
              event.preventDefault();
              event.stopPropagation();
            }
          }
        });

    commentBox.addKeyUpHandler(
        new KeyUpHandler() {
          public void onKeyUp(final KeyUpEvent event) {
            onCommentChanges();
          }
        });

    commentBox.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          public void onValueChange(final ValueChangeEvent<String> inArg0) {
            onCommentChanges();
          }
        });

    commentBox.addChangeHandler(
        new ChangeHandler() {
          public void onChange(final ChangeEvent event) {
            onCommentChanges();
          }
        });
  }
 private void updateStyles() {
   treeContainer.addStyleName(style.actionTreeContainer());
 }
Exemplo n.º 13
0
  /**
   * Builds the UI.
   *
   * @param inScope the scope.
   */
  private void setupWidgets(final StreamScope inScope) {
    this.getElement().setAttribute("id", "post-to-stream");
    this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().small());

    charsRemaining = new Label();
    postButton = new Hyperlink("", History.getToken());
    postButton.getElement().setAttribute("tabindex", "2");
    message = new PostToStreamTextboxPanel();
    message.setText(postBoxDefaultText);
    message.setVisible(false); // Hide until post ready event.

    this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postToStream());
    errorMsg.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formErrorBox());
    errorMsg.setVisible(false);
    this.add(errorMsg);

    FlowPanel postInfoContainer = new FlowPanel();
    postInfoContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postInfoContainer());

    postButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postButton());
    postInfoContainer.add(postButton);

    charsRemaining.addStyleName(StaticResourceBundle.INSTANCE.coreCss().charactersRemaining());
    postInfoContainer.add(charsRemaining);

    AvatarWidget avatar =
        new AvatarWidget(
            Session.getInstance().getCurrentPerson(), EntityType.PERSON, Size.VerySmall);
    avatar.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postEntryAvatar());

    Panel entryPanel = new FlowPanel();
    entryPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postEntryPanel());
    entryPanel.add(avatar);
    entryPanel.add(postInfoContainer);
    entryPanel.add(message);
    SimplePanel breakPanel = new SimplePanel();
    breakPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().breakClass());
    entryPanel.add(breakPanel);
    add(entryPanel);

    // below text area: links and post to on one line, then content warning below

    expandedPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postExpandedPanel());

    postToPanel = new PostToPanel(inScope);
    expandedPanel.add(postToPanel);
    links = new AddLinkComposite();
    expandedPanel.add(links);

    contentWarning = new FlowPanel();
    contentWarningContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().contentWarning());
    contentWarningContainer.add(new SimplePanel());
    contentWarningContainer.add(contentWarning);
    expandedPanel.add(contentWarningContainer);

    add(expandedPanel);

    setVisible(false);

    setVisible(Session.getInstance().getCurrentPerson() != null);
  }
Exemplo n.º 14
0
  @Override
  protected void start() {
    root.add(loginBar);

    goTop.addStyleName(style.gotop());
    goTop.addDomHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            root.getElement().setScrollTop(0);
          }
        },
        ClickEvent.getType());

    gotoTask =
        new DelayedTask() {
          @Override
          public void onExecute() {
            if (!gotoShowing && scrollTop >= 800) {
              goTop.addStyleName(style.gotopshow());
              gotoShowing = true;
            } else if (scrollTop < 800 && gotoShowing) {
              goTop.removeStyleName(style.gotopshow());
              gotoShowing = false;
            }
          }
        };

    navTask =
        new DelayedTask() {
          @Override
          public void onExecute() {
            if (scrollTop >= navMix && scrollTop <= navMax) {
              return;
            }
            currentli.removeClassName(style.active());
            int i = 0;
            while (i < pns.size()) {
              PositionNav nav = pns.get(i);
              navMix = nav.getScrollTop() - OFFSET;
              navMax =
                  ((i == (pns.size() - 1))
                          ? root.getElement().getScrollHeight()
                          : pns.get(i + 1).getScrollTop())
                      - OFFSET;
              if (scrollTop >= navMix && scrollTop <= navMax) {
                currentli = nav.getElm();
                break;
              }
              i++;
            }
            currentli.addClassName(style.active());
          }
        };

    initPostion();

    root.addDomHandler(
        new ScrollHandler() {
          @Override
          public void onScroll(ScrollEvent event) {
            scrollTop = event.getRelativeElement().getScrollTop();
            gotoTask.delay(100);
            navTask.delay(30);
          }
        },
        ScrollEvent.getType());
  }