use of com.google.gwt.user.client.ui.VerticalPanel 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.VerticalPanel in project libgdx by libgdx.
the class GwtApplication method onModuleLoad.
@Override
public void onModuleLoad() {
GwtApplication.agentInfo = computeAgentInfo();
this.listener = createApplicationListener();
this.config = getConfig();
setApplicationLogger(new GwtApplicationLogger(this.config.log));
addEventListeners();
if (config.rootPanel != null) {
this.root = config.rootPanel;
} else {
Element element = Document.get().getElementById("embed-" + GWT.getModuleName());
if (element == null) {
VerticalPanel panel = new VerticalPanel();
panel.setWidth("" + config.width + "px");
panel.setHeight("" + config.height + "px");
panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
RootPanel.get().add(panel);
RootPanel.get().setWidth("" + config.width + "px");
RootPanel.get().setHeight("" + config.height + "px");
this.root = panel;
} else {
VerticalPanel panel = new VerticalPanel();
panel.setWidth("" + config.width + "px");
panel.setHeight("" + config.height + "px");
panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
element.appendChild(panel.getElement());
root = panel;
}
}
// initialize SoundManager2
SoundManager.init(GWT.getModuleBaseURL(), 9, config.preferFlash, new SoundManager.SoundManagerCallback() {
@Override
public void onready() {
final PreloaderCallback callback = getPreloaderCallback();
preloader = createPreloader();
preloader.preload("assets.txt", new PreloaderCallback() {
@Override
public void error(String file) {
callback.error(file);
}
@Override
public void update(PreloaderState state) {
callback.update(state);
if (state.hasEnded()) {
getRootPanel().clear();
if (loadingListener != null)
loadingListener.beforeSetup();
setupLoop();
if (loadingListener != null)
loadingListener.afterSetup();
}
}
});
}
@Override
public void ontimeout(String status, String errorType) {
error("SoundManager", status + " " + errorType);
}
});
}
use of com.google.gwt.user.client.ui.VerticalPanel in project rstudio by rstudio.
the class MiniDialogPopupPanel method commonInit.
private void commonInit() {
addStyleName(ThemeStyles.INSTANCE.miniDialogPopupPanel());
verticalPanel_ = new VerticalPanel();
verticalPanel_.setStyleName(ThemeStyles.INSTANCE.miniDialogContainer());
// title bar
HorizontalPanel titleBar = new HorizontalPanel();
titleBar.setWidth("100%");
captionLabel_ = new Label();
captionLabel_.setStyleName(ThemeStyles.INSTANCE.miniDialogCaption());
titleBar.add(captionLabel_);
titleBar.setCellHorizontalAlignment(captionLabel_, HasHorizontalAlignment.ALIGN_LEFT);
HorizontalPanel toolsPanel = new HorizontalPanel();
toolsPanel.setStyleName(ThemeStyles.INSTANCE.miniDialogTools());
ToolbarButton hideButton = new ToolbarButton(new ImageResource2x(ThemeResources.INSTANCE.closeChevron2x()), new ClickHandler() {
public void onClick(ClickEvent event) {
MiniDialogPopupPanel.this.hideMiniDialog();
}
});
hideButton.setTitle("Close");
toolsPanel.add(hideButton);
titleBar.add(toolsPanel);
titleBar.setCellHorizontalAlignment(toolsPanel, HasHorizontalAlignment.ALIGN_RIGHT);
verticalPanel_.add(titleBar);
// main widget
verticalPanel_.add(createMainWidget());
setWidget(verticalPanel_);
}
use of com.google.gwt.user.client.ui.VerticalPanel in project rstudio by rstudio.
the class ModifyKeyboardShortcutsWidget method createMainWidget.
@Override
protected Widget createMainWidget() {
resetState();
setEscapeDisabled(true);
setEnterDisabled(true);
previewHandler_ = Event.addNativePreviewHandler(new NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent preview) {
if (swallowNextKeyUpEvent_ && preview.getTypeInt() == Event.ONKEYUP) {
swallowNextKeyUpEvent_ = false;
preview.cancel();
preview.getNativeEvent().stopPropagation();
preview.getNativeEvent().preventDefault();
} else if (preview.getTypeInt() == Event.ONKEYDOWN) {
int keyCode = preview.getNativeEvent().getKeyCode();
if (keyCode == KeyCodes.KEY_ESCAPE || keyCode == KeyCodes.KEY_ENTER) {
// If the DataGrid (or an underlying element) has focus, let it
// handle the escape / enter key.
Element target = preview.getNativeEvent().getEventTarget().cast();
Element foundTable = DomUtils.findParentElement(target, new ElementPredicate() {
@Override
public boolean test(Element el) {
return el.equals(table_.getElement());
}
});
if (foundTable != null)
return;
// the widget.
if (filterWidget_.isFocused()) {
if (keyCode == KeyCodes.KEY_ENTER) {
table_.setKeyboardSelectedRow(0);
table_.setKeyboardSelectedColumn(0);
return;
} else if (keyCode == KeyCodes.KEY_ESCAPE) {
focusOkButton();
return;
}
}
// Otherwise, handle Enter / Escape 'modally' as we might normally do.
preview.cancel();
preview.getNativeEvent().stopPropagation();
preview.getNativeEvent().preventDefault();
if (keyCode == KeyCodes.KEY_ENTER) {
clickOkButton();
return;
} else if (keyCode == KeyCodes.KEY_ESCAPE) {
closeDialog();
return;
}
}
}
}
});
addAttachHandler(new AttachEvent.Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
if (event.isAttached())
;
else
previewHandler_.removeHandler();
}
});
VerticalPanel container = new VerticalPanel();
FlowPanel headerPanel = new FlowPanel();
Label radioLabel = new Label("Show:");
radioLabel.getElement().getStyle().setFloat(Style.Float.LEFT);
radioLabel.getElement().getStyle().setMarginRight(8, Unit.PX);
headerPanel.add(radioLabel);
headerPanel.add(radioAll_);
radioAll_.setValue(true);
headerPanel.add(radioCustomized_);
filterWidget_.getElement().getStyle().setFloat(Style.Float.LEFT);
filterWidget_.getElement().getStyle().setMarginLeft(10, Unit.PX);
filterWidget_.getElement().getStyle().setMarginTop(-1, Unit.PX);
headerPanel.add(filterWidget_);
HelpLink link = new HelpLink("Customizing Keyboard Shortcuts", "custom_keyboard_shortcuts");
link.getElement().getStyle().setFloat(Style.Float.RIGHT);
headerPanel.add(link);
container.add(headerPanel);
FlowPanel spacer = new FlowPanel();
spacer.setWidth("100%");
spacer.setHeight("4px");
container.add(spacer);
DockPanel dockPanel = new DockPanel();
dockPanel.add(table_, DockPanel.CENTER);
container.add(dockPanel);
return container;
}
use of com.google.gwt.user.client.ui.VerticalPanel in project rstudio by rstudio.
the class Wizard method createMainWidget.
@Override
protected Widget createMainWidget() {
WizardResources res = WizardResources.INSTANCE;
WizardResources.Styles styles = res.styles();
VerticalPanel mainWidget = new VerticalPanel();
mainWidget.addStyleName(getMainWidgetStyle());
headerPanel_ = new LayoutPanel();
headerPanel_.addStyleName(styles.headerPanel());
// layout constants
final int kTopMargin = 5;
final int kLeftMargin = 8;
final int kCaptionWidth = 400;
final int kCaptionHeight = 30;
final int kPageUILeftMargin = 123;
// first page caption
subCaptionLabel_ = new Label(firstPage_.getPageCaption());
subCaptionLabel_.addStyleName(styles.headerLabel());
headerPanel_.add(subCaptionLabel_);
headerPanel_.setWidgetLeftWidth(subCaptionLabel_, kTopMargin, Unit.PX, kCaptionWidth, Unit.PX);
headerPanel_.setWidgetTopHeight(subCaptionLabel_, kLeftMargin, Unit.PX, kCaptionHeight, Unit.PX);
// second page back button
ImageResource bkImg = res.wizardBackButton();
backButton_ = new Label("Back");
backButton_.addStyleName(styles.wizardBackButton());
backButton_.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor());
headerPanel_.add(backButton_);
headerPanel_.setWidgetLeftWidth(backButton_, kTopMargin - 2, Unit.PX, bkImg.getWidth(), Unit.PX);
headerPanel_.setWidgetTopHeight(backButton_, kTopMargin - 2, Unit.PX, bkImg.getHeight(), Unit.PX);
backButton_.setVisible(false);
backButton_.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
goBack();
}
});
// second page caption label
pageCaptionLabel_ = new Label();
pageCaptionLabel_.addStyleName(styles.headerLabel());
headerPanel_.add(pageCaptionLabel_);
headerPanel_.setWidgetLeftWidth(pageCaptionLabel_, kPageUILeftMargin, Unit.PX, kCaptionWidth, Unit.PX);
headerPanel_.setWidgetTopHeight(pageCaptionLabel_, kLeftMargin, Unit.PX, kCaptionHeight, Unit.PX);
pageCaptionLabel_.setVisible(false);
mainWidget.add(headerPanel_);
// main body panel for transitions
bodyPanel_ = new LayoutPanel();
ArrayList<String> wizardBodyStyles = getWizardBodyStyles();
for (String styleName : wizardBodyStyles) bodyPanel_.addStyleName(styleName);
bodyPanel_.getElement().getStyle().setProperty("overflowX", "hidden");
mainWidget.add(bodyPanel_);
// add first page (and all sub-pages recursively)
addAndInitializePage(firstPage_, true);
setNextButtonState(firstPage_);
return mainWidget;
}
Aggregations