本文整理匯總了Java中com.google.gwt.user.client.ui.FocusPanel類的典型用法代碼示例。如果您正苦於以下問題:Java FocusPanel類的具體用法?Java FocusPanel怎麽用?Java FocusPanel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FocusPanel類屬於com.google.gwt.user.client.ui包,在下文中一共展示了FocusPanel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: NewMessageAlertWidget
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
* The basic constructor
*/
private NewMessageAlertWidget( final FocusPanel userAreaPanel ) {
//Add the tool tip
soundImageButton.setTitle( titles.newMessageSoundNotificationButtonToolTip() );
//Add the click handler, for turning the sounds on/off
soundImageButton.addClickHandler( new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
setSoundImageButtonStatus( ! isSoundOn );
}
});
//Store the panel
this.userAreaPanel = userAreaPanel;
//Get the on/off status from the cookie and initialize the visual part of the widget
setSoundImageButtonStatus( SiteManager.isMessageNotifySoundOn() );
//Initialize the composite
initWidget( mainPanel );
}
示例2: cleanAndRestoreMessageContent
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
* Allows to restore the message content from the list of widgets,
* note that the title panel is then added in some other place.
* @param titlePanel the title panel that should be in the message content
* @param contentWidgets the list of widgets to place after the message title panel
*/
protected void cleanAndRestoreMessageContent( final FocusPanel titlePanel, List<Widget> contentWidgets ) {
//First clean the current message content
content.clear();
//Put back the message title. Do not add spaces,
//we already have them in the stored message content.
if( titlePanel != null ) {
addContentWidget( titlePanel, false );
}
//Put back the widgets from the list
if( contentWidgets != null ) {
for(int index = 0; index < contentWidgets.size(); index++) {
content.add( contentWidgets.get( index ) );
}
}
}
示例3: saveAndCleanMessageContent
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
* Allows to get all the message content widgets except for
* the title widget and then clean the message content.
* The title panel, if present, remains in the message content.
* @param titlePanel the title panel or null if it is not needed
*/
protected List<Widget> saveAndCleanMessageContent( final FocusPanel titlePanel ) {
List<Widget> result = new ArrayList<Widget>();
//If the title panel should be there then try to remove it
if( titlePanel != null ) {
content.remove( titlePanel );
}
//Copy all of the widgets to the list
for(int index = 0; index < content.getWidgetCount(); index++) {
result.add( content.getWidget( index ) );
}
//Clear the message content
content.clear();
//Put back the message title panel
if( titlePanel != null ) {
addMessageContentWidget( titlePanel );
}
return result;
}
示例4: ErrorMessageUI
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
* The exception that occurred while we were working with the given room
* @param exception the site exception
* @param theChatRoomData the chat room we are in
* @param isLeft if true then we apply the left message style, otherwise right
*/
public ErrorMessageUI( final RoomAccessException exception, final ChatRoomData theChatRoomData, final boolean isLeft ) {
super( CommonResourcesContainer.ERROR_MESSAGE_LEFT_UI_STYLE,
CommonResourcesContainer.ERROR_MESSAGE_RIGHT_UI_STYLE, isLeft,
ChatRoomData.UNKNOWN_ROOM_ID, ShortUserData.UNKNOWN_UID, null, false );
//Add default font size and font type
addStyleNameToContent( MessageFontData.getFontTypeStyle( MessageFontData.DEFAULT_FONT_FAMILY ) );
addStyleNameToContent( MessageFontData.getFontSizeStyle( MessageFontData.DEFAULT_FONT_SIZE ) );
//Add the message title and spacing
FocusPanel resultPanel = addMessageTitlePanel( new Date(), i18nTitles.chatMessageTypeError(), false, null );
resultPanel.addStyleName( CommonResourcesContainer.ERROR_MESSAGE_TITLE_STYLE );
//Add error message text
exception.setRoomName( ChatRoomData.getRoomName( theChatRoomData ) );
exception.processErrorCodes( I18NManager.getErrors() );
List<String> errorMsgs = exception.getErrorMessages();
String longErrorMessage = "";
for(int i=0; i< errorMsgs.size(); i++){
longErrorMessage += errorMsgs.get( i ) + " ";
}
addMessageContentWidget( new HTML( longErrorMessage ) );
}
示例5: View
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
View(Window.Resources res, boolean showBottomPanel) {
this.res = res;
this.css = res.windowCss();
windowWidth = com.google.gwt.user.client.Window.getClientWidth();
clientLeft = Document.get().getBodyOffsetLeft();
clientTop = Document.get().getBodyOffsetTop();
initWidget(uiBinder.createAndBindUi(this));
footer = new HTMLPanel("");
if (showBottomPanel) {
footer.setStyleName(res.windowCss().footer());
contentContainer.add(footer);
}
handleEvents();
FocusPanel dummyFocusElement = new FocusPanel();
dummyFocusElement.setTabIndex(0);
dummyFocusElement.addFocusHandler(
new FocusHandler() {
@Override
public void onFocus(FocusEvent event) {
setFocus();
}
});
contentContainer.add(dummyFocusElement);
}
示例6: addEventHandler
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
public static void addEventHandler(final FocusPanel handlerTarget, final EventHandlingTarget... panels) {
final DragCache storage = new DragCache();
for (final EventHandlingTarget panel : panels) {
storage.nonTouchHandlers.add(panel.addMouseOutHandler(new MouseOutHandler() {
@Override
public void onMouseOut(MouseOutEvent event) {
storage.mouseContainingPanel = null;
}
}));
storage.nonTouchHandlers.add(panel.addMouseOverHandler(new MouseOverHandler() {
@Override
public void onMouseOver(MouseOverEvent event) {
storage.mouseContainingPanel = panel;
}
}));
}
handlerTarget.addTouchStartHandler(new TouchStartHandler() {
示例7: AppMain
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
*
*/
public AppMain()
{
super();
s_instance = this;
loadAccountInfoFromPage();
HorizontalPanel hPanel = new HorizontalPanel();
hPanel.add( new Image( Icons.s_instance.takeOff32() ) );
hPanel.add( new Label( MAppBoard.s_messages.unconnected() ) );
m_pnlChannelDisconnected = new FocusPanel( hPanel );
// disconnect if leaving this page
Window.addWindowClosingHandler( this );
}
示例8: createVisualization
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
* Creates the pie chart visualization and returns it in a Widget
* @return Widget The movie collection visualized in pie chart form
*/
public Widget createVisualization() {
focusPanel = new FocusPanel();
ChartLoader chartLoader = new ChartLoader(ChartPackage.CORECHART);
chartLoader.loadApi(new Runnable() {
@Override
public void run() {
pieChart = new PieChart();
focusPanel.setWidget(pieChart);
draw();
}
});
return focusPanel;
}
示例9: createVisualization
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
* Creates a table visualization and returns it in a Widget.
* @return Widget The movie collection visualized in table form
*/
public Widget createVisualization() {
returnPanel = new FocusPanel();
ChartLoader chartLoader = new ChartLoader(ChartPackage.TABLE);
chartLoader.loadApi(new Runnable() {
@Override
public void run() {
table = new Table();
returnPanel.setWidget(table);
draw();
}
});
return returnPanel;
}
示例10: setupCell
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
private Widget setupCell(int row, int col, DirectionConstant direction) {
final FocusPanel widget = new FocusPanel();
widget.setPixelSize(BORDER_THICKNESS, BORDER_THICKNESS);
grid.setWidget(row, col, widget);
windowController.getResizeDragController().makeDraggable(widget,
direction);
grid.getCellFormatter().addStyleName(
row,
col,
CSS_DEMO_RESIZE_EDGE + " demo-resize-"
+ direction.directionLetters);
widget.addMouseDownHandler(this);
widget.addMouseUpHandler(this);
return widget;
}
示例11: testPanels
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
@Test
public void testPanels() throws Exception {
invokeAllAccessibleMethods(new AbsolutePanel() {});
invokeAllAccessibleMethods(new CellPanel() {});
invokeAllAccessibleMethods(new ComplexPanel() {});
invokeAllAccessibleMethods(new DeckLayoutPanel() {});
invokeAllAccessibleMethods(new DeckPanel() {});
invokeAllAccessibleMethods(new DecoratorPanel() {});
invokeAllAccessibleMethods(new DockLayoutPanel(Unit.PX) {});
invokeAllAccessibleMethods(new DockPanel() {});
invokeAllAccessibleMethods(new FlowPanel() {});
invokeAllAccessibleMethods(new FocusPanel() {});
invokeAllAccessibleMethods(new HorizontalPanel() {});
invokeAllAccessibleMethods(new HTMLPanel("") {});
invokeAllAccessibleMethods(new LayoutPanel() {});
invokeAllAccessibleMethods(new PopupPanel() {});
invokeAllAccessibleMethods(new RenderablePanel("") {});
invokeAllAccessibleMethods(new ResizeLayoutPanel() {});
invokeAllAccessibleMethods(new SimpleLayoutPanel() {});
invokeAllAccessibleMethods(new SimplePanel() {});
invokeAllAccessibleMethods(new SplitLayoutPanel() {});
invokeAllAccessibleMethods(new StackPanel() {});
invokeAllAccessibleMethods(new VerticalPanel() {});
}
示例12: SiteLoadingGlassPanel
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
* The basic constructor
*/
public SiteLoadingGlassPanel( final FocusPanel theMainFocusPanel ) {
//Store the main focus panel reference
this.theMainFocusPanel = theMainFocusPanel;
//Get the title manager
final UITitlesI18N titlesI18N = I18NManager.getTitles();
//Set up the component's content
final DecoratorPanel decoratedPanel = new DecoratorPanel();
decoratedPanel.setStyleName( CommonResourcesContainer.INTERNAL_ROUNDED_CORNER_PANEL_STYLE );
//Add the content to the decorated panel
final HorizontalPanel horizontalPanel = new HorizontalPanel();
horizontalPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
horizontalPanel.setStyleName( CommonResourcesContainer.INTERNAL_ROUNDED_CORNER_PANEL_CONTENT_STYLE );
//Add the loading image
horizontalPanel.add( new Image( ServerSideAccessManager.getActivityImageURL( ) ) );
//Add the spacing
horizontalPanel.add( new HTML(" ") );
//Add the communicating label
final Label loadingLabel = new Label( titlesI18N.communicatingText() );
loadingLabel.setStyleName( CommonResourcesContainer.LOADING_LABEL_STYLE );
horizontalPanel.add( loadingLabel );
//Store the content in the decorated panel
decoratedPanel.add( horizontalPanel );
//Put the stuff into the glass panel, make sure it is centered
loadingGlassPanel.insertRow( 0 );
loadingGlassPanel.insertCell( 0, 0 );
loadingGlassPanel.getCellFormatter().setAlignment( 0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE );
loadingGlassPanel.setWidget( 0, 0, decoratedPanel );
loadingGlassPanel.setVisible( false );
loadingGlassPanel.setTitle( titlesI18N.communicatingToolTipText() );
loadingGlassPanel.setStyleName( CommonResourcesContainer.SITE_LOADING_COMPONENT_GLASS_PANEL_STYLE );
//Initialize the widget
initWidget( loadingGlassPanel );
}
示例13: PriceTagWidget
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
* THe basic constructor
* @param priceStrPrefix the prefix that will be placed before the price tag
* @param priceInGoldPieces the price or the minimum price in gold pieces
* @param isMinimumPrice if true then this is the "minimum money in the wallet", otherwise it is just a price tag
* @param isEnabled indicates which mode we initialize the object in
*/
public PriceTagWidget( final String priceStrPrefix, final int priceInGoldPieces,
final boolean isMinimumPrice, final boolean isEnabled ) {
//Store the prise
this.priceInGoldPieces = priceInGoldPieces;
dataPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
dataPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
if( priceStrPrefix != null ) {
dataPanel.add( new Label( priceStrPrefix ) );
dataPanel.add( new HTML(": ") );
}
if( isMinimumPrice ) {
dataPanel.setTitle( titles.accessStartsFromNumGoldPieces( priceInGoldPieces ) );
} else {
dataPanel.setTitle( titles.priceIsNumGoldPieces( priceInGoldPieces ) );
}
dataPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
goldPieceImage.setUrl( ServerSideAccessManager.SITE_IMAGES_LOCATION + "coin.png" );
dataPanel.add( goldPieceImage );
dataPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
dataPanel.add( new HTML(" ") );
gouldPiecesPrice.setText( priceInGoldPieces+"" );
dataPanel.add( gouldPiecesPrice );
setEnabled( isEnabled );
focusPanel = new FocusPanel();
focusPanel.add( dataPanel );
isInitialized = true;
initWidget( focusPanel );
}
示例14: initAvatarPanel
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
private Widget initAvatarPanel( final int index, final PresetAvatarImages.AvatarDescriptor descriptor ){
Widget avatarWidget;
//Initialize the avatar image
final String avatarURLBase = ServerSideAccessManager.getPresetAvatarImagesBase();
Image image = new Image( avatarURLBase + descriptor.relativeURL );
image.setStyleName( CommonResourcesContainer.AVATAR_IMAGE_CHOICE_DEFAULT_STYLE );
image.setTitle( titlesI18N.clickToChooseToolTip() );
//Sort out what the avatar widget is.
if( descriptor.price > 0 ) {
//If there is a price tag then the avatar is a special object
FocusPanel focusPanel = new FocusPanel();
VerticalPanel verticalPanel = new VerticalPanel();
verticalPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
verticalPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
verticalPanel.add( image );
verticalPanel.add( new PriceTagWidget( null, descriptor.price, false, true ));
focusPanel.add( verticalPanel );
avatarWidget = focusPanel;
} else {
//If there is no price then the avatar is the image widget itself
avatarWidget = image;
}
//Add the floading style and the click handler
avatarWidget.addStyleName( CommonResourcesContainer.AVATAR_IMAGE_IN_LIST_STYLE );
((HasClickHandlers) avatarWidget).addClickHandler( new ClickHandler() {
public void onClick(ClickEvent e) {
if( isChooseEnabled ) {
//Initiate the avatar selection, do the RPC call
doChooseAvatarServerCall( index );
}
//Just in case stop the event here
e.preventDefault(); e.stopPropagation();
}
});
return (Widget) avatarWidget;
}
示例15: setReplyMessageClickHandler
import com.google.gwt.user.client.ui.FocusPanel; //導入依賴的package包/類
/**
* Allows to set the reply message click handler. This method only works if the
* class constructor had the isWithFocusPanel parameter set to true.
* @param clickToReplyHandler the click handler
*/
public void setReplyMessageClickHandler( final ClickHandler clickToReplyHandler ) {
if( clickToReplyHandler != null && messageContentPanel instanceof FocusPanel ) {
messageContentPanel.setTitle( I18NManager.getTitles().clickHereToReplyToTheMessage() );
clickHandlerRegistration = ( (FocusPanel) messageContentPanel ).addClickHandler( clickToReplyHandler );
messageContentPanel.addStyleName( CommonResourcesContainer.CLICKABLE_PANEL_STYLE );
}
}