Search in sources :

Example 56 with Image

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

the class ImageTest method getElement.

@Test
public void getElement() {
    // Then
    Image i = new Image();
    // When
    Element e = i.getElement();
    assertThat(e).isNotNull();
    assertThat(e.getTagName()).isEqualTo("img");
}
Also used : Element(com.google.gwt.dom.client.Element) Image(com.google.gwt.user.client.ui.Image) Test(org.junit.Test)

Example 57 with Image

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

the class ImageTest method height_Em.

@Test
public void height_Em() {
    // Given
    Image i = new Image();
    // When
    i.setHeight("20em");
    // Then
    assertThat(i.getHeight()).isEqualTo(20);
}
Also used : Image(com.google.gwt.user.client.ui.Image) Test(org.junit.Test)

Example 58 with Image

use of com.google.gwt.user.client.ui.Image in project libgdx by libgdx.

the class GwtApplication method getPreloaderCallback.

public PreloaderCallback getPreloaderCallback() {
    final Panel preloaderPanel = new VerticalPanel();
    preloaderPanel.setStyleName("gdx-preloader");
    final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png");
    logo.setStyleName("logo");
    preloaderPanel.add(logo);
    final Panel meterPanel = new SimplePanel();
    meterPanel.setStyleName("gdx-meter");
    meterPanel.addStyleName("red");
    final InlineHTML meter = new InlineHTML();
    final Style meterStyle = meter.getElement().getStyle();
    meterStyle.setWidth(0, Unit.PCT);
    meterPanel.add(meter);
    preloaderPanel.add(meterPanel);
    getRootPanel().add(preloaderPanel);
    return new PreloaderCallback() {

        @Override
        public void error(String file) {
            System.out.println("error: " + file);
        }

        @Override
        public void update(PreloaderState state) {
            meterStyle.setWidth(100f * state.getProgress(), Unit.PCT);
        }
    };
}
Also used : PreloaderCallback(com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderCallback) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Panel(com.google.gwt.user.client.ui.Panel) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) RootPanel(com.google.gwt.user.client.ui.RootPanel) PreloaderState(com.badlogic.gdx.backends.gwt.preloader.Preloader.PreloaderState) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) InlineHTML(com.google.gwt.user.client.ui.InlineHTML) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) Style(com.google.gwt.dom.client.Style) Image(com.google.gwt.user.client.ui.Image)

Example 59 with Image

use of com.google.gwt.user.client.ui.Image in project rstudio by rstudio.

the class SectionChooser method addSection.

public void addSection(ImageResource icon, String name) {
    Image img = new Image(icon.getSafeUri());
    img.setSize("29px", "20px");
    Label label = new Label(name, false);
    final ClickableVerticalPanel panel = new ClickableVerticalPanel();
    panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    panel.add(img);
    panel.add(label);
    panel.setStyleName(res_.styles().section());
    panel.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            select(inner_.getWidgetIndex(panel));
        }
    });
    inner_.add(panel);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Label(com.google.gwt.user.client.ui.Label) Image(com.google.gwt.user.client.ui.Image)

Example 60 with Image

use of com.google.gwt.user.client.ui.Image in project rstudio by rstudio.

the class DirectoryContentsWidget method addItem.

private int addItem(FileSystemItem item, String customName, ImageResource customIcon) {
    if (customName == null)
        customName = item.getName();
    if (customIcon == null)
        customIcon = context_.getIcon(item);
    items_.put(customName, item);
    int newRow = table_.insertRow(table_.getRowCount());
    table_.setWidget(newRow, COL_ICON, new Image(customIcon));
    table_.setText(newRow, COL_NAME, customName);
    table_.getCellFormatter().setStylePrimaryName(newRow, COL_ICON, styles_.columnIcon());
    table_.getCellFormatter().setStylePrimaryName(newRow, COL_NAME, styles_.columnName());
    if (!item.isDirectory()) {
        table_.setText(newRow, COL_SIZE, StringUtil.formatFileSize(item.getLength()));
        table_.setText(newRow, COL_TIMESTAMP, StringUtil.formatDate(item.getLastModified()));
        table_.getCellFormatter().setStylePrimaryName(newRow, COL_SIZE, styles_.columnSize());
        table_.getCellFormatter().setStylePrimaryName(newRow, COL_TIMESTAMP, styles_.columnDate());
    } else {
        ((FlexTable.FlexCellFormatter) table_.getCellFormatter()).setColSpan(newRow, COL_NAME, 3);
    }
    return newRow;
}
Also used : Image(com.google.gwt.user.client.ui.Image) Point(org.rstudio.core.client.Point)

Aggregations

Image (com.google.gwt.user.client.ui.Image)98 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)28 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)28 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)15 Test (org.junit.Test)13 FlexTable (com.google.gwt.user.client.ui.FlexTable)12 HTML (com.google.gwt.user.client.ui.HTML)10 Element (com.google.gwt.dom.client.Element)8 Label (com.google.gwt.user.client.ui.Label)8 ImageResource2x (org.rstudio.core.client.resources.ImageResource2x)7 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)7 ImageResource (com.google.gwt.resources.client.ImageResource)6 Widget (com.google.gwt.user.client.ui.Widget)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)5 Style (com.google.gwt.dom.client.Style)4 Anchor (com.google.gwt.user.client.ui.Anchor)4 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)4 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)3 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)3 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)3