Java 类net.sf.jasperreports.engine.base.JRBaseFont 实例源码

项目:jasperreports    文件:JRXlsExporter.java   
protected HSSFRichTextString getRichTextString(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale)
{
    String text = styledText.getText();
    HSSFRichTextString richTextStr = new HSSFRichTextString(text);
    int runLimit = 0;
    AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();

    while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length())
    {
        Map<Attribute,Object> attributes = iterator.getAttributes();
        JRFont runFont = attributes.isEmpty()? defaultFont : new JRBaseFont(attributes);
        short runForecolor = attributes.get(TextAttribute.FOREGROUND) != null ? 
                getWorkbookColor((Color)attributes.get(TextAttribute.FOREGROUND)).getIndex() :
                forecolor;
        HSSFFont font = getLoadedFont(runFont, runForecolor, attributes, locale);
        richTextStr.applyFont(iterator.getIndex(), runLimit, font);
        iterator.setIndex(runLimit);
    }
    return richTextStr;
}
项目:jasperreports    文件:JRXlsMetadataExporter.java   
protected HSSFRichTextString getRichTextString(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale) {
    String text = styledText.getText();
    HSSFRichTextString richTextStr = new HSSFRichTextString(text);
    int runLimit = 0;
    AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();

    while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) {
        Map<Attribute,Object> attributes = iterator.getAttributes();
        JRFont runFont = attributes.isEmpty()? defaultFont : new JRBaseFont(attributes);
        short runForecolor = attributes.get(TextAttribute.FOREGROUND) != null  
            ? getWorkbookColor((Color)attributes.get(TextAttribute.FOREGROUND)).getIndex() 
            : forecolor;
        HSSFFont font = getLoadedFont(runFont, runForecolor, attributes, locale);
        richTextStr.applyFont(iterator.getIndex(), runLimit, font);
        iterator.setIndex(runLimit);
    }
    return richTextStr;
}
项目:PDFReporter-Studio    文件:MChart.java   
@Override
public void setValue(Object value) {
    JRChart oldObject = (JRChart) getValue();
    JRChart newObject = (JRChart) value;

    if (oldObject != null) {
        ((JRBaseChartPlot) oldObject.getPlot()).getEventSupport().removePropertyChangeListener(this);
        if (oldObject.getLegendFont() != null)
            ((JRBaseFont) oldObject.getLegendFont()).getEventSupport().removePropertyChangeListener(this);
        if (oldObject.getSubtitleFont() != null)
            ((JRBaseFont) oldObject.getSubtitleFont()).getEventSupport().removePropertyChangeListener(this);
        if (oldObject.getTitleFont() != null)
            ((JRBaseFont) oldObject.getTitleFont()).getEventSupport().removePropertyChangeListener(this);
    }
    if (newObject != null) {
        ((JRBaseChartPlot) newObject.getPlot()).getEventSupport().addPropertyChangeListener(this);
        if (newObject.getLegendFont() != null)
            ((JRBaseFont) newObject.getLegendFont()).getEventSupport().addPropertyChangeListener(this);
        if (newObject.getSubtitleFont() != null)
            ((JRBaseFont) newObject.getSubtitleFont()).getEventSupport().addPropertyChangeListener(this);
        if (newObject.getTitleFont() != null)
            ((JRBaseFont) newObject.getTitleFont()).getEventSupport().addPropertyChangeListener(this);
    }
    super.setValue(value);
}
项目:PDFReporter-Studio    文件:SPFontPanelChartPopUp.java   
/**
 * The ovverrided version first change the font into a temp. mfont item, the use this object to 
 * replace the font size inside the chart model
 */
@Override
protected void createCommand(boolean increment){
    Object fontSizeString = fontSize.getText(); 
    Integer newValue = 2;
    if (fontSizeString != null && fontSizeString.toString().length()>0){
        newValue = Integer.valueOf(fontSizeString.toString());
        Integer plus = null;
        if (increment) plus = Math.round((new Float(newValue) / 100)*SPButton.factor)+1;
        else plus =  Math.round((new Float(newValue) / 100)*-SPButton.factor)-1;
        if ((newValue+plus)>99) newValue = 99;
        else if ((newValue+plus)>0) newValue += plus;
        section.changePropertyOn(JRBaseFont.PROPERTY_FONT_SIZE, newValue.toString(), mfont);
        section.changePropertyOn(fontNameProperty, new MFont((JRFont) mfont.getValue()), parentNode);
    }
}
项目:PDFReporter-Studio    文件:SPFont.java   
/**
 * The ovverrided version first change the font into a temp. mfont item, the use this object to replace the font
 * size inside the chart model
 */
@Override
protected void createCommand(boolean increment) {
    Object fontSizeString = fontSize.getText();
    Integer newValue = 2;
    if (fontSizeString != null && fontSizeString.toString().length() > 0) {
        newValue = Integer.valueOf(fontSizeString.toString());
        Integer plus = null;
        if (increment)
            plus = Math.round((new Float(newValue) / 100) * SPButton.factor) + 1;
        else
            plus = Math.round((new Float(newValue) / 100) * -SPButton.factor) - 1;
        if ((newValue + plus) > 99)
            newValue = 99;
        else if ((newValue + plus) > 0)
            newValue += plus;
        section.changePropertyOn(JRBaseFont.PROPERTY_FONT_SIZE, newValue.toString(), mfont);
        section.changePropertyOn(fontNameProperty, new MFont((JRFont) mfont.getValue()), parentNode);
    }
}
项目:PDFReporter-Studio    文件:SPButton.java   
protected void createCommand(boolean increment){
    //Object fontSize = fontValue.getPropertyActualValue(JRBaseFont.PROPERTY_FONT_SIZE);
    Object fontSize = section.getElement().getPropertyValue(JRBaseFont.PROPERTY_FONT_SIZE);
    if (fontSize.equals(""))
        fontSize = fontValue.getPropertyActualValue(JRBaseFont.PROPERTY_FONT_SIZE);
    Float newValue = 2.0f;
    if (fontSize != null && fontSize.toString().length()>0){
        newValue = Float.valueOf(fontSize.toString());
        Integer plus = null;
        if (increment) plus = Math.round((new Float(newValue) / 100)*factor)+1;
        else plus =  Math.round((new Float(newValue) / 100)*-factor)-1;
        if ((newValue+plus)>99) newValue = 99.0f;
        else if ((newValue+plus)>0) newValue += plus;
        section.changeProperty(JRBaseFont.PROPERTY_FONT_SIZE, newValue.toString());
    }
}
项目:PDFReporter-Studio    文件:MTextElement.java   
/**
 * Return the graphical properties for an MTextElement
 */
public HashSet<String> generateGraphicalProperties(){
    HashSet<String> result = super.generateGraphicalProperties();
    result.add(JRBaseStyle.PROPERTY_HORIZONTAL_ALIGNMENT);
    result.add(JRBaseStyle.PROPERTY_VERTICAL_ALIGNMENT);
    result.add(JRBaseStyle.PROPERTY_ROTATION);

    result.add(JRBaseParagraph.PROPERTY_LINE_SPACING);
    result.add(JRBaseParagraph.PROPERTY_LINE_SPACING_SIZE);
    result.add(JRBaseParagraph.PROPERTY_FIRST_LINE_INDENT);
    result.add(JRBaseParagraph.PROPERTY_LEFT_INDENT);
    result.add(JRBaseParagraph.PROPERTY_RIGHT_INDENT);
    result.add(JRBaseParagraph.PROPERTY_SPACING_BEFORE);
    result.add(JRBaseParagraph.PROPERTY_SPACING_AFTER);
    result.add(JRBaseParagraph.PROPERTY_TAB_STOP_WIDTH);

    result.add(JRBaseStyle.PROPERTY_VERTICAL_ALIGNMENT);
    result.add(JRBaseFont.PROPERTY_BOLD);
    result.add(JRBaseFont.PROPERTY_UNDERLINE);
    result.add(JRBaseFont.PROPERTY_STRIKE_THROUGH);
    result.add(JRBaseFont.PROPERTY_ITALIC);
    result.add(JRBaseFont.PROPERTY_FONT_SIZE);
    result.add(JRBaseFont.PROPERTY_FONT_NAME);
    return result;
}
项目:PDFReporter-Studio    文件:MFont.java   
public Object getPropertyActualValue(Object id) {
    JRFont jrElement = (JRFont) getValue();
    if (id.equals(JRBaseFont.PROPERTY_BOLD))
        return jrElement.isBold();
    if (id.equals(JRBaseFont.PROPERTY_UNDERLINE))
        return jrElement.isUnderline();
    if (id.equals(JRBaseFont.PROPERTY_ITALIC))
        return jrElement.isItalic();
    if (id.equals(JRBaseFont.PROPERTY_STRIKE_THROUGH))
        return jrElement.isStrikeThrough();
    if (id.equals(JRBaseFont.PROPERTY_PDF_EMBEDDED))
        return jrElement.isPdfEmbedded();
    if (id.equals(JRBaseFont.PROPERTY_FONT_NAME))
        return jrElement.getFontName();
    if (id.equals(JRBaseFont.PROPERTY_PDF_FONT_NAME))
        return jrElement.getPdfFontName();
    if (id.equals(JRBaseFont.PROPERTY_PDF_ENCODING))
        return ModelUtils.getKey4PDFEncoding(jrElement.getPdfEncoding());
    if (id.equals(JRBaseFont.PROPERTY_FONT_SIZE))
        return Float.toString(jrElement.getFontsize()); //$NON-NLS-1$
    return null;
}
项目:PDFReporter-Studio    文件:MFont.java   
public Object getPropertyValue(Object id) {
    JRFont jrElement = (JRFont) getValue();
    if (id.equals(JRBaseFont.PROPERTY_BOLD))
        return jrElement.isOwnBold();
    if (id.equals(JRBaseFont.PROPERTY_UNDERLINE))
        return jrElement.isOwnUnderline();
    if (id.equals(JRBaseFont.PROPERTY_ITALIC))
        return jrElement.isOwnItalic();
    if (id.equals(JRBaseFont.PROPERTY_STRIKE_THROUGH))
        return jrElement.isOwnStrikeThrough();
    if (id.equals(JRBaseFont.PROPERTY_PDF_EMBEDDED))
        return jrElement.isOwnPdfEmbedded();
    if (id.equals(JRBaseFont.PROPERTY_FONT_NAME))
        return jrElement.getOwnFontName();
    if (id.equals(JRBaseFont.PROPERTY_PDF_FONT_NAME))
        return jrElement.getOwnPdfFontName();
    if (id.equals(JRBaseFont.PROPERTY_PDF_ENCODING))
        return ModelUtils.getKey4PDFEncoding(jrElement.getOwnPdfEncoding());
    if (id.equals(JRBaseFont.PROPERTY_FONT_SIZE))
        return jrElement.getOwnFontsize()!= null ? jrElement.getOwnFontsize().toString() : ""; //$NON-NLS-1$
    return null;
}
项目:PDFReporter-Studio    文件:TextStyle.java   
private static JRFont buildFont(Node xmlFontNode){
    NamedNodeMap fontAttributes = xmlFontNode.getAttributes();
    String fontName = fontAttributes.getNamedItem("name").getNodeValue();
    float size = Float.parseFloat(fontAttributes.getNamedItem("size").getNodeValue());
    boolean isBold = fontAttributes.getNamedItem("isBold").getNodeValue().equals("true"); 
    boolean isItalic = fontAttributes.getNamedItem("isItalic").getNodeValue().equals("true"); 
    boolean isUnderline = fontAttributes.getNamedItem("isUnderline").getNodeValue().equals("true"); 
    boolean isStriketrought = fontAttributes.getNamedItem("isStriketrought").getNodeValue().equals("true"); 

    JRBaseFont result = new JRBaseFont();
    result.setFontName(fontName);
    result.setFontSize(size);
    result.setBold(isBold);
    result.setItalic(isItalic);
    result.setUnderline(isUnderline);
    result.setStrikeThrough(isStriketrought);
    return result;
}
项目:PDFReporter-Studio    文件:TextualContributionItem.java   
/**
 * Create the command to change the font size
 * 
 * @param increment true if you want to increment the font, false otherwise
 */
protected JSSCompoundCommand createIncremenrtsCommand(boolean increment, List<Object> models){
    JSSCompoundCommand changeSizeCommands = new JSSCompoundCommand(null);
    for (Object model : models){
        Object fontSize  = ((APropertyNode)model).getPropertyActualValue(JRBaseFont.PROPERTY_FONT_SIZE);
        Float newValue = 2.0f;
        if (fontSize != null && fontSize.toString().length()>0){
            newValue = Float.valueOf(fontSize.toString());
            Integer plus = null;
            if (increment) plus = Math.round((new Float(newValue) / 100)*factor)+1;
            else plus =  Math.round((new Float(newValue) / 100)*-factor)-1;
            if ((newValue+plus)>99) newValue = 99.0f;
            else if ((newValue+plus)>0) newValue += plus;

            Command c = createCommand(model, newValue.toString(), JRBaseFont.PROPERTY_FONT_SIZE );
            changeSizeCommands.setReferenceNodeIfNull(model);
            if (c != null) {
                changeSizeCommands.add(c);
            }
        }
    }
    return changeSizeCommands;
}
项目:jasperreports    文件:GenericChartTheme.java   
/**
 *
 */
protected JRFont getFont(JRFont font)
{
    if (font == null)
    {
        return new JRBaseFont(getChart());
    }
    return font;
}
项目:jasperreports    文件:DefaultChartTheme.java   
/**
 *
 */
protected JRFont getFont(JRFont font)
{
    if (font == null)
    {
        return new JRBaseFont(getChart());
    }
    return font;
}
项目:PDFReporter-Studio    文件:SPFontNameCombo.java   
/**
 * Set the data of the combo popup, and if it wasn't initialized the fonts will be added
 */
@Override
public void setData(final APropertyNode pnode, Object b) {
    if (pnode != null) {
        combo.setEnabled(pnode.isEditable());
        if (!dataSetted) {
            if (pnode.getJasperConfiguration() != null) combo.setItems(pnode.getJasperConfiguration().getFontList());
            else FontUtils.stringToItems(getFontNames());
            combo.addModifyListener(new ModifyListener() {

                private int time = 0;

                public void modifyText(ModifyEvent e) {
                    if (e.time - time > 100) {
                        String value = combo.getText();
                        if (!value.equals(separator))
                            propertyChange(section, JRBaseFont.PROPERTY_FONT_NAME, combo.getText());
                        else
                            combo.select(indexOf(combo, (String) pnode.getPropertyActualValue(JRBaseFont.PROPERTY_FONT_NAME)));
                        int stringLength = combo.getText().length();
                        combo.setSelection(new Point(stringLength, stringLength));
                    }
                    time = e.time;
                }
            });
            dataSetted = true;
        }
        if (b != null) combo.setText(b.toString());
    }
}
项目:PDFReporter-Studio    文件:SPFontNamePopUp.java   
/**
 * Set the data of the combo popup, and if it wasn't initialized the fonts will be added
 */
@Override
public void setData(APropertyNode pnode, Object b) {
    if (pnode != null) {
        if (!dataSetted) {
            List<String[]> fontsList = ModelUtils.getFontNames(pnode.getJasperConfiguration());
            List<ComboItem> itemsList = new ArrayList<ComboItem>();
            int i = 0;
            for (int index = 0; index < fontsList.size(); index++) {
                String[] fonts = fontsList.get(index);
                for (String element : fonts) {
                    itemsList.add(new ComboItem(element, true, createFontImage(element), i, element, element));
                    i++;
                }
                if (index + 1 != fontsList.size() && fonts.length > 0) {
                    itemsList.add(new ComboItemSeparator(i));
                    i++;
                }
            }
            combo.setItems(itemsList);
            combo.addSelectionListener(new ComboItemAction() {
                /**
                 * The action to execute when an entry is selected
                 */
                @Override
                public void exec() {
                    propertyChange(section, JRBaseFont.PROPERTY_FONT_NAME, combo.getSelectionValue() != null ? combo
                            .getSelectionValue().toString() : null);
                }
            });
            dataSetted = true;
        }
        combo.setText(b.toString());
    }
}
项目:PDFReporter-Studio    文件:MGraphicElement.java   
protected JRFont getFontClone(JRFont sourceFont){
    if (sourceFont == null) return null;
    if (sourceFont instanceof JRBaseFont){
        return (JRBaseFont)((JRBaseFont)sourceFont).clone();
    }
    if (sourceFont instanceof JRTextElement){
        return (JRTextElement)((JRTextElement)sourceFont).clone();
    }
    return null;
}
项目:PDFReporter-Studio    文件:MFont.java   
public void setPropertyValue(Object id, Object value) {
    JRFont jrElement = (JRFont) getValue();
    if (id.equals(JRBaseFont.PROPERTY_BOLD))
        jrElement.setBold((Boolean) value);
    else if (id.equals(JRBaseFont.PROPERTY_UNDERLINE))
        jrElement.setUnderline((Boolean) value);
    else if (id.equals(JRBaseFont.PROPERTY_ITALIC))
        jrElement.setItalic((Boolean) value);
    else if (id.equals(JRBaseFont.PROPERTY_STRIKE_THROUGH))
        jrElement.setStrikeThrough((Boolean) value);
    else if (id.equals(JRBaseFont.PROPERTY_PDF_EMBEDDED))
        jrElement.setPdfEmbedded((Boolean) value);
    else if (id.equals(JRBaseFont.PROPERTY_FONT_NAME)) {
        if (value instanceof String) {
            if (((String) value).isEmpty())
                value = null;
            jrElement.setFontName((String) value);
        } else if (value == null)
            jrElement.setFontName((String) value);
    } else if (id.equals(JRBaseFont.PROPERTY_FONT_SIZE))
        try {
            jrElement.setFontSize(value != null ? new Float((String) value) : null);
        } catch (NumberFormatException e) {
        }
    else if (id.equals(JRBaseFont.PROPERTY_PDF_FONT_NAME))
        jrElement.setPdfFontName((String) value);
    else if (id.equals(JRBaseFont.PROPERTY_PDF_ENCODING))
        jrElement.setPdfEncoding(ModelUtils.getPDFEncoding2key((String) value));
}
项目:PDFReporter-Studio    文件:MFont.java   
@Override
public void propertyChange(PropertyChangeEvent evt) {
    String name = evt.getPropertyName();
    if (name.equals(JRBaseFont.PROPERTY_BOLD) || name.equals(JRBaseFont.PROPERTY_UNDERLINE)
            || name.equals(JRBaseFont.PROPERTY_ITALIC) || name.equals(JRBaseFont.PROPERTY_STRIKE_THROUGH)
            || name.equals(JRBaseFont.PROPERTY_PDF_EMBEDDED) || name.equals(JRBaseFont.PROPERTY_FONT_NAME)
            || name.equals(JRBaseFont.PROPERTY_FONT_SIZE) || name.equals(JRBaseFont.PROPERTY_PDF_FONT_NAME)
            || name.equals(JRBaseFont.PROPERTY_PDF_ENCODING))
        super.propertyChange(evt);

}
项目:PDFReporter-Studio    文件:TextStyleWizardPage.java   
private TextStyle createDefaultElement(){
    TextStyle defaultTextStyle = new TextStyle();
    defaultTextStyle.setBackGround(AlfaRGB.getFullyOpaque(new RGB(255,255,255)));
    defaultTextStyle.setForeGround(AlfaRGB.getFullyOpaque(new RGB(0,0,0)));
    defaultTextStyle.setHorizontalAlignmen(HorizontalAlignEnum.LEFT);
    defaultTextStyle.setVerticalAlignmen(VerticalAlignEnum.TOP);
    defaultTextStyle.setTransparent(true);
    defaultTextStyle.setRotation(RotationEnum.NONE);

    JRBaseFont font = new JRBaseFont();
    font.setFontName("Arial"); //$NON-NLS-1$
    font.setFontSize(8f);
    font.setBold(false);
    font.setItalic(false);
    font.setUnderline(false);
    font.setStrikeThrough(false);
    defaultTextStyle.setFont(font);


    JRBaseLineBox box = new JRBaseLineBox(null);
    box.setPadding(null);
    box.setTopPadding(0);
    box.setBottomPadding(0);
    box.setLeftPadding(0);
    box.setRightPadding(0);

    defaultTextStyle.setBorders(box);
    defaultTextStyle.setDescription(Messages.TextStyleView_sampleText);

    return defaultTextStyle;
}
项目:PDFReporter-Studio    文件:TextStyle.java   
public TextStyle(JRStyle style){
    super(null,null);
    setTransparent(style.getOwnModeValue() != null ? ModeEnum.TRANSPARENT.equals(style.getOwnModeValue()) : true);
    setBackGround(style.getOwnBackcolor());
    setForeGround(style.getOwnForecolor());
    setVerticalAlignmen(style.getOwnVerticalAlignmentValue() != null ? style.getOwnVerticalAlignmentValue() : VerticalAlignEnum.TOP);
    setHorizontalAlignmen(style.getOwnHorizontalAlignmentValue() != null ? style.getOwnHorizontalAlignmentValue() : HorizontalAlignEnum.LEFT);
    setRotation(style.getOwnRotationValue() != null ? style.getOwnRotationValue() : RotationEnum.NONE);

    JRFont font = new JRBaseFont();
    font.setBold(style.isOwnBold() != null ? style.isOwnBold() : false);
    font.setItalic(new Boolean(style.isOwnItalic() != null ? style.isOwnItalic() : false));
    style.isItalic();
    font.setUnderline(new Boolean(style.isOwnUnderline() != null ? style.isOwnUnderline() : false));
    font.setStrikeThrough(new Boolean(style.isOwnStrikeThrough() != null ? style.isOwnStrikeThrough() : false));
    font.setFontName(new String(style.getOwnFontName()));
    font.setFontSize(new Float(style.getOwnFontsize()));
    setFont(font);

    JRLineBox originBox = style.getLineBox();
    JRBaseLineBox copyBox = new JRBaseLineBox(null);
    copyBox.setPadding(originBox.getOwnPadding() != null ? new Integer(originBox.getOwnPadding()): null);
    copyBox.setTopPadding(originBox.getOwnTopPadding() != null ? new Integer(originBox.getOwnTopPadding()): null);
    copyBox.setBottomPadding(originBox.getOwnBottomPadding() != null ? new Integer(originBox.getOwnBottomPadding()): null);
    copyBox.setLeftPadding(originBox.getOwnLeftPadding() != null ? new Integer(originBox.getOwnLeftPadding()): null);
    copyBox.setRightPadding(originBox.getOwnRightPadding() != null ? new Integer(originBox.getOwnRightPadding()): null);
    copyLinePen(originBox.getPen(), copyBox.getPen());
    copyLinePen(originBox.getLeftPen(), copyBox.getLeftPen());
    copyLinePen(originBox.getRightPen(), copyBox.getRightPen());
    copyLinePen(originBox.getBottomPen(), copyBox.getBottomPen());
    copyLinePen(originBox.getTopPen(), copyBox.getTopPen());
    setBorders(copyBox);

    String name = style.getName();
    if (name != null && !name.isEmpty()) setDescription(name);
}
项目:PDFReporter-Studio    文件:TextStyle.java   
public TextStyle clone(){
    TextStyle copy = new TextStyle();
    copy.setBackGround(getBackGround() != null ? getBackGround().clone() : null);
    copy.setForeGround(getForeGround() != null ? getForeGround().clone() : null);
    copy.setTransparent(new Boolean(isTransparent()));
    copy.setDescription(new String(getDescription()));
    copy.setRotation(getRotation());
    copy.setHorizontalAlignmen(getHorizontalAlignmen());
    copy.setVerticalAlignmen(getVerticalAlignmen());
    JRBaseFont copyFont = new JRBaseFont();
    JRFont originFont = getFont();
    copyFont.setBold(new Boolean(originFont.isOwnBold()));
    copyFont.setItalic(new Boolean(originFont.isOwnItalic()));
    copyFont.setUnderline(new Boolean(originFont.isOwnUnderline()));
    copyFont.setStrikeThrough(new Boolean(originFont.isOwnStrikeThrough()));
    copyFont.setFontName(new String(originFont.getOwnFontName()));
    copyFont.setFontSize(new Float(originFont.getOwnFontsize()));
    copy.setFont(copyFont);
    JRLineBox originBox = getBorders();
    JRBaseLineBox copyBox = new JRBaseLineBox(null);
    copyBox.setPadding(originBox.getOwnPadding() != null ? new Integer(originBox.getOwnPadding()): null);
    copyBox.setTopPadding(originBox.getOwnTopPadding() != null ? new Integer(originBox.getOwnTopPadding()): null);
    copyBox.setBottomPadding(originBox.getOwnBottomPadding() != null ? new Integer(originBox.getOwnBottomPadding()): null);
    copyBox.setLeftPadding(originBox.getOwnLeftPadding() != null ? new Integer(originBox.getOwnLeftPadding()): null);
    copyBox.setRightPadding(originBox.getOwnRightPadding() != null ? new Integer(originBox.getOwnRightPadding()): null);
    copyLinePen(originBox.getPen(), copyBox.getPen());
    copyLinePen(originBox.getLeftPen(), copyBox.getLeftPen());
    copyLinePen(originBox.getRightPen(), copyBox.getRightPen());
    copyLinePen(originBox.getBottomPen(), copyBox.getBottomPen());
    copyLinePen(originBox.getTopPen(), copyBox.getTopPen());
    copy.setBorders(copyBox);
    return copy;
}
项目:ireport-fork    文件:AxisSettingsNode.java   
public AxisSettingsNode(AxisSettings axisSettings, Lookup doLkp)
{
    super(Children.LEAF, doLkp); //
    this.axisSettings = axisSettings;
    setName("Axis Settings");
    setIconBaseWithExtension(IMAGE_ICON_BASE);
    axisSettings.getEventSupport().addPropertyChangeListener(this);
    ((JRBaseFont)axisSettings.getLabelFont()).getEventSupport().addPropertyChangeListener(this);
    ((JRBaseFont)axisSettings.getTickLabelFont()).getEventSupport().addPropertyChangeListener(this);
}
项目:ireport-fork    文件:LegendSettingsNode.java   
public LegendSettingsNode(LegendSettings legendSettings, Lookup doLkp)
{
    super(Children.LEAF, doLkp); //
    this.legendSettings = legendSettings;
    setName("Legend Settings");
    setIconBaseWithExtension(IMAGE_ICON_BASE);
    legendSettings.getEventSupport().addPropertyChangeListener(this);
    ((JRBaseFont)legendSettings.getFont()).getEventSupport().addPropertyChangeListener(this);
}
项目:ireport-fork    文件:TitleSettingsNode.java   
public TitleSettingsNode(TitleSettings titleSettings, Lookup doLkp)
{
    super(Children.LEAF, doLkp); //
    this.titleSettings = titleSettings;
    setName("Title Settings");
    setIconBaseWithExtension(IMAGE_ICON_BASE);
    titleSettings.getEventSupport().addPropertyChangeListener(this);
    ((JRBaseFont)titleSettings.getFont()).getEventSupport().addPropertyChangeListener(this);
}
项目:PDFReporter-Studio    文件:SPFontPanelChartPopUp.java   
protected void createComponent(Composite parent) {
    mfont = new MFont(new JRDesignFont(null));
    group = section.getWidgetFactory().createSection(parent, pDescriptor.getDisplayName(), true, 3);

    final FontNamePropertyDescriptor pd = (FontNamePropertyDescriptor) mfont
            .getPropertyDescriptor(JRBaseStyle.PROPERTY_FONT_NAME);
    fontName = new ComboMenuViewer(group, ComboMenuViewer.NO_IMAGE, "SampleSampleSample");
    fontName.setToolTipText(pd.getDescription());
    fontName.addSelectionListener(new ComboItemAction() {
        @Override
        public void exec() {
            propertyChange(section, JRBaseFont.PROPERTY_FONT_NAME, fontName.getSelectionValue() != null ? fontName.getSelectionValue().toString() : null, pd);          
        }
    });

    final RWComboBoxPropertyDescriptor pd1 = (RWComboBoxPropertyDescriptor) mfont
            .getPropertyDescriptor(JRBaseStyle.PROPERTY_FONT_SIZE);


    Composite fontSizeLayout = new Composite(group, SWT.NONE);
    GridData fontSizeData = new GridData();
    fontSizeData.widthHint = 65;
    fontSizeData.minimumWidth = 65;
    fontSizeLayout.setLayout(new GridLayout(1,false));
    fontSizeLayout.setLayoutData(fontSizeData);
    fontSize = section.getWidgetFactory().createCombo(fontSizeLayout, SWT.FLAT);
    fontSize.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fontSize.setItems(pd1.getItems());
    fontSize.addModifyListener(new ModifyListener() {
        private int time = 0;

        public void modifyText(ModifyEvent e) {
            if (e.time - time > 100) {
                String value = fontSize.getText();
                if (IntegerCellEditorValidator.instance().isValid(value) == null)
                    changeProperty(section, pDescriptor.getId(), pd1.getId(), value);
            }
            time = e.time;
        }
    });
    fontSize.setToolTipText(pd1.getDescription());

    /*
     *Button to increment\decrment the font size 
     */
    new SPChartButtom(group, section, pd1,  mfont, pDescriptor.getId().toString());

    ToolBar toolBar = new ToolBar(group, SWT.FLAT | SWT.WRAP | SWT.LEFT);
    GridData gd = new GridData();
    gd.horizontalSpan = 3;
    toolBar.setLayoutData(gd);

    boldButton = createItem(toolBar, JRBaseStyle.PROPERTY_BOLD, "icons/resources/edit-bold.png");

    italicButton = createItem(toolBar, JRBaseStyle.PROPERTY_ITALIC, "icons/resources/edit-italic.png");

    underlineButton = createItem(toolBar, JRBaseStyle.PROPERTY_UNDERLINE, "icons/resources/edit-underline.png");

    strikeTroughtButton = createItem(toolBar, JRBaseStyle.PROPERTY_STRIKE_THROUGH, "icons/resources/edit-strike.png");
}
项目:ireport-fork    文件:JRFontPanel.java   
private void jButtonResetAllToDefaultjButtonOKActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonResetAllToDefaultjButtonOKActionPerformed1
    JRFont ifont = new JRBaseFont();
    setJRFont(ifont, jTextFieldReportFont.isVisible());
}