Search in sources :

Example 41 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project che by eclipse.

the class ActionButton method renderImage.

/** Redraw icon. */
private void renderImage() {
    panel.clear();
    if (presentation.getImageResource() != null) {
        Image img = new Image(presentation.getImageResource());
        img.setStyleName(toolbarResources.toolbar().iconButtonIcon());
        panel.add(img);
    } else if (presentation.getSVGResource() != null) {
        SVGImage image = new SVGImage(presentation.getSVGResource());
        image.getElement().setAttribute("class", toolbarResources.toolbar().iconButtonIcon());
        panel.add(image);
    } else if (presentation.getHTMLResource() != null) {
        FlowPanel icon = new FlowPanel();
        icon.setStyleName(toolbarResources.toolbar().iconButtonIcon());
        FlowPanel inner = new FlowPanel();
        inner.setStyleName(toolbarResources.toolbar().iconButtonIconInner());
        inner.getElement().setInnerHTML(presentation.getHTMLResource());
        icon.add(inner);
        panel.add(inner);
    }
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Image(com.google.gwt.user.client.ui.Image) SVGImage(org.vectomatic.dom.svg.ui.SVGImage) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 42 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method remove.

@Test
public void remove() {
    // Given
    ComplexPanel panel = new FlowPanel();
    Button b = new Button();
    panel.add(b);
    // Preconditions
    assertThat(panel.getWidgetCount()).isEqualTo(1);
    assertThat(b.getParent()).isEqualTo(panel);
    // When
    panel.remove(b);
    // Then
    assertThat(panel.getWidgetCount()).isEqualTo(0);
    assertThat(b.getParent()).isNull();
}
Also used : Button(com.google.gwt.user.client.ui.Button) ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Example 43 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method remove_ByIndex.

@Test
public void remove_ByIndex() {
    // Given
    ComplexPanel panel = new FlowPanel();
    Button b0 = new Button();
    panel.add(b0);
    Button b1 = new Button();
    panel.add(b1);
    // When
    panel.remove(1);
    // Then
    assertThat(panel.getWidgetCount()).isEqualTo(1);
    assertThat(panel.getWidget(0)).isEqualTo(b0);
    assertThat(b0.getParent()).isEqualTo(panel);
    assertThat(b1.getParent()).isNull();
}
Also used : Button(com.google.gwt.user.client.ui.Button) ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Example 44 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method add.

@Test
public void add() {
    // Given
    ComplexPanel panel = new FlowPanel();
    RootPanel.get().add(panel);
    assertThat(panel.isAttached()).isTrue();
    assertThat(panel.getWidgetCount()).isEqualTo(0);
    Button b1 = new Button();
    assertThat(b1.isAttached()).isFalse();
    assertThat(b1.getParent()).isNull();
    // When
    panel.add(b1);
    // Then
    assertThat(b1.isAttached()).isTrue();
    assertThat(b1.getParent()).isEqualTo(panel);
    assertThat(panel.getWidgetCount()).isEqualTo(1);
    assertThat(panel.getWidget(0)).isEqualTo(b1);
    assertThat(panel.getWidgetIndex(b1)).isEqualTo(0);
}
Also used : Button(com.google.gwt.user.client.ui.Button) ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Example 45 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method title.

@Test
public void title() {
    // Given
    ComplexPanel panel = new FlowPanel();
    // When
    panel.setTitle("title");
    // Then
    assertThat(panel.getTitle()).isEqualTo("title");
}
Also used : ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Aggregations

FlowPanel (com.google.gwt.user.client.ui.FlowPanel)81 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)18 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)15 Button (com.google.gwt.user.client.ui.Button)14 Label (com.google.gwt.user.client.ui.Label)12 Grid (com.google.gwt.user.client.ui.Grid)10 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)8 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)7 SmallHeading (com.google.gerrit.client.ui.SmallHeading)6 Element (com.google.gwt.dom.client.Element)6 CheckBox (com.google.gwt.user.client.ui.CheckBox)6 CellFormatter (com.google.gwt.user.client.ui.HTMLTable.CellFormatter)6 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)6 Widget (com.google.gwt.user.client.ui.Widget)6 Test (org.junit.Test)6 ComplexPanel (com.google.gwt.user.client.ui.ComplexPanel)5 HTML (com.google.gwt.user.client.ui.HTML)5 Image (com.google.gwt.user.client.ui.Image)5 IsWidget (com.google.gwt.user.client.ui.IsWidget)5 List (java.util.List)4