本文整理汇总了Java中com.google.gwt.user.client.ui.Panel.add方法的典型用法代码示例。如果您正苦于以下问题:Java Panel.add方法的具体用法?Java Panel.add怎么用?Java Panel.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.Panel
的用法示例。
在下文中一共展示了Panel.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPageViewCarrier
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
@Override
public void setPageViewCarrier(PageViewCarrier pageViewCarrier) {
view.getTitlePanel().clear();
view.getTitlePanel().add(pageViewCarrier.getPageTitle());
if (pageViewCarrier.hasContent()) {
Panel contentPanel = new FlowPanel();
if (pageViewCarrier.pageType == PageType.ERROR) {
contentPanel.setStyleName(styleNames.QP_PAGE_ERROR());
Label errorLabel = new Label(pageViewCarrier.errorMessage);
errorLabel.setStyleName(styleNames.QP_PAGE_ERROR_TEXT());
contentPanel.add(errorLabel);
}
view.getItemsPanel().clear();
view.getItemsPanel().add(contentPanel);
}
}
示例2: initAppTitle
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
/**
* Helper method called by constructor to initialize the app's title section
* @param container The container that title resides
*/
private void initAppTitle(Panel container) {
if (newOrUpdateApp()) {
// GUI for editable title container
if (editStatus==NEWAPP) {
// If it's new app, give a textual hint telling user this is title
titleText.setText(app.getTitle());
} else if (editStatus==UPDATEAPP) {
// If it's not new, just set whatever's in the data field already
titleText.setText(app.getTitle());
}
titleText.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
app.setTitle(titleText.getText());
}
});
titleText.addStyleName("app-desc-textarea");
container.add(titleText);
container.addStyleName("app-title-container");
} else {
Label title = new Label(app.getTitle());
title.addStyleName("app-title");
container.add(title);
}
}
示例3: initAppDesc
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
/**
* Helper method called by constructor to initialize the app's description
* @param c1 The container that description resides (editable state)
* @param c2 The container that description resides (public state)
*/
private void initAppDesc(Panel c1, Panel c2) {
desc.getElement().setPropertyString("placeholder", MESSAGES.galleryDescriptionHint());
if (newOrUpdateApp()) {
desc.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
app.setDescription(desc.getText());
}
});
if(editStatus==UPDATEAPP){
desc.setText(app.getDescription());
}
desc.addStyleName("app-desc-textarea");
c1.add(desc);
} else {
Label description = new Label(app.getDescription());
c2.add(description);
c2.addStyleName("app-description");
}
}
示例4: initSalvageSection
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
/**
* Helper method called by constructor to initialize the salvage section
* @param container The container that salvage label reside
*/
private void initSalvageSection(Panel container) { //TODO: Update the location of this button
if (!canSalvage()) { // Permitted to salvage?
return;
}
final Label salvagePrompt = new Label("salvage");
salvagePrompt.addStyleName("primary-link");
container.add(salvagePrompt);
salvagePrompt.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
final OdeAsyncCallback<Void> callback = new OdeAsyncCallback<Void>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(Void bool) {
salvagePrompt.setText("done");
}
};
Ode.getInstance().getGalleryService().salvageGalleryApp(app.getGalleryAppId(), callback);
}
});
}
示例5: createPanel
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
private Panel createPanel() {
Label label = new Label("Search Options");
label.addStyleName("search-header");
label.getElement().getStyle().setDisplay(Display.BLOCK);
Grid grid = new Grid(2,2);
grid.setText(0, 0, "Ontology/Codelist:");
grid.setWidget(0, 1, ontologiesDropBox);
grid.setText(1, 0, "Include Synonyms:");
grid.setWidget(1, 1, includeSynonyms);
grid.addStyleName("search-options");
CellFormatter cellFormatter = grid.getCellFormatter();
for(int i = 0; i < grid.getRowCount(); i++) {
cellFormatter.addStyleName(i, 0, "search-option");
}
Panel panel = new FlowPanel();
panel.add(label);
panel.add(grid);
return panel;
}
示例6: onChannelMessage
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
@Override
public void onChannelMessage(Object p_message)
{
// redraw widget according to new presenceRoom
PresenceRoom newPresenceRoom = (PresenceRoom)p_message;
m_panel.clear();
Set<String> pseudoList = new HashSet<String>();
for( Presence presence : newPresenceRoom )
{
if( !pseudoList.contains( presence.getPseudo() ) )
{
pseudoList.add( presence.getPseudo() );
Panel panel = new HorizontalPanel();
Image image = new Image( presence.getAvatarUrl() );
image.setPixelSize( 32, 32 );
image.setAltText( presence.getPseudo() );
image.setTitle( presence.getPseudo() );
panel.add( image );
panel.add( new Label(presence.getPseudo()) );
m_panel.add( panel );
}
}
}
示例7: MAppChat
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
public MAppChat()
{
m_panel.setSize( "100%", "100%" );
scrollPanel.setHeight( "400px" );
m_msgList.setStyleName( "msglist" );
scrollPanel.add( m_msgList );
m_panel.add( scrollPanel );
Panel hpanel = new HorizontalPanel();
hpanel.setSize( "100%", "100%" );
hpanel.add( m_text );
m_text.setWidth( "100%" );
m_text.addKeyDownHandler( this );
hpanel.add( m_btnOk );
m_btnOk.addClickHandler( this );
m_panel.add( hpanel );
initWidget( m_panel );
}
示例8: generateBreadcrumbs
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
/**
* Generate breadcrumbs into the specified container using the format link > link > text where the
* last breadcrumb is always plain text.
*/
private void generateBreadcrumbs(Panel container, List<Title> titles) {
container.clear();
// For all of the titles previous to the last, add a link and a separator.
for (Title notLast : titles.subList(0, titles.size() - 1)) {
container.add(new InlineHyperlink(notLast.getTitle(), notLast.getFragment()));
container.add(new InlineLabel(" > "));
}
// Append only the text for the last title.
Title lastTitle = Iterables.getLast(titles);
container.add(new InlineLabel(lastTitle.getTitle()));
if (lastTitle.getSubtitle() != null) {
Label subtitle = new InlineLabel(" - " + lastTitle.getSubtitle());
subtitle.addStyleName(style.methodSubtitle());
container.add(subtitle);
}
}
示例9: makeIntegerBox
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
private IntegerBox makeIntegerBox(Panel parent,String name,int value){
HorizontalPanel h1=new HorizontalPanel();
//h.setWidth("100%");
parent.add(h1);
Label label=new Label(name);
label.setWidth("100px");
h1.add(label);
IntegerBox box=new IntegerBox();
box.setWidth("40px");
box.setValue(value);
h1.add(box);
return box;
}
示例10: GwtGraphics
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
public GwtGraphics (Panel root, GwtApplicationConfiguration config) {
Canvas canvasWidget = Canvas.createIfSupported();
if (canvasWidget == null) throw new GdxRuntimeException("Canvas not supported");
canvas = canvasWidget.getCanvasElement();
root.add(canvasWidget);
canvas.setWidth(config.width);
canvas.setHeight(config.height);
this.config = config;
WebGLContextAttributes attributes = WebGLContextAttributes.create();
attributes.setAntialias(config.antialiasing);
attributes.setStencil(config.stencil);
attributes.setAlpha(false);
attributes.setPremultipliedAlpha(false);
attributes.setPreserveDrawingBuffer(config.preserveDrawingBuffer);
context = WebGLRenderingContext.getContext(canvas, attributes);
context.viewport(0, 0, config.width, config.height);
this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GwtGL20(context);
}
示例11: showProgressBarForPage
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
private void showProgressBarForPage(int pageIndex) {
if (!loadedPages.contains(pageIndex) && isValidPageIndex(pageIndex)) {
Panel panel = getViewForPage(pageIndex);
panel.add(new ProgressPanel());
pageProgressBar = pageIndex;
}
}
示例12: createTitleWidget
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
protected Widget createTitleWidget(String index, String text) {
Panel titlePanel = new FlowPanel();
titlePanel.setStyleName(styleNames.QP_ITEM_TITLE());
Label indexLabel = new Label(index + ". ");
indexLabel.setStyleName(styleNames.QP_ITEM_TITLE_INDEX());
Label textLabel = new Label(text);
textLabel.setStyleName(styleNames.QP_ITEM_TITLE_TEXT());
titlePanel.add(indexLabel);
titlePanel.add(textLabel);
return titlePanel;
}
示例13: updateAppImage
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
/**
* Helper method to update the app image
* @param url The URL of the image to show
* @param container The container that image widget resides
*/
private void updateAppImage(String url, final Panel container) {
image = new Image();
image.addStyleName("app-image");
image.setUrl(url);
// if the user has provided a gallery app image, we'll load it. But if not
// the error will occur and we'll load default image
image.addErrorHandler(new ErrorHandler() {
public void onError(ErrorEvent event) {
image.setUrl(GalleryApp.DEFAULTGALLERYIMAGE);
}
});
container.add(image);
if(gallery.getSystemEnvironment() != null &&
gallery.getSystemEnvironment().toString().equals("Development")){
final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(String newUrl) {
image.setUrl(newUrl + "?" + System.currentTimeMillis());
}
};
Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
}
}
示例14: initAppStats
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
/**
* Helper method called by constructor to initialize the app's stats fields
* @param container The container that stats fields reside
*/
private void initAppStats(Panel container) {
// Images for stats data
Image numDownloads = new Image();
numDownloads.setUrl(DOWNLOAD_ICON_URL);
Image numLikes = new Image();
numLikes.setUrl(HOLLOW_HEART_ICON_URL);
// Add stats data
container.addStyleName("app-stats");
container.add(numDownloads);
container.add(new Label(Integer.toString(app.getDownloads())));
// Adds dynamic like
initLikeSection(container);
// Adds dynamic feature
initFeatureSection(container);
// Adds dynamic tutorial
initTutorialSection(container);
// Adds dynamic salvage
initSalvageSection(container);
// We are not using views and comments at initial launch
/*
Image numViews = new Image();
numViews.setUrl(NUM_VIEW_ICON_URL);
Image numComments = new Image();
numComments.setUrl(NUM_COMMENT_ICON_URL);
container.add(numViews);
container.add(new Label(Integer.toString(app.getViews())));
container.add(numComments);
container.add(new Label(Integer.toString(app.getComments())));
*/
}
示例15: updateUserImage
import com.google.gwt.user.client.ui.Panel; //导入方法依赖的package包/类
/**
* Helper method to update the user's image
* @param url The URL of the image to show
* @param container The container that image widget resides
*/
private void updateUserImage(final String url, Panel container) {
userAvatar = new Image();
//setUrl if the new URL is the same one as it was before; an easy workaround is
//to make the URL unique so it forces the browser to reload
userAvatar.setUrl(url + "?" + System.currentTimeMillis());
userAvatar.addStyleName("app-image");
if (profileStatus == PRIVATE) {
//userAvatar.addStyleName("status-updating");
}
// if the user has provided a gallery app image, we'll load it. But if not
// the error will occur and we'll load default image
userAvatar.addErrorHandler(new ErrorHandler() {
public void onError(ErrorEvent event) {
userAvatar.setUrl(GalleryApp.DEFAULTUSERIMAGE);
}
});
container.add(userAvatar);
if(gallery.getSystemEnvironment() != null &&
gallery.getSystemEnvironment().toString().equals("Development")){
final OdeAsyncCallback<String> callback = new OdeAsyncCallback<String>(
// failure message
MESSAGES.galleryError()) {
@Override
public void onSuccess(String newUrl) {
userAvatar.setUrl(newUrl + "?" + System.currentTimeMillis());
}
};
Ode.getInstance().getGalleryService().getBlobServingUrl(url, callback);
}
}