本文整理汇总了Java中com.google.gwt.user.client.ui.Widget类的典型用法代码示例。如果您正苦于以下问题:Java Widget类的具体用法?Java Widget怎么用?Java Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Widget类属于com.google.gwt.user.client.ui包,在下文中一共展示了Widget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setWidget
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
public void setWidget(Widget w, boolean delegateCaptionHandling) {
if (w != null) {
this.widgetType = VaadinWidgetUtils.getWidgetTypeByWidget(w);
this.widgetElement = VaadinWidgetUtils.getElementByVaadinWidget(w, this.widgetType);
if (this.widgetType.isAddStyle()) {
this.widgetElement.addClassName(this.widgetType.getCssStyle());
} else {
this.widgetElement.setClassName(this.widgetType.getCssStyle());
}
if (delegateCaptionHandling) {
getElement().appendChild(label = DOM.createLabel());
} else {
getElement().appendChild(label = DOM.createDiv());
}
getElement().appendChild(div);
}
super.setWidget(w);
if (w != null) {
getContainerElement().appendChild(small);
getContainerElement().appendChild(feedback);
}
}
示例2: getSelection
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
@Override
public List<SelectionInterface> getSelection() {
List<SelectionInterface> selection = new ArrayList<EventInterface.SelectionInterface>();
for (int i = 0; i < iTables.getWidgetCount(); i++) {
Widget w = iTables.getWidget(i);
if (w instanceof TimeGrid)
for (SelectionInterface s: ((TimeGrid)w).getSelections()) {
SelectionInterface x = new SelectionInterface();
x.setLength(s.getLength());
x.setStartSlot(s.getStartSlot());
for (ResourceInterface r: s.getLocations())
x.addLocation(r);
for (Integer d: s.getDays())
x.addDay(iSelectedDates.get(d - iSelectedDates.get(0)));
selection.add(x);
}
}
return selection;
}
示例3: getCell
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
protected Widget getCell(final AttributeInterface feature, final AttributesColumn column, final int idx) {
switch (column) {
case NAME:
return new Label(feature.getName() == null ? "" : feature.getName(), false);
case CODE:
return new Label(feature.getCode() == null ? "" : feature.getCode(), false);
case TYPE:
if (feature.getType() == null)
return null;
else {
Label type = new Label(feature.getType().getAbbreviation(), false);
type.setTitle(feature.getType().getLabel());
return type;
}
case PARENT:
return new Label(feature.getParentName() == null ? "" : feature.getParentName(), false);
case INSTRUCTORS:
if (feature.hasInstructors())
return new InstructorsCell(feature);
else
return null;
default:
return null;
}
}
示例4: buildProcessInstancesGrid
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
private final Widget buildProcessInstancesGrid() {
commonGridSettings(processInstancesGrid);
processInstancesGrid.setSelectionType(SelectionStyle.SINGLE);
ListGridField nameField = new ListGridField("piid", "Process Instance ID", 120);
ListGridField stateField = new ListGridField("state", "Process Instance State");
ListGridField currentField = new ListGridField("current", "Current Steps", 100);
ListGridField historyField = new ListGridField("history", "History Steps", 100);
processInstancesGrid.setFields(new ListGridField[] {
integerField(nameField),
leftField(stateField),
integerField(currentField),
integerField(historyField)
});
return processInstancesGrid;
}
示例5: shouldInitModule_withTemplate
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
@Test
public void shouldInitModule_withTemplate() {
// given
Element element = mock(Element.class);
SlideshowBean slideshowBean = new SlideshowBean();
List<SlideBean> slides = Lists.newArrayList();
slideshowBean.setSlideBeans(slides);
SlideshowPlayerBean slideshowPlayer = new SlideshowPlayerBean();
slideshowPlayer.setSlideshowBean(slideshowBean);
when(moduleStructure.getBean()).thenReturn(slideshowPlayer);
when(templateInterpreter.isPagerTemplateActivate(slideshowPlayer)).thenReturn(true);
// when
testObj.initModule(element, moduleSocket, eventsBus);
// then
verify(presenter).init(slideshowBean, inlineBodyGeneratorSocket);
verify(controller).init(slideshowBean.getSlideBeans(), inlineBodyGeneratorSocket);
verify(controller).initPager(slides.size());
verify(presenter).setPager(any(Widget.class));
}
示例6: focus
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
private boolean focus(int row, int col) {
if (!getRowFormatter().isVisible(row) || col >= getCellCount(row)) return false;
Widget w = super.getWidget(row, col);
if (w == null || !w.isVisible()) return false;
if (w instanceof SmartTableCell) {
return ((SmartTableCell)w).focus();
} else if (w instanceof HasFocus) {
return ((HasFocus)w).focus();
} else if (w instanceof Focusable) {
((Focusable)w).setFocus(true);
if (w instanceof TextBoxBase)
((TextBoxBase)w).selectAll();
return true;
}
return false;
}
示例7: initComponent
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
/**
* Sets the components widget representation and initializes its properties.
*
* <p>To be called from implementing constructor.
*
* @param widget components visual representation in designer
*/
void initComponent(Widget widget) {
// Widget needs to be initialized before the component itself so that the component properties
// can be reflected by the widget
initWidget(widget);
// Capture mouse and click events in onBrowserEvent(Event)
sinkEvents(Event.MOUSEEVENTS | Event.ONCLICK);
// Add the special name property and set the tooltip
String name = componentName();
setTitle(name);
addProperty(PROPERTY_NAME_NAME, name, null, new TextPropertyEditor());
// TODO(user): Ensure this value is unique within the project using a list of
// already used UUIDs
// Set the component's UUID
// The default value here can be anything except 0, because YoungAndroidProjectServce
// creates forms with an initial Uuid of 0, and Properties.java doesn't encode
// default values when it generates JSON for a component.
addProperty(PROPERTY_NAME_UUID, "-1", null, new TextPropertyEditor());
changeProperty(PROPERTY_NAME_UUID, "" + Random.nextInt());
editor.getComponentPalettePanel().configureComponent(this);
}
示例8: createSwfExecutor
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
private MediaExecutor<Widget> createSwfExecutor(BaseMediaConfiguration bmc) {
if (bmc.isFeedback()) {
return simpleSwfExecutorProvider.get();
} else {
return createLocalSwfMediaExecutor();
}
}
示例9: createOldView
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
/**
* buduke widok na starych zasadach
*
* @param element
*/
protected void createOldView(Element element) {
ImgContent content;
imageSource = element.getAttribute("src");
if (element.getElementsByTagName("label").getLength() > 0) {
content = labelledImgContentProvider.get();
} else {
Map<String, String> styles = styleSocket.getStyles(element);
if (styles.containsKey(EMPIRIA_IMG_MODE) && styles.get(EMPIRIA_IMG_MODE).equalsIgnoreCase("explorable")) {
content = explorableImgContentProvider.get();
} else {
content = picturePlayerModuleProvider.get();
}
}
content.init(element, getModuleSocket());
view.setContent(content);
NodeList titleNodes = element.getElementsByTagName("title");
if (titleNodes.getLength() > 0) {
Widget titleWidget = getModuleSocket().getInlineBodyGeneratorSocket().generateInlineBody(titleNodes.item(0));
if (titleWidget != null) {
view.setTitle(titleWidget);
}
}
NodeList descriptionNodes = element.getElementsByTagName("description");
if (descriptionNodes.getLength() > 0) {
Widget descriptionWidget = getModuleSocket().getInlineBodyGeneratorSocket().generateInlineBody(descriptionNodes.item(0));
if (descriptionWidget != null) {
view.setDescription(descriptionWidget);
}
}
}
示例10: createCallbackReceiver
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
private CallbackReceiver<MediaWrapper<Widget>> createCallbackReceiver(final String audioName, final ExternalSoundInstanceCallback callback, final Optional<OnEndCallback> onEndCallback, final Optional<OnPauseCallback> onPauseCallback) {
return new CallbackReceiver<MediaWrapper<Widget>>() {
@Override
public void setCallbackReturnObject(MediaWrapper<Widget> audioWrapper) {
ExternalSoundInstance soundInstance = moduleFactory.getExternalSoundInstance(audioWrapper, onEndCallback, onPauseCallback);
callback.onSoundCreated(soundInstance, audioName);
}
};
}
示例11: shouldReturnViewAsWidget
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
@Test
public void shouldReturnViewAsWidget() {
// given
Widget widget = mock(Widget.class);
when(view.asWidget()).thenReturn(widget);
// when
Widget result = testObj.getView();
// then
assertThat(result).isEqualTo(widget);
}
示例12: createVideoDialog
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
/**
* Creates video on page!
*/
private static void createVideoDialog(String tutorialId) {
// Create the UI elements of the DialogBox
final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal)
dialogBox.setStylePrimaryName("ode-DialogBox");
dialogBox.setText("Tutorial Video");
dialogBox.setGlassEnabled(true);
dialogBox.setAnimationEnabled(true);
VerticalPanel DialogBoxContents = new VerticalPanel();
// Adds Youtube Video
HTML message = new HTML("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/" + tutorialId + "?rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>");
message.setStyleName("DialogBox-message");
FlowPanel holder = new FlowPanel();
Button ok = new Button("Close");
ok.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
dialogBox.hide();
}
});
ok.setStyleName("DialogBox-button");
holder.add(ok);
DialogBoxContents.add(message);
DialogBoxContents.add(holder);
dialogBox.setWidget(DialogBoxContents);
dialogBox.center();
dialogBox.show();
}
示例13: createTitleWidget
import com.google.gwt.user.client.ui.Widget; //导入依赖的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;
}
示例14: mockDropEnabling
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
private void mockDropEnabling() {
@SuppressWarnings("unchecked")
DroppableObject<FlowPanelWithDropZone> droppable = Mockito.mock(DroppableObject.class);
when(dragGapView.enableDropCapabilities()).thenReturn(droppable);
Widget droppableWidget = Mockito.mock(Widget.class);
when(droppable.getDroppableWidget()).thenReturn(droppableWidget);
dropZoneGuardian = Mockito.mock(DropZoneGuardian.class);
when(dragGapModuleFactory.createDropZoneGuardian(droppable, droppableWidget)).thenReturn(dropZoneGuardian);
}
示例15: restoreSizeStyle
import com.google.gwt.user.client.ui.Widget; //导入依赖的package包/类
static void restoreSizeStyle(Widget w, String[] style) {
Element element = w.getElement();
if (style[0] != null) {
DOM.setStyleAttribute(element, "width", style[0]);
}
if (style[1] != null) {
DOM.setStyleAttribute(element, "height", style[1]);
}
}