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

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

Introduction

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

Prototype

public void setWidth(String width) 

Source Link

Document

Sets the object's width.

Usage

From source file:nz.co.doltech.gwt.sdm.ui.SuperDevModeUI.java

License:Apache License

public SuperDevModeUI() {
    resources.style().ensureInjected();//from  w  w w  .  j  a  va 2 s  .  com

    superDevCompiler.addPollCallback(new PollCallback() {
        @Override
        public void onPoll(float startTime) {
            if (progressPanel != null && progressPanel.getWidgetCount() > 0) {
                Paragraph paragraph = (Paragraph) progressPanel.getWidget(0);
                paragraph.setHTML(paragraph.getHTML() + ".");
            }
        }
    });

    superDevCompiler.addCompileStartCallback(new StartedCallback() {
        @Override
        public void onStarted(String moduleName, String requestUrl) {
            progressPanel = new AbsolutePanel();
            progressPanel.add(new Paragraph("Compiling " + moduleName));
            showMessagePanel(progressPanel);
        }
    });

    superDevCompiler.addCompileCompleteCallback(new CompletedCallback() {
        @Override
        public boolean onCompleted(JavaScriptObject json) {
            compilationStopped();
            return false;
        }
    });

    superDevCompiler.addCompileFailedCallback(new FailedCallback() {
        @Override
        public void onFailed(String reason, String logUrl) {
            btnCompile.setText("Try Again");

            AbsolutePanel content = new AbsolutePanel();
            content.getElement().getStyle().setColor("red");
            content.add(new Paragraph(reason));
            Widget error;
            if (!showErrorLog) {
                error = new Anchor("View Error Log", logUrl);
                ((Anchor) error).setTarget("_blank");
            } else {
                error = new Frame(logUrl);
                error.setWidth("730px");
                error.setHeight("300px");
            }
            content.add(error);
            showMessagePanel(content);

            compilationStopped();
        }
    });

    RootPanel.getBodyElement().focus();
    RootPanel.get().addDomHandler(new KeyDownHandler() {
        @Override
        public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_F5) {
                event.preventDefault();
                startCompile();
            }
        }
    }, KeyDownEvent.getType());

    initWidget(uibinder.createAndBindUi(this));
}

From source file:org.apache.hupa.client.widgets.MessageHeaders.java

License:Apache License

private void addRow(String name, final Widget widget) {

    //      Block insertion:
    //// w  w w.  j  ava 2s  .co m
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x2_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x00x0");

    //      Block insertion:
    //
    InstrumentationLoggerProvider.get()
            .instrument("org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x00x1");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x20x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x30x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x2_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x3_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x4_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x30x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c1763067_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x1");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x00x0");
    if (widget == null)
        return;

    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x10x10x00x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x10x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x10x10x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x10x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x10x10x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x1");
    Widget label = new Label(name + ":");
    if (widget instanceof MultiValueSuggestArea) {
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x2");
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x00x0");
        widget.setWidth("100%");
        if (((HasText) widget).getText().trim().length() == 0) {
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x00x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x00x00x00x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x00x00x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x00x0");
            InstrumentationLoggerProvider.get().instrument(
                    "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x10x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x10x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x10x10x10x00x0");
            label = createLinkToShow(name, widget);
        }
    } else if (widget instanceof TextBox) {
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x2_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x00x0");
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x10x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x10x0");
        widget.setWidth("100%");
    } else if (widget instanceof HasText) {
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x2_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x00x0");

        //      Block insertion:
        //
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x10x00x1");
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x10x00x00x00x00x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x10x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x10x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x10x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x10x00x00x00x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x10x00x00x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x10x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x10x00x00x00x00x0");
        if (((HasText) widget).getText().trim().length() == 0)
            return;
    } else if (widget instanceof IUploader) {
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x1_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x2_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x00x0");
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x10x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x10x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x10x00x0");
        label = createLinkToShow(name, widget);
    } else if (widget instanceof Panel) {

        //      Block insertion:
        //
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x10x00x1");
        InstrumentationLoggerProvider.get().instrument(
                "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x10x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x10x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x10x00x00x00x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x10x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x10x00x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x10x00x00x00x00x00x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x20x20x20x20x20x10x00x00x00x0");
        if (((Panel) widget).iterator().hasNext() == false)
            return;
    }

    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x3_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x30x0");
    detailGrid.setWidget(rowCounter, 0, label);
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x4_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x40x0");
    detailGrid.setWidget(rowCounter, 1, widget);
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x50x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x5_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x50x00x0");
    detailGrid.getCellFormatter().setStyleName(rowCounter, 0, "label");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x6_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x60x0_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x60x00x0");
    detailGrid.getCellFormatter().setStyleName(rowCounter, 1, "value");
    InstrumentationLoggerProvider.get().instrument(
            "org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x7_____org_apache_hupa_client_widgets_MessageHeaders_java0x01ab7e481c17630670x40x70x0");
    rowCounter++;
}

From source file:org.apache.oozie.tools.workflowgenerator.client.property.PropertyTable.java

License:Apache License

/**
 * Set the width of widget// w w  w  . j a v  a 2 s . co m
 *
 * @param w widget
 * @return
 */
protected Widget formatCell(Widget w) {
    w.setWidth("300px");
    return w;
}

From source file:org.cruxframework.crux.smartfaces.client.storyboard.StoryboardPanel.java

License:Apache License

protected void configHeightWidth(final Widget panel) {
    if (!StringUtils.isEmpty(itemHeight)) {
        if (fixedHeight) {
            panel.setHeight(itemHeight);
        } else {/*from  w  w  w  .j ava 2 s . co  m*/
            panel.getElement().getStyle().setProperty("minHeight", itemHeight);
        }
    }

    if (!StringUtils.isEmpty(itemWidth)) {
        if (fixedWidth) {
            panel.setWidth(itemWidth);
        } else {
            panel.getElement().getStyle().setProperty("minWidth", itemWidth);
        }
    }
}

From source file:org.cruxframework.crux.widgets.client.slider.Slider.java

License:Apache License

@SuppressWarnings("unused")
private static void fixWidthHeight(final Widget widget) {
    widget.setWidth("100%");
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override//from w ww  .j  ava 2 s . c  o m
        public void execute() {
            widget.setHeight("100%");
        }
    });
}

From source file:org.drools.brms.client.modeldriven.ui.RuleModeller.java

License:Apache License

/**
 * Do all the widgets for the RHS./* w  w  w  .j a v a2s. c  o m*/
 */
/*
 * TODO STILL NEED TO BE CHECKED
 */
private Widget renderRhs(final RuleModel model) {
    DirtyableVerticalPane vert = new DirtyableVerticalPane();

    for (int i = 0; i < model.rhs.length; i++) {
        IAction action = model.rhs[i];

        Widget w = null;
        if (action instanceof ActionSetField) {
            w = new ActionSetFieldWidget(this, (ActionSetField) action, completions);
        } else if (action instanceof ActionInsertFact) {
            w = new ActionInsertFactWidget(this, (ActionInsertFact) action, completions);
        } else if (action instanceof ActionRetractFact) {
            w = new ActionRetractFactWidget(this.completions, (ActionRetractFact) action);
        } else if (action instanceof DSLSentence) {
            w = new DSLSentenceWidget((DSLSentence) action);
            w.setStyleName("model-builderInner-Background");
        }

        //w.setWidth( "100%" );
        vert.add(spacerWidget());
        //vert.setWidth( "100%" );

        DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();

        Image remove = new ImageButton("images/delete_item_small.gif");
        remove.setTitle("Remove this action.");
        final int idx = i;
        remove.addClickListener(new ClickListener() {
            public void onClick(Widget w) {
                YesNoDialog diag = new YesNoDialog("Remove this item?", new Command() {
                    public void execute() {
                        model.removeRhsItem(idx);
                        refreshWidget();
                    }
                });
                diag.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop());
                diag.show();
            }
        });
        horiz.add(w);
        if (!(w instanceof ActionRetractFactWidget)) {
            w.setWidth("100%");
            horiz.setWidth("100%");
        }

        horiz.add(remove);
        vert.add(horiz);

    }

    return vert;
}

From source file:org.drools.brms.client.modeldriven.ui.RuleModeller.java

License:Apache License

/**
 * This adds the widget to the UI, also adding the remove icon.
 *///from ww w  . j  a  v  a  2s .c  om
private Widget wrapLHSWidget(final RuleModel model, int i, Widget w) {
    DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();

    Image remove = new ImageButton("images/delete_item_small.gif");
    remove.setTitle("Remove this ENTIRE condition, and all the field constraints that belong to it.");
    final int idx = i;
    remove.addClickListener(new ClickListener() {
        public void onClick(Widget w) {
            YesNoDialog diag = new YesNoDialog("Remove this entire condition?", new Command() {
                public void execute() {
                    if (model.removeLhsItem(idx)) {
                        refreshWidget();
                    } else {
                        ErrorPopup.showMessage(
                                "Can't remove that item as it is used in the action part of the rule.");
                    }
                }
            });
            diag.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop());
            diag.show();
        }
    });

    horiz.setWidth("100%");
    w.setWidth("100%");

    horiz.add(w);
    horiz.add(remove);

    return horiz;
}

From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.FromCompositeFactPatternWidget.java

License:Apache License

protected Widget addRemoveButton(Widget w, ClickHandler listener) {
    DirtyableHorizontalPane horiz = new DirtyableHorizontalPane();

    final Image remove = DroolsGuvnorImages.INSTANCE.DeleteItemSmall();
    remove.setAltText(Constants.INSTANCE.RemoveThisBlockOfData());
    remove.setTitle(Constants.INSTANCE.RemoveThisBlockOfData());
    remove.addClickHandler(listener);//  w w w  .j av a2  s.  c om

    horiz.setWidth("100%");
    w.setWidth("100%");

    horiz.add(w);
    if (!this.readOnly) {
        horiz.add(remove);
    }
    return horiz;
}

From source file:org.drools.guvnor.client.common.Popup.java

License:Apache License

@Override
public void show() {

    if (afterShowEvent != null) {
        afterShowEvent.execute();//w w w .j  a  v  a 2s  . c  om
    }

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);

    this.titleBar = new PopupTitleBar(getTitle());

    this.titleBar.closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
            if (afterCloseEvent != null) {
                afterCloseEvent.execute();
            }
        }
    });
    this.titleBar.addMouseDownHandler(new MouseDownHandler() {

        public void onMouseDown(MouseDownEvent event) {
            dragged = true;
            dragStartX = event.getRelativeX(getElement());
            dragStartY = event.getRelativeY(getElement());
            DOM.setCapture(titleBar.getElement());
        }
    });
    this.titleBar.addMouseMoveHandler(new MouseMoveHandler() {

        public void onMouseMove(MouseMoveEvent event) {
            if (dragged) {
                setPopupPosition(event.getClientX() - dragStartX, event.getClientY() - dragStartY);
            }
        }
    });
    this.titleBar.addMouseUpHandler(new MouseUpHandler() {

        public void onMouseUp(MouseUpEvent event) {
            dragged = false;
            DOM.releaseCapture(titleBar.getElement());
        }
    });

    verticalPanel.add(titleBar);

    Widget content = getContent();

    content.setWidth("100%");
    verticalPanel.add(content);
    add(verticalPanel);

    add(createKeyListeningFocusPanel(verticalPanel));

    super.show();

    focusFirstWidget(content);

    if (!fixedLocation) {
        center();
    }
}

From source file:org.drools.guvnor.client.explorer.PerspectivesPanelViewImpl.java

License:Apache License

public void setWidget(IsWidget widget) {
    perspective.clear();//from  w  w w  . j  av a 2s  .  c  o  m
    Widget w = widget.asWidget();
    w.setHeight("100%");
    w.setWidth("100%");
    perspective.add(w);
}