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

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

Introduction

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

Prototype

public void setPixelSize(int width, int height) 

Source Link

Document

Sets the object's size, in pixels, not including decorations such as border, margin, and padding.

Usage

From source file:ch.eaternity.client.FlexTableRowDropController.java

License:Apache License

Widget newPositioner(DragContext context) {
    Widget p = new SimplePanel();
    p.addStyleName("dragHere");
    p.setPixelSize(flexTable.getOffsetWidth(), 1);
    return p;//from   w ww  .  j a  v a 2  s. com
}

From source file:cl.uai.client.toolbar.sortpages.FlexTableRowDropController.java

License:Open Source License

Widget newPositioner(DragContext context) {
    Widget p = new SimplePanel();
    p.addStyleName(Resources.INSTANCE.css().sortpagespositioner());
    p.setPixelSize(flexTable.getOffsetWidth(), 1);
    return p;/*from  w  w w.ja  v  a  2s .  c o  m*/
}

From source file:com.allen_sauer.gwt.dnd.client.PickupDragController.java

License:Apache License

/**
 * Called by {@link PickupDragController#dragStart()} to allow subclasses to provide their own
 * drag proxies.//from w w w.  j a  v  a2s  .c om
 *
 * @param context the current drag context
 * @return a new drag proxy
 */
protected Widget newDragProxy(DragContext context) {
    AbsolutePanel container = new AbsolutePanel();
    container.getElement().getStyle().setProperty("overflow", "visible");

    WidgetArea draggableArea = new WidgetArea(context.draggable, null);
    for (Widget widget : context.selectedWidgets) {
        WidgetArea widgetArea = new WidgetArea(widget, null);
        Widget proxy = new SimplePanel();
        proxy.setPixelSize(widget.getOffsetWidth(), widget.getOffsetHeight());
        proxy.addStyleName(DragClientBundle.INSTANCE.css().proxy());
        container.add(proxy, widgetArea.getLeft() - draggableArea.getLeft(),
                widgetArea.getTop() - draggableArea.getTop());
    }

    return container;
}

From source file:com.allen_sauer.gwt.dnd.demo.client.example.flextable.FlexTableRowDropController.java

License:Apache License

Widget newPositioner(DragContext context) {
    Widget p = new SimplePanel();
    p.addStyleName(CSS_DEMO_TABLE_POSITIONER);
    p.setPixelSize(flexTable.getOffsetWidth(), 1);
    return p;//from   w  w  w .  j av a 2  s.c  o m
}

From source file:com.objetdirect.gwt.umlapi.client.gfx.IncubatorGfxPlatform.java

License:Open Source License

public void setSize(final Widget canvas, final int width, final int height) {
    canvas.setPixelSize(width, height);
}

From source file:com.risevision.ui.client.presentation.PresentationLayoutWidget.java

License:Open Source License

private void setWidgetPixelSize(Widget placeholderWidget, PlaceholderInfo placeholder) {
    //       DOM.setStyleAttribute(placeholderWidget.getElement(), "width", placeholder.getWidth() + placeholder.getWidthUnits());
    //       DOM.setStyleAttribute(placeholderWidget.getElement(), "height", placeholder.getHeight() + placeholder.getHeightUnits());

    int placeholderWidth = getPixelSize(placeholder.getWidth(), width, placeholder.getWidthUnits());
    int placeholderHeight = getPixelSize(placeholder.getHeight(), height, placeholder.getHeightUnits());

    placeholderWidget.setPixelSize(placeholderWidth - 2, placeholderHeight - 2); // 2px for border size
}

From source file:com.sencha.gxt.widget.core.client.grid.editing.GridInlineEditing.java

License:sencha.com license

@SuppressWarnings("unchecked")
protected <N, O> void doStartEditing(final GridCell cell) {
    if (GXTLogConfiguration.loggingIsEnabled()) {
        logger.finest("doStartEditing");
    }/*from   ww  w .j a  v a2  s. co m*/

    if (getEditableGrid() != null && getEditableGrid().isAttached() && cell != null) {
        M value = getEditableGrid().getStore().get(cell.getRow());

        ColumnConfig<M, N> c = columnModel.getColumn(cell.getCol());
        if (c != null && value != null) {

            Converter<N, O> converter = getConverter(c);

            ValueProvider<? super M, N> v = c.getValueProvider();
            N colValue = getEditableGrid().getStore().hasRecord(value)
                    ? getEditableGrid().getStore().getRecord(value).getValue(v)
                    : v.getValue(value);
            O convertedValue;
            if (converter != null) {
                convertedValue = converter.convertModelValue(colValue);
            } else {
                convertedValue = (O) colValue;
            }

            final IsField<O> field = getEditor(c);
            if (field != null) {
                if (field instanceof HasErrorHandler) {
                    ((HasErrorHandler) field).setErrorSupport(null);
                }

                activeCell = cell;

                if (GXTLogConfiguration.loggingIsEnabled()) {
                    logger.finest("doStartEditing convertedValue: " + convertedValue);
                }

                field.setValue(convertedValue);

                if (field instanceof TriggerField<?>) {
                    ((TriggerField<?>) field).setMonitorTab(false);
                }

                if (field instanceof CheckBox) {
                    ((CheckBox) field).setBorders(true);
                }

                Widget w = field.asWidget();
                getEditableGrid().getView().getEditorParent().appendChild(w.getElement());
                ComponentHelper.setParent(getEditableGrid(), w);
                ComponentHelper.doAttach(w);

                w.setPixelSize(c.getWidth(), Integer.MIN_VALUE);
                w.getElement().<XElement>cast().makePositionable(true);

                Element row = getEditableGrid().getView().getRow(cell.getRow());

                int left = 0;
                for (int i = 0; i < cell.getCol(); i++) {
                    if (!columnModel.isHidden(i)) {
                        left += columnModel.getColumnWidth(i);
                    }
                }

                w.getElement().<XElement>cast().setLeftTop(left,
                        row.getAbsoluteTop() - getEditableGrid().getView().getBody().getAbsoluteTop());

                field.asWidget().setVisible(true);

                startMonitoring();

                Scheduler.get().scheduleDeferred(new ScheduledCommand() {
                    @Override
                    public void execute() {
                        if (GXTLogConfiguration.loggingIsEnabled()) {
                            logger.finest("doStartEditing scheduleDeferred doFocus ");
                        }

                        // browsers select all when tabbing into a input and put cursor at location when clicking into an input
                        // with inline editing, the field is not visible at time of click so we select all. we ignore
                        // field.isSelectOnFocus as this only applies when clicking into a field
                        if (field instanceof ValueBaseField<?>) {
                            ValueBaseField<?> vf = (ValueBaseField<?>) field;
                            vf.selectAll();
                        }

                        // EXTGWT-2856 calling doFocus before selectAll is causing blur to fire which ends the edit immediately
                        // after it starts
                        doFocus(field);

                        ignoreScroll = false;

                        fieldRegistration.removeHandler();

                        fieldRegistration.add(field.addValueChangeHandler(new ValueChangeHandler<O>() {

                            @Override
                            public void onValueChange(ValueChangeEvent<O> event) {

                                if (GXTLogConfiguration.loggingIsEnabled()) {
                                    logger.finest("doStartEditing onValueChanged");
                                }

                                // if enter key cause value change we want to ignore the next
                                // enter key otherwise
                                // new edit will start by onEnter
                                ignoreNextEnter = true;

                                Timer t = new Timer() {

                                    @Override
                                    public void run() {
                                        ignoreNextEnter = false;
                                    }
                                };

                                completeEditing();

                                t.schedule(100);
                            }
                        }));

                        fieldRegistration.add(field.addBlurHandler(new BlurHandler() {

                            @Override
                            public void onBlur(final BlurEvent event) {
                                if (GXTLogConfiguration.loggingIsEnabled()) {
                                    logger.finest("doStartEditing onBlur");
                                }

                                ignoreNextEnter = true;

                                Timer t = new Timer() {

                                    @Override
                                    public void run() {
                                        ignoreNextEnter = false;
                                    }
                                };

                                if (GXTLogConfiguration.loggingIsEnabled()) {
                                    logger.finest("doStartEditing onBlur call cancelEditing");
                                }

                                cancelEditing();

                                t.schedule(100);
                            }
                        }));

                        fireEvent(new StartEditEvent<M>(cell));
                    }
                });
            }
        }
    }

}

From source file:com.wso2.jsplumb.client.GWTjsplumbSample.java

License:Open Source License

private void createNewPanel(Widget panel, String panelID, String paneltStyle, int panelWidth, int panelHeight,
        String stylePosition) {/*from www. j  av  a2  s.  c  om*/
    createNewPanel(panel, panelID, paneltStyle);
    panel.setPixelSize(panelWidth, panelHeight);
    panel.getElement().getStyle().setProperty(STYLE_POSITION, stylePosition);

}

From source file:edu.caltech.ipac.firefly.core.SupportedBrowsers.java

public static HTML getUnsupportedMessage() {
    ensureInitialized();//from   w  w  w  .j  a  v  a  2  s  .c o m
    Widget w = new HTML(_unsupportedMsg);
    w.setPixelSize(500, 500);

    return new HTML(_unsupportedMsg);
}

From source file:edu.caltech.ipac.firefly.ui.PopupContainerForRegion.java

private void ensureSize() {
    if (_popout.isExpanded() && GwtUtil.isOnDisplay(_layout)) {
        Dimension dim = getAvailableSize();
        Widget tlExpRoot = _popout.getToplevelExpandRoot();
        tlExpRoot.setPixelSize(dim.getWidth(), dim.getHeight());
        _layout.onResize();/*w  ww .  ja va2  s  . c  o  m*/
    }
}