本文整理汇总了Java中com.google.gwt.user.client.ui.FocusPanel.add方法的典型用法代码示例。如果您正苦于以下问题:Java FocusPanel.add方法的具体用法?Java FocusPanel.add怎么用?Java FocusPanel.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.FocusPanel
的用法示例。
在下文中一共展示了FocusPanel.add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 );
}
示例2: 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;
}
示例3: populateTitlePanel
import com.google.gwt.user.client.ui.FocusPanel; //导入方法依赖的package包/类
private void populateTitlePanel() {
//Add the avatar panel to the message if needed
final boolean isAvatarPanelNeeded = isAvatarTitlePanelNeeded();
if( isAvatarPanelNeeded ) {
//Add the sub-panel with the avatar
VerticalPanel avatarTitlePanel = new VerticalPanel();
avatarTitlePanel.setWidth("100%");
avatarTitlePanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
avatarTitlePanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
avatarTitlePanel.addStyleName( CommonResourcesContainer.MESSAGE_AVATAR_TITLE_PANEL_STYLE );
//Populate the panel, store the link to the avatar, if needed
userAvatar = populateAvatarTitlePanel( avatarTitlePanel, messageData.senderData );
//Put it into the message
titlePanelTable.setWidget(0, 0, avatarTitlePanel );
titlePanelTable.getCellFormatter().addStyleName(0, 0, CommonResourcesContainer.FORUM_MESSAGE_SUBJECT_DELIM_PANEL_STYLE );
}
//Add the subpanel with the title and other message info
VerticalPanel titleVertPanel = new VerticalPanel();
titleVertPanel.setHeight("100%");
//In case of the avatar panel NOT needed this is the first cell in the row, otherwise it is the second cell
titlePanelTable.setWidget(0, ( isAvatarPanelNeeded ? 1 : 0 ), titleVertPanel );
titleVertPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_TOP );
titleVertPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_LEFT );
final Label messageSubjectField = new Label( getMessageSubjectFieldName() + ":" );
messageSubjectField.setWordWrap( false );
MessageTextToFlowPanel.addContentWidget( messageSubjectContent, messageSubjectField, true );
final List<Widget> messageWidgets = SmileyHandlerUI.getMessageViewObject( messageData.messageTitle,
ChatMessage.MAX_ONE_WORD_LENGTH, false );
for( Widget w : messageWidgets ) {
MessageTextToFlowPanel.addContentWidget( messageSubjectContent, w, true );
}
//Set the proper styles to the field and value labels
setMessageSubjectFieldValueStyles( messageSubjectField, messageSubjectContent );
titleVertPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_TOP );
titleVertPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_MIDDLE );
//Add message title clicking capability, if needed
if( isMsgTitleClickable ) {
//THe clickable version allows to view the forum message replies
messageSubjectClickPanel = new FocusPanel();
messageSubjectClickPanel.setTitle( getViewForumMessageRepliesLinkText() );
messageSubjectClickPanel.addStyleName( CommonResourcesContainer.FORUM_MESSAGE_TITLE_STYLE );
messageSubjectClickPanel.add( messageSubjectContent );
titleVertPanel.add( messageSubjectClickPanel );
} else {
messageSubjectContent.addStyleName( CommonResourcesContainer.FORUM_MESSAGE_TITLE_STYLE );
titleVertPanel.add( messageSubjectContent );
}
lastSenderProfileLink = populateMessageTitleLastReplyInfoPanel( titleInfoLastRepPanel );
titleVertPanel.add( titleInfoLastRepPanel );
//Add the message title info
if( SiteManager.isAdministrator() ) {
//if the user is an administrator, then he is allowed to see the message id of all messages
addNewFieldValuePair( titleInfoPanel, i18nTitles.forumMessageID(), messageData.messageID + "", true );
}
populateMessageTitleInfoPanel( titleInfoPanel );
titleVertPanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
titleVertPanel.add( titleInfoPanel );
//Complete the title panel
mainVerticalPanel.add( titlePanelTable );
//Add the delimiter panel
SimplePanel delimiterPanel = new SimplePanel();
delimiterPanel.setStyleName( CommonResourcesContainer.FORUM_MESSAGE_TITLE_DELIMITER_PANEL_STYLE );
mainVerticalPanel.add( delimiterPanel );
}
示例4: UserAvatarImageWidget
import com.google.gwt.user.client.ui.FocusPanel; //导入方法依赖的package包/类
/**
* The basic constructor
*/
public UserAvatarImageWidget() {
//The simple panel here is needed for stupid Opera and later I started using if for the mouse move listeners
FocusPanel panel = new FocusPanel();
panel.add( vpanel );
panel.addMouseOverHandler( this );
panel.addMouseOutHandler( this );
//Initialize the action images
String actionImageUrlEnbl = CommonResourcesContainer.USER_AVATAR_CONTROL_IMAGES_LOCATION_PREFIX + PRANK_ACTION_IMAGE_NAME + ACTION_IMAGE_EXT;
prankActionPanel = new ActionLinkPanel( actionImageUrlEnbl, i18nTitles.clickToPrankTheUserToolTip(),
ServerSideAccessManager.getActivityImageURL( ), "", null, new ClickHandler() {
@Override
public void onClick( ClickEvent event) {
//Ensure lazy loading
( new SplitLoad( true ) {
@Override
public void execute() {
//Open the prank selection dialog
AvatarPrankSelectionDialogUI dialog = new AvatarPrankSelectionDialogUI( UserAvatarImageWidget.this, userID, isMale );
dialog.show();
dialog.center();
//Hide the controls
activateControls( false, false );
}
}).loadAndExecute();
//Stop the event from being propagated
event.stopPropagation(); event.preventDefault();
}
}, false, true );
prankActionPanel.addStyleName( CommonResourcesContainer.USER_AVATAR_PRANK_ACTION_PANEL_STYLE );
actionImageUrlEnbl = CommonResourcesContainer.USER_AVATAR_CONTROL_IMAGES_LOCATION_PREFIX + CLEAR_ACTION_IMAGE_NAME + ACTION_IMAGE_EXT;
clearActionPanel = new ActionLinkPanel( actionImageUrlEnbl, i18nTitles.clickToClearThePrankToolTip(),
ServerSideAccessManager.getActivityImageURL( ), "", null, new ClickHandler() {
@Override
public void onClick( ClickEvent event) {
//Ensure lazy loading
( new SplitLoad( true ) {
@Override
public void execute() {
//Open the confirmation dialog
final int price = AvatarSpoilersHelper.getSpoilerPrice( spoilerID );
CleanPrankQuestionDialogUI dialog = UserAvatarImageWidget.this.new CleanPrankQuestionDialogUI( price );
dialog.show();
dialog.center();
}
}).loadAndExecute();
//Stop the event from being propagated
event.stopPropagation(); event.preventDefault();
}
}, false, true );
clearActionPanel.addStyleName( CommonResourcesContainer.USER_AVATAR_NOPRANK_ACTION_PANEL_STYLE );
//Hide the action buttons
prankActionPanel.setVisible(false);
clearActionPanel.setVisible(false);
//Initialize the widget to be a vertical panel
panel.setStyleName( CommonResourcesContainer.AVATAR_IMAGE_WIDGET_STYLE );
initWidget( panel );
}
示例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;
}
示例6: AlertWidget
import com.google.gwt.user.client.ui.FocusPanel; //导入方法依赖的package包/类
public AlertWidget(AlertBean alert) {
VerticalPanel rootPanel = new VerticalPanel();
FocusPanel headerPanel = new FocusPanel();
rootPanel.add(headerPanel);
headerPanel.addStyleName("alert-header");
HorizontalPanel titleAndButtonPanel = new HorizontalPanel();
headerPanel.add(titleAndButtonPanel);
Label icon = new Label("");
icon.addStyleName(alert.getLevel() == AlertBean.LEVEL_INFO ? "info-icon"
: "warn-icon");
titleAndButtonPanel.add(icon);
Label alertTitle = new Label(alert.getTitle());
alertTitle.addStyleName("alert-title");
titleAndButtonPanel.add(alertTitle);
final SimplePanel collapsibleOuterPanel = new SimplePanel();
rootPanel.add(collapsibleOuterPanel);
collapsibleOuterPanel.addStyleName("alert-details-outer");
VerticalPanel collapsibleInnerPanel = new VerticalPanel();
collapsibleOuterPanel.add(collapsibleInnerPanel);
collapsibleInnerPanel.addStyleName("alert-details-inner");
if (DISPLAY_ALERT_DATE && alert.isPublishActiveRange()
&& (alert.getFrom() != null || alert.getTo() != null)) {
Label dateRangeLabel = new Label(
formatDateRange(alert.getFrom(), alert.getTo()));
collapsibleInnerPanel.add(dateRangeLabel);
dateRangeLabel.addStyleName("alert-datetime");
}
Label descriptionLabel = new Label(alert.getDescription());
collapsibleInnerPanel.add(descriptionLabel);
descriptionLabel.addStyleName("alert-description");
if (alert.getUrl() != null && alert.getUrl().length() > 0) {
final String url = alert.getUrl();
Anchor moreInfoAnchor = new Anchor(I18nUtils.tr("more.info.alert"));
moreInfoAnchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.open(url, "_blank", "");
}
});
moreInfoAnchor.addStyleName("alert-url");
collapsibleInnerPanel.add(moreInfoAnchor);
}
initWidget(rootPanel);
}
示例7: init
import com.google.gwt.user.client.ui.FocusPanel; //导入方法依赖的package包/类
private void init()
{
if( m_initialized ) return;
m_focusPanel = new FocusPanel();
m_innerContainer = new AbsolutePanel();
m_dialog = new Dialog(m_clickMngr, 512, 256, new Dialog.I_Delegate()
{
@Override
public void onOkPressed()
{
//--- DRK > TODO: Hopefully in future I'll have a better overridable action set up,
//--- so that I only have to call State_GenericDialog.Ok, and the system knows
//--- to call State_AsyncDialog.Ok because it is State_AsyncDialog that is foregrounded.
//--- Until then, I present the following somewhat sloppy workaround.
if( m_stateContext.perform(State_GenericDialog.Ok.class) )
{
}
else if( m_stateContext.perform(State_AsyncDialog.Ok.class) )
{
}
}
});
m_dialogGlass = new FlowPanel();
m_dialogContainer = new HorizontalPanel();
m_focusPanel.getElement().getStyle().setPosition(Position.ABSOLUTE);
m_focusPanel.getElement().getStyle().setTop(0, Unit.PX);
m_focusPanel.getElement().getStyle().setLeft(0, Unit.PX);
m_focusPanel.setSize("100%", "100%");
m_innerContainer.setSize("100%", "100%");
m_dialogGlass.addStyleName("sm_dialog_glass");
m_dialogContainer.addStyleName("sm_dialog_container");
E_ZIndex.DIALOG_GLASS.assignTo(m_dialogGlass);
E_ZIndex.DIALOG.assignTo(m_dialogContainer);
m_focusPanel.add(m_innerContainer);
m_innerContainer.add(m_dialogGlass);
m_innerContainer.add(m_dialogContainer);
m_focusPanel.addKeyUpHandler(new KeyUpHandler()
{
@Override
public void onKeyUp(KeyUpEvent event)
{
m_dialog.onKeyPressed(event.getNativeKeyCode());
event.preventDefault();
}
});
}