本文整理汇总了Java中com.google.gwt.user.client.ui.DecoratorPanel.setWidget方法的典型用法代码示例。如果您正苦于以下问题:Java DecoratorPanel.setWidget方法的具体用法?Java DecoratorPanel.setWidget怎么用?Java DecoratorPanel.setWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.DecoratorPanel
的用法示例。
在下文中一共展示了DecoratorPanel.setWidget方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeFixedSizeContainer
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
public Panel makeFixedSizeContainer(int width, int height, boolean decorated) {
SimplePanel panel= new SimplePanel();
panel.setWidget(this);
panel.setPixelSize(width,height);
Panel retval= panel;
if (decorated) {
DecoratorPanel dp= new DecoratorPanel();
dp.setWidget(panel);
retval= dp;
}
return retval;
}
示例2: makeFailureMessage
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
public Panel makeFailureMessage(String message, int width, int height, boolean decorated) {
VerticalPanel panel= new VerticalPanel();
HTML header = new HTML(getTitle());
Widget msg = GwtUtil.centerAlign(new HTML(message));
header.addStyleName("preview-title");
GwtUtil.setStyle(msg, "padding", "5px");
panel.add(header);
panel.add(msg);
panel.setPixelSize(width, height);
Panel retval= panel;
if (decorated) {
DecoratorPanel dp= new DecoratorPanel();
dp.setWidget(panel);
retval= dp;
}
return retval;
}
示例3: onSuccess
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
public void onSuccess(List<PacketBbsThread> result) {
for (final PacketBbsThread thread : result) {
final LazyPanel lazyPanel = new LazyPanel() {
@Override
protected Widget createWidget() {
DecoratorPanel decoratorPanel = new DecoratorPanel();
decoratorPanel.setWidget(new PanelThread((int) thread.id, thread.title));
return decoratorPanel;
}
};
OpenHandler<DisclosurePanel> openHandler = new OpenHandler<DisclosurePanel>() {
@Override
public void onOpen(OpenEvent<DisclosurePanel> event) {
lazyPanel.ensureWidget();
}
};
DisclosurePanel disclosurePanel = new DisclosurePanel(thread.title);
disclosurePanel.setContent(lazyPanel);
disclosurePanel.addOpenHandler(openHandler);
add(disclosurePanel);
}
}
示例4: onInitialize
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
/**
* Initialize this example.
*/
@ShowcaseSource
@Override
public Widget onInitialize() {
// Create a table to layout the form options
FlexTable layout = new FlexTable();
layout.setCellSpacing(6);
FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
// Add a title to the form
layout.setHTML(0, 0, constants.cwDecoratorPanelFormTitle());
cellFormatter.setColSpan(0, 0, 2);
cellFormatter.setHorizontalAlignment(
0, 0, HasHorizontalAlignment.ALIGN_CENTER);
// Add some standard form options
layout.setHTML(1, 0, constants.cwDecoratorPanelFormName());
layout.setWidget(1, 1, new TextBox());
layout.setHTML(2, 0, constants.cwDecoratorPanelFormDescription());
layout.setWidget(2, 1, new TextBox());
// Wrap the content in a DecoratorPanel
DecoratorPanel decPanel = new DecoratorPanel();
decPanel.setWidget(layout);
return decPanel;
}
示例5: onModuleLoad
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
@Override
public void onModuleLoad()
{
final DecoratorPanel deco = new DecoratorPanel();
Label text = new Label( "Drop files here..." );
deco.setWidget( text );
DropTarget target = DropTarget.create( deco, new DropTarget.Callback()
{
@Override
public void onDropFiles( FilesList files )
{
deco.getElement().getStyle().clearBackgroundColor();
sendFiles( files );
}
@Override
public void onDragLeave()
{
deco.getElement().getStyle().clearBackgroundColor();
}
@Override
public void onDragEnter()
{
deco.getElement().getStyle().setBackgroundColor( "grey" );
}
} );
if( target != null )
{
RootPanel.get().add( target );
}
else
{
RootPanel.get().add( new Label( "Sorry, no drop enabled..." ) );
}
RootPanel.get().add( table );
}
示例6: WidgetProblemSentenceRensou
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
public WidgetProblemSentenceRensou(PacketProblem problem) {
sentence = problem.getPanelSentence().replaceAll("%c\n", "%c").trim();
sentenceLength = sentence.length();
clearSentence();
// 初めから全て表示する場合
if (sentence.startsWith("!")) {
String[] sentences = sentence.replaceAll(" ", "").substring(1).split("\n");
for (StringBuilder sb : lines) {
sb.delete(0, sb.length());
}
int n = Math.min(sentences.length, NUMBER_OF_LINES);
for (int i = 0; i < n; ++i) {
lines[i].append(sentences[i]);
}
index = sentenceLength;
}
htmlSentence.addStyleDependentName("problemStatement");
htmlSentence.addStyleDependentName("problemStatementCenter");
htmlSentence.setSize("600px", "200px");
DecoratorPanel decoratorPanel = new DecoratorPanel();
decoratorPanel.setWidget(htmlSentence);
add(decoratorPanel);
}
示例7: WidgetProblemSentenceNormal
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
public WidgetProblemSentenceNormal(PacketProblem problem) {
sentence = problem.getPanelSentence().replaceAll("%c\n", "%c");
sentenceLength = sentence.length();
html = new StringBuilder(sentenceLength * 2);
final HorizontalPanel panel = new HorizontalPanel();
panel.add(htmlSentence);
// 画像または動画を使用する場合は問題文の長さを調整する
htmlSentence.getElement().setAttribute("oncopy", "return false;");
htmlSentence.getElement().setAttribute("oncut", "return false;");
htmlSentence.addStyleDependentName("problemStatement");
if (problem.imageUrl != null) {
htmlSentence.setPixelSize(360, 200);
panel.add(new WidgetBackgroundImage(problem, 240, 180));
} else if (problem.movieUrl != null) {
htmlSentence.setPixelSize(360, 200);
panel.add(new WidgetBackgroundYouTube(problem.movieUrl, 240, 200));
} else {
htmlSentence.setPixelSize(600, 200);
}
final DecoratorPanel decoratorPanel = new DecoratorPanel();
decoratorPanel.setWidget(panel);
add(decoratorPanel);
}
示例8: onSuccess
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
public void onSuccess(List<PacketBbsThread> result) {
displayPanel.clear();
for (PacketBbsThread thread : result) {
DecoratorPanel decoratorPanel = new DecoratorPanel();
decoratorPanel.setWidget(new PanelThread((int) thread.id, thread.title));
displayPanel.add(decoratorPanel);
}
}
示例9: onInitialize
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
/**
* Initialize this example.
*/
@ShowcaseSource
@Override
public Widget onInitialize() {
// Create a new panel
absolutePanel = new AbsolutePanel();
absolutePanel.setSize("250px", "250px");
absolutePanel.ensureDebugId("cwAbsolutePanel");
// Add a widget that we will animate
animateeTop = new Image(Showcase.images.gwtLogoThumb());
animateeBottom = new Image(Showcase.images.gwtLogoThumb());
animateeLeft = new Image(Showcase.images.gwtLogoThumb());
animateeRight = new Image(Showcase.images.gwtLogoThumb());
absolutePanel.add(animateeTop);
absolutePanel.add(animateeBottom);
absolutePanel.add(animateeLeft);
absolutePanel.add(animateeRight);
// Wrap the absolute panel in a DecoratorPanel
DecoratorPanel absolutePanelWrapper = new DecoratorPanel();
absolutePanelWrapper.setWidget(absolutePanel);
// Create the options bar
DecoratorPanel optionsWrapper = new DecoratorPanel();
optionsWrapper.setWidget(createOptionsBar());
// Add the components to a panel and return it
HorizontalPanel mainLayout = new HorizontalPanel();
mainLayout.setSpacing(10);
mainLayout.add(optionsWrapper);
mainLayout.add(absolutePanelWrapper);
// Create the custom animation
animation = new CustomAnimation();
// Set the start position of the widgets
animation.onComplete();
// Return the layout
return mainLayout;
}
示例10: onInitialize
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
/**
* Initialize this example.
*/
@ShowcaseSource
@Override
public Widget onInitialize() {
// Create a new panel
widgetMap = new LinkedHashMap<String, Widget>();
absolutePanel = new AbsolutePanel();
absolutePanel.setSize("250px", "250px");
absolutePanel.ensureDebugId("cwAbsolutePanel");
// Add an HTML widget to the panel
String[] widgetNames = constants.cwAbsolutePanelWidgetNames();
HTML text = new HTML(constants.cwAbsolutePanelHelloWorld());
absolutePanel.add(text, 10, 20);
widgetMap.put(widgetNames[0], text);
// Add a Button to the panel
Button button = new Button(constants.cwAbsolutePanelClickMe());
absolutePanel.add(button, 80, 45);
widgetMap.put(widgetNames[1], button);
// Add a Button to the panel
Grid grid = new Grid(2, 3);
grid.setBorderWidth(1);
for (int i = 0; i < 3; i++) {
grid.setHTML(0, i, i + "");
grid.setWidget(1, i, new Image(Showcase.images.gwtLogoThumb()));
}
absolutePanel.add(grid, 60, 100);
widgetMap.put(widgetNames[2], grid);
// Wrap the absolute panel in a DecoratorPanel
DecoratorPanel absolutePanelWrapper = new DecoratorPanel();
absolutePanelWrapper.setWidget(absolutePanel);
// Create the options bar
DecoratorPanel optionsWrapper = new DecoratorPanel();
optionsWrapper.setWidget(createOptionsBar());
// Add the components to a panel and return it
HorizontalPanel mainLayout = new HorizontalPanel();
mainLayout.setSpacing(10);
mainLayout.add(optionsWrapper);
mainLayout.add(absolutePanelWrapper);
return mainLayout;
}
示例11: createAdvancedForm
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
/**
* Create a form that contains undisclosed advanced options.
*/
@ShowcaseSource
private Widget createAdvancedForm() {
// Create a table to layout the form options
FlexTable layout = new FlexTable();
layout.setCellSpacing(6);
layout.setWidth("300px");
FlexCellFormatter cellFormatter = layout.getFlexCellFormatter();
// Add a title to the form
layout.setHTML(0, 0, constants.cwDisclosurePanelFormTitle());
cellFormatter.setColSpan(0, 0, 2);
cellFormatter.setHorizontalAlignment(
0, 0, HasHorizontalAlignment.ALIGN_CENTER);
// Add some standard form options
layout.setHTML(1, 0, constants.cwDisclosurePanelFormName());
layout.setWidget(1, 1, new TextBox());
layout.setHTML(2, 0, constants.cwDisclosurePanelFormDescription());
layout.setWidget(2, 1, new TextBox());
// Create some advanced options
HorizontalPanel genderPanel = new HorizontalPanel();
String[] genderOptions = constants.cwDisclosurePanelFormGenderOptions();
for (int i = 0; i < genderOptions.length; i++) {
genderPanel.add(new RadioButton("gender", genderOptions[i]));
}
Grid advancedOptions = new Grid(2, 2);
advancedOptions.setCellSpacing(6);
advancedOptions.setHTML(0, 0, constants.cwDisclosurePanelFormLocation());
advancedOptions.setWidget(0, 1, new TextBox());
advancedOptions.setHTML(1, 0, constants.cwDisclosurePanelFormGender());
advancedOptions.setWidget(1, 1, genderPanel);
// Add advanced options to form in a disclosure panel
DisclosurePanel advancedDisclosure = new DisclosurePanel(
constants.cwDisclosurePanelFormAdvancedCriteria());
advancedDisclosure.setAnimationEnabled(true);
advancedDisclosure.ensureDebugId("cwDisclosurePanel");
advancedDisclosure.setContent(advancedOptions);
layout.setWidget(3, 0, advancedDisclosure);
cellFormatter.setColSpan(3, 0, 2);
// Wrap the contents in a DecoratorPanel
DecoratorPanel decPanel = new DecoratorPanel();
decPanel.setWidget(layout);
return decPanel;
}
示例12: onInitialize
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
/**
* Initialize this example.
*/
@ShowcaseSource
@Override
public Widget onInitialize() {
// Create a static tree and a container to hold it
Tree staticTree = createStaticTree();
staticTree.setAnimationEnabled(true);
staticTree.ensureDebugId("cwTree-staticTree");
ScrollPanel staticTreeWrapper = new ScrollPanel(staticTree);
staticTreeWrapper.ensureDebugId("cwTree-staticTree-Wrapper");
staticTreeWrapper.setSize("300px", "300px");
// Wrap the static tree in a DecoratorPanel
DecoratorPanel staticDecorator = new DecoratorPanel();
staticDecorator.setWidget(staticTreeWrapper);
// Create a dynamically generated tree and a container to hold it
final Tree dynamicTree = createDynamicTree();
dynamicTree.ensureDebugId("cwTree-dynamicTree");
ScrollPanel dynamicTreeWrapper = new ScrollPanel(dynamicTree);
dynamicTreeWrapper.ensureDebugId("cwTree-dynamicTree-Wrapper");
dynamicTreeWrapper.setSize("300px", "300px");
// Wrap the dynamic tree in a DecoratorPanel
DecoratorPanel dynamicDecorator = new DecoratorPanel();
dynamicDecorator.setWidget(dynamicTreeWrapper);
// Combine trees onto the page
Grid grid = new Grid(2, 3);
grid.setCellPadding(2);
grid.getRowFormatter().setVerticalAlign(1, HasVerticalAlignment.ALIGN_TOP);
grid.setHTML(0, 0, constants.cwTreeStaticLabel());
grid.setHTML(0, 1, " ");
grid.setHTML(0, 2, constants.cwTreeDynamicLabel());
grid.setWidget(1, 0, staticDecorator);
grid.setHTML(1, 1, " ");
grid.setWidget(1, 2, dynamicDecorator);
// Wrap the trees in DecoratorPanels
return grid;
}
示例13: Application
import com.google.gwt.user.client.ui.DecoratorPanel; //导入方法依赖的package包/类
/**
* Constructor.
*/
public Application() {
// Setup the main layout widget
FlowPanel layout = new FlowPanel();
initWidget(layout);
// Setup the top panel with the title and links
createTopPanel();
layout.add(topPanel);
// Add the main menu
bottomPanel = new HorizontalPanel();
bottomPanel.setWidth("100%");
bottomPanel.setSpacing(0);
bottomPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
layout.add(bottomPanel);
createMainMenu();
bottomPanel.add(mainMenu);
// Setup the content layout
contentLayout = new Grid(2, 1);
contentLayout.setCellPadding(0);
contentLayout.setCellSpacing(0);
contentDecorator = new DecoratorPanel();
contentDecorator.setWidget(contentLayout);
contentDecorator.addStyleName(DEFAULT_STYLE_NAME + "-content-decorator");
bottomPanel.add(contentDecorator);
if (LocaleInfo.getCurrentLocale().isRTL()) {
bottomPanel.setCellHorizontalAlignment(contentDecorator,
HasHorizontalAlignment.ALIGN_LEFT);
contentDecorator.getElement().setAttribute("align", "LEFT");
} else {
bottomPanel.setCellHorizontalAlignment(contentDecorator,
HasHorizontalAlignment.ALIGN_RIGHT);
contentDecorator.getElement().setAttribute("align", "RIGHT");
}
CellFormatter formatter = contentLayout.getCellFormatter();
formatter.setStyleName(0, 0, DEFAULT_STYLE_NAME + "-content-title");
setContentTitle(new HTML("jCommerce Administation"));
// Add the content wrapper
contentWrapper = new SimplePanel();
contentLayout.setWidget(1, 0, contentWrapper);
formatter.setStyleName(1, 0, DEFAULT_STYLE_NAME + "-content-wrapper");
setContent(null);
rightButton.setVisible(false);
}