Example usage for com.google.gwt.user.client.ui Widget getOffsetWidth

List of usage examples for com.google.gwt.user.client.ui Widget getOffsetWidth

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Widget getOffsetWidth.

Prototype

@Override
    public int getOffsetWidth() 

Source Link

Usage

From source file:edu.caltech.ipac.firefly.ui.previews.DataSourceCoveragePreview.java

private void replotCoverageImage() {
    double radiusD = _info.getRadius();

    if (Double.isInfinite(radiusD) || Double.isNaN(radiusD) || radiusD == 0F) {
        _plotDeck.showNoData(_prop.getName("cantCompute"));
    } else {//from w w w .j av a 2 s .  c  o  m
        WorldPt wp = _info.getCenter();

        String base = _covData.getCoverageBaseTitle();
        Widget w = getWidget();
        int width = (w != null) ? w.getOffsetWidth() - 15 : 40;

        WebPlotRequest request = new CoverageChooser().getRequest(wp, (float) radiusD, base + " ",
                _covData.getSmartZoomHint(), _covData.getUseBlankPlot(), WebPlotRequest.GridOnStatus.FALSE,
                width);
        if (w != null && width > 50) {
            request.setZoomType(ZoomType.TO_WIDTH);
            request.setZoomToWidth(width);
        }
        _plotDeck.showPlot();
        if (!request.equals(_info.getActivePlottingRequest())) {
            _info.setActivePlottingRequest(request);
            plot(request);
        }
    }
}

From source file:edu.caltech.ipac.firefly.visualize.FloatingVisBar.java

private void startPackaging(DownloadRequest dataRequest) {
    /*todo: title= buildTitle();
            //from   w ww  .ja v  a 2  s. c  om
    String emailStr= null;
    if (_useEmail.getValue() && !StringUtils.isEmpty(_emailField.getValue()))  {
    emailStr= _emailField.getValue();
    Preferences.set(BackgroundManager.EMAIL_PREF, emailStr);
    }*/

    LayoutManager lman = Application.getInstance().getLayoutManager();
    dataRequest.setBaseFileName(dataRequest.getFilePrefix());
    dataRequest.setTitle(dataRequest.getTitlePrefix() + "-pdf-" + downloadCounter++);
    /*todo: add dialog box dataRequest.setEmail(emailStr);*/
    dataRequest.setDataSource(DynRequestHandler.getCurrentProject());
    dataRequest.setParam("file_type", "pdf");

    /*todo: add dialog box
    // set options into request
    List<InputField> ifs = Form.searchForFields(_optionsPanel);
    for (InputField i : ifs) {
    if (GwtUtil.isOnDisplay(i) || i instanceof HiddenField) {
        dataRequest.setParam(i.getFieldDef().getName(), i.getValue());
    }
    }*/

    Widget maskW = lman.getRegion(LayoutManager.RESULT_REGION).getDisplay();
    Widget w = _popup.getPopupPanel().getParent();
    int cX = w.getAbsoluteLeft() + w.getOffsetWidth() / 2;
    int cY = w.getAbsoluteTop() + w.getOffsetHeight() / 2;
    PackageTask.preparePackage(maskW, cX, cY, dataRequest);
}

From source file:edu.caltech.ipac.firefly.visualize.MiniPlotWidget.java

public Dimension getEstimatedFitSize(Widget w) {
    int width = w.getOffsetWidth() - 10;
    int height = w.getOffsetHeight() - getTitleHeight() - 6;
    return new Dimension(width, height);
}

From source file:edu.caltech.ipac.firefly.visualize.ui.AutoGridRenderer.java

public void reinitSingle() {
    grid.clear();/*from  w ww  .  j ava  2 s.c o  m*/
    int mpwSize = showMask == null ? mpwMap.size() : showMask.size();
    if (mpwSize == 0)
        return;
    grid.resize(1, 1);
    grid.setCellPadding(2);
    MiniPlotWidget selectedMPW = AllPlots.getInstance().getMiniPlotWidget();
    Widget p = grid.getParent();
    int w = p.getOffsetWidth();
    int h = p.getOffsetHeight();
    for (Map.Entry<String, MiniPlotWidget> entry : mpwMap.entrySet()) {
        if (showMask == null || showMask.contains(entry.getKey())) {
            MiniPlotWidget mpw = entry.getValue();
            if (selectedMPW == mpw) {
                grid.setWidget(0, 0, mpw);
                mpw.setPixelSize(w, h);
                mpw.onResize();
                break;
            }
        }
    }
}

From source file:edu.caltech.ipac.firefly.visualize.ui.AutoGridRenderer.java

public void reinitGridAsGrid() {
    grid.clear();//ww w.j  a va  2  s. c o  m
    int mpwSize = showMask == null ? mpwMap.size() : showMask.size();
    int size = mpwSize + xyList.size();
    if (size > 0) {
        int rows = 1;
        int cols = 1;
        if (size >= 7) {
            rows = size / 4 + (size % 4);
            cols = 4;
        } else if (size == 5 || size == 6) {
            rows = 2;
            cols = 3;
        } else if (size == 4) {
            rows = 2;
            cols = 2;
        } else if (size == 3) {
            rows = 2;
            cols = 2;
        } else if (size == 2) {
            rows = 1;
            cols = 2;
        }
        Widget p = grid.getParent();
        int w = p.getOffsetWidth() / cols;
        int h = p.getOffsetHeight() / rows;

        grid.resize(rows, cols);
        grid.setCellPadding(2);

        int col = 0;
        int row = 0;
        for (Map.Entry<String, MiniPlotWidget> entry : mpwMap.entrySet()) {
            if (showMask == null || showMask.contains(entry.getKey())) {
                MiniPlotWidget mpw = entry.getValue();
                grid.setWidget(row, col, mpw);
                mpw.setPixelSize(w, h);
                mpw.onResize();
                col = (col < cols - 1) ? col + 1 : 0;
                if (col == 0)
                    row++;
            }
        }

        for (XYPlotWidget xy : xyList) {
            grid.setWidget(row, col, xy);
            xy.setPixelSize(w, h);
            xy.onResize();
            col = (col < cols - 1) ? col + 1 : 0;
            if (col == 0)
                row++;
        }
        AllPlots.getInstance().updateUISelectedLook();
    }
}

From source file:edu.caltech.ipac.firefly.visualize.ui.AutoGridRenderer.java

private Dimension getGridDimension() {
    final int margin = 4;
    final int panelMargin = 14;
    Widget p = grid.getParent();
    if (!GwtUtil.isOnDisplay(p))
        return null;
    int rows = grid.getRowCount();
    int cols = grid.getColumnCount();
    if (rows == 0 || cols == 0)
        return null;
    int w = (p.getOffsetWidth() - panelMargin) / cols - margin;
    int h = (p.getOffsetHeight() - panelMargin) / rows - margin;
    return new Dimension(w, h);
}

From source file:edu.caltech.ipac.firefly.visualize.ui.FinderChartGridRenderer.java

public void reinitSingle() {
    grid.clear();/*from  w w  w . j a v a 2  s.  c  o m*/
    grid.removeAllRows();
    grid.setCellPadding(2);

    int mpwSize = showMask == null ? mpwMap.size() : showMask.size();
    if (mpwSize == 0)
        return;
    grid.setCellPadding(2);
    MiniPlotWidget selectedMPW = AllPlots.getInstance().getMiniPlotWidget();
    Widget p = grid.getParent();
    int w = p.getOffsetWidth();
    int h = p.getOffsetHeight();
    for (Map.Entry<String, MiniPlotWidget> entry : mpwMap.entrySet()) {
        if (showMask == null || showMask.contains(entry.getKey())) {
            MiniPlotWidget mpw = entry.getValue();
            if (selectedMPW == mpw) {
                grid.setWidget(0, 0, mpw);
                mpw.setPixelSize(w, h);
                mpw.onResize();
                break;
            }
        }
    }

}

From source file:edu.caltech.ipac.firefly.visualize.ui.ImageSelectPanel.java

private void setTargetCard(int card) {
    if (card == TARGET_PANEL && _targetPanelHolder.getWidget() == null) {
        _targetPanelHolder.setWidget(_targetPanel);
    }/* w  w w  .  j ava2  s  . c  o m*/
    if (card == TARGET_DESC) {
        updateTargetDesc();
    }

    int hideHeight = Math.max(_targetPanelHolder.getOffsetHeight(), _targetDesc.getOffsetHeight());
    int oldHeight = hideTargetLabel.getOffsetHeight();
    hideTargetLabel.setPixelSize(10, hideHeight > oldHeight ? hideHeight : oldHeight);

    if (card == TARGET_HIDDEN && _targetCards.getVisibleWidget() == TARGET_DESC) {
        Widget desc = _targetCards.getWidget(TARGET_DESC);
        Widget hidden = _targetCards.getWidget(TARGET_HIDDEN);
        hidden.setSize(desc.getOffsetWidth() + "px", desc.getOffsetHeight() + "px");
    }

    _targetCards.showWidget(card);
}

From source file:edu.caltech.ipac.firefly.visualize.VisMenuBar.java

Dimension getToolbarSize() {
    Dimension dim = new Dimension(0, 0);
    if (asPopup) {
        Widget pp = popup.getPopupPanel();
        if (pp != null) {
            dim = new Dimension(pp.getOffsetWidth(), pp.getOffsetHeight());
        }/*from  www  . ja v  a 2 s.  c  om*/
    } else {
        dim = new Dimension(inlineLayout.getOffsetWidth(), inlineLayout.getOffsetHeight());
    }
    return dim;

}

From source file:edu.caltech.ipac.firefly.visualize.ZoomUtil.java

public static void zoomGroup(FitFill fitFill) {
    AllPlots ap = AllPlots.getInstance();
    MiniPlotWidget mpw = ap.getMiniPlotWidget();
    final WebPlot plot = mpw.getCurrentPlot();
    VisUtil.FullType ft;/*from   ww w.ja v  a 2s.co  m*/
    PopoutWidget.FillType fillType;

    if (fitFill == FitFill.FIT) {
        ft = VisUtil.FullType.WIDTH_HEIGHT;
        fillType = PopoutWidget.FillType.FIT;
    } else {
        ft = VisUtil.FullType.ONLY_WIDTH;
        fillType = PopoutWidget.FillType.FILL;
    }
    if (ap.isExpanded()) {
        PopoutWidget w = ap.getExpandedController();
        if (w.isExpandedSingleView())
            w.setOneFillType(fillType);
        else
            w.setGridFillType(fillType);

    } else {
        Widget p = mpw.getParent();
        Widget sizeWidget = mpw;
        if (mpw.getOffsetWidth() * mpw.getOffsetHeight() < 4)
            sizeWidget = p;
        if (p != null && GwtUtil.isOnDisplay(p)) {
            Dimension dim = new Dimension(sizeWidget.getOffsetWidth(), sizeWidget.getOffsetHeight());
            if (dim.getWidth() * dim.getHeight() > 1) {
                float zlevel = ZoomUtil.getEstimatedFullZoomFactor(plot, dim, ft, -1, 1);
                zoomGroupTo(zlevel);
            }
        }
    }
}