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


Java Image.setStylePrimaryName方法代碼示例

本文整理匯總了Java中com.google.gwt.user.client.ui.Image.setStylePrimaryName方法的典型用法代碼示例。如果您正苦於以下問題:Java Image.setStylePrimaryName方法的具體用法?Java Image.setStylePrimaryName怎麽用?Java Image.setStylePrimaryName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.user.client.ui.Image的用法示例。


在下文中一共展示了Image.setStylePrimaryName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SimplePaletteItem

import com.google.gwt.user.client.ui.Image; //導入方法依賴的package包/類
/**
 * Creates a new palette item.
 *
 * @param scd component descriptor for palette item
 * @param dropTargetProvider provider of targets that palette items can be dropped on
 */
public SimplePaletteItem(SimpleComponentDescriptor scd, DropTargetProvider dropTargetProvider) {
  this.dropTargetProvider = dropTargetProvider;
  this.scd = scd;

  componentPrototype = null;

  // Initialize palette item UI
  HorizontalPanel panel = new HorizontalPanel();
  panel.setStylePrimaryName("ode-SimplePaletteItem");

  Image image = scd.getImage();
  image.setStylePrimaryName("ode-SimplePaletteItem-icon");
  panel.add(image);
  panel.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_LEFT);
  panel.setCellWidth(image, "30px");

  Label label = new Label(ComponentsTranslation.getComponentName(scd.getName()));
  label.setHorizontalAlignment(Label.ALIGN_LEFT);
  label.addStyleName("ode-SimplePaletteItem-caption");
  panel.add(label);

  HorizontalPanel optPanel = new HorizontalPanel();

  ComponentHelpWidget helpImage = new ComponentHelpWidget(scd);
  helpImage.addStyleName("ode-SimplePalleteItem-button");
  optPanel.add(helpImage);
  optPanel.setCellHorizontalAlignment(helpImage, HorizontalPanel.ALIGN_LEFT);

  if (scd.getExternal()) {
    ComponentRemoveWidget deleteImage = new ComponentRemoveWidget(scd);
    deleteImage.addStyleName("ode-SimplePalleteItem-button");
    optPanel.add(deleteImage);
    optPanel.setCellHorizontalAlignment(deleteImage, HorizontalPanel.ALIGN_RIGHT);
  }

  panel.add(optPanel);
  panel.setCellHorizontalAlignment(optPanel, HorizontalPanel.ALIGN_RIGHT);

  panel.setWidth("100%");
  add(panel);
  setWidth("100%");

  addHandlers();
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:51,代碼來源:SimplePaletteItem.java

示例2: addRowToTable

import com.google.gwt.user.client.ui.Image; //導入方法依賴的package包/類
@Override
@SuppressWarnings("unchecked")
protected void addRowToTable(int row, int index, Object result) {
	//The column index
	int column = 0;
	
	//Convert the object data
	OnePageViewData<ShortUserData> data = (OnePageViewData<ShortUserData>) result;
	final ShortUserData shortUserData = data.entries.get( index );

	//Set the index of the entry
	int userNumber = ( ( getCurrentPageNumber() - 1 ) * NUMBER_OF_ROWS_PER_PAGE) + ( index + 1);
	dataTable.setWidget( row, column++, new Label( Integer.toString( userNumber ) ) );
	
	//Add the check box into the rom/column, it should mark the 
	//data entry (short user data) with the given ID and name. 
	if( doNeedSelectColumn ) {
		addSelectorIntoDataTableRow(row, column++, index, new Integer(shortUserData.getUID()), shortUserData.getUserLoginName());
	}

	//Add the gender column
	final String genderURL, genderTipStr;
	if( shortUserData.isMale() ) {
		genderURL = ServerSideAccessManager.getUserMaleGenderImageURL();
		genderTipStr = titlesI18N.genderMaleValue();
	} else {
		genderURL = ServerSideAccessManager.getUserFemaleGenderImageURL();
		genderTipStr = titlesI18N.genderFemaleValue();
	}
	Image genderImage = new Image(genderURL);
	genderImage.setTitle( genderTipStr );
	genderImage.setStylePrimaryName( CommonResourcesContainer.USER_SEARCH_DIALOG_STATUS_IMAGE_STYLE_NAME );
	dataTable.setWidget( row, column++, genderImage );
	
	//Add the online/offline status column
	final String statusURL, statusTipStr;
	if( shortUserData.isOnline() ) {
		statusURL = ServerSideAccessManager.getUserOnlineStatusImageURL();
		statusTipStr = titlesI18N.userOnlineStatus();
	} else {
		statusURL = ServerSideAccessManager.getUserOfflineStatusImageURL();
		statusTipStr = titlesI18N.userOfflineStatus();
	}
	Image statusImage = new Image(statusURL);
	statusImage.setTitle( statusTipStr );
	statusImage.setStylePrimaryName( CommonResourcesContainer.USER_SEARCH_DIALOG_STATUS_IMAGE_STYLE_NAME );
	dataTable.setWidget( row, column++, statusImage );
	
	//Add the last online column value
	Label lastOnlineDataLabel = new Label();
	if( shortUserData.isOnline() ) {
		lastOnlineDataLabel.setText( titlesI18N.userOnlineStatus() );
	} else {
		setDateLabelValue( lastOnlineDataLabel, shortUserData.getUserLastOnlineDate() );
	}
	lastOnlineDataLabel.setStyleName( CommonResourcesContainer.CONST_FIELD_VALUE_DEFAULT_STYLE_NAME );
	dataTable.setWidget( row, column++, lastOnlineDataLabel );
	
	//Set the user name/link here, depending o whether we browse by and admin or not we open different dialogs
	Label userNameLink = new Label( shortUserData.getUserLoginName() );
	userNameLink.setStyleName( CommonResourcesContainer.DIALOG_LINK_BLUE_STYLE );
	userNameLink.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent e){
			//Ensure lazy loading
			final SplitLoad executor = new SplitLoad( true ) {
				@Override
				public void execute() {
					//Show the user profile
					ViewUserProfileDialogUI userProfile = new ViewUserProfileDialogUI( shortUserData.getUID(),
																						shortUserData.getUserLoginName(),
																						thisDialog, false );
					userProfile.show();
					userProfile.center();
				}
			};
			executor.loadAndExecute();
		}
	});
	dataTable.setWidget( row, column++, userNameLink );
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:81,代碼來源:UserSearchDialog.java


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