本文整理汇总了Java中com.google.gwt.user.client.ui.PopupPanel.setWidget方法的典型用法代码示例。如果您正苦于以下问题:Java PopupPanel.setWidget方法的具体用法?Java PopupPanel.setWidget怎么用?Java PopupPanel.setWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.PopupPanel
的用法示例。
在下文中一共展示了PopupPanel.setWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HorizontalPanelWithHint
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public HorizontalPanelWithHint(Widget hint) {
super();
iHint = new PopupPanel();
iHint.setWidget(hint);
iHint.setStyleName("unitime-PopupHint");
sinkEvents(Event.ONMOUSEOVER);
sinkEvents(Event.ONMOUSEOUT);
sinkEvents(Event.ONMOUSEMOVE);
iShowHint = new Timer() {
@Override
public void run() {
iHint.show();
}
};
iHideHint = new Timer() {
@Override
public void run() {
iHint.hide();
}
};
}
示例2: SelectionLayer
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public SelectionLayer() {
setStyleName("selection-layer");
iPopup = new PopupPanel();
iPopup.setStyleName("unitime-TimeGridSelectionPopup");
iHint = new P("content");
iPopup.setWidget(iHint);
iSelection = new SelectionPanel();
iSelection.setVisible(false);
add(iSelection, 0, 0);
sinkEvents(Event.ONMOUSEDOWN);
sinkEvents(Event.ONMOUSEUP);
sinkEvents(Event.ONMOUSEMOVE);
sinkEvents(Event.ONMOUSEOVER);
sinkEvents(Event.ONMOUSEOUT);
}
示例3: MultiLineTextDisplayElement
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public MultiLineTextDisplayElement(String id, int x, int y, int width, int height,
String text, String label, int[][] coords) {
super(id, x, y, width, height);
this.coords = coords;
this.label = label;
this.text = text;
popup = new PopupPanel(true, false);
HTML content = new HTML(text);
popup.setStylePrimaryName("PopupPanel");
popup.addStyleName("AnnotationPopup");
popup.setWidget(content);
// Create a canvas containing the filled polygon with no border
Canvas sub_canvas = Canvas.createIfSupported();
sub_canvas.setCoordinateSpaceWidth(width);
sub_canvas.setCoordinateSpaceHeight(height);
Context2d context = sub_canvas.getContext2d();
context.beginPath();
context.moveTo(coords[0][0] - baseLeft(), coords[0][1] - baseTop());
for (int i = 1; i < coords.length; i++) {
context.lineTo(coords[i][0] - baseLeft(), coords[i][1] - baseTop());
}
context.setFillStyle(color_fill);
context.fill();
context.closePath();
this.image_data = context.getImageData(0, 0, width, height);
}
示例4: createInfoWindow
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
/**
* Opens an HTML popup info window at the given screen coordinates (within the
* plot bounds)
*
* It sets the same font family, size, color and bgcolor defined for markers, if
* you wanted override them use the css selector div.chrono-infoWindow-content.
*
* FIXME: (MCM) this should be a unique instance of popup: ask Shawn
*/
public InfoWindow createInfoWindow(String html, double x, double y) {
final PopupPanel pp = new DecoratedPopupPanel(true);
pp.addStyleName("chrono-infoWindow");
Widget content = new HTML(html);
content.setStyleName("chrono-infoWindow-content");
pp.setWidget(content);
pp.setPopupPosition(getElement().getAbsoluteLeft() + (int)x, getElement().getAbsoluteTop() + (int)y);
GssProperties markerProperties = gssContext.getPropertiesBySelector("marker");
if (markerProperties != null) {
pp.getElement().getStyle().setBackgroundColor(markerProperties.bgColor.toString());
pp.getElement().getStyle().setColor(markerProperties.color.toString());
pp.getElement().getStyle().setProperty("fontFamily", markerProperties.fontFamily.toString());
pp.getElement().getStyle().setProperty("fontSize", markerProperties.fontSize.toString());
pp.getElement().getStyle().setPadding(5, Unit.PX);
}
pp.getElement().getStyle().setZIndex(9999);
pp.show();
return new BrowserInfoWindow(this, pp);
}
示例5: showMinimalError
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public static void showMinimalError(Widget anchor, String msg) {
final PopupPanel p = new PopupPanel(true);
p.setAnimationEnabled(true);
p.addStyleName("onTopDialog");
p.setWidget(new HTML(msg));
p.setPopupPosition(anchor.getAbsoluteLeft() + anchor.getOffsetWidth(), anchor.getAbsoluteTop() + anchor.getOffsetHeight());
p.show();
new Timer(){
public void run() {
p.hide();
}
}.schedule(4000);
}
示例6: animationIconCSS
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
private void animationIconCSS(int mills, int startX, int startY) {
Image icon = new Image(ONE_GEAR_ICON_LARGE);
final PopupPanel popup= new PopupPanel();
popup.setStyleName("");
popup.addStyleName("animationLevel");
popup.setAnimationEnabled(false);
popup.setWidget(icon);
Widget w= button.getIcon()!=null ? button.getIcon() : button;
int endX= w.getAbsoluteLeft();
int endY= w.getAbsoluteTop();
setupCssAnimation(startX,startY,endX,endY);
int extra= 35;
CssAnimation.setAnimationStyle(popup,"iconAnimate "+ (mills+extra) +"ms ease-in-out 1 normal");
popup.setPopupPosition(endX, endY);
popup.show();
Timer t= new Timer() {
@Override
public void run() {
popup.hide();
}
};
t.schedule( mills);
}
示例7: PopupPane
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public PopupPane(String header,
Widget content,
PopupType ptype,
boolean pointerPopup,
boolean modal,
boolean autoHide,
HeaderType headerType) {
cnt++;
this.header = header;
_ptype= isStyleImplemented(ptype) ? ptype : PopupType.STANDARD;
_pointerPopup= pointerPopup;
_pointerIm= null;
_headerType= headerType;
_anStyleName = "ppDrop"+cnt;
init(modal,autoHide, headerType);
if (content!=null) setWidget(content);
popup.setAnimationEnabled(true);
_masking= modal;
if (Application.getInstance().getDefZIndex()>0) {
GwtUtil.setStyle(popup,"zIndex", Application.getInstance().getDefZIndex()+"");
}
if (_masking) {
_maskPanel = new PopupPanel(false, false);
_maskPanel.setAnimationEnabled(false);
_maskPanel.setStyleName("firefly-mask-ui");
addZIndexStyle(popup,"onTopDialog" );
_maskPanel.setWidget(new Label()); // needed for style to take effect
}
else {
_maskPanel = null;
}
popup.addCloseHandler(new CloseHandler<PopupPanel>() {
public void onClose(CloseEvent<PopupPanel> ev) {
CloseEvent.fire(PopupPane.this, PopupPane.this, ev.isAutoClosed());
}
});
}
示例8: showMenu
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
protected void showMenu() {
if (menu != null) {
final PopupPanel pp = new PopupPanel();
pp.setAutoHideEnabled(true);
pp.setAutoHideOnHistoryEventsEnabled(true);
pp.setAnimationEnabled(true);
pp.setWidget(menu);
pp.showRelativeTo(chevronMenu);
}
}
示例9: deliverError
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public void deliverError(ValidationError ve) {
AtomTools.log(Level.FINE, "Frame.deliverError using generic implementation", this);
final PopupPanel popupPanel = new PopupPanel(false);
popupPanel.getElement().getStyle().setZIndex(1000);
VerticalPanel popUpPanelContents = new VerticalPanel();
popupPanel.setTitle("Error");
HTML message = new HTML(ve.getMessage());
Button button = new Button("Close", new ClickHandler() {
public void onClick(ClickEvent event) {
popupPanel.hide();
}
});
SimplePanel holder = new SimplePanel();
holder.add(button);
popUpPanelContents.add(message);
popUpPanelContents.add(holder);
popupPanel.setWidget(popUpPanelContents);
popupPanel.center();
}
示例10: show
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public static void show(String text, int delayMillis, final boolean doReload){
final PopupPanel notificationPopup = new PopupPanel(false);
final Label label = new Label(text);
notificationPopup.setWidget(label);
notificationPopup.setPopupPosition(50, 20);
notificationPopup.setVisible(true);
notificationPopup.show();
Timer t = new Timer() {
@Override
public void run() {
Animation a = new Animation() {
@Override
protected void onUpdate(double progress) {
notificationPopup.getElement().getStyle().setProperty("opacity", String.valueOf(1-progress));
if(progress == 1) {
notificationPopup.hide();
if(doReload)
Location.reload();
}
}
};
a.run(500);
}
};
t.schedule(delayMillis);
}
示例11: createContactsItem
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
/**
* Create the list of Contacts.
*
* @param images the {@link Images} used in the Contacts
* @return the list of contacts
*/
@ShowcaseSource
private VerticalPanel createContactsItem(Images images) {
// Create a popup to show the contact info when a contact is clicked
HorizontalPanel contactPopupContainer = new HorizontalPanel();
contactPopupContainer.setSpacing(5);
contactPopupContainer.add(new Image(images.defaultContact()));
final HTML contactInfo = new HTML();
contactPopupContainer.add(contactInfo);
final PopupPanel contactPopup = new PopupPanel(true, false);
contactPopup.setWidget(contactPopupContainer);
// Create the list of contacts
VerticalPanel contactsPanel = new VerticalPanel();
contactsPanel.setSpacing(4);
String[] contactNames = constants.cwStackPanelContacts();
String[] contactEmails = constants.cwStackPanelContactsEmails();
for (int i = 0; i < contactNames.length; i++) {
final String contactName = contactNames[i];
final String contactEmail = contactEmails[i];
final Anchor contactLink = new Anchor(contactName);
contactsPanel.add(contactLink);
// Open the contact info popup when the user clicks a contact
contactLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// Set the info about the contact
contactInfo.setHTML(contactName + "<br><i>" + contactEmail + "</i>");
// Show the popup of contact info
int left = contactLink.getAbsoluteLeft() + 14;
int top = contactLink.getAbsoluteTop() + 14;
contactPopup.setPopupPosition(left, top);
contactPopup.show();
}
});
}
return contactsPanel;
}
示例12: handleException
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public void handleException(Object source, ValidationException exception) {
final Widget w = (Widget) source;
final PopupPanel p = new PopupPanel(false);
popups.put( source, p );
p.setStyleName("gwittir-ValidationPopup");
p.setWidget(new Label(this.getMessage(exception)));
p.setPopupPosition( -5000, -5000 );
p.show();
if(this.position == BOTTOM) {
p.setPopupPosition(w.getAbsoluteLeft(),
w.getAbsoluteTop() + w.getOffsetHeight());
} else if(this.position == RIGHT) {
p.setPopupPosition(w.getAbsoluteLeft() + w.getOffsetWidth(),
w.getAbsoluteTop());
} else if(this.position == LEFT) {
p.setPopupPosition(w.getAbsoluteLeft() - p.getOffsetWidth(),
w.getAbsoluteTop());
} else if(this.position == TOP) {
p.setPopupPosition(w.getAbsoluteLeft(),
w.getAbsoluteTop() - p.getOffsetHeight());
}
if( w instanceof SourcesPropertyChangeEvents ){
GWT.log("is PCE", null);
PropertyChangeListener attachListener = new PropertyChangeListener(){
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
if( ((Boolean)propertyChangeEvent.getNewValue()).booleanValue() ){
p.setVisible( true );
} else {
p.setVisible( false );
}
}
};
listeners.put(w, attachListener );
((SourcesPropertyChangeEvents)w).addPropertyChangeListener("attached", attachListener);
((SourcesPropertyChangeEvents)w).addPropertyChangeListener("visible", attachListener);
}
}
示例13: show
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public void show() {
final PopupPanel panel = new PopupPanel();
panel.setStyleName(Res.R.style().toast());
HTML label = new HTML(message.replace("\n", "<br/>"));
panel.setWidget(label);
panel.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
public void setPosition(int offsetWidth, int offsetHeight) {
int left = (Window.getClientWidth() - offsetWidth) / 2;
int top = 0;
switch (gravity) {
case Gravity.TOP:
top = (Window.getClientHeight() - offsetHeight) / 10;
break;
case Gravity.CENTER:
top = (Window.getClientHeight() - offsetHeight) / 2;
break;
case Gravity.BOTTOM:
top = 9 * (Window.getClientHeight() - offsetHeight) / 10;
break;
}
panel.setPopupPosition(left, top);
}
});
// Create a new timer that calls hide().
Timer t = new Timer() {
public void run() {
panel.hide();
}
};
if (duration == LENGTH_SHORT) {
t.schedule(2500);
} else {
t.schedule(4000);
}
}
示例14: AriaSuggestBox
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public AriaSuggestBox(AriaTextBox box, SuggestOracle oracle) {
iOracle = oracle;
iText = box;
iText.setStyleName("gwt-SuggestBox");
initWidget(iText);
addEventsToTextBox();
iSuggestionMenu = new SuggestionMenu();
iPopupScroll = new ScrollPanel(iSuggestionMenu);
iPopupScroll.addStyleName("scroll");
iSuggestionPopup = new PopupPanel(true, false);
iSuggestionPopup.setPreviewingAllNativeEvents(true);
iSuggestionPopup.setStyleName("unitime-SuggestBoxPopup");
iSuggestionPopup.setWidget(iPopupScroll);
iSuggestionPopup.addAutoHidePartner(getElement());
iSuggestionCallback = new SuggestionCallback() {
@Override
public void onSuggestionSelected(Suggestion suggestion) {
if (!suggestion.getReplacementString().isEmpty()) {
setStatus(ARIA.suggestionSelected(status(suggestion)));
}
iCurrentText = suggestion.getReplacementString();
setText(suggestion.getReplacementString());
hideSuggestionList();
fireSuggestionEvent(suggestion);
}
};
iOracleCallback = new SuggestOracle.Callback() {
@Override
public void onSuggestionsReady(Request request, Response response) {
if (response.getSuggestions() == null || response.getSuggestions().isEmpty()) {
if (iSuggestionPopup.isShowing()) iSuggestionPopup.hide();
} else {
iSuggestionMenu.clearItems();
SuggestOracle.Suggestion first = null;
for (SuggestOracle.Suggestion suggestion: response.getSuggestions()) {
iSuggestionMenu.addItem(new SuggestionMenuItem(suggestion));
if (first == null) first = suggestion;
}
iSuggestionMenu.selectItem(0);
ToolBox.setMinWidth(iSuggestionMenu.getElement().getStyle(), (iText.getElement().getClientWidth() - 4) + "px");
iSuggestionPopup.showRelativeTo(iText);
iSuggestionMenu.scrollToView();
if (response.getSuggestions().size() == 1) {
if (first.getReplacementString().isEmpty())
setStatus(status(first));
else
setStatus(ARIA.showingOneSuggestion(status(first)));
} else {
setStatus(ARIA.showingMultipleSuggestions(response.getSuggestions().size(), request.getQuery(), status(first)));
}
}
}
};
Roles.getTextboxRole().setAriaAutocompleteProperty(iText.getElement(), AutocompleteValue.NONE);
iSuggestionPopup.getElement().setAttribute("id", DOM.createUniqueId());
Roles.getTextboxRole().setAriaOwnsProperty(iText.getElement(), Id.of(iSuggestionPopup.getElement()));
}
示例15: InfoPanelImpl
import com.google.gwt.user.client.ui.PopupPanel; //导入方法依赖的package包/类
public InfoPanelImpl() {
super("cell");
iText = new P("text");
add(iText);
iHint = new ClickableHint(""); iHint.setStyleName("hint");
add(iHint);
iUpdateInfo = new Callback() {
@Override
public void execute(Callback callback) {
if (callback != null) callback.execute(null);
}
};
iInfo = new FlexTable();
iInfo.setStyleName("unitime-InfoTable");
// iUpdateInfo = updateInfo;
iInfoPanel = new PopupPanel();
iInfoPanel.setWidget(iInfo);
iInfoPanel.setStyleName("unitime-PopupHint");
sinkEvents(Event.ONMOUSEOVER);
sinkEvents(Event.ONMOUSEOUT);
sinkEvents(Event.ONMOUSEMOVE);
iShowInfo = new Timer() {
@Override
public void run() {
if (iInfo.getRowCount() == 0) return;
iUpdateInfo.execute(new Callback() {
public void execute(Callback callback) {
iInfoPanel.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
@Override
public void setPosition(int offsetWidth, int offsetHeight) {
int maxX = Window.getScrollLeft() + Window.getClientWidth() - offsetWidth - 10;
iInfoPanel.setPopupPosition(Math.min(iX, maxX), iY);
}
});
if (callback != null) callback.execute(null);
}
});
}
};
iHideInfo = new Timer() {
@Override
public void run() {
iInfoPanel.hide();
}
};
iDefaultClickHandler = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (iUrl != null && !iUrl.isEmpty())
ToolBox.open(GWT.getHostPageBaseURL() + iUrl);
}
};
iTextClick = iHint.addClickHandler(iDefaultClickHandler);
iHintClick = iText.addClickHandler(iDefaultClickHandler);
iHint.setTabIndex(-1);
}