Example usage for com.google.gwt.user.client Window getClientHeight

List of usage examples for com.google.gwt.user.client Window getClientHeight

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window getClientHeight.

Prototype

public static int getClientHeight() 

Source Link

Usage

From source file:cl.uai.client.rubric.RubricPanel.java

License:Open Source License

@Override
protected void onLoad() {
    super.onLoad();

    if (MarkingInterface.submissionData == null
            || MarkingInterface.submissionData.getRubricfillings() == null) {
        logger.severe("Submission data should not be null when loading the rubric interface!");
        return;//w  ww. jav  a  2  s . c  om
    }

    if (isPopupInterface()) {
        float height = Window.getClientHeight() - EMarkingWeb.markingInterface.getToolbar().getOffsetHeight()
                - 140;
        if (scrollRubric != null) {
            scrollRubric.getElement().getStyle().setProperty("MaxHeight", height + "px");
            // scrollRubric.setHeight(height + "px");
        } else {
            logger.severe("scrollRubric shouldn't be null when ");
        }
    }

    if (EMarkingConfiguration.getMarkingType() == EMarkingConfiguration.EMARKING_TYPE_PRINT_SCAN) {
        mainPanel.setVisible(false);
        rubricFilter.setVisible(false);
    }

    rubricTable.clear();

    rubricRows = new HashMap<Integer, FlowPanel>();
    rubricIndices = new HashMap<Integer, Integer>();
    rubricTitle.setText(MarkingInterface.submissionData.getRubricname());

    int index = 0;
    for (int criterionSortId : MarkingInterface.submissionData.getSortedRubricfillings().keySet()) {
        Criterion criterion = MarkingInterface.submissionData.getSortedRubricfillings().get(criterionSortId);
        index++;
        FlowPanel rowPanel = new FlowPanel();
        rowPanel.addStyleName(Resources.INSTANCE.css().rubricrow());
        if (EMarkingConfiguration.isFormativeFeedbackOnly() || EMarkingConfiguration.isColoredRubric()) {
            Color.setWidgetBackgroundHueColor(criterion.getId(), rowPanel);
        }

        CriterionHeader header = new CriterionHeader(index, criterion.getId(), criterion.getDescription(),
                criterion.getBonus(), criterion.getRegradeid(), criterion.getRegradeaccepted());

        rowPanel.add(header);

        rubricIndices.put(criterion.getId(), index);
        boolean criterionSelected = false;
        int levelNumber = EMarkingConfiguration
                .getRubricLevelsSorting() == EMarkingConfiguration.EMARKING_RUBRIC_SORT_LEVELS_ASCENDING ? 1
                        : criterion.getLevels().keySet().size();
        for (int levelid : criterion.getLevels().keySet()) {
            Level level = criterion.getLevels().get(levelid);
            LevelLabel levelLabel = new LevelLabel(level.getId(), levelNumber);
            levelLabel.addStyleName(Resources.INSTANCE.css().criterionDescription());

            if (criterion.getSelectedLevel() != null && criterion.getSelectedLevel().getId() == level.getId()) {
                levelLabel.addStyleName(Resources.INSTANCE.css().rubricLevelSelected());
                criterionSelected = true;

                header.setCommentId(level.getMarkId());
                header.setCommentPage(level.getPage());
                header.setBackGroundPercent(criterion.getHue());

                if (criterion.getRegradeid() > 0) {
                    levelLabel.setRegradeRequested(true);
                    levelLabel.setRegradeComment(criterion.getRegradeComment());
                    levelLabel.updateHtml();
                }
            }

            if (!popupInterface) {
                if (!EMarkingConfiguration.isReadonly()) {
                    EMarkingWeb.markingInterface.dragController.makeDraggable(levelLabel);
                }
            } else if (this.getParent().getParent().getParent() instanceof AddMarkDialog) {
                final AddMarkDialog dialog = (AddMarkDialog) this.getParent().getParent().getParent();
                final int lvlid = level.getId();
                if (criterion.getSelectedLevel() == null
                        || criterion.getSelectedLevel().getId() != level.getId()) {
                    levelLabel.addStyleName(Resources.INSTANCE.css().rubriclabelclickable());
                    levelLabel.addClickHandler(new ClickHandler() {
                        @Override
                        public void onClick(ClickEvent event) {
                            dialog.setLevelId(lvlid);
                            dialog.hide();
                        }
                    });
                }
            } else {
                logger.severe("Problem adding click handler");
                logger.severe(this.getParent().getClass().getName());
                logger.severe(this.getParent().getParent().getClass().getName());
                logger.severe(this.getParent().getParent().getParent().getClass().getName());
            }
            rowPanel.add(levelLabel);
            if (EMarkingConfiguration
                    .getRubricLevelsSorting() == EMarkingConfiguration.EMARKING_RUBRIC_SORT_LEVELS_ASCENDING) {
                levelNumber++;
            } else {
                levelNumber--;
            }
        }

        if (criterionSelected) {
            header.setMarkerVisible(!popupInterface);
            rowPanel.addStyleName(getCriterionVisibilityCss(criterion));
        } else {
            header.setMarkerVisible(false);
            rowPanel.addStyleName(getCriterionVisibilityCss(criterion));
        }

        rubricRows.put(criterion.getId(), rowPanel);
        rubricTable.add(rowPanel);

        // If we have a colored rubric or formative feedback is forced, then paint the whole row.
        if (EMarkingConfiguration.isFormativeFeedbackOnly() || EMarkingConfiguration.isColoredRubric()) {
            Color.setElementBackgroundHueColor(criterion.getId(), DOM.getParent(rowPanel.getElement()));
        } else {
            rowPanel.addStyleName(Resources.INSTANCE.css().rubricrowplain());
        }
    }

    if (!EMarkingConfiguration.isReadonly() && !isPopupInterface()) {
        rubricTable.add(generalFeedbackInterface);
    }

    EMarkingWeb.reloadMathJax();
}

From source file:client.ManagementGui.java

License:Open Source License

/**
 * Build the whole panel./*from  w ww.  ja  va  2s.c om*/
 */
public final void onModuleLoad() {
    ManagementGui.instance = this;

    this.logoPanel.setWidth("100%");

    this.rightPanel.addStyleName("rightPanel");
    this.rightPanel.setWidth("100%");

    this.resTree.addStyleName("treeMenu");

    this.topologyTree.addStyleName("treeMenu");

    this.argonTree.addStyleName("treeMenu");

    this.stackPanel.setWidth("200");

    this.stackPanel.add(this.resTree, this.createImageHtml("journal.png", "Reservation"), true);
    this.stackPanel.add(this.topologyTree, this.createImageHtml("connect.png", "Tools"), true);
    this.stackPanel.add(this.argonTree, this.createImageHtml("database.png", "Argon"), true);
    this.stackPanel.add(this.renameTree, "About", true);

    this.dock.add(this.logoPanel, DockPanel.NORTH);
    this.dock.add(LoggingPanel.getPanel(), DockPanel.SOUTH);
    this.dock.add(this.stackPanel, DockPanel.WEST);
    this.dock.add(this.rightPanel, DockPanel.CENTER);

    this.dock.setWidth("100%");

    this.dock.setSpacing(4);
    this.dock.setCellWidth(this.rightPanel, "100%");

    Window.addWindowResizeListener(this);
    Window.enableScrolling(true);
    Window.setMargin("0px");

    RootPanel.get().add(this.dock);

    DeferredCommand.addCommand(new Command() {
        public void execute() {
            ManagementGui.this.onWindowResized(Window.getClientWidth(), Window.getClientHeight());
        }
    });

    this.onWindowResized(Window.getClientWidth(), Window.getClientHeight());
}

From source file:client.template.panel.LoggingPanel.java

License:Open Source License

public void onClose(final DisclosureEvent event) {
    LoggingPanel.isOpen = false;/*from  w w w  .ja  v a 2s  .c om*/

    ManagementGui.get().onWindowResized(Window.getClientWidth(), Window.getClientHeight());
}

From source file:client.template.panel.LoggingPanel.java

License:Open Source License

public void onOpen(final DisclosureEvent event) {
    LoggingPanel.unread = 0;/*www  .  j a v  a  2s  .c  om*/
    LoggingPanel.isOpen = true;

    this.panel.getHeaderTextAccessor().setText(this.title);

    ManagementGui.get().onWindowResized(Window.getClientWidth(), Window.getClientHeight());
}

From source file:co.fxl.gui.gwt.GWTDisplay.java

License:Open Source License

@Override
public int height() {
    return Window.getClientHeight();
}

From source file:com.ait.lienzo.client.widget.LienzoPanel.java

License:Open Source License

public LienzoPanel(final Viewport view) {
    if (false == view.adopt(this)) {
        throw new IllegalArgumentException("Viewport is already adopted.");
    }//from  w  ww  .ja  va2  s  .c  o m
    m_view = view;

    setWidth("100%");

    setHeight("100%");

    doPostCTOR(Window.getClientWidth(), Window.getClientHeight(), true);
}

From source file:com.ait.lienzo.client.widget.panel.impl.LienzoPanelImpl.java

License:Open Source License

public LienzoPanelImpl(final Viewport view) {
    if (false == view.adopt(this)) {
        throw new IllegalArgumentException("Viewport is already adopted.");
    }//  w ww  . j a  v a 2  s  .  co  m
    m_view = view;

    setWidth("100%");

    setHeight("100%");

    doPostCTOR(Window.getClientWidth(), Window.getClientHeight(), true);
}

From source file:com.ait.toolkit.gmaps.client.GMapWidget.java

License:Open Source License

@Override
protected void onAttach() {
    super.onAttach();
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override/*from w  w w .  j  a va  2  s .c o  m*/
        public void execute() {
            setUpMap(div, options.getJsObj());
            GMapWidget.this.getElement().getStyle().setWidth(Window.getClientWidth(), Unit.PX);
            GMapWidget.this.getElement().getStyle().setHeight(Window.getClientHeight(), Unit.PX);
            GMapWidget.this.setWidth(Window.getClientWidth() + "px");
            GMapWidget.this.setHeight(Window.getClientHeight() + "px");
        }
    });
}

From source file:com.ait.toolkit.gmaps.client.GMapWidget.java

License:Open Source License

public void strech() {
    this.getElement().getStyle().setWidth(Window.getClientWidth(), Unit.PX);
    this.getElement().getStyle().setHeight(Window.getClientHeight(), Unit.PX);
    this.setWidth(Window.getClientWidth() + "px");
    this.setHeight(Window.getClientHeight() + "px");
}

From source file:com.alkacon.acacia.client.ui.AttributeChoiceWidget.java

License:Open Source License

/**
 * Evaluates if the choice select should be displayed above the button.<p>
 * // www.ja  v  a2 s.  co m
 * @return <code>true</code> if the choice select should be displayed above the button
 */
private boolean displayAbove() {

    int popupHeight = m_choices.getOffsetHeight();
    // Calculate top position for the choice select
    int top = m_buttonIcon.getAbsoluteTop();

    // Make sure scrolling is taken into account, since
    // box.getAbsoluteTop() takes scrolling into account.
    int windowTop = Window.getScrollTop();
    int windowBottom = Window.getScrollTop() + Window.getClientHeight();

    // Distance from the top edge of the window to the top edge of the
    // text box
    int distanceFromWindowTop = top - windowTop;

    // Distance from the bottom edge of the window to the bottom edge of
    // the text box
    int distanceToWindowBottom = windowBottom - (top + m_buttonIcon.getOffsetHeight());

    // If there is not enough space for the popup's height below the button
    // and there IS enough space for the popup's height above the button,
    // then then position the popup above the button. However, if there
    // is not enough space on either side, then stick with displaying the
    // popup below the button.
    boolean displayAbove = (distanceFromWindowTop > distanceToWindowBottom)
            && (distanceToWindowBottom < popupHeight);
    return displayAbove;
}