Example usage for com.google.gwt.event.dom.client FocusHandler FocusHandler

List of usage examples for com.google.gwt.event.dom.client FocusHandler FocusHandler

Introduction

In this page you can find the example usage for com.google.gwt.event.dom.client FocusHandler FocusHandler.

Prototype

FocusHandler

Source Link

Usage

From source file:com.vaadin.addon.timeline.gwt.client.VTimelineWidget.java

public VTimelineWidget() {
    setWidget(root);/*w  w  w .  j  a  v  a2s.c  o m*/
    getElement().setClassName("v-timeline");

    dts = new DateTimeService();

    root.setStyleName(CLASSNAME);
    root.setSize("100%", "100%");

    caption = new Label("");
    caption.setStyleName(CAPTION_CLASSNAME);
    caption.setVisible(false);
    root.add(caption);

    endDate = new Date();
    startDate = new Date(endDate.getTime() - VDateFormatInfo.MONTH);

    topBar = new HorizontalPanel();
    topBar.setStyleName(CLASSNAME_TOPBAR);
    topBar.setVisible(zoomIsVisible || dateSelectVisible);
    root.add(topBar);

    zoomBar = new HorizontalPanel();
    zoomBar.setStyleName(CLASSNAME_ZOOMBAR);
    zoomBar.setVisible(zoomIsVisible);

    Label zoomLbl = new Label("Zoom:");
    zoomLbl.setStyleName(CLASSNAME_ZOOMBARLABEL);
    zoomBar.add(zoomLbl);
    topBar.add(zoomBar);

    dateRangeBar = new HorizontalPanel();
    dateRangeBar.setStyleName(CLASSNAME_DATERANGE);
    dateRangeBar.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
    dateRangeBar.setVisible(dateSelectVisible);

    dateFrom = new TextBox();
    dateFrom.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            try {
                Date newDate = dts.parseDate(event.getValue(), dateFormatInfo.getEditFormat().getPattern(),
                        true);
                if ((newDate.equals(startDate) || newDate.after(startDate))
                        && (newDate.equals(endDate) || newDate.before(endDate))) {
                    intervalStartDate = newDate;
                    setBrowserRange(intervalStartDate, intervalEndDate);
                    setDisplayRange(intervalStartDate, intervalEndDate);
                    dateFrom.setFocus(false);
                } else {
                    dateFrom.setText(
                            dts.formatDate(intervalStartDate, dateFormatInfo.getEditFormat().getPattern()));
                }
            } catch (IllegalArgumentException iae) {
                dateFrom.setText(
                        dts.formatDate(intervalStartDate, dateFormatInfo.getEditFormat().getPattern()));
            }
        }
    });
    dateFrom.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            dateFrom.setStyleName(CLASSNAME_DATEFIELDEDIT);
            dateFrom.setText(dts.formatDate(intervalStartDate, dateFormatInfo.getEditFormat().getPattern()));
            dateFrom.selectAll();
        }
    });
    dateFrom.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            dateFrom.setStyleName(CLASSNAME_DATEFIELD);
            dateFrom.setText(dts.formatDate(intervalStartDate, dateFormatInfo.getDisplayFormat().getPattern()));
        }
    });
    dateFrom.setReadOnly(!dateSelectEnabled);
    dateFrom.setStyleName(CLASSNAME_DATEFIELD);
    dateRangeBar.add(dateFrom);

    Label dash = new Label();
    dash.setText("-");
    dateRangeBar.add(dash);

    dateTo = new TextBox();
    dateTo.addValueChangeHandler(new ValueChangeHandler<String>() {
        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            try {
                Date newDate = dts.parseDate(event.getValue(), dateFormatInfo.getEditFormat().getPattern(),
                        true);
                if ((newDate.equals(startDate) || newDate.after(startDate))
                        && (newDate.equals(endDate) || newDate.before(endDate))) {
                    intervalEndDate = newDate;
                    setBrowserRange(intervalStartDate, intervalEndDate);
                    setDisplayRange(intervalStartDate, intervalEndDate);
                    dateTo.setFocus(false);
                } else {
                    dateTo.setText(
                            dts.formatDate(intervalEndDate, dateFormatInfo.getEditFormat().getPattern()));
                }
            } catch (IllegalArgumentException iae) {
                dateTo.setText(dts.formatDate(intervalEndDate, dateFormatInfo.getEditFormat().getPattern()));
            }
        }
    });
    dateTo.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            dateTo.setStyleName(CLASSNAME_DATEFIELDEDIT);
            dateTo.setText(dts.formatDate(intervalEndDate, dateFormatInfo.getEditFormat().getPattern()));
            dateTo.selectAll();
        }
    });
    dateTo.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            dateTo.setStyleName(CLASSNAME_DATEFIELD);
            dateTo.setText(dts.formatDate(intervalEndDate, dateFormatInfo.getDisplayFormat().getPattern()));
        }
    });
    dateTo.setReadOnly(!dateSelectEnabled);
    dateTo.setStyleName(CLASSNAME_DATEFIELD);
    dateRangeBar.add(dateTo);

    topBar.add(dateRangeBar);
    topBar.setCellHorizontalAlignment(dateRangeBar, HorizontalPanel.ALIGN_RIGHT);

    legend = new HorizontalPanel();
    legend.setVisible(legendVisible);
    legend.setHeight("30px");
    legend.setStyleName(CLASSNAME_LEGEND);

    chartModeBar = new HorizontalPanel();
    chartModeBar.setVisible(chartModeVisible);
    chartModeBar.setStyleName(CLASSNAME_CHARTMODE);

    Label modelbl = new Label("Chart mode:");
    chartModeBar.add(modelbl);

    lineModeBtn = new Button("", modeClickHandler);
    lineModeBtn.setTabIndex(-1);
    lineModeBtn.setVisible(lineChartModeVisible);
    lineModeBtn.setStyleName(CLASSNAME_CHARTMODELINE);
    lineModeBtn.setTitle("Line Graph");
    chartModeBar.add(lineModeBtn);

    barModeBtn = new Button("", modeClickHandler);
    barModeBtn.setTabIndex(-1);
    barModeBtn.setVisible(barChartModeVisible);
    barModeBtn.setStyleName(CLASSNAME_CHARTMODEBAR);
    barModeBtn.setTitle("Bar Graph");
    chartModeBar.add(barModeBtn);

    scatterModeBtn = new Button("", modeClickHandler);
    scatterModeBtn.setTabIndex(-1);
    scatterModeBtn.setVisible(scatterChartModeVisible);
    scatterModeBtn.setStyleName(CLASSNAME_CHARTMODESCATTER);
    scatterModeBtn.setTitle("Scatter Graph");
    chartModeBar.add(scatterModeBtn);

    modeLegendBar = new HorizontalPanel();
    modeLegendBar.setVisible(chartModeVisible || legendVisible);
    modeLegendBar.setWidth("100%");
    modeLegendBar.setHeight("31px");
    modeLegendBar.setStyleName(CLASSNAME_MODELEGEND_ROW);
    modeLegendBar.add(chartModeBar);
    modeLegendBar.add(legend);
    modeLegendBar.setCellHorizontalAlignment(legend, HorizontalPanel.ALIGN_RIGHT);

    root.add(modeLegendBar);

    // Add the display
    display = new VTimelineDisplay(this);
    root.add(display);

    // Add the browser
    browser = new VTimelineBrowser(this);
    browser.setVisible(browserIsVisible);
    root.add(browser);
}

From source file:com.vaadin.client.ui.VTextualDate.java

License:Apache License

public VTextualDate() {
    super();// ww w.  j ava2  s.c  o  m
    text = new TextBox();
    text.addChangeHandler(this);
    text.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            text.addStyleName(VTextField.CLASSNAME + "-" + VTextField.CLASSNAME_FOCUS);
            if (prompting) {
                text.setText("");
                setPrompting(false);
            }
            if (getClient() != null && getClient().hasEventListeners(VTextualDate.this, EventId.FOCUS)) {
                getClient().updateVariable(getId(), EventId.FOCUS, "", true);
            }

            // Needed for tooltip event handling
            VTextualDate.this.fireEvent(event);
        }
    });
    text.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            text.removeStyleName(VTextField.CLASSNAME + "-" + VTextField.CLASSNAME_FOCUS);
            String value = getText();
            setPrompting(inputPrompt != null && (value == null || "".equals(value)));
            if (prompting) {
                text.setText(readonly ? "" : inputPrompt);
            }
            if (getClient() != null && getClient().hasEventListeners(VTextualDate.this, EventId.BLUR)) {
                getClient().updateVariable(getId(), EventId.BLUR, "", true);
            }

            // Needed for tooltip event handling
            VTextualDate.this.fireEvent(event);
        }
    });
    if (BrowserInfo.get().isIE()) {
        addDomHandler(this, KeyDownEvent.getType());
    }
    add(text);
}

From source file:com.vaadin.terminal.gwt.client.ui.VTextualDate.java

License:Open Source License

public VTextualDate() {

    super();//www .j a va 2 s .c o  m
    text = new TextBox();
    // use normal textfield styles as a basis
    text.setStyleName(VTextField.CLASSNAME);
    // add datefield spesific style name also
    text.addStyleName(CLASSNAME + "-textfield");
    text.addChangeHandler(this);
    text.addFocusHandler(new FocusHandler() {
        public void onFocus(FocusEvent event) {
            text.addStyleName(VTextField.CLASSNAME + "-" + VTextField.CLASSNAME_FOCUS);
            if (prompting) {
                text.setText("");
                setPrompting(false);
            }
            if (getClient() != null && getClient().hasEventListeners(VTextualDate.this, EventId.FOCUS)) {
                getClient().updateVariable(getId(), EventId.FOCUS, "", true);
            }
        }
    });
    text.addBlurHandler(new BlurHandler() {
        public void onBlur(BlurEvent event) {
            text.removeStyleName(VTextField.CLASSNAME + "-" + VTextField.CLASSNAME_FOCUS);
            String value = getText();
            setPrompting(inputPrompt != null && (value == null || "".equals(value)));
            if (prompting) {
                text.setText(readonly ? "" : inputPrompt);
            }
            if (getClient() != null && getClient().hasEventListeners(VTextualDate.this, EventId.BLUR)) {
                getClient().updateVariable(getId(), EventId.BLUR, "", true);
            }
        }
    });
    add(text);
}

From source file:de.swm.commons.mobile.client.widgets.date.DatePopup.java

License:Apache License

/**
 * Will create the spinner buttons.//www  .j  a  v  a2  s .c o m
 *
 * @param df the date field
 * @return spinner button panel
 */
private VerticalPanel createSpinner(final DateField df) {
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.setVisible(false);
    ImageButton upButton = new ImageButton(SWMMobile.getTheme().getMGWTImageBundle().arrowup(),
            new ClickHandler() {
                /**
                 * {@inheritDoc}
                 */
                @Override
                public void onClick(ClickEvent event) {
                    switch (df) {
                    case DAY:
                        dateCalc.incrementDay();
                        break;
                    case MONTH:
                        dateCalc.incrementMonth();
                        break;
                    case YEAR:
                        dateCalc.incrementYear();
                        break;
                    case HOUR:
                        dateCalc.incrementHour();
                        break;
                    case MINUTE:
                        dateCalc.incrementMinute();
                        break;
                    default:
                        break;
                    }
                    updateLabels();
                    clearRelativeTime();
                }

            });
    vPanel.add(upButton);

    final TextBox label;
    switch (df) {
    case DAY:
        dayLabel = new TextBox();
        dayLabel.setWidth("2rem");
        dayLabel.setText(dateCalc.getDay() + ".");
        label = dayLabel;
        break;
    case MONTH:
        monthLabel = new TextBox();
        monthLabel.setWidth("2rem");
        monthLabel.setText(dateCalc.getMonth() + ".");
        label = monthLabel;
        break;
    case YEAR:
        yearLabel = new TextBox();
        yearLabel.setWidth("4rem");
        yearLabel.setText(dateCalc.getYear());
        label = yearLabel;
        break;
    case HOUR:
        hourLabel = new TextBox();
        hourLabel.setWidth("2rem");
        hourLabel.setText(numFormat.format(dateCalc.getHour()));
        label = hourLabel;
        break;
    case MINUTE:
        minuteLabel = new TextBox();
        minuteLabel.setWidth("2rem");
        label = minuteLabel;
        minuteLabel.setText(numFormat.format(dateCalc.getMinute()));
        break;
    default:
        label = new TextBox();
        break;
    }
    label.addFocusHandler(new FocusHandler() {

        @Override
        public void onFocus(FocusEvent event) {
            label.setText("");
        }
    });
    label.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            switch (df) {
            case DAY:
                dateCalc.setDay(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            case MONTH:
                dateCalc.setMonth(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            case YEAR:
                dateCalc.setYear(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            case HOUR:
                dateCalc.setHour(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            case MINUTE:
                dateCalc.setMinute(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            default:
                break;
            }

        }
    });

    label.setStyleName(SWMMobile.getTheme().getMGWTCssBundle().getPopupsCss().dateValueLabel());
    vPanel.add(label);

    ImageButton downButton = new ImageButton(SWMMobile.getTheme().getMGWTImageBundle().arrowdown(),
            new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    switch (df) {
                    case DAY:
                        dateCalc.decrementDay();
                        break;
                    case MONTH:
                        dateCalc.decrementMonth();
                        break;
                    case YEAR:
                        dateCalc.decrementYear();
                        break;
                    case HOUR:
                        dateCalc.decrementHour();
                        break;
                    case MINUTE:
                        dateCalc.decrementMinute();
                        break;
                    default:
                        break;
                    }
                    updateLabels();
                    clearRelativeTime();
                }
            });
    vPanel.add(downButton);

    return vPanel;
}

From source file:de.swm.commons.mobile.client.widgets.popup.SimpleDatePopup.java

License:Apache License

/**
 * Will create the spinner buttons.//from   w ww  . j av a2 s  .co  m
 *
 * @param df the date field
 * @return spinner button panel
 */
private VerticalPanel createSpinner(final DateField df) {
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.setVisible(false);
    ImageHighlightButton upButton = new ImageHighlightButton(null,
            SWMMobile.getTheme().getMGWTImageBundle().arrowup(), null, new ClickHandler() {
                /**
                 * {@inheritDoc}
                 */
                @Override
                public void onClick(ClickEvent event) {
                    switch (df) {
                    case DAY:
                        dateCalc.incrementDay();
                        break;
                    case MONTH:
                        dateCalc.incrementMonth();
                        break;
                    case YEAR:
                        dateCalc.incrementYear();
                        break;
                    case HOUR:
                        dateCalc.incrementHour();
                        break;
                    case MINUTE:
                        dateCalc.incrementMinute();
                        break;
                    default:
                        break;
                    }
                    updateLabels();
                    clearRelativeTime();
                }

            });
    vPanel.add(upButton);

    final TextBox label;
    switch (df) {
    case DAY:
        dayLabel = new TextBox();
        dayLabel.setWidth("30px");
        dayLabel.setText(dateCalc.getDay() + ".");
        label = dayLabel;
        break;
    case MONTH:
        monthLabel = new TextBox();
        monthLabel.setWidth("30px");
        monthLabel.setText(dateCalc.getMonth() + ".");
        label = monthLabel;
        break;
    case YEAR:
        yearLabel = new TextBox();
        yearLabel.setWidth("50px");
        yearLabel.setText(dateCalc.getYear());
        label = yearLabel;
        break;
    case HOUR:
        hourLabel = new TextBox();
        hourLabel.setWidth("30px");
        hourLabel.setText(numFormat.format(dateCalc.getHour()));
        label = hourLabel;
        break;
    case MINUTE:
        minuteLabel = new TextBox();
        minuteLabel.setWidth("30px");
        label = minuteLabel;
        minuteLabel.setText(numFormat.format(dateCalc.getMinute()));
        break;
    default:
        label = new TextBox();
        break;
    }
    label.addFocusHandler(new FocusHandler() {

        @Override
        public void onFocus(FocusEvent event) {
            label.setText("");
        }
    });
    label.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            switch (df) {
            case DAY:
                dateCalc.setDay(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            case MONTH:
                dateCalc.setMonth(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            case YEAR:
                dateCalc.setYear(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            case HOUR:
                dateCalc.setHour(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            case MINUTE:
                dateCalc.setMinute(label.getText());
                updateLabels();
                clearRelativeTime();
                break;
            default:
                break;
            }

        }
    });

    label.setStyleName(SWMMobile.getTheme().getMGWTCssBundle().getPopupsCss().dateValueLabel());
    vPanel.add(label);

    ImageHighlightButton downButton = new ImageHighlightButton(null,
            SWMMobile.getTheme().getMGWTImageBundle().arrowdown(), null, new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    switch (df) {
                    case DAY:
                        dateCalc.decrementDay();
                        break;
                    case MONTH:
                        dateCalc.decrementMonth();
                        break;
                    case YEAR:
                        dateCalc.decrementYear();
                        break;
                    case HOUR:
                        dateCalc.decrementHour();
                        break;
                    case MINUTE:
                        dateCalc.decrementMinute();
                        break;
                    default:
                        break;
                    }
                    updateLabels();
                    clearRelativeTime();
                }
            });
    vPanel.add(downButton);

    return vPanel;
}

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

public DatePanel(long maxSecBetweenDates, String startDateKey, String endDateKey, FormBuilder.Config config) {

    maxMillisecBetweenDates = maxSecBetweenDates * 1000;
    startDateField = FormBuilder.createField(startDateKey);
    endDateField = FormBuilder.createField(endDateKey);
    fields = Arrays.asList(startDateField, endDateField);
    endDateField.getFocusWidget().addFocusHandler(new FocusHandler() {
        public void onFocus(FocusEvent ev) {
            if (StringUtils.isEmpty(endDateField.getValue()) && startDateField.validate()) {
                endDateField.setValue(startDateField.getValue());
            }//from   ww w .j  av a2s.  c  o  m
        }
    });

    endDateField.getFocusWidget().addBlurHandler(new BlurHandler() {
        public void onBlur(BlurEvent ev) {
            if (!StringUtils.isEmpty(startDateField.getValue())) {
                validate();
            }
        }
    });

    Widget dateFieldsPanel = FormBuilder.createPanel(config, startDateField, endDateField);

    Label spacer0 = new Label();
    spacer0.setHeight("5px");
    Label spacer2 = new Label();
    spacer2.setHeight("5px");
    datePanel = new VerticalPanel();
    datePanel.add(spacer0);
    datePanel.add(dateFieldsPanel);
    format = ((DateFieldDef) startDateField.getFieldDef()).getDefaultDateTimeFormat();
    if (config.getDirection().equals(FormBuilder.Config.Direction.VERTICAL)) {
        Label spacer1 = new Label();
        spacer1.setHeight("5px");
        datePanel.add(spacer1);
        DateTimeFormat aFmt = DateTimeFormat.getFormat("yyyy.MM.dd HH:mm:ss");
        HTML desc = GwtUtil.makeFaddedHelp("Enter date range to search, format example: "
                + format.format(aFmt.parse("2007.10.23 19:30:01")) + ".");
        datePanel.add(desc);
    }
    datePanel.add(spacer2);

    initWidget(datePanel);

}

From source file:eu.maxschuster.vaadin.signaturefield.client.VSignatureField.java

License:Apache License

private Canvas createCanvas() {
    Canvas newCanvas = Canvas.createIfSupported();
    newCanvas.addFocusHandler(new FocusHandler() {
        @Override/*  w ww . ja v  a  2  s . c  o  m*/
        public void onFocus(FocusEvent event) {
            addStyleName(CLASSNAME_FOCUS);
            addStyleDependentName(CLASSNAME_FOCUS);
        }
    });
    newCanvas.addBlurHandler(new BlurHandler() {
        @Override
        public void onBlur(BlurEvent event) {
            removeStyleName(CLASSNAME_FOCUS);
            removeStyleDependentName(CLASSNAME_FOCUS);
        }
    });
    return newCanvas;
}

From source file:eu.nextstreet.gwt.components.client.ui.widget.AdvancedTextBox.java

License:Apache License

public AdvancedTextBox(final String defautText) {
    this.defaultText = defautText;
    addFocusHandler(new FocusHandler() {

        @Override/*from w ww.  java2s.  c om*/
        public void onFocus(FocusEvent event) {
            focused = true;
            String text = AdvancedTextBox.this.getText();
            if (AdvancedTextBox.this.defaultText == null || !AdvancedTextBox.this.defaultText.equals(text)) {
                setSelectionRange(0, text.length());
            } else {
                AdvancedTextBox.super.setText("");
            }
        }
    });

    addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            focused = false;
            handleDefaultText();
        }
    });

    addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            handleDefaultText();
        }
    });

    addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            handleTextStyles();
        }
    });
}

From source file:fr.aliasource.webmail.client.addressbook.AddressBook.java

License:Open Source License

public AddressBook(View wm) {
    this.webmail = wm;

    int height = Window.getClientHeight() - 150;
    HorizontalPanel search = new HorizontalPanel();
    search.addStyleName("wrap");
    search.addStyleName("addressBookSearchField");
    search.setWidth("16em");

    upSpinner = new Image("minig/images/spinner_moz.gif");
    upSpinner.setVisible(false);//from w  w  w.  j  a  v a  2 s  .  c o  m

    searchField = new TextBox();
    searchField.setText(I18N.strings.searchContactField());
    searchField.setWidth("16em");
    searchField.addFocusHandler(new FocusHandler() {
        public void onFocus(FocusEvent sender) {
            if (searchField.getText().equals(I18N.strings.searchContactField())) {
                searchField.setText("");
            }
        }
    });

    searchField.addBlurHandler(new BlurHandler() {
        public void onBlur(BlurEvent be) {
            if (searchField.getText().isEmpty()) {
                searchField.setText(I18N.strings.searchContactField());
            }
        }
    });

    searchField.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent ev) {
            if (KeyCodes.KEY_ESCAPE == ev.getNativeKeyCode()) {
                searchField.setText("");
            } else {
                if (!searchField.getText().isEmpty()) {
                    searchResult();
                } else {
                    reset();
                }
            }
        }
    });

    search.add(searchField);
    search.add(upSpinner);
    Anchor refresh = new Anchor(I18N.strings.refresh());
    refresh.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent sender) {
            webmail.getSpinner().startSpinning();
            new Timer() {
                @Override
                public void run() {
                    webmail.getSpinner().stopSpinning();
                }
            }.schedule(500);
        }
    });
    HorizontalPanel toolbar = new HorizontalPanel();
    toolbar.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
    toolbar.add(search);
    toolbar.add(new HTML("&nbsp;"));
    toolbar.add(refresh);

    add(toolbar, DockPanel.NORTH);

    setWidth("100%");

    ScrollPanel sp;

    HorizontalPanel hp = new HorizontalPanel();
    groupsList = new ContactGroups(webmail);
    sp = new ScrollPanel(groupsList);
    sp.addStyleName("whiteBackground");
    sp.setWidth("16em");
    sp.setHeight(height + "px");
    hp.add(sp);

    contactList = new ContactList(webmail);
    groupsList.addGroupSelectionListener(contactList);
    sp = new ScrollPanel(contactList);
    sp.addStyleName("whiteBackground");
    sp.setWidth("16em");
    sp.setHeight(height + "px");
    hp.add(sp);

    display = new ContactDisplay(webmail);
    contactList.addContactSelectionListerner(display);
    sp = new ScrollPanel(display);
    sp.addStyleName("contactDisplay");
    sp.setHeight(height + "px");
    hp.add(sp);

    hp.setWidth("100%");
    hp.setCellWidth(sp, "100%");

    hp.setSpacing(1);
    hp.setStyleName("addressBook");
    add(hp, DockPanel.CENTER);
    addTabListener();

    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            resize(event.getHeight());
        }
    });
}

From source file:fr.aliasource.webmail.client.filter.ForwardToWidget.java

License:GNU General Public License

public ForwardToWidget() {
    cb = new CheckBox(I18N.strings.actionForwardItTo());

    addr = new TextBox();
    addr.setText(I18N.strings.forwardPlaceholder());
    add(cb);/*from w  w w  .  ja v a2s.  c om*/
    add(new HTML("&nbsp;"));
    add(addr);

    reg = addr.addFocusHandler(new FocusHandler() {
        public void onFocus(FocusEvent sender) {
            addr.setText("");
            reg.removeHandler();
        }
    });
}