项目:Yun_Shan-Common-Library
文件:AttributedString.java
public Set<Entry<Attribute,Object>> entrySet() {
HashSet<Entry<Attribute,Object>> set = new HashSet<>();
synchronized (AttributedString.this) {
int size = runAttributes[runIndex].size();
for (int i = 0; i < size; i++) {
Attribute key = runAttributes[runIndex].get(i);
Object value = runAttributeValues[runIndex].get(i);
if (value instanceof Annotation) {
value = AttributedString.this.getAttributeCheckRange(key,runIndex,beginIndex,endindex);
if (value == null) {
continue;
}
}
Entry<Attribute,Object> entry = new AttributeEntry(key,value);
set.add(entry);
}
}
return set;
}
项目:ttt
文件:Converter.java
private void populateText(Paragraph p,AttributedString as,boolean insertBreakBefore,Direction blockDirection) {
if (as != null) {
List<Serializable> content = p.getContent();
if (insertBreakBefore)
content.add(ttmlFactory.createBr(ttmlFactory.createBreak()));
AttributedCharacterIterator aci = as.getIterator();
aci.first();
StringBuffer sb = new StringBuffer();
while (aci.current() != CharacterIterator.DONE) {
int i = aci.getRunStart();
int e = aci.getRunLimit();
Annotation annotation = (Annotation) aci.getAttribute(TextAttribute.ANNOTATION);
while (i < e) {
sb.append(aci.setIndex(i++));
}
String text = sb.toString();
if (annotation != null)
content.add(ttmlFactory.createSpan(createSpan(text,(Attribute) annotation.getValue(),blockDirection)));
else
content.add(text);
sb.setLength(0);
aci.setIndex(e);
}
}
}
项目:openjdk-jdk10
文件:getRunStartLimitTest.java
public static void main(String[] args) throws Exception {
String text = "Hello world";
AttributedString as = new AttributedString(text);
// add non-Annotation attributes
as.addAttribute(TextAttribute.WEIGHT,TextAttribute.WEIGHT_LIGHT,3);
as.addAttribute(TextAttribute.WEIGHT,TextAttribute.WEIGHT_BOLD,3,5);
as.addAttribute(TextAttribute.WEIGHT,TextAttribute.WEIGHT_EXTRABOLD,5,text.length());
// add Annotation attributes
as.addAttribute(TextAttribute.WIDTH,new Annotation(TextAttribute.WIDTH_EXTENDED),3);
as.addAttribute(TextAttribute.WIDTH,new Annotation(TextAttribute.WIDTH_CONDENSED),4);
AttributedCharacterIterator aci = as.getIterator(null,2,4);
aci.first();
int runStart = aci.getRunStart();
if (runStart != 2) {
throw new Exception("1st run start is wrong. ("+runStart+" should be 2.)");
}
int runLimit = aci.getRunLimit();
if (runLimit != 3) {
throw new Exception("1st run limit is wrong. ("+runLimit+" should be 3.)");
}
Object value = aci.getAttribute(TextAttribute.WEIGHT);
if (value != TextAttribute.WEIGHT_LIGHT) {
throw new Exception("1st run attribute is wrong. ("
+value+" should be "+TextAttribute.WEIGHT_LIGHT+".)");
}
value = aci.getAttribute(TextAttribute.WIDTH);
if (value != null) {
throw new Exception("1st run annotation is wrong. ("
+value+" should be null.)");
}
aci.setIndex(runLimit);
runStart = aci.getRunStart();
if (runStart != 3) {
throw new Exception("2nd run start is wrong. ("+runStart+" should be 3.)");
}
runLimit = aci.getRunLimit();
if (runLimit != 4) {
throw new Exception("2nd run limit is wrong. ("+runLimit+" should be 4.)");
}
value = aci.getAttribute(TextAttribute.WEIGHT);
if (value != TextAttribute.WEIGHT_BOLD) {
throw new Exception("2nd run attribute is wrong. ("
+value+" should be "+TextAttribute.WEIGHT_BOLD+".)");
}
value = aci.getAttribute(TextAttribute.WIDTH);
if (!(value instanceof Annotation)
|| (((Annotation)value).getValue() != TextAttribute.WIDTH_CONDENSED)) {
throw new Exception("2nd run annotation is wrong. (" + value + " should be "
+ new Annotation(TextAttribute.WIDTH_CONDENSED)+".)");
}
}
项目:android-awt
文件:TextRunBreaker.java
/**
* Adds InputMethodHighlight to the attributes
* @param attrs - text attributes
* @return patched text attributes
*/
Map<? extends Attribute,?> unpackAttributes(Map<? extends Attribute,?> attrs) {
if (attrs.containsKey(TextAttribute.INPUT_METHOD_HIGHLIGHT)) {
Map<TextAttribute,?> styles = null;
Object val = attrs.get(TextAttribute.INPUT_METHOD_HIGHLIGHT);
if (val instanceof Annotation) {
val = ((Annotation) val).getValue();
}
//
// if (val instanceof InputMethodHighlight) {
// InputMethodHighlight ihl = ((InputMethodHighlight) val);
// styles = ihl.getStyle();
//
// if (styles == null) {
// Toolkit tk = Toolkit.getDefaultToolkit();
// styles = tk.mapInputMethodHighlight(ihl);
// }
// }
if (styles != null) {
HashMap<Attribute,Object> newAttrs = new HashMap<Attribute,Object>();
newAttrs.putAll(attrs);
newAttrs.putAll(styles);
return newAttrs;
}
}
return attrs;
}
项目:appengine-imaging
文件:TextRunBreaker.java
/**
* Adds InputMethodHighlight to the attributes
* @param attrs - text attributes
* @return patched text attributes
*/
Map<? extends Attribute,?> styles = null;
Object val = attrs.get(TextAttribute.INPUT_METHOD_HIGHLIGHT);
if (val instanceof Annotation) {
val = ((Annotation) val).getValue();
}
// if (val instanceof InputMethodHighlight) {
// InputMethodHighlight ihl = ((InputMethodHighlight) val);
// styles = ihl.getStyle();
//
// if (styles == null) {
// Toolkit tk = Toolkit.getDefaultToolkit();
// styles = tk.mapInputMethodHighlight(ihl);
// }
// }
if (styles != null) {
HashMap<Attribute,Object>();
newAttrs.putAll(attrs);
newAttrs.putAll(styles);
return newAttrs;
}
}
return attrs;
}
项目:cn1
文件:TextRunBreaker.java
/**
* Adds InputMethodHighlight to the attributes
* @param attrs - text attributes
* @return patched text attributes
*/
Map<? extends Attribute,?> attrs) {
if (attrs.containsKey(TextAttribute.INPUT_METHOD_HIGHLIGHT)) {
Map<TextAttribute,?> styles = null;
Object val = attrs.get(TextAttribute.INPUT_METHOD_HIGHLIGHT);
if (val instanceof Annotation) {
val = ((Annotation) val).getValue();
}
if (val instanceof InputMethodHighlight) {
InputMethodHighlight ihl = ((InputMethodHighlight) val);
styles = ihl.getStyle();
if (styles == null) {
Toolkit tk = Toolkit.getDefaultToolkit();
styles = tk.mapInputMethodHighlight(ihl);
}
}
if (styles != null) {
HashMap<Attribute,Object>();
newAttrs.putAll(attrs);
newAttrs.putAll(styles);
return newAttrs;
}
}
return attrs;
}
项目:cn1
文件:AnnotationTest.java
/**
* @tests java.text.Annotation.toString()
*/
public void testToString() {
Annotation ant = new Annotation("HelloWorld");
assertEquals("toString error.","java.text.Annotation[value=HelloWorld]",ant.toString());
assertNotNull(new Annotation(null).toString());
assertNotNull(new Annotation("value").toString());
}
项目:freeVM
文件:TextRunBreaker.java
/**
* Adds InputMethodHighlight to the attributes
* @param attrs - text attributes
* @return patched text attributes
*/
Map<? extends Attribute,Object>();
newAttrs.putAll(attrs);
newAttrs.putAll(styles);
return newAttrs;
}
}
return attrs;
}
项目:freeVM
文件:AnnotationTest.java
/**
* @tests java.text.Annotation.toString()
*/
public void testToString() {
Annotation ant = new Annotation("HelloWorld");
assertEquals("toString error.",ant.toString());
assertNotNull(new Annotation(null).toString());
assertNotNull(new Annotation("value").toString());
}
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:jdk8u-jdk
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:openjdk-jdk10
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:openjdk9
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:openjdk9
文件:getRunStartLimitTest.java
public static void main(String[] args) throws Exception {
String text = "Hello world";
AttributedString as = new AttributedString(text);
// add non-Annotation attributes
as.addAttribute(TextAttribute.WEIGHT,4);
aci.first();
int runStart = aci.getRunStart();
if (runStart != 2) {
throw new Exception("1st run start is wrong. ("+runStart+" should be 2.)");
}
int runLimit = aci.getRunLimit();
if (runLimit != 3) {
throw new Exception("1st run limit is wrong. ("+runLimit+" should be 3.)");
}
Object value = aci.getAttribute(TextAttribute.WEIGHT);
if (value != TextAttribute.WEIGHT_LIGHT) {
throw new Exception("1st run attribute is wrong. ("
+value+" should be "+TextAttribute.WEIGHT_LIGHT+".)");
}
value = aci.getAttribute(TextAttribute.WIDTH);
if (value != null) {
throw new Exception("1st run annotation is wrong. ("
+value+" should be null.)");
}
aci.setIndex(runLimit);
runStart = aci.getRunStart();
if (runStart != 3) {
throw new Exception("2nd run start is wrong. ("+runStart+" should be 3.)");
}
runLimit = aci.getRunLimit();
if (runLimit != 4) {
throw new Exception("2nd run limit is wrong. ("+runLimit+" should be 4.)");
}
value = aci.getAttribute(TextAttribute.WEIGHT);
if (value != TextAttribute.WEIGHT_BOLD) {
throw new Exception("2nd run attribute is wrong. ("
+value+" should be "+TextAttribute.WEIGHT_BOLD+".)");
}
value = aci.getAttribute(TextAttribute.WIDTH);
if (!(value instanceof Annotation)
|| (((Annotation)value).getValue() != TextAttribute.WIDTH_CONDENSED)) {
throw new Exception("2nd run annotation is wrong. (" + value + " should be "
+ new Annotation(TextAttribute.WIDTH_CONDENSED)+".)");
}
}
项目:jdk8u_jdk
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:lookaside_java-1.8.0-openjdk
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:infobip-open-jdk-8
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:jdk8u-dev-jdk
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:ttt
文件:Converter.java
public AnnotatedRange(Annotation annotation,int start,int end) {
this.annotation = annotation;
this.start = start;
this.end = end;
}
项目:jdk7-jdk
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:openjdk-source-code-learn
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:OLD-OpenJDK8
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:cn1
文件:AnnotationTest.java
/**
* @tests java.text.Annotation(Object)
*/
public void testAnnotation() {
assertNotNull(new Annotation(null));
assertNotNull(new Annotation("value"));
}
项目:openjdk-jdk7u-jdk
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
项目:freeVM
文件:AnnotationTest.java
/**
* @tests java.text.Annotation(Object)
*/
public void testAnnotation() {
assertNotNull(new Annotation(null));
assertNotNull(new Annotation("value"));
}
项目:openjdk-icedtea7
文件:AttributeValues.java
public void setInputMethodHighlight(Annotation f) {
this.imHighlight = f; update(EINPUT_METHOD_HIGHLIGHT); }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。