當前位置: 首頁>>代碼示例>>Java>>正文


Java FocusPanel.addClickHandler方法代碼示例

本文整理匯總了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;
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:43,代碼來源:ChatMessageBaseUI.java

示例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;

}
 
開發者ID:lsst,項目名稱:firefly,代碼行數:11,代碼來源:DownloadGroupPanel.java

示例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);
}
 
開發者ID:lsst,項目名稱:firefly,代碼行數:10,代碼來源:GwtUtil.java

示例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 );
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:55,代碼來源:NavigationButtonPanel.java

示例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;
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:61,代碼來源:ChatMessageBaseUI.java


注:本文中的com.google.gwt.user.client.ui.FocusPanel.addClickHandler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。