Esempio n. 1
0
 public void scrollToCursor(ScrollPanel scrollPanel, int paddingVert, int paddingHoriz) {
   DomUtils.ensureVisibleVert(
       scrollPanel.getElement(),
       widget_.getEditor().getRenderer().getCursorElement(),
       paddingVert);
   DomUtils.ensureVisibleHoriz(
       scrollPanel.getElement(),
       widget_.getEditor().getRenderer().getCursorElement(),
       paddingHoriz,
       paddingHoriz,
       false);
 }
Esempio n. 2
0
  public void run(final RootPanel rp, final String nick) {

    if (Cookies.getCookie(nick) == null) Cookies.setCookie(nick, "" + 0);

    cl.setPageSize(500);

    final Button sendMessage =
        new Button(
            "sendMessage",
            new ClickHandler() {

              public void onClick(ClickEvent event) {

                if (!message.getText().equals("")) {
                  new Post().postJson(SERVERURL, nick.toString(), message.getText());
                  message.setText("");
                }
              }
            });

    rp.get("mainDiv2").setVisible(true);
    message.getElement().setAttribute("placeholder", "Introduce your message");
    message.getElement().setAttribute("id", "message");

    cl.getElement().setAttribute("id", "chatBox");

    sendMessage.getElement().setAttribute("id", "sendMessage");
    sendMessage.setText("Send");

    vp.getElement().setAttribute("id", "verticalPanel");
    hp.getElement().setAttribute("id", "horizontalPanel");

    panel.getElement().setAttribute("id", "scroller");

    hp.add(message);
    hp.add(sendMessage);
    panel.add(cl);
    vp.add(panel);

    vp.add(hp);
    rp.get("mainDiv2").add(vp);

    Timer t =
        new Timer() {
          @Override
          public void run() {
            getMessages();

            if (chatList != null && Integer.parseInt(Cookies.getCookie(nick)) < chatList.size()) {
              cl.setRowCount(chatList.size() + 1, true);
              cl.setRowData(
                  Integer.parseInt(Cookies.getCookie(nick)),
                  chatList.subList(Integer.parseInt(Cookies.getCookie(nick)), chatList.size()));
              panel.setVerticalScrollPosition(panel.getMaximumVerticalScrollPosition() - 1);
              Cookies.setCookie(nick, "" + chatList.size());
            }
          }
        };
    t.scheduleRepeating(1000);
  }
Esempio n. 3
0
  @Override
  protected Widget onInitialization() {
    setHeight100();

    lockInfo = new LockInfoWidget();
    HeaderWidget header = new HeaderWidget();
    sidebar = new SwitcherWidget(true);
    workarea.setStyleName("Workspace-body-center-content");

    ScrollPanel workareaScroller =
        new ScrollPanel(Gwt.createDiv("Workspace-body-center-content", workarea));
    workareaScroller.getElement().setId("workarea-scroller");
    workareaScroller.setHeight("100%");
    workarea.setScrollPanel(workareaScroller);

    FlowPanel body = new FlowPanel();
    body.setStyleName("Workspace-body");
    body.add(Gwt.createDiv("Workspace-body-west", sidebar));
    body.add(Gwt.createDiv("Workspace-body-center", workareaScroller));

    FlowPanel workspace = Gwt.createFlowPanel(Gwt.createDiv("Workspace-header", header), body);
    workspace.setStyleName("Workspace");

    locker = new LockWidget(workspace);

    return new FullscreenPanel(locker);
  }
Esempio n. 4
0
  public MainContainer() {
    initWidget(uiBinder.createAndBindUi(this));
    deck.add(flow);
    deck.add(new Label("Deck 1"));
    final Label label2 = new Label("Deck 2");
    label2.setType(LabelType.WARNING);
    deck.add(label2);
    final Label label3 = new Label("Deck 3");
    label3.setType(LabelType.DANGER);
    deck.add(label3);

    scroll.getElement().getStyle().setOverflowX(Overflow.AUTO);
    scroll.getElement().getStyle().setOverflowY(Overflow.SCROLL);

    // scroll.setTouchScrollingDisabled(false);
    // NotifyUser.info("Touch enabled: " + !scroll.isTouchScrollingDisabled());

    // getScrollableElement().getStyle().setOverflowX(Overflow.HIDDEN);
    // scroll.getScrollableElement().getStyle().setOverflowY(Overflow.SCROLL);
    //
    // scroll.addScrollHandler(new ScrollHandler() {
    //
    // @Override
    // public void onScroll(final ScrollEvent event) {
    // // NotifyUser.info("scrolling");
    // }
    // });

    // addTouchEndHandler(new TouchEndHandler() {
    // @Override
    // public void onTouchEnd(final TouchEndEvent event) {
    // // NotifyUser.info("Touch end event");
    // next();
    // }
    // });
    // addTouchStartHandler(new TouchStartHandler() {
    // @Override
    // public void onTouchStart(final TouchStartEvent event) {
    // // NotifyUser.info("Touch start event");
    // }
    // });
    // addTouchCancelHandler(new TouchCancelHandler() {
    // @Override
    // public void onTouchCancel(final TouchCancelEvent event) {
    // // NotifyUser.info("Touch cancel event");
    // }
    // });
    // addTouchMoveHandler(new TouchMoveHandler() {
    // @Override
    // public void onTouchMove(final TouchMoveEvent event) {
    // // NotifyUser.info("Touch move event");
    //
    // }
    // });
  }
Esempio n. 5
0
 public Viewer(int rowLimit, Set<String> showNames) {
   table = new FlexTable();
   table.setSize("100%", "auto");
   table.setCellSpacing(2);
   cellFormatter = table.getCellFormatter();
   rowFormatter = table.getRowFormatter();
   scroller = new ScrollPanel(table);
   scroller.getElement().getStyle().setProperty("borderTop", "1px solid #333333");
   setPause(false);
   setRowLimit(rowLimit);
   updateRowVisibility(showNames);
 }
Esempio n. 6
0
 @Override
 public void setCourseDetails(CourseFinderCourseDetails... details) {
   iDetails = details;
   int tabIndex = 0;
   for (CourseFinderCourseDetails detail : iDetails) {
     ScrollPanel panel = new ScrollPanel(detail.asWidget());
     panel.setStyleName("unitime-ScrollPanel-inner");
     panel.getElement().getStyle().setWidth(780, Unit.PX);
     panel.getElement().getStyle().setHeight(200, Unit.PX);
     iCourseDetailsTabPanel.add(panel, detail.getName(), true);
     Character ch = UniTimeHeaderPanel.guessAccessKey(detail.getName());
     if (ch != null) iTabAccessKeys.put(ch, tabIndex);
     tabIndex++;
   }
   selectLastTab();
 }
Esempio n. 7
0
  protected void scrollToSelectedRow() {
    if (iCourses.getSelectedRow() < 0) return;

    Element scroll = iCoursesPanel.getElement();

    com.google.gwt.dom.client.Element item =
        iCourses.getTable().getRowFormatter().getElement(iCourses.getSelectedRow());
    if (item == null) return;

    int realOffset = 0;
    while (item != null && !item.equals(scroll)) {
      realOffset += item.getOffsetTop();
      item = item.getOffsetParent();
    }

    scroll.setScrollTop(realOffset - scroll.getOffsetHeight() / 2);
  }
  public void setData(List<UserTagsResourceDO> result) {

    tagContainer.setVisible(true);
    TagTextMessage.setText(i18n.GL1915());
    TagTextMessage.getElement().setId("lblTagTextMessage");
    TagTextMessage.getElement().setAttribute("alt", i18n.GL1915());
    TagTextMessage.getElement().setAttribute("title", i18n.GL1915());

    tagMessage.setText(i18n.GL1944());
    tagMessage.getElement().setId("lblTagMessage");
    tagMessage.getElement().setAttribute("alt", i18n.GL1944());
    tagMessage.getElement().setAttribute("title", i18n.GL1944());

    tagContainer.getElement().setAttribute("alt", labelName);
    tagContainer.setTitle(labelName);

    /*if(labelName.length()>=12){
    	labelName = labelName.substring(0, 12) + "...";
    }*/
    tagType.setText(labelName);
    tagType.getElement().setId("lblTagType");
    tagType.getElement().setAttribute("alt", labelName);
    tagType.getElement().setAttribute("title", labelName);

    tagCount.setText(count);
    tagCount.getElement().setId("lblTagCount");
    tagCount.getElement().setAttribute("alt", count);
    tagCount.getElement().setAttribute("title", count);

    userTagsResourceContainerConatiner.clear();
    for (int i = 0; i < result.size(); i++) {
      ProfileUserTagsResourceWidget profileUserTagsResourceWidget =
          new ProfileUserTagsResourceWidget(result.get(i));
      userTagsResourceContainerConatiner.add(profileUserTagsResourceWidget);
    }

    tagContainer.getElement().setId("pnlTagContainer");
    tagScrollPanel.getElement().setId("sbTagScrollPanel");
    userTagsResourceContainerConatiner.getElement().setId("pnlUserTagsResourceContainerConatiner");
  }
  public ShowMorePagerPanel(int pageSize) {
    incrementSize = pageSize;
    initWidget(scrollable);

    // Do not let the scrollable take tab focus.
    scrollable.getElement().setTabIndex(-1);

    // Handle scroll events.
    scrollable.addScrollHandler(
        new ScrollHandler() {
          @Override
          public void onScroll(ScrollEvent event) {
            // If scrolling up, ignore the event.
            int oldScrollPos = lastScrollPos;
            lastScrollPos = scrollable.getVerticalScrollPosition();
            if (oldScrollPos >= lastScrollPos) {
              return;
            }

            HasRows display = getDisplay();
            if (display == null) {
              return;
            }

            int maxScrollTop =
                scrollable.getWidget().getOffsetHeight() - scrollable.getOffsetHeight();
            if (lastScrollPos >= maxScrollTop - 16) {
              // We are near the end, so increase the page size.
              int newPageSize =
                  Math.min(
                      display.getVisibleRange().getLength() + incrementSize, display.getRowCount());
              display.setVisibleRange(0, newPageSize);
            }
          }
        });
  }
Esempio n. 10
0
  public CourseFinderCourses() {
    super();

    iCourses = new WebTable();
    iCourses.setHeader(
        new WebTable.Row(
            new WebTable.Cell(MESSAGES.colSubject(), 1, "80px"),
            new WebTable.Cell(MESSAGES.colCourse(), 1, "80px"),
            new WebTable.Cell(MESSAGES.colLimit(), 1, "60px"),
            new WebTable.Cell(MESSAGES.colTitle(), 1, "300px"),
            new WebTable.Cell(MESSAGES.colCredit(), 1, "60px"),
            new WebTable.Cell(MESSAGES.colNote(), 1, "300px")));
    iCourses.addRowDoubleClickHandler(
        new WebTable.RowDoubleClickHandler() {
          public void onRowDoubleClick(WebTable.RowDoubleClickEvent event) {
            iCourses.setSelectedRow(event.getRowIdx());
            updateCourseDetails();
            SelectionEvent.fire(CourseFinderCourses.this, getValue());
          }
        });
    iCourses.addRowClickHandler(
        new WebTable.RowClickHandler() {
          public void onRowClick(WebTable.RowClickEvent event) {
            iCourses.setSelectedRow(event.getRowIdx());
            updateCourseDetails();
          }
        });

    iCoursesPanel = new ScrollPanel(iCourses);
    iCoursesPanel.getElement().getStyle().setWidth(780, Unit.PX);
    iCoursesPanel.getElement().getStyle().setHeight(200, Unit.PX);
    iCoursesPanel.setStyleName("unitime-ScrollPanel");

    iCoursesTip =
        new Label(CONSTANTS.courseTips()[(int) (Math.random() * CONSTANTS.courseTips().length)]);
    iCoursesTip.setStyleName("unitime-Hint");
    ToolBox.disableTextSelectInternal(iCoursesTip.getElement());
    iCoursesTip.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            String oldText = iCoursesTip.getText();
            do {
              iCoursesTip.setText(
                  CONSTANTS.courseTips()[(int) (Math.random() * CONSTANTS.courseTips().length)]);
            } while (oldText.equals(iCoursesTip.getText()));
          }
        });

    iCourseDetailsTabPanel = new UniTimeTabPanel();
    iCourseDetailsTabPanel.setDeckStyleName("unitime-TabPanel");
    iCourseDetailsTabPanel.addSelectionHandler(
        new SelectionHandler<Integer>() {
          @Override
          public void onSelection(SelectionEvent<Integer> event) {
            Cookies.setCookie(
                "UniTime:CourseFinderCourses", String.valueOf(event.getSelectedItem()));
          }
        });

    setSpacing(10);
    add(iCoursesPanel);
    add(iCourseDetailsTabPanel);
    add(iCoursesTip);
  }
Esempio n. 11
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);
    }
  }
 @Override
 public void scrollBottom() {
   scrollPanel.getElement().setScrollTop(scrollPanel.getElement().getScrollHeight());
 }
 public void setTreeContainerHeight(double height) {
   treeContainer.getElement().getStyle().setHeight(height, Unit.PX);
 }
 @Override
 public void ensureVisible(TargetContentsDisplay currentDisplay) {
   Widget transUnitRow = currentDisplay.asWidget();
   scrollToElement(root.getElement(), transUnitRow.getElement());
 }