本文整理汇总了Java中com.google.gwt.user.client.ui.FocusPanel.addClickHandler方法的典型用法代码示例。如果您正苦于以下问题:Java FocusPanel.addClickHandler方法的具体用法?Java FocusPanel.addClickHandler怎么用?Java FocusPanel.addClickHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.FocusPanel
的用法示例。
在下文中一共展示了FocusPanel.addClickHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChatFileThumbnail
import com.google.gwt.user.client.ui.FocusPanel; //导入方法依赖的package包/类
/**
* Allows to create the file thumbnail with the click listener
* @param thumbnailURL the url to the thumbnail of the image
* @param originalURL the url of the original image if the chat-message file is an image given by its URL
* @param the id of the room this file came from, is needed if the fileDesc is not null
* @param fileDesc the chat-message file descriptor or null if we want to show an image given by its URL
*/
protected static FocusPanel createChatFileThumbnail( final String thumbnailURL, final String originalURL, final int roomID, final ShortFileDescriptor fileDesc ) {
FocusPanel actionImageOpenPanel = new FocusPanel();
actionImageOpenPanel.addStyleName( CommonResourcesContainer.ATTACHED_USER_IMAGE_THUMBNAIL_STYLE );
actionImageOpenPanel.addStyleName( CommonResourcesContainer.ZOOME_IN_IMAGE_STYLE );
actionImageOpenPanel.setTitle( i18nTitles.clickToViewToolTip() );
actionImageOpenPanel.addClickHandler( new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
//Ensure lazy loading
(new SplitLoad( true ) {
@Override
public void execute() {
//Open the file view dialog
DialogBox dialog;
if( originalURL != null ) {
dialog = new ViewStaticImageDialogUI( i18nTitles.chatMessageFileViewDialogTitle( ), originalURL, null );
} else {
dialog = new ViewChatMediaFileDialogUI( roomID, fileDesc, true, null );
}
dialog.show();
dialog.center();
}
}).loadAndExecute();
//Stop the event from being propagated
event.stopPropagation();
}
});
Image imageThumbStyled = new Image( thumbnailURL );
final String imageThumbString = imageThumbStyled.getElement().getString();
actionImageOpenPanel.getElement().setInnerHTML( imageThumbString + "<span>" + imageThumbString+ "</span>");
return actionImageOpenPanel;
}
示例2: makeAbortButton
import com.google.gwt.user.client.ui.FocusPanel; //导入方法依赖的package包/类
private FocusPanel makeAbortButton() {
FocusPanel fp= new FocusPanel();
Image image= new Image(GWT.getModuleBaseURL()+ "images/stop.gif");
image.setPixelSize(15,15);
fp.setWidget(image);
fp.addClickHandler(new AbortHandler());
fp.setTitle(ABORT_TIP);
return fp;
}
示例3: ImageButton
import com.google.gwt.user.client.ui.FocusPanel; //导入方法依赖的package包/类
public ImageButton(Image image, String tip, ClickHandler handler) {
fp = new FocusPanel();
this.image = image;
image.setTitle(tip);
image.addStyleName("imageTypeButton");
fp.setWidget(image);
if (handler != null) fp.addClickHandler(handler);
initWidget(fp);
}
示例4: NavigationButtonPanel
import com.google.gwt.user.client.ui.FocusPanel; //导入方法依赖的package包/类
/**
* The basic constructor
* @param buttom_type defines the type of the button NAV_LEFT_IMG_BUTTON, ...
* @param isEnabled if true then the button is enabled, if false then it is disabled. That is based on the current page index
* @param isActive if true then the button is active, if it is enabled, otherwise not
* @param isHideOnDisabled if true then we hide the button if it is disabled
* @param extraLeftButtonStyle the additional left-button style or null
* @param extraRightButtonStyle the additional right-button style or null
* @param extraTopButtonStyle the additional top-button style or null
* @param extraBottomButtonStyle the additional bottom-button style or null
*/
public NavigationButtonPanel( final int buttom_type, final boolean isEnabled, final boolean isActive,
final boolean isHideOnDisabled, final String extraLeftButtonStyle,
final String extraRightButtonStyle, final String extraTopButtonStyle,
final String extraBottomButtonStyle ) {
//Set/Store the button type;
this.buttom_type = buttom_type;
this.isNext = ( buttom_type == CommonResourcesContainer.NAV_RIGHT_IMG_BUTTON ) || ( buttom_type == CommonResourcesContainer.NAV_BOTTOM_IMG_BUTTON );
this.isHideOnDisabled = isHideOnDisabled;
this.extraLeftButtonStyle = extraLeftButtonStyle;
this.extraRightButtonStyle = extraRightButtonStyle;
this.extraTopButtonStyle = extraTopButtonStyle;
this.extraBottomButtonStyle = extraBottomButtonStyle;
//Add the click listener
buttonPanel = new FocusPanel();
buttonPanel.addClickHandler( new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if( NavigationButtonPanel.this.isEnabled &&
NavigationButtonPanel.this.isActive ) {
//Disable the event, just in case
event.stopPropagation();
event.preventDefault();
//Navigate to the page
moveToPage( isNext );
}
}
} );
//Complete the widget creation
try{
initializeNavigationButtonContent( );
} catch (Exception e) {
//There is nothing we can really do about it
}
//Set the enabled and active statuses
setAllowed( isEnabled );
setEnabled( isActive );
//Initialize the composite
initWidget( buttonPanel );
}
示例5: addMessageTitlePanel
import com.google.gwt.user.client.ui.FocusPanel; //导入方法依赖的package包/类
/**
* Adds the panel containing the message title, stores the message sending date
* @param date the date we take
* @param the chat message type: Simple message/Private message/Error message/Info message
* @param isUserMsg true if this is a message sent by a real user
* @param message the user message in case isUserMsg is true otherwise null
* @return the chat message title panel
*/
public FocusPanel addMessageTitlePanel( final Date date, final String messageType,
final boolean isUserMsg, final ChatMessage message ) {
final FocusPanel titleFocusPanel = new FocusPanel();
final FlowPanel messageTitleContent = new FlowPanel();
messageTitleContent.addStyleName( CommonResourcesContainer.FORCE_INLINE_DISPLAY_STYLE );
titleFocusPanel.add( messageTitleContent );
//Store the message sending date
sentDate = date;
//Allow to minimize the message only if it is a user message
if( isUserMsg ){
//Make the message title clickable
titleFocusPanel.addStyleName( CommonResourcesContainer.CLICKABLE_PANEL_STYLE );
titleFocusPanel.setTitle( i18nTitles.clickMessageTitleToShowHideMessageContentToolTip() );
titleFocusPanel.addClickHandler( new ClickHandler(){
List<Widget> storedMessageContent = null;
@Override
public void onClick(ClickEvent event) {
if( isMessageMinimized ) {
//Restore the message content
cleanAndRestoreMessageContent( titlePanel, storedMessageContent );
} else {
//Retrieve the message content
storedMessageContent = saveAndCleanMessageContent( titlePanel );
//Add the minimized message text
addContentText( i18nTitles.clickMessageTitleToShowTheMessage() );
}
isMessageMinimized = !isMessageMinimized;
//Prevent the event propagation and its default action
event.preventDefault();
event.stopPropagation();
}});
}
final DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_MEDIUM );
messageTitleContent.add( getInlineDisplayLabel( "[" + dateTimeFormat.format( date ) +
(messageType.trim().isEmpty()? "": ", " ) + messageType) );
//If this is a user message and all data is available then we add the "from ..." section
if( isUserMsg && ( message != null ) && visibleUsers != null ) {
ShortUserData userData = visibleUsers.get( message.senderID );
if( userData != null ) {
messageTitleContent.add( getInlineDisplayLabel( " " + i18nTitles.chatMessageFromTextTitle()+" " ) );
messageTitleContent.add( getUserLinkLabel( ShortUserData.UNKNOWN_UID, null, userData, roomID, false, true ) );
}
}
messageTitleContent.add( getInlineDisplayLabel( "]" ) );
titleFocusPanel.addStyleName( CommonResourcesContainer.CHAT_MESSAGE_TITLE_STYLE );
//Add the message title panel widget
addMessageTitleContentWidget( titleFocusPanel );
return titleFocusPanel;
}