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");
}
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);
}
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);
}
};
}
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);
}
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;
}
Aggregations