@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); }
@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); }
@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); }
@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); }
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); }
@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); }
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); }
@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); }
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); }
@Override public ViewFactory getViewFactory() { final ViewFactory sf = super.getViewFactory(); return new ViewFactory() { public View create(Element element) { if (element.getName().equals(AbstractDocument.ParagraphElementName)) { return new ParagraphView(element) { @Override public void layout(int width, int height) { try { super.layout(Short.MAX_VALUE, height); } catch (Throwable t) { // this method sometimes throws an error // which prevents the component from // initializing. Just ignore any errors. logger.log(Level.WARNING, "Error in layout", t); } } @Override public float getMinimumSpan(int axis) { return super.getPreferredSpan(axis); } }; } return sf.create(element); } }; }
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); }
public View create(Element e){ View view = super.create(e); if (view instanceof ParagraphView) { return new LetterWrappingParagraphView(e); } else { return view; } }