本文整理了Java中java.text.Format.formatToCharacterIterator()
方法的一些代码示例,展示了Format.formatToCharacterIterator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Format.formatToCharacterIterator()
方法的具体详情如下:
包路径:java.text.Format
类名称:Format
方法名:formatToCharacterIterator
[英]Formats the specified object using the rules of this format and returns an AttributedCharacterIterator with the formatted string and no attributes.
Subclasses should return an AttributedCharacterIterator with the appropriate attributes.
[中]使用此格式的规则设置指定对象的格式,并返回带格式字符串且无属性的AttributedCharacterIterator。
子类应返回具有适当属性的AttributedCharacterIterator。
代码示例来源:origin: stackoverflow.com
return fDelegate.formatToCharacterIterator( obj );
代码示例来源:origin: robovm/robovm
/**
* If fields list is not null, find and add the fields of this format to
* the fields list by iterating through its AttributedCharacterIterator
*
* @param format
* the format to find fields for
* @param arg
* object to format
* @param begin
* the index where the string this format has formatted begins
*/
private void handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) {
if (fields == null) {
return;
}
AttributedCharacterIterator iterator = format.formatToCharacterIterator(arg);
while (iterator.getIndex() != iterator.getEndIndex()) {
int start = iterator.getRunStart();
int end = iterator.getRunLimit();
Iterator<?> it = iterator.getAttributes().keySet().iterator();
while (it.hasNext()) {
AttributedCharacterIterator.Attribute attribute =
(AttributedCharacterIterator.Attribute) it.next();
Object value = iterator.getAttribute(attribute);
fields.add(new FieldContainer(begin + start, begin + end, attribute, value));
}
iterator.setIndex(end);
}
}
代码示例来源:origin: geotools/geotools
/**
* Formats the specified object. This method delegates the work to the {@linkplain Format
* format} specified at construction time.
*
* @param value The object to format.
* @return The character iterator describing the formatted value.
*/
@Override
public AttributedCharacterIterator formatToCharacterIterator(final Object value) {
return format.formatToCharacterIterator(value);
}
代码示例来源:origin: org.geotools/gt-metadata
/**
* Formats the specified object. This method delegates the work to the
* {@linkplain Format format} specified at construction time.
*
* @param value The object to format.
* @return The character iterator describing the formatted value.
*/
@Override
public AttributedCharacterIterator formatToCharacterIterator(final Object value) {
return format.formatToCharacterIterator(value);
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Formats the specified object. This method delegates the work to the
* {@linkplain Format format} specified at construction time.
*
* @param value The object to format.
* @return The character iterator describing the formatted value.
*/
//@Override
public AttributedCharacterIterator formatToCharacterIterator(final Object value) {
return format.formatToCharacterIterator(value);
}
代码示例来源:origin: org.geotools/gt2-metadata
/**
* Formats the specified object. This method delegates the work to the
* {@linkplain Format format} specified at construction time.
*
* @param value The object to format.
* @return The character iterator describing the formatted value.
*/
public AttributedCharacterIterator formatToCharacterIterator(final Object value) {
return format.formatToCharacterIterator(value);
}
代码示例来源:origin: com.jgoodies/jgoodies-common
@Override
public final AttributedCharacterIterator formatToCharacterIterator(Object obj) {
return delegate.formatToCharacterIterator(obj);
}
代码示例来源:origin: Geomatys/geotoolkit
/**
* Formats the specified object. This method delegates the work to the
* {@linkplain Format format} specified at construction time.
*
* @param value The object to format.
* @return The character iterator describing the formatted value.
*/
@Override
public AttributedCharacterIterator formatToCharacterIterator(final Object value) {
return format.formatToCharacterIterator(value);
}
代码示例来源:origin: stackoverflow.com
return fDelegate.formatToCharacterIterator( obj );
代码示例来源:origin: jtulach/bck2brwsr
subFormatter.formatToCharacterIterator(obj);
代码示例来源:origin: ibinti/bugvm
/**
* If fields list is not null, find and add the fields of this format to
* the fields list by iterating through its AttributedCharacterIterator
*
* @param format
* the format to find fields for
* @param arg
* object to format
* @param begin
* the index where the string this format has formatted begins
*/
private void handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) {
if (fields == null) {
return;
}
AttributedCharacterIterator iterator = format.formatToCharacterIterator(arg);
while (iterator.getIndex() != iterator.getEndIndex()) {
int start = iterator.getRunStart();
int end = iterator.getRunLimit();
Iterator<?> it = iterator.getAttributes().keySet().iterator();
while (it.hasNext()) {
AttributedCharacterIterator.Attribute attribute =
(AttributedCharacterIterator.Attribute) it.next();
Object value = iterator.getAttribute(attribute);
fields.add(new FieldContainer(begin + start, begin + end, attribute, value));
}
iterator.setIndex(end);
}
}
代码示例来源:origin: MobiVM/robovm
/**
* If fields list is not null, find and add the fields of this format to
* the fields list by iterating through its AttributedCharacterIterator
*
* @param format
* the format to find fields for
* @param arg
* object to format
* @param begin
* the index where the string this format has formatted begins
*/
private void handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) {
if (fields == null) {
return;
}
AttributedCharacterIterator iterator = format.formatToCharacterIterator(arg);
while (iterator.getIndex() != iterator.getEndIndex()) {
int start = iterator.getRunStart();
int end = iterator.getRunLimit();
Iterator<?> it = iterator.getAttributes().keySet().iterator();
while (it.hasNext()) {
AttributedCharacterIterator.Attribute attribute =
(AttributedCharacterIterator.Attribute) it.next();
Object value = iterator.getAttribute(attribute);
fields.add(new FieldContainer(begin + start, begin + end, attribute, value));
}
iterator.setIndex(end);
}
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* If fields list is not null, find and add the fields of this format to
* the fields list by iterating through its AttributedCharacterIterator
*
* @param format
* the format to find fields for
* @param arg
* object to format
* @param begin
* the index where the string this format has formatted begins
*/
private void handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) {
if (fields == null) {
return;
}
AttributedCharacterIterator iterator = format.formatToCharacterIterator(arg);
while (iterator.getIndex() != iterator.getEndIndex()) {
int start = iterator.getRunStart();
int end = iterator.getRunLimit();
Iterator<?> it = iterator.getAttributes().keySet().iterator();
while (it.hasNext()) {
AttributedCharacterIterator.Attribute attribute =
(AttributedCharacterIterator.Attribute) it.next();
Object value = iterator.getAttribute(attribute);
fields.add(new FieldContainer(begin + start, begin + end, attribute, value));
}
iterator.setIndex(end);
}
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
public void formatAndAppend(Format formatter, Object arg) {
if (attributes == null) {
append(formatter.format(arg));
} else {
AttributedCharacterIterator formattedArg = formatter.formatToCharacterIterator(arg);
int prevLength = length;
append(formattedArg);
// Copy all of the attributes from formattedArg to our attributes list.
formattedArg.first();
int start = formattedArg.getIndex(); // Should be 0 but might not be.
int limit = formattedArg.getEndIndex(); // == start + length - prevLength
int offset = prevLength - start; // Adjust attribute indexes for the result string.
while (start < limit) {
Map<Attribute, Object> map = formattedArg.getAttributes();
int runLimit = formattedArg.getRunLimit();
if (map.size() != 0) {
for (Map.Entry<Attribute, Object> entry : map.entrySet()) {
attributes.add(
new AttributeAndPosition(
entry.getKey(), entry.getValue(),
offset + start, offset + runLimit));
}
}
start = runLimit;
formattedArg.setIndex(start);
}
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* If fields list is not null, find and add the fields of this format to
* the fields list by iterating through its AttributedCharacterIterator
*
* @param format
* the format to find fields for
* @param arg
* object to format
* @param begin
* the index where the string this format has formatted begins
*/
private void handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) {
if (fields == null) {
return;
}
AttributedCharacterIterator iterator = format.formatToCharacterIterator(arg);
while (iterator.getIndex() != iterator.getEndIndex()) {
int start = iterator.getRunStart();
int end = iterator.getRunLimit();
Iterator<?> it = iterator.getAttributes().keySet().iterator();
while (it.hasNext()) {
AttributedCharacterIterator.Attribute attribute =
(AttributedCharacterIterator.Attribute) it.next();
Object value = iterator.getAttribute(attribute);
fields.add(new FieldContainer(begin + start, begin + end, attribute, value));
}
iterator.setIndex(end);
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* If fields list is not null, find and add the fields of this format to
* the fields list by iterating through its AttributedCharacterIterator
*
* @param format
* the format to find fields for
* @param arg
* object to format
* @param begin
* the index where the string this format has formatted begins
*/
private void handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) {
if (fields == null) {
return;
}
AttributedCharacterIterator iterator = format.formatToCharacterIterator(arg);
while (iterator.getIndex() != iterator.getEndIndex()) {
int start = iterator.getRunStart();
int end = iterator.getRunLimit();
Iterator<?> it = iterator.getAttributes().keySet().iterator();
while (it.hasNext()) {
AttributedCharacterIterator.Attribute attribute =
(AttributedCharacterIterator.Attribute) it.next();
Object value = iterator.getAttribute(attribute);
fields.add(new FieldContainer(begin + start, begin + end, attribute, value));
}
iterator.setIndex(end);
}
}
代码示例来源:origin: FlexoVM/flexovm
/**
* If fields list is not null, find and add the fields of this format to
* the fields list by iterating through its AttributedCharacterIterator
*
* @param format
* the format to find fields for
* @param arg
* object to format
* @param begin
* the index where the string this format has formatted begins
*/
private void handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) {
if (fields == null) {
return;
}
AttributedCharacterIterator iterator = format.formatToCharacterIterator(arg);
while (iterator.getIndex() != iterator.getEndIndex()) {
int start = iterator.getRunStart();
int end = iterator.getRunLimit();
Iterator<?> it = iterator.getAttributes().keySet().iterator();
while (it.hasNext()) {
AttributedCharacterIterator.Attribute attribute =
(AttributedCharacterIterator.Attribute) it.next();
Object value = iterator.getAttribute(attribute);
fields.add(new FieldContainer(begin + start, begin + end, attribute, value));
}
iterator.setIndex(end);
}
}
代码示例来源:origin: stackoverflow.com
return format.formatToCharacterIterator( obj );
代码示例来源:origin: org.apache.sis.core/sis-utility
characterIterator.append(format.formatToCharacterIterator(value), toAppendTo);
} else {
format.format(value, toAppendTo, new FieldPosition(-1));
代码示例来源:origin: net.sf.tinylaf/tinylaf
/**
* If the spinner's editor is a DateEditor, this selects the field
* associated with the value that is being incremented.
*/
private void select(JSpinner spinner) {
JComponent editor = spinner.getEditor();
if(editor instanceof JSpinner.DateEditor) {
JSpinner.DateEditor dateEditor = (JSpinner.DateEditor) editor;
JFormattedTextField ftf = dateEditor.getTextField();
Format format = dateEditor.getFormat();
Object value;
if(format != null && (value = spinner.getValue()) != null) {
SpinnerDateModel model = dateEditor.getModel();
DateFormat.Field field = DateFormat.Field.ofCalendarField(model.getCalendarField());
if(field != null) {
try {
AttributedCharacterIterator iterator = format.formatToCharacterIterator(value);
if(!select(ftf, iterator, field) && field == DateFormat.Field.HOUR0) {
select(ftf, iterator, DateFormat.Field.HOUR1);
}
} catch (IllegalArgumentException iae) {}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!