Java 类javax.swing.text.LabelView 实例源码
项目:incubator-netbeans
文件:ViewFactoryImpl.java
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return null;
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new DocumentView(elem);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
return null;
}
项目:meja
文件:CellEditorPane.java
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
switch (kind) {
case AbstractDocument.ContentElementName:
return new LabelView(elem);
case AbstractDocument.ParagraphElementName:
return new ParagraphView(elem);
case AbstractDocument.SectionElementName:
return new AlignedBoxView(elem, View.Y_AXIS);
case StyleConstants.ComponentElementName:
return new ComponentView(elem);
case StyleConstants.IconElementName:
return new IconView(elem);
default:
}
}
return new LabelView(elem);
}
项目:MPL
文件:BnJaggedEditorKit.java
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return createLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
// return new MyParagraphView(elem);
return new ParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
} // default to text display
return new LabelView(elem);
}
项目:chatty
文件:ExtendedTextPane.java
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new WrapLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new ParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
return new LabelView(elem);
}
项目:chatty
文件:MyEditorKit.java
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new WrapLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new MyParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new ChatBoxView(elem, View.Y_AXIS, startAtBottom);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new MyIconView(elem);
}
}
return new LabelView(elem);
}
项目:stendhal
文件:KTextEdit.java
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new WrapLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new ParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
// default to text display
return new LabelView(elem);
}
项目:tellervo
文件:SamplePrintEditor.java
public View create(Element elem) {
String kind = elem.getName();
if (kind != null)
if (kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
// We changed this so we can mess with tab stops
return new SPParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
// we changed this so we can zoom in on text
//return new ScaledBoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
// default to text display
return new LabelView(elem);
}
项目:Chatty-Twitch-Client
文件:ExtendedTextPane.java
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new WrapLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new ParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
return new LabelView(elem);
}
项目:Chatty-Twitch-Client
文件:MyEditorKit.java
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new WrapLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new MyParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new ChatBoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new MyIconView(elem);
}
}
return new LabelView(elem);
}
项目:hortonmachine
文件:WrapEditorKit.java
public View create( Element elem ) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new WrapLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new ParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
// default to text display
return new LabelView(elem);
}
项目:findbugs-all-the-bugs
文件:NumberedViewFactory.java
public View create(Element elem) {
String kind = elem.getName();
// System.out.println("Kind: " + kind);
if (kind != null)
if (kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new NumberedParagraphView(elem, highlight);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new NoWrapBoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
// default to text display
return new LabelView(elem);
}
项目:K-scope
文件:InformationDialog.java
/**
* 要素に基づいてビューを作成します。
* @param elem 作成対象要素
* @return ビュー
*/
@Override
public View create(Element elem) {
String kind = elem.getName();
if(kind != null) {
if(kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
}else if(kind.equals(AbstractDocument.ParagraphElementName)) {
return new NoWrapParagraphView(elem);
}else if(kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
}else if(kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
}else if(kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
return new LabelView(elem);
}
项目:K-scope
文件:SwingUtils.java
/**
* 要素に基づいてビューを作成します。
*
* @param elem
* 作成対象要素
* @return ビュー
*/
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new NoWrapParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
return new LabelView(elem);
}
项目:K-scope
文件:CodePane.java
/**
* 要素に基づいてビューを作成します。
* @param elem 作成対象要素
* @return ビュー
*/
@Override
public View create(Element elem) {
String kind = elem.getName();
if(kind != null) {
if(kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
}else if(kind.equals(AbstractDocument.ParagraphElementName)) {
return new WordWrapParagraphView(elem);
}else if(kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
}else if(kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
}else if(kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
return new LabelView(elem);
}
项目:TwitchChatClient
文件:ExtendedTextPane.java
@Override
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new WrapLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new ParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
return new LabelView(elem);
}
项目:desktopclient-java
文件:MessageList.java
@Override
public javax.swing.text.View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
switch (kind) {
case AbstractDocument.ContentElementName:
return new WrapLabelView(elem);
case AbstractDocument.ParagraphElementName:
return new ParagraphView(elem);
case AbstractDocument.SectionElementName:
return new BoxView(elem, javax.swing.text.View.Y_AXIS);
case StyleConstants.ComponentElementName:
return new ComponentView(elem);
case StyleConstants.IconElementName:
return new IconView(elem);
}
}
// default to text display
return new LabelView(elem);
}
项目:HexScape
文件:WrapTextPane.java
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new WrapLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new ParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
// default to text display
return new LabelView(elem);
}
项目:Zong
文件:ScaledEditorKit.java
@Override public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
switch (kind) {
case AbstractDocument.ContentElementName:
return new LabelView(elem);
case AbstractDocument.ParagraphElementName:
return new ParagraphView(elem);
case AbstractDocument.SectionElementName:
return new ScaledView(elem, View.Y_AXIS);
case StyleConstants.ComponentElementName:
return new ComponentView(elem);
case StyleConstants.IconElementName:
return new IconView(elem);
}
}
// default to text display
return new LabelView(elem);
}
项目:JTChat
文件:ChatroomPanel.java
public View create(Element elem) {
String kind = elem.getName();
if (kind != null) {
if (kind.equals(AbstractDocument.ContentElementName)) {
return new ChatroomPanel.WrapLabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
return new ParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
return new BoxView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
}
}
// default to text display
return new LabelView(elem);
}
项目:incubator-taverna-workbench
文件:NoWrapEditorKit.java
public View create(Element elem)
{
String kind = elem.getName();
if (kind != null)
{
if (kind.equals(AbstractDocument.ContentElementName))
{
return new LabelView(elem);
}
else if (kind.equals(AbstractDocument.ParagraphElementName))
{
return new ParagraphView(elem);
}
else if (kind.equals(AbstractDocument.SectionElementName))
{
return new NoWrapBoxView(elem, View.Y_AXIS);
}
else if (kind.equals(StyleConstants.ComponentElementName))
{
return new ComponentView(elem);
}
else if (kind.equals(StyleConstants.IconElementName))
{
return new IconView(elem);
}
}
return new LabelView(elem);
}
项目:cn1
文件:ParagraphView_RequirementsTest.java
public void testCalculateMinorAxisRequirements03() throws Exception {
factory = new ViewFactory() {
public View create(Element element) {
LabelView result = new LabelView(element);
result.setGlyphPainter(BlockViewTest.InlineViewFactory.painter);
return result;
}
};
view = new ParagraphViewImpl(doc.getParagraphElement(10), factory);
SizeRequirements sr =
view.calculateMinorAxisRequirements(View.X_AXIS, null);
final View layoutPool = ((ParagraphViewImpl)view).getLayoutPool();
int min = 0;
int pref = 0;
for (int i = 0; i < layoutPool.getViewCount(); i++) {
View child = layoutPool.getView(i);
int ps = (int)child.getPreferredSpan(View.X_AXIS);
min = Math.max(min, ps);
pref += ps;
}
assertEquals(min, 8 * CHAR_WIDTH);
assertEquals(pref, (isHarmony() ? 13 : 12) * CHAR_WIDTH);
assertEquals(8 * CHAR_WIDTH, sr.minimum);
assertEquals((isHarmony() ? 13 : 12) * CHAR_WIDTH, sr.preferred);
assertEquals(Integer.MAX_VALUE, sr.maximum);
}
项目:freeVM
文件:ParagraphView_RequirementsTest.java
public void testCalculateMinorAxisRequirements03() throws Exception {
factory = new ViewFactory() {
public View create(Element element) {
LabelView result = new LabelView(element);
result.setGlyphPainter(BlockViewTest.InlineViewFactory.painter);
return result;
}
};
view = new ParagraphViewImpl(doc.getParagraphElement(10), factory);
SizeRequirements sr =
view.calculateMinorAxisRequirements(View.X_AXIS, null);
final View layoutPool = ((ParagraphViewImpl)view).getLayoutPool();
int min = 0;
int pref = 0;
for (int i = 0; i < layoutPool.getViewCount(); i++) {
View child = layoutPool.getView(i);
int ps = (int)child.getPreferredSpan(View.X_AXIS);
min = Math.max(min, ps);
pref += ps;
}
assertEquals(min, 8 * CHAR_WIDTH);
assertEquals(pref, (isHarmony() ? 13 : 12) * CHAR_WIDTH);
assertEquals(8 * CHAR_WIDTH, sr.minimum);
assertEquals((isHarmony() ? 13 : 12) * CHAR_WIDTH, sr.preferred);
assertEquals(Integer.MAX_VALUE, sr.maximum);
}
项目:freeVM
文件:ParagraphView_RequirementsTest.java
public void testCalculateMinorAxisRequirements03() throws Exception {
factory = new ViewFactory() {
public View create(Element element) {
LabelView result = new LabelView(element);
result.setGlyphPainter(BlockViewTest.InlineViewFactory.painter);
return result;
}
};
view = new ParagraphViewImpl(doc.getParagraphElement(10), factory);
SizeRequirements sr =
view.calculateMinorAxisRequirements(View.X_AXIS, null);
final View layoutPool = ((ParagraphViewImpl)view).getLayoutPool();
int min = 0;
int pref = 0;
for (int i = 0; i < layoutPool.getViewCount(); i++) {
View child = layoutPool.getView(i);
int ps = (int)child.getPreferredSpan(View.X_AXIS);
min = Math.max(min, ps);
pref += ps;
}
assertEquals(min, 8 * CHAR_WIDTH);
assertEquals(pref, (isHarmony() ? 13 : 12) * CHAR_WIDTH);
assertEquals(8 * CHAR_WIDTH, sr.minimum);
assertEquals((isHarmony() ? 13 : 12) * CHAR_WIDTH, sr.preferred);
assertEquals(Integer.MAX_VALUE, sr.maximum);
}