当前位置: 首页>>代码示例>>Java>>正文


Java PredefinedFormat类代码示例

本文整理汇总了Java中com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat的典型用法代码示例。如果您正苦于以下问题:Java PredefinedFormat类的具体用法?Java PredefinedFormat怎么用?Java PredefinedFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PredefinedFormat类属于com.google.gwt.i18n.client.DateTimeFormat包,在下文中一共展示了PredefinedFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addNewFieldValuePair

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
protected void addNewFieldValuePair( final FlowPanel content, final String fieldName,
		   						   final Date dateValue, final boolean addEndCommaDelimiter ) {
	final Label fieldLabel = new Label( fieldName );
	fieldLabel.setStyleName( CommonResourcesContainer.USER_DIALOG_REGULAR_FIELD_STYLE );
	final DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_SHORT );
	final Label dateTimeLabel = new Label( dateTimeFormat.format( dateValue ) );
	dateTimeLabel.setStyleName( CommonResourcesContainer.CONST_FIELD_VALUE_DEFAULT_STYLE_NAME );
	final int width = ( dateTimeLabel.getOffsetWidth() == 0 ? DEFAULT_PROGRESS_BAR_WIDTH_PIXELS : dateTimeLabel.getOffsetWidth() );
	DateOldProgressBarUI progressBarUI= new DateOldProgressBarUI( width, DEFAULT_PROGRESS_BAR_HEIGHT_PIXELS, dateValue );
	
	//If there are replies to this message
	VerticalPanel dateTimePanel = new VerticalPanel();
	dateTimePanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
	dateTimePanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
	dateTimePanel.add( dateTimeLabel );
	dateTimePanel.add( progressBarUI );
	
	//Add the widgets to the panel
	addNewFieldValuePair( content, fieldLabel, dateTimePanel, addEndCommaDelimiter );
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:21,代码来源:ForumMessageWidget.java

示例2: processResult

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
@Override
public void processResult(String result) {
    JSONArray array = controller.parseJSON(result).isArray();
    if (array != null) {
        String timeStamp = DateTimeFormat.getFormat(PredefinedFormat.HOUR24_MINUTE)
                                         .format(new Date(System.currentTimeMillis()));
        addRow();

        loadTable.setValue(loadTable.getNumberOfRows() - 1, 0, timeStamp);

        // getting primitive values of all attributes
        for (int i = 0; i < attrs.length; i++) {
            double value = array.get(i).isObject().get("value").isNumber().doubleValue();
            loadTable.setValue(loadTable.getNumberOfRows() - 1, i + 1, formatValue(value));
        }

        loadChart.draw(loadTable, loadOpts);
    }
}
 
开发者ID:ow2-proactive,项目名称:scheduling-portal,代码行数:20,代码来源:MemoryLineChart.java

示例3: processResult

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
@Override
public void processResult(String result) {
    JSONValue json = controller.parseJSON(result);
    JSONArray array = json.isArray();

    if (array != null) {
        String timeStamp = DateTimeFormat.getFormat(PredefinedFormat.HOUR24_MINUTE)
                                         .format(new Date(System.currentTimeMillis()));
        addRow();

        loadTable.setValue(loadTable.getNumberOfRows() - 1, 0, timeStamp);

        // getting primitive values of all attributes
        for (int i = 0; i < attrs.length; i++) {
            double value = array.get(i).isObject().get("value").isNumber().doubleValue();
            loadTable.setValue(loadTable.getNumberOfRows() - 1, i + 1, value);
        }

        loadChart.draw(loadTable, loadOpts);
    }
}
 
开发者ID:ow2-proactive,项目名称:scheduling-portal,代码行数:22,代码来源:MBeanTimeAreaChart.java

示例4: getParameterValue

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
private Object getParameterValue(Record record, ValueType valueType, DisplayType displayType) {
    Object val = record.getAttributeAsObject(WorkflowParameterDataSource.FIELD_VALUE);
    if (valueType == ValueType.DATETIME && val instanceof String) {
        DateTimeFormat format = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601);
        val = format.parse((String) val);
    } else if (displayType == DisplayType.CHECKBOX && val instanceof String) {
        if (Boolean.TRUE.toString().equalsIgnoreCase((String) val)) {
            val = true;
        } else if (Boolean.FALSE.toString().equalsIgnoreCase((String) val)) {
            val = false;
        } else {
            try {
                val = new BigDecimal((String) val).compareTo(BigDecimal.ZERO) > 0;
            } catch (NumberFormatException e) {
                // ignore
            }
        }
    } else if (displayType == DisplayType.CHECKBOX && val instanceof Number) {
        val = ((Number) val).doubleValue() > 0;
    }
    return val;
}
 
开发者ID:proarc,项目名称:proarc,代码行数:23,代码来源:WorkflowTaskFormView.java

示例5: resolveRecordValues

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
/**
     * Replace string values of record attributes with types declared by item children.
     * This is necessary as declarative forms do not use DataSource stuff.
     * @param record record to scan for attributes
     * @param item item with possible profile
     * @return resolved record
     */
    private static Record resolveRecordValues(Record record, FormItem item) {
        Field f = getProfile(item);
        if (f != null) {
            for (Field field : f.getFields()) {
                String fType = field.getType();
                if ("date".equals(fType) || "datetime".equals(fType)) {
                    // parses ISO dateTime to Date; otherwise DateItem cannot recognize the value!
                    Object value = record.getAttributeAsObject(field.getName());
                    if (!(value instanceof String)) {
                        continue;
                    }
                    String sd = (String) value;
//                    ClientUtils.severe(LOG, "name: %s, is date, %s", field.getName(), sd);
//                    Date d = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).parse("1994-11-05T13:15:30Z");
                    try {
                        Date d = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601).parse(sd);
                        record.setAttribute(field.getName(), d);
                    } catch (IllegalArgumentException ex) {
                        LOG.log(Level.WARNING, sd, ex);
                    }
                }
            }
        }
        return record;
    }
 
开发者ID:proarc,项目名称:proarc,代码行数:33,代码来源:RepeatableFormItem.java

示例6: EmbeddedHistoryItemView

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
public EmbeddedHistoryItemView(ApiRequest request) {
  initWidget();

  this.request = request;

  // Stash the real URL in case we need it for loading media
  realPathFragment = request.getRequestPath();

  // Replace the API key with a fake version if the default was used
  if (ExplorerConfig.API_KEY.equals(request.getApiKey())) {
    request.setApiKey("{YOUR_API_KEY}");
  }

  String prefix = request.getMethod().getId() + " executed ";
  PrettyDate.keepMakingPretty(new Date(), prefix, title);

  String dateString =
      DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_SHORT).format(new Date());
  title.setTitle(dateString);

  requestDiv.setInnerText(getRequestString(request));
}
 
开发者ID:showlowtech,项目名称:google-apis-explorer,代码行数:23,代码来源:EmbeddedHistoryItemView.java

示例7: setData

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
@Override
public void setData(AssetCommand asset) {
    m_asset = asset;

    nodeInfoLabel.setText(asset.getNodeLabel() + " " + con.nodeIdLabel() + " " + asset.getNodeId());
    nodeInfoLink.setHref("element/node.jsp?node=" + asset.getNodeId());
    nodeInfoLink.setHTML(con.nodeInfoLink());
    setDataSNMP(m_asset);
    setDataConfigCategories(m_asset);
    setDataIdentification(m_asset);
    setDataLocation(m_asset);
    setDataVendor(m_asset);
    setDataAuthentication(m_asset);
    setDataHardware(m_asset);
    setDataComments(m_asset);
    setDataVmware(m_asset);
    DateTimeFormat m_formater = DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM);
    lastModified.setText(con.lastModified() + " " + m_formater.format(asset.getLastModifiedDate()) + " | "
            + asset.getLastModifiedBy());
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:21,代码来源:AssetNodePageImpl.java

示例8: getDatesInRange

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static List<String> getDatesInRange(String startDateTimeStr, String endDateTimeStr) {
    DateTimeFormat parser = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601);

    Date startDate = parser.parse(startDateTimeStr);
    Date endDate = parser.parse(endDateTimeStr);
    startDate.setHours(0);
    startDate.setMinutes(0);
    startDate.setSeconds(0);

    endDate.setDate(endDate.getDate()+1);
    endDate.setHours(0);
    endDate.setMinutes(0);
    endDate.setSeconds(0);

    List<String> dates = new ArrayList<String>();
    while (startDate.getTime() < endDate.getTime()) {
        dates.add(DATE_FORMAT.format(startDate));
        startDate.setDate(startDate.getDate() + 1);
    }
    return dates;
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:23,代码来源:TimeSelector.java

示例9: setData

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
@Override
public void setData(AssetCommand asset) {
	m_asset = asset;
	
	nodeInfoLabel.setText(asset.getNodeLabel() + " " + con.nodeIdLabel() + " " + asset.getNodeId());
	nodeInfoLink.setHref("element/node.jsp?node=" + asset.getNodeId());
	nodeInfoLink.setHTML(con.nodeInfoLink());
	setDataSNMP(m_asset);
	setDataConfigCategories(m_asset);
	setDataIdentification(m_asset);
	setDataLocation(m_asset);
	setDataVendor(m_asset);
	setDataAuthentication(m_asset);
	setDataHardware(m_asset);
	setDataComments(m_asset);
	DateTimeFormat m_formater = DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM);
	lastModified.setText(con.lastModified() + " " + m_formater.format(asset.getLastModifiedDate()) + " | "
			+ asset.getLastModifiedBy());
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:20,代码来源:AssetNodePageImpl.java

示例10: parseExtended

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
/**
 * Parse string date in format "YYYY-MM-DDThh:mm:ss.SSSTZD"
 */
public static Date parseExtended(String value) {
	if (value == null) {
		return null;
	} else {
		DateTimeFormat dtf = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601);
		return dtf.parse(value);
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:12,代码来源:ISO8601.java

示例11: formatExtended

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
/**
 * Format date with format "YYYY-MM-DDThh:mm:ss.SSSTZD"
 */
public static String formatExtended(Date value) {
	if (value == null) {
		return null;
	} else {
		DateTimeFormat dtf = DateTimeFormat.getFormat(PredefinedFormat.ISO_8601);
		return dtf.format(value);
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:12,代码来源:ISO8601.java

示例12: Top10UserFileWidget

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
/**
 * The basic constructor
 * @param parentDialog the reference to the parent dialog or null if none
 * @param fileDescriptors the list of the users' profile files to browse through 
 * @param fileIndex the index of the file we create this preview widget for
 */
public Top10UserFileWidget( final DialogBox parentDialog, final List<ShortUserFileDescriptor> fileDescriptors, final int fileIndex ) {
	//Store the data
	this.parentDialog = parentDialog;
	this.fileDescr = fileDescriptors.get( fileIndex );
	
	//Initialize and fill out the main panel
	mainPanel = new VerticalPanel();
	mainPanel.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );
	
	//Initialize the image 
	previewImage = constructThumbnailImage( fileDescriptors, fileIndex );
	
	//Initialize the upload date panel
	final HorizontalPanel uploadDatePanel = new HorizontalPanel();
	uploadDatePanel.setVerticalAlignment( HasVerticalAlignment.ALIGN_BOTTOM );
	//Add the image
	uploadDatePanel.add( new Image( ServerSideAccessManager.USER_INFO_RELATED_IMAGES_LOCATION +
			  			 ServerSideAccessManager.SERVER_CONTEXT_DELIMITER + "uploaded.png" ) );
	uploadDatePanel.add( new HTML("&nbsp;") );
	//Add the date label
	{
		final DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_SHORT );
		final Label uploadDateLabel = new Label( dateTimeFormat.format( fileDescr.uploadDate ) );
		uploadDateLabel.setStyleName( CommonResourcesContainer.TOP_TEN_USER_FILE_UPLOAD_DATE_STYLE );
		uploadDatePanel.add( uploadDateLabel );
	}
	
	//Initialize the user name label
	userNameAvatar = new UserAvatarWidget( fileDescr.ownerID, fileDescr.ownerLoginName );
	
	mainPanel.add( previewImage );
	mainPanel.add( uploadDatePanel );
	mainPanel.add( userNameAvatar );
	
	//Initialize the composite
	initWidget(mainPanel);
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:44,代码来源:Top10UserFileWidget.java

示例13: processRoomData

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
private void processRoomData() {
	if( userAccess != null ){
		//Set the read all access life time
		for( int index = 0; index < readAllDurationListBox.getItemCount(); index ++) {
			final int roomDuration = Integer.parseInt( readAllDurationListBox.getValue( index ) );
			if( roomDuration == ChatRoomData.UNKNOWN_HOURS_DURATION ){
				readAllDurationListBox.setSelectedIndex(index);
				break;
			}
		}
		//Set the read marker
		isReadCheckBox.setValue( userAccess.isRead() );
		//Set the read all marker
		isReadAllCheckBox.setValue( userAccess.isReadAll() );
		//Set write marker
		isWriteCheckBox.setValue( userAccess.isWrite() );
		if( userAccess.isSystem() ) {
			//We can not write if this is a system access
			isWriteCheckBox.setEnabled( false ); 
		}
		//Set system marker
		isSystemCheckBox.setValue( userAccess.isSystem() );
		if( userAccess.isWrite() ) {
			//We can not have system access if we can write
			isSystemCheckBox.setEnabled( false );
		}
		//Set room expiration data
		if( userAccess.getReadAllExpires() != null ) {
			final DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_SHORT );
			readAllExpirationLabel.setText( dateTimeFormat.format( userAccess.getReadAllExpires() ) );
		} else {
			readAllExpirationLabel.setText( titlesI18N.unknownTextValue() );
		}
	}
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:36,代码来源:RoomUserAccessDialogUI.java

示例14: setRoomExpirationLabelValue

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
/**
 * Set the room expration time label based on the available room data
 * @param showDate if true we want to show the real date if possible,
 * if false we want to show that the expiration time is unknown 
 */
private void setRoomExpirationLabelValue( final boolean showDate ) {
	if( showDate && ( roomData != null ) && (roomData.getExpirationDate() != null ) && !roomData.isExpired() ) {
		final DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_SHORT );
		roomExpirationLabel.setText( dateTimeFormat.format( roomData.getExpirationDate() ) );
	} else {
		roomExpirationLabel.setText( titlesI18N.unknownTextValue() );
	}
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:14,代码来源:RoomDialogUI.java

示例15: setDateLabelValue

import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; //导入依赖的package包/类
/**
 * This method sets the Date value label. Calls the setLabelValue method.
 * @param label the label to set value to
 * @param date the date value to set
 */
protected void setDateLabelValue( Label label, Date date ) {
	String dateStr = null;
	if( date != null ) {
		final DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat( PredefinedFormat.DATE_TIME_SHORT );
		dateStr = dateTimeFormat.format( date );
	}
	setLabelValue( null, label, dateStr );
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:14,代码来源:ActionGridDialog.java


注:本文中的com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。