Пример #1
0
  private void showPopup() {
    if (position.equals("auto")) {
      int extra = 20;

      int left = getPopupPositionWidget().getAbsoluteLeft();
      int top =
          getPopupPositionWidget().getAbsoluteTop() + getPopupPositionWidget().getOffsetHeight();
      int browserWindowWidth = Window.getClientWidth() + Window.getScrollLeft();
      int browserWindowHeight = Window.getClientHeight() + Window.getScrollTop();
      if (left + popup.getOffsetWidth() > browserWindowWidth - extra) {
        left =
            getPopupPositionWidget().getAbsoluteLeft()
                - (popup.getOffsetWidth() - getPopupPositionWidget().getOffsetWidth());
      }
      if (top + popup.getOffsetHeight() > browserWindowHeight - extra) {
        top = getPopupPositionWidget().getAbsoluteTop() - popup.getOffsetHeight() - 2;
      }
      left = left + xOffset;
      if (left < 0) {
        left = 0;
      }
      popup.setPopupPosition(left, top + yOffset);
      popup.setVisible(true);
    } else if (position.equals("fixed")) {
      int extra = 20;

      int left = getPopupPositionWidget().getAbsoluteLeft();
      int top =
          getPopupPositionWidget().getAbsoluteTop()
              + getPopupPositionWidget().getOffsetHeight()
              - Window.getScrollTop();

      int browserWindowWidth = Window.getClientWidth() + Window.getScrollLeft();
      int clientHeight = Window.getClientHeight();
      if (left + popup.getOffsetWidth() > browserWindowWidth - extra) {
        left =
            getPopupPositionWidget().getAbsoluteLeft()
                - (popup.getOffsetWidth() - getPopupPositionWidget().getOffsetWidth());
      }
      if (top + popup.getOffsetHeight() > clientHeight - extra) {
        top =
            (getPopupPositionWidget().getAbsoluteTop() - Window.getScrollTop())
                - popup.getOffsetHeight()
                - 2;
      }
      left = left + xOffset;
      if (left < 0) {
        left = 0;
      }
      popup.setPopupPosition(left, top + yOffset);
      popup.addStyleName("fixed");
      popup.setShadowStyle("fixed");
      popup.setVisible(true);
    }
  }
 public void center() {
   boundaryPanel.clear();
   int left = (Window.getClientWidth() - windowPanel.getOffsetWidth()) >> 1;
   int top = (Window.getClientHeight() - windowPanel.getOffsetHeight()) >> 1;
   boundaryPanel.add(windowPanel, Window.getScrollLeft() + left, Window.getScrollTop() + top);
   left = (Window.getClientWidth() - windowPanel.getOffsetWidth()) >> 1;
   top = (Window.getClientHeight() - windowPanel.getOffsetHeight()) >> 1;
   boundaryPanel.clear();
   boundaryPanel.add(windowPanel, Window.getScrollLeft() + left, Window.getScrollTop() + top);
   // hide <embeds>
   FrameUtils.toggleEmbedVisibility(false);
 }
Пример #3
0
  /**
   * Displays this menu at a specific xy position.
   *
   * @param x the x coordinate
   * @param y the y coordinate
   */
  public void showAt(int x, int y) {
    MenuEvent me = new MenuEvent(this);
    if (fireEvent(Events.BeforeShow, me)) {
      lastWindowSize = new Size(Window.getClientWidth(), Window.getClientHeight());

      RootPanel.get().add(this);
      el().makePositionable(true);

      onShow();
      el().updateZIndex(0);

      showing = true;
      doAutoSize();

      if (constrainViewport) {
        Point p = el().adjustForConstraints(new Point(x, y));
        x = p.x;
        y = p.y;
      }
      setPagePosition(x + XDOM.getBodyScrollLeft(), y + XDOM.getBodyScrollTop());
      if (enableScrolling) {
        constrainScroll(y);
      }

      el().show();
      eventPreview.add();

      if (focusOnShow) {
        focus();
      }

      fireEvent(Events.Show, me);
    }
  }
 private int getHeight() {
   int height = Window.getClientHeight() - widget.getAbsoluteTop() - getMarginSize() - 14;
   if (height < 0) {
     return 0;
   }
   return height;
 }
Пример #5
0
  /** Popup the view source dialog, showing the given content. */
  public static void showSource(final String content, String name) {
    Constants constants = GWT.create(Constants.class);
    int windowWidth = Window.getClientWidth() / 2;
    int windowHeight = Window.getClientHeight() / 2;
    final FormStylePopup pop =
        new FormStylePopup(images.viewSource(), constants.ViewingSourceFor0(name), windowWidth);

    String[] rows = content.split("\n");

    FlexTable table = new FlexTable();
    for (int i = 0; i < rows.length; i++) {

      table.setHTML(i, 0, "<span style='color:grey;'>" + (i + 1) + ".</span>");
      table.setHTML(i, 1, "<span style='color:green;' >|</span>");
      table.setHTML(i, 2, addSyntaxHilights(rows[i]));
    }

    ScrollPanel scrollPanel = new ScrollPanel(table);

    scrollPanel.setHeight(windowHeight + "px");
    scrollPanel.setWidth(windowWidth + "px");

    pop.addRow(scrollPanel);

    LoadingPopup.close();

    pop.show();
  }
Пример #6
0
  public ConsoleDialog(ConsoleDialogListener listener) {
    super(false, true);
    this.listener = listener;

    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    setWidget(dialogContents);

    console = new TextArea();
    console.setReadOnly(true);
    int width = Window.getClientWidth();
    int height = Window.getClientHeight();
    console.setSize(width * 2 / 3 + "px", height * 2 / 3 + "px");
    console.addStyleName(Utils.sandboxStyle.consoleArea());
    okButton = new Button("Ok");
    addButton(okButton);

    dialogContents.add(console);

    okButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
            if (ConsoleDialog.this.listener != null) {
              ConsoleDialog.this.listener.onOk(success);
            }
          }
        });
    okButton.setEnabled(false);
  }
Пример #7
0
  /**
   * Displays this menu relative to another element.
   *
   * @param elem the element to align to
   * @param pos the {@link El#alignTo} anchor position to use in aligning to the element (defaults
   *     to defaultAlign)
   * @param offsets the menu align offsets
   */
  public void show(Element elem, String pos, int[] offsets) {
    MenuEvent me = new MenuEvent(this);
    if (fireEvent(Events.BeforeShow, me)) {
      lastWindowSize = new Size(Window.getClientWidth(), Window.getClientHeight());

      RootPanel.get().add(this);

      el().makePositionable(true);

      onShow();
      el().updateZIndex(0);

      showing = true;
      doAutoSize();

      el().alignTo(elem, pos, offsets);

      if (enableScrolling) {
        constrainScroll(el().getY());
      }
      el().show();

      eventPreview.add();

      if (focusOnShow) {
        focus();
      }

      fireEvent(Events.Show, me);
    }
  }
 /**
  * Height of pop-up, 1/2 of the client height or MIN_HEIGHT
  *
  * @return
  */
 protected int getChoicesHeight() {
   int h = Window.getClientHeight() / 2;
   if (h < MIN_HEIGHT) {
     h = MIN_HEIGHT;
   }
   return h;
 }
Пример #9
0
 private void resize() {
   setHeight((int) (Window.getClientHeight() * heightPercentage));
   setWidth((int) (Window.getClientWidth() * widthPercentage));
   if (isRendered()) {
     center();
     layout(true);
   }
 }
Пример #10
0
 private void resizeScrollPanel() {
   int width = Window.getClientWidth() - 20;
   String height = (Window.getClientHeight() - 60) + "px";
   treeScrollPanel.setWidth(Math.round(width * 0.2) + "px");
   treeScrollPanel.setHeight(height);
   explorerScrollPanel.setWidth(Math.round(width * 0.8) + "px");
   explorerScrollPanel.setHeight(height);
 }
Пример #11
0
  private void popupDbCurator() {

    ClientSequenceDatabase csd = (ClientSequenceDatabase) dlb.getSelected();
    Integer selected = csd.getId();

    Map<String, String> emailInitialPairs = new TreeMap<String, String>();

    for (Map.Entry<String, ClientUser> me : userInfo.entrySet()) {
      emailInitialPairs.put(me.getKey(), me.getValue().getInitials());
    }

    final DialogBox dialogBox = new DialogBox(false);
    CurationEditor ce =
        new CurationEditor(
            selected,
            user.getEmail(),
            emailInitialPairs,
            new EditorCloseCallback() {
              public void editorClosed(final Integer openCurationID) {
                validationController.getAllowedValues(
                    dlb,
                    new Callback() {
                      public void done() {
                        if (openCurationID != null) {
                          dlb.select(openCurationID, validationController);
                        }
                        dialogBox.hide();
                      }
                    });
              }
            });
    DOM.setElementAttribute(dialogBox.getElement(), "id", "db-curator");
    dialogBox.setStyleName("dbCuratorEmbed");
    dialogBox.setWidget(ce);
    dialogBox.setSize(Window.getClientWidth() * .8 + "px", Window.getClientHeight() * .8 + "px");
    ce.setPixelSize(
        Math.max((int) (Window.getClientWidth() * .8), 770), (int) (Window.getClientHeight() * .8));
    //		LightBox lb = new LightBox(dialogBox);
    //		try {
    //			lb.show();
    //		} catch (Exception ignore) {
    dialogBox.show();
    //		}
    dialogBox.center();
  }
        @Override
        public void run() {
          // Ignore changes that result from window resize events
          if (windowHeight != Window.getClientHeight() || windowWidth != Window.getClientWidth()) {
            windowHeight = Window.getClientHeight();
            windowWidth = Window.getClientWidth();
            schedule(resizeCheckDelay);
            return;
          }

          // Look for elements that have new dimensions
          checkWidgetSize();

          // Start checking again
          if (resizeCheckingEnabled) {
            schedule(resizeCheckDelay);
          }
        }
  public LOpenTrialsDocumentCardPanel(IDomeo domeo) {
    _domeo = domeo;

    initWidget(binder.createAndBindUi(this));
    body.setHeight("100%");
    tabToolsPanel.setHeight(Window.getClientHeight() - 45 + "px");
    // tabToolsPanel.addStyleName(style.tabLayoutPanel());
    urlImage.setVisible(false);
  }
Пример #14
0
 public void slideFromTopToCenter(int durationMilli) {
   this.initMarginTop =
       Integer.parseInt(
           element.getStyle().getMarginTop().replace(Unit.PX.getType(), "").replace(" ", ""));
   this.maxMarginTop = Window.getClientHeight() / 2 - element.getOffsetHeight() / 2;
   cancel();
   currentOp = IabakoAnimation.SLIDE_DOWN;
   run(durationMilli);
 }
 public BaseModal() {
   setMaxHeigth((Window.getClientHeight() * 0.75) + "px");
   setBackdrop(BackdropType.STATIC);
   setKeyboard(true);
   setAnimation(true);
   setDynamicSafe(true);
   setHideOthers(false);
   setShowHandler();
   setKeyPressHandler();
 }
Пример #16
0
  public LessonsComposite() {
    initWidget(uiBinder.createAndBindUi(this));
    setWidth("100%");
    setHeight(Window.getClientHeight() + "px");

    lessonTreeTitle.getElement().getStyle().setFontSize(16, Style.Unit.PX);
    lessonPanel.setLessonsMap(lessonViewNameToWidgetMap);
    getAllTreeLessons();
    initLessonTree();
  }
Пример #17
0
  protected void center(int offsetWidth, int offsetHeight) {
    int width = Window.getClientWidth();
    int height = Window.getClientHeight();
    int scrollLeft = Window.getScrollLeft();
    int scrollRight = Window.getScrollTop();

    int left = scrollLeft + (width - offsetWidth) / 2;
    int top = scrollRight + (height - offsetHeight) / 2;

    child.setPopupPosition(left, top);
  }
Пример #18
0
 @Override
 public void run() {
   int newHeight = Window.getClientHeight();
   int newWidth = Window.getClientWidth();
   if (newHeight != height) {
     height = newHeight;
     LayoutContainer center = (LayoutContainer) Registry.get(AppView.CENTER_PANEL);
     calendar.setHeight(center.getHeight() - calendarHeightSize + "px");
     calendar.doSizing();
     calendar.doLayout();
   }
 }
Пример #19
0
 public FolderInfoWidget() {
   initWidget(uiBinder.createAndBindUi(this));
   folderInfo.getElement().setId("pnlCollectionInfo");
   folderInfo.getElement().getStyle().setHeight(Window.getClientHeight(), Unit.PX);
   titleDetailsPnl.getElement().setAttribute("style", "border-bottom: 0px solid #ddd;");
   Window.addResizeHandler(
       new ResizeHandler() {
         @Override
         public void onResize(ResizeEvent event) {
           folderInfo.getElement().getStyle().setHeight(Window.getClientHeight(), Unit.PX);
         }
       });
 }
  private void popoutTreeVisTab(TreeVisPlace place, int id) {
    // FIXME: this needs to be injected...
    AppPlaceHistoryMapper historyMapper = Entry.getPlaceHistoryMapper();

    String token = historyMapper.getToken(place);
    String url = Window.Location.createUrlBuilder().setHash(token).buildString();
    int width = Window.getClientWidth() / 2;
    int height = Window.getClientHeight() / 2;
    String features =
        "width=" + width + ",height=" + height + ",menubar=0,location=0,toolbar=0,status=0";

    TreeVisActivity.openPanel(this, url, "_blank", features, Integer.toString(id));
  }
Пример #21
0
  @Override
  public void getDynamicPopupMenu(DynamicPopupMenuCallback callback) {
    // truncate the MRU list size for smaller client heights
    if (Window.getClientHeight() < 700) {
      commands_.projectMru10().setVisible(false);
      commands_.projectMru11().setVisible(false);
      commands_.projectMru12().setVisible(false);
      commands_.projectMru13().setVisible(false);
      commands_.projectMru14().setVisible(false);
    }

    ProjectMRUList.setOpenInNewWindow(false);
    callback.onPopupMenu(this);
  }
Пример #22
0
  /**
   * TODO check if we need to support this with touch based devices.
   *
   * <p>Checks if the cursor was inside the browser content area when the event happened.
   *
   * @param event The event to be checked
   * @return true, if the cursor is inside the browser content area
   *     <p>false, otherwise
   */
  private boolean cursorInsideBrowserContentArea(Event event) {
    if (event.getClientX() < 0 || event.getClientY() < 0) {
      // Outside to the left or above
      return false;
    }

    if (event.getClientX() > Window.getClientWidth()
        || event.getClientY() > Window.getClientHeight()) {
      // Outside to the right or below
      return false;
    }

    return true;
  }
Пример #23
0
  /** Shows the popup */
  public void show() {
    initButtons();
    int left = (Window.getClientWidth() - 700) / 2;
    int top = (Window.getClientHeight() - 350) / 2;
    setPopupPosition(left, top);
    setText(Main.i18n("search.folder.filter"));

    // Resets to initial tree value
    removeAllRows();
    keyword.setText("");
    evaluateEnableAction();
    super.show();
    keyword.setFocus(true);
  }
Пример #24
0
  public Widget onInitialize(Object content) {
    Attestation.titleForm.showTitle("Работа с кандидатами");

    CandidateSearchFormUIUiBinder uiBinder =
        (CandidateSearchFormUIUiBinder) GWT.create(CandidateSearchFormUIUiBinder.class);
    Widget widget = (Widget) uiBinder.createAndBindUi(this);

    this.mainPanel.setWidgetSize(this.searchPanel, 290.0D);

    this.mainPanel.setHeight(Window.getClientHeight() - 200 + "px");
    this.candidatesModel = new SingleSelectionModel<Reference>();
    this.candidatesModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          public void onSelectionChange(SelectionChangeEvent event) {
            if (CandidateSearchForm.this.candidatesModel.getSelectedObject() != null) {
              CandidateEditForm cep = new CandidateEditForm();
              Widget widget =
                  cep.onInitialize(
                      ((Reference) CandidateSearchForm.this.candidatesModel.getSelectedObject())
                          .getId());
              CandidateSearchForm.this.candidateEditPanel.setWidget(widget);
            }
          }
        });
    TextColumn<Reference> nameColumn =
        new TextColumn<Reference>() {
          public String getValue(Reference object) {
            return object.getName();
          }
        };
    this.searchList.addColumn(nameColumn, "Результаты поиска");
    this.searchList.setSelectionModel(this.candidatesModel);

    this.searchListPager =
        new SimplePager(
            SimplePager.TextLocation.CENTER,
            (SimplePager.Resources) GWT.create(SimplePager.Resources.class),
            false,
            0,
            true);
    this.vp.add(this.searchListPager);
    this.searchListPager.setDisplay(this.searchList);
    this.searchListPager.firstPage();
    this.searchListPager.startLoading();
    if (!MenuForm.getUserInfo().getType().equalsIgnoreCase("НСТ")) {
      this.deleteButton.setVisible(false);
    }
    return widget;
  }
Пример #25
0
  public static int[] getCenterOfWindow(int reqHeight, int reqWidth) {
    int browserHeight = Window.getClientHeight();
    int browserWidth = Window.getClientWidth();

    int top = 0, left = 0;
    if (browserHeight > reqHeight) {
      top = (browserHeight - reqHeight) / 2;
    }

    if (browserWidth > reqWidth) {
      left = (browserWidth - reqWidth) / 2;
    }

    return new int[] {top, left};
  }
  private void popoutDataTab(DataTablePlace place, int id) {
    logger.log(Level.INFO, "Popping data panel: " + place.getDataKey());

    // FIXME: this needs to be injected...
    AppPlaceHistoryMapper historyMapper = Entry.getPlaceHistoryMapper();

    String token = historyMapper.getToken(place);
    String url = Window.Location.createUrlBuilder().setHash(token).buildString();
    int width = Window.getClientWidth() / 2;
    int height = Window.getClientHeight() / 2;
    String features =
        "width=" + width + ",height=" + height + ",menubar=0,location=0,toolbar=0,status=0";

    DataPanelActivity.openPanel(this, url, "_blank", features, Integer.toString(id));
  }
Пример #27
0
  private void moveIntoVisibleArea() {
    if (calendarDlg != null) {
      int w = Window.getClientWidth() + Window.getScrollLeft();
      int xd = calendarDlg.getAbsoluteLeft();
      int wd = calendarGrid.getOffsetWidth() + 40;
      if ((xd + wd) > w) {
        xd = xd - ((xd + wd) - w);
      }

      int h = Window.getClientHeight() + Window.getScrollTop();
      int yd = calendarDlg.getAbsoluteTop();
      int hd = calendarDlg.getOffsetHeight() + 20;
      if ((yd + hd) > h) {
        yd = yd - ((yd + hd) - h);
      }
      calendarDlg.setPopupPosition(xd, yd);
    }
  }
Пример #28
0
  public S screenCenter() {
    int width = this.outerWidth();
    int height = this.outerHeight();

    int left = (Window.getClientWidth() - width) >> 1;
    int top = (Window.getClientHeight() - height) >> 1;

    int computedLeft =
        Math.max(Window.getScrollLeft() + left, 0) - Document.get().getBodyOffsetLeft();
    int computedTop = Math.max(Window.getScrollTop() + top, 0) - Document.get().getBodyOffsetTop();

    Element element = this.getElement();
    element.getStyle().setPropertyPx("left", computedLeft);
    element.getStyle().setPropertyPx("top", computedTop);
    element.getStyle().setPosition(Position.ABSOLUTE);

    return (S) this;
  }
Пример #29
0
 public void onMouseMove(MouseMoveEvent event) {
   if (isMouseDown()) {
     setDragging(true);
     updateCSS();
     model.setX(event.getX() + model.getX() - dragStartX);
     model.setY(event.getY() + model.getY() - dragStartY);
     onUpdateInModel();
     int clientX = event.getClientX();
     int clientY = event.getClientY();
     boolean outsideWindow =
         clientX < 0
             || clientY < 0
             || clientX > Window.getClientWidth()
             || clientY > Window.getClientHeight();
     if (outsideWindow) {
       parent.save(model, true);
       setDragging(false);
     }
   }
   event.preventDefault();
 }
Пример #30
0
  public FormDialog(double heightPercentage, double widthPercentage) {
    this.heightPercentage = heightPercentage;
    this.widthPercentage = widthPercentage;
    setLayout(new FitLayout());

    Window.addResizeHandler(
        new ResizeHandler() {
          @Override
          public void onResize(ResizeEvent event) {
            resize();
          }
        });

    setBorders(false);
    setBodyBorder(false);

    setModal(true);
    setHeight((int) (Window.getClientHeight() * heightPercentage));
    setWidth((int) (Window.getClientWidth() * widthPercentage));
    setButtons("");
  }