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

项目:jasperreports    文件:JRDocxExporter.java   
/**
 *
 */
protected void exportRectangle(DocxTableHelper tableHelper, JRPrintRectangle rectangle, JRExporterGridCell gridCell)
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = box.getPen();
    pen.setLineColor(rectangle.getLinePen().getLineColor());
    pen.setLineStyle(rectangle.getLinePen().getLineStyleValue());
    pen.setLineWidth(rectangle.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    tableHelper.getCellHelper().exportHeader(rectangle, gridCell);
    tableHelper.getParagraphHelper().exportEmptyParagraph(startPage, bookmarkIndex, pageAnchor);
    if (startPage)
    {
        // increment the bookmarkIndex for the first cell in the sheet, due to page anchor creation
        bookmarkIndex++;
    }
    tableHelper.getCellHelper().exportFooter();
}
项目:jasperreports    文件:JRDocxExporter.java   
/**
 *
 */
protected void exportEllipse(DocxTableHelper tableHelper, JRPrintEllipse ellipse, JRExporterGridCell gridCell)
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = box.getPen();
    pen.setLineColor(ellipse.getLinePen().getLineColor());
    pen.setLineStyle(ellipse.getLinePen().getLineStyleValue());
    pen.setLineWidth(ellipse.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    tableHelper.getCellHelper().exportHeader(ellipse, gridCell);
    tableHelper.getParagraphHelper().exportEmptyParagraph(startPage, bookmarkIndex, pageAnchor);
    if (startPage)
    {
        // increment the bookmarkIndex for the first cell in the sheet, due to page anchor creation
        bookmarkIndex++;
    }
    tableHelper.getCellHelper().exportFooter();
}
项目:jasperreports    文件:JRXlsxExporter.java   
@Override
protected void exportRectangle(
    JRPrintGraphicElement rectangle,
    JRExporterGridCell gridCell, 
    int colIndex, 
    int rowIndex
    ) throws JRException 
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = box.getPen();
    pen.setLineColor(rectangle.getLinePen().getLineColor());
    pen.setLineStyle(rectangle.getLinePen().getLineStyleValue());
    pen.setLineWidth(rectangle.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    cellHelper.exportHeader(gridCell, rowIndex, colIndex, maxColumnIndex, sheetInfo);
    sheetHelper.exportMergedCells(rowIndex, colIndex, maxColumnIndex, gridCell.getRowSpan(), gridCell.getColSpan());
    cellHelper.exportFooter();
}
项目:jasperreports    文件:JRDesignCrosstab.java   
/**
 * Creates a new crosstab.
 * 
 * @param defaultStyleProvider default style provider
 */
public JRDesignCrosstab(JRDefaultStyleProvider defaultStyleProvider)
{
    super(defaultStyleProvider);

    parametersList = new ArrayList<JRCrosstabParameter>();
    parametersMap = new HashMap<String, JRCrosstabParameter>();
    rowGroupsMap = new HashMap<String, Integer>();
    rowGroups = new ArrayList<JRCrosstabRowGroup>();
    columnGroupsMap = new HashMap<String, Integer>();
    columnGroups = new ArrayList<JRCrosstabColumnGroup>();
    measuresMap = new HashMap<String, Integer>();
    measures = new ArrayList<JRCrosstabMeasure>();

    cellsMap = new HashMap<Pair<String,String>,JRCrosstabCell>();
    cellsList = new ArrayList<JRCrosstabCell>();

    addBuiltinParameters();

    variablesList = new LinkedMap();
    addBuiltinVariables();

    dataset = new JRDesignCrosstabDataset();
    lineBox = new JRBaseLineBox(this);
}
项目:PDFReporter-Studio    文件:BordersSection.java   
/**
 * Change the padding property of a linebox
 * @param property the property name
 * @param newValue the new value
 */
public void changePropertyPadding(String property, Object newValue){
    if (!isRefreshing()) {
        JSSCompoundCommand cc = new JSSCompoundCommand("Change padding", null); //$NON-NLS-1$
        for (APropertyNode m : getElements()) {
            cc.setReferenceNodeIfNull(m);
            Command c = null;
            MLineBox lb = (MLineBox) m.getPropertyValue(MGraphicElementLineBox.LINE_BOX);
            //If the checkbox is set i need to set the general padding, otherwise it must be null
            if (checkBoxPadding.getSelection()){
                c = getChangePropertyCommand(JRBaseLineBox.PROPERTY_PADDING, newValue, lb);
            } else {
                c = getChangePropertyCommand(JRBaseLineBox.PROPERTY_PADDING, null, lb);
                if (c != null)
                    cc.add(c);
                c = getChangePropertyCommand(property, newValue, lb);
            }
            if (c != null)
                cc.add(c);
        }
        CommandStack cs = getEditDomain().getCommandStack();
        cs.execute(cc);
    }
}
项目:PDFReporter-Studio    文件:BordersSection.java   
/**
 * Refresh the padding information, actually it's not used
 */
public void refreshPadding(MLineBox lb) {
    if (lb != null) {
        Object propertyPadding = lb.getPropertyValue(JRBaseLineBox.PROPERTY_PADDING);
        if (propertyPadding != null){
            checkBoxPadding.setSelection(true);
            Integer value = (Integer)propertyPadding;
            paddingTop.setSelection(value);
            paddingBottom.setSelection(value);
            paddingLeft.setSelection(value);
            paddingRight.setSelection(value);
        } else {
            checkBoxPadding.setSelection(false);
            paddingTop.setSelection(getPaddingValue(lb.getPropertyValue(JRBaseLineBox.PROPERTY_TOP_PADDING)));
            paddingBottom.setSelection(getPaddingValue(lb.getPropertyValue(JRBaseLineBox.PROPERTY_BOTTOM_PADDING)));
            paddingLeft.setSelection(getPaddingValue(lb.getPropertyValue(JRBaseLineBox.PROPERTY_LEFT_PADDING)));
            paddingRight.setSelection(getPaddingValue(lb.getPropertyValue(JRBaseLineBox.PROPERTY_RIGHT_PADDING)));
        }
        checkBoxValueChange();
    }
}
项目:PDFReporter-Studio    文件:MLineBox.java   
@Override
public HashMap<String, Object> getStylesDescriptors() {
    HashMap<String, Object> result = new HashMap<String, Object>();
    if (getValue() == null)
        return result;
    JRBaseLineBox element = (JRBaseLineBox) getValue();
    result.put(JRBaseLineBox.PROPERTY_PADDING, element.getOwnPadding());
    result.put(JRBaseLineBox.PROPERTY_TOP_PADDING, element.getOwnTopPadding());
    result.put(JRBaseLineBox.PROPERTY_BOTTOM_PADDING, element.getOwnBottomPadding());
    result.put(JRBaseLineBox.PROPERTY_LEFT_PADDING, element.getOwnLeftPadding());
    result.put(JRBaseLineBox.PROPERTY_RIGHT_PADDING, element.getOwnRightPadding());
    MLinePen linePen = (MLinePen) getPropertyValue(LINE_PEN);
    result.put(LINE_PEN, linePen);
    MLinePen linePenTop = (MLinePen) getPropertyValue(LINE_PEN_TOP);
    result.put(LINE_PEN_TOP, linePenTop);
    MLinePen linePenBottom = (MLinePen) getPropertyValue(LINE_PEN_BOTTOM);
    result.put(LINE_PEN_BOTTOM, linePenBottom);
    MLinePen linePenLeft = (MLinePen) getPropertyValue(LINE_PEN_LEFT);
    result.put(LINE_PEN_LEFT, linePenLeft);
    MLinePen linePenRight = (MLinePen) getPropertyValue(LINE_PEN_RIGHT);
    result.put(LINE_PEN_RIGHT, linePenRight);
    return result;
}
项目:PDFReporter-Studio    文件:MLineBox.java   
public void setPropertyValue(Object id, Object value) {
    JRLineBox lineBox = (JRLineBox) getValue();
    if (lineBox != null) {
        if (id.equals(JRBaseLineBox.PROPERTY_PADDING))
            lineBox.setPadding((Integer) value);
        else if (id.equals(JRBaseLineBox.PROPERTY_TOP_PADDING))
            lineBox.setTopPadding((Integer) value);
        else if (id.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING))
            lineBox.setBottomPadding((Integer) value);
        else if (id.equals(JRBaseLineBox.PROPERTY_LEFT_PADDING))
            lineBox.setLeftPadding((Integer) value);
        else if (id.equals(JRBaseLineBox.PROPERTY_RIGHT_PADDING))
            lineBox.setRightPadding((Integer) value);
        // --------------------------------------------
    }
}
项目:ireport-fork    文件:AbstractStyleNode.java   
private void init()
{
    setDisplayName ( style.getName());
    super.setName( style.getName() );
    setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/style-16.png");

    style.getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)style.getLinePen()).getEventSupport().addPropertyChangeListener(this);

    JRBaseLineBox baseBox = (JRBaseLineBox)style.getLineBox();
    baseBox.getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getTopPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getBottomPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getLeftPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getRightPen()).getEventSupport().addPropertyChangeListener(this);

    ((JRBaseParagraph)style.getParagraph()).getEventSupport().addPropertyChangeListener(this);
}
项目:ireport-fork    文件:PaddingAndBordersAction.java   
private JRLineBox createCommonBox(List<JRLineBox> boxes, JRBoxContainer container)
{
    if (boxes == null || boxes.size() == 0) return new JRBaseLineBox(container);
    if (boxes.size() == 1) return (boxes.get(0)).clone(container);

    JRBaseLineBox finalbox = new JRBaseLineBox(null);

    boolean isFirst = true;

    for (JRLineBox box : boxes)
    {

        if (isFirst)
        {
            ModelUtils.applyBoxProperties(finalbox, box);
            isFirst = false;
            continue;
        }

        ModelUtils.applyDiff(finalbox, box);

    }

    return finalbox;
}
项目:ireport-fork    文件:StyleNode.java   
private void init()
{
    setDisplayName ( style.getName());
    super.setName( style.getName() );
    setIconBaseWithExtension("com/jaspersoft/ireport/designer/resources/style-16.png");

    style.getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)style.getLinePen()).getEventSupport().addPropertyChangeListener(this);

    JRBaseLineBox baseBox = (JRBaseLineBox)style.getLineBox();
    baseBox.getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getTopPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getBottomPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getLeftPen()).getEventSupport().addPropertyChangeListener(this);
    ((JRBasePen)baseBox.getRightPen()).getEventSupport().addPropertyChangeListener(this);

    ((JRBaseParagraph)style.getParagraph()).getEventSupport().addPropertyChangeListener(this);
}
项目:jasperreports    文件:JRDesignTextElement.java   
/**
 * Creates a new text element.
 */
protected JRDesignTextElement(JRDefaultStyleProvider defaultStyleProvider)
{
    super(defaultStyleProvider);

    lineBox = new JRBaseLineBox(this);
    paragraph = new JRBaseParagraph(this);
}
项目:jasperreports    文件:JRDesignChart.java   
/**
 *
 */
public JRDesignChart(JRDefaultStyleProvider defaultStyleProvider, byte chartType)
{
    super(defaultStyleProvider);

    setChartType(chartType);

    hyperlinkParameters = new ArrayList<JRHyperlinkParameter>();

    lineBox = new JRBaseLineBox(this);
}
项目:jasperreports    文件:JRDesignImage.java   
/**
 *
 */
public JRDesignImage(JRDefaultStyleProvider defaultStyleProvider)
{
    super(defaultStyleProvider);

    hyperlinkParameters = new ArrayList<JRHyperlinkParameter>();

    lineBox = new JRBaseLineBox(this);
}
项目:jasperreports    文件:JRDesignFrame.java   
/**
 * Creates a new frame object.
 * 
 * @param defaultStyleProvider default style provider instance
 */
public JRDesignFrame(JRDefaultStyleProvider defaultStyleProvider)
{
    super(defaultStyleProvider);

    children = new ArrayList<JRChild>();

    lineBox = new JRBaseLineBox(this);
}
项目:jasperreports    文件:TableBuilder.java   
/**
 *
 */
public void exportRectangle(JRPrintGraphicElement rectangle, JRExporterGridCell gridCell)
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = box.getPen();
    pen.setLineColor(rectangle.getLinePen().getLineColor());
    pen.setLineStyle(rectangle.getLinePen().getLineStyleValue());
    pen.setLineWidth(rectangle.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    buildCellHeader(styleCache.getCellStyle(gridCell), gridCell.getColSpan(), gridCell.getRowSpan());
    buildCellFooter();
}
项目:jasperreports    文件:JRTemplateText.java   
/**
 * Creates a template text.
 * 
 * @param origin the origin of the elements that will use this template
 * @param defaultStyleProvider the default style provider to use for
 * this template
 */
public JRTemplateText(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider)
{
    super(origin, defaultStyleProvider);

    lineBox = new JRBaseLineBox(this);
    paragraph = new JRBaseParagraph(this);
}
项目:jasperreports    文件:JRTemplateImage.java   
/**
 * Creates a template image.
 * 
 * @param origin the origin of the elements that will use this template
 * @param defaultStyleProvider the default style provider to use for
 * this template
 */
public JRTemplateImage(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider)
{
    super(origin, defaultStyleProvider);

    this.lineBox = new JRBaseLineBox(this);
    this.linePen = new JRBasePen(this);
}
项目:jasperreports    文件:JRDesignCellContents.java   
/**
 * Creates an empty cell contents.
 */
public JRDesignCellContents()
{
    super();

    lineBox = new JRBaseLineBox(this);
}
项目:PDFReporter-Studio    文件:PaddingSection.java   
@Override
public IHighlightPropertyWidget getWidgetForProperty(Object propertyId) {
    if (propertyId.equals(JRBaseLineBox.PROPERTY_PADDING)) return new ASHighlightControl(allPadding, new BackgroundHighlight(allPadding));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_LEFT_PADDING)) return new ASHighlightControl(leftPadding, new BackgroundHighlight(leftPadding));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_RIGHT_PADDING)) return new ASHighlightControl(rightPadding, new BackgroundHighlight(rightPadding));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_TOP_PADDING)) return new ASHighlightControl(topPadding, new BackgroundHighlight(topPadding));
    else return new ASHighlightControl(bottomPadding, new BackgroundHighlight(bottomPadding));
}
项目:PDFReporter-Studio    文件:PaddingSection.java   
@Override
protected void initializeProvidedProperties() {
    super.initializeProvidedProperties();
    addProvidedProperties(JRBaseLineBox.PROPERTY_PADDING,  Messages.BordersSection_Padding_Box_Title);
    addProvidedProperties(JRBaseLineBox.PROPERTY_BOTTOM_PADDING, Messages.common_bottom);
    addProvidedProperties(JRBaseLineBox.PROPERTY_TOP_PADDING, Messages.BordersSection_Top_Label);
    addProvidedProperties(JRBaseLineBox.PROPERTY_LEFT_PADDING, Messages.BordersSection_Left_Label);
    addProvidedProperties(JRBaseLineBox.PROPERTY_RIGHT_PADDING, Messages.common_right);
}
项目:PDFReporter-Studio    文件:PaddingSection.java   
/**
 * @see org.eclipse.ui.views.properties.tabbed.view.ITabbedPropertySection#refresh()
 */
public void refresh() {
    setRefreshing(true);
    APropertyNode element = getElement();
    if (element != null) {
        UIUtil.setSpinnerSelection(allPadding, element.getPropertyValue(JRBaseLineBox.PROPERTY_PADDING), 0);
        UIUtil.setSpinnerSelection(bottomPadding, element.getPropertyValue(JRBaseLineBox.PROPERTY_BOTTOM_PADDING), 0);
        UIUtil.setSpinnerSelection(topPadding, element.getPropertyValue(JRBaseLineBox.PROPERTY_TOP_PADDING), 0);
        UIUtil.setSpinnerSelection(leftPadding, element.getPropertyValue(JRBaseLineBox.PROPERTY_LEFT_PADDING), 0);
        UIUtil.setSpinnerSelection(rightPadding, element.getPropertyValue(JRBaseLineBox.PROPERTY_RIGHT_PADDING), 0);
    }
    setRefreshing(false);
}
项目:PDFReporter-Studio    文件:BordersSection.java   
/**
 * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
 *      org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
 */
public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
    super.createControls(parent, tabbedPropertySheetPage);

    Composite mainLayout = new Composite(parent, SWT.NONE);
    mainLayout.setLayout(new GridLayout(1,true));
    mainLayout.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    createPaddingPanel(mainLayout);

    rightPanel = new Group(mainLayout, SWT.NONE);
    rightPanel.setText(Messages.common_borders);
    rightPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    rightPanel.setLayout(new GridLayout(2,false));

    createBorderPreview(rightPanel);

    createStyle(rightPanel, JRBaseLineBox.PROPERTY_PADDING);

    Composite toolBarLayout = new Composite(rightPanel, SWT.NONE);
    toolBarLayout.setLayout(new GridLayout(1,false));
    GridData toolBardGridData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false);
    toolBardGridData.horizontalSpan = 2;
    toolBardGridData.widthHint = 200;
    toolBardGridData.horizontalIndent = 5;
    toolBarLayout.setLayoutData(toolBardGridData);
    Label textLabel = new Label(toolBarLayout,SWT.NONE);
    textLabel.setText(Messages.BordersSection_Default_Label);
    ToolBar toolBar = new ToolBar(toolBarLayout, SWT.FLAT | SWT.WRAP);
    createButtons(toolBar);

    allBorder.setSelection(false);
    noneBorder.setSelection(false);
    leftRightBorder.setSelection(false);
    upDownBorder.setSelection(false);
}
项目:PDFReporter-Studio    文件:BordersSection.java   
@Override
protected void initializeProvidedProperties() {
    super.initializeProvidedProperties();
    addProvidedProperties(JRBaseLineBox.PROPERTY_PADDING, Messages.BordersSection_Padding_Box_Title);
    addProvidedProperties(JRBaseLineBox.PROPERTY_LEFT_PADDING, Messages.BordersSection_Left_Label);
    addProvidedProperties(JRBaseLineBox.PROPERTY_RIGHT_PADDING, Messages.common_right);
    addProvidedProperties(JRBaseLineBox.PROPERTY_TOP_PADDING, Messages.BordersSection_Top_Label);
    addProvidedProperties(JRBaseLineBox.PROPERTY_BOTTOM_PADDING, Messages.common_bottom);
    addProvidedProperties(JRBasePen.PROPERTY_LINE_COLOR, Messages.common_pen_color);
    addProvidedProperties(JRBasePen.PROPERTY_LINE_WIDTH, Messages.common_pen_width);
    addProvidedProperties(JRBasePen.PROPERTY_LINE_STYLE, Messages.common_pen_style);
    addProvidedProperties("BordersDefinitionGroup", Messages.common_borders);
}
项目:PDFReporter-Studio    文件:BordersSection.java   
public IHighlightPropertyWidget getWidgetForProperty(Object propertyId){
    if (propertyId.equals(JRBaseLineBox.PROPERTY_PADDING)) return new ASHighlightControl(checkBoxPadding.getParent(), new BorderHightLight(checkBoxPadding.getParent(), Composite.class));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_LEFT_PADDING)) return new ASHighlightControl(paddingLeft, new BackgroundHighlight(paddingLeft));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_RIGHT_PADDING)) return new ASHighlightControl(paddingRight, new BackgroundHighlight(paddingRight));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_TOP_PADDING)) return new ASHighlightControl(paddingTop, new BackgroundHighlight(paddingTop));
    else if (propertyId.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING)) return new ASHighlightControl(paddingBottom, new BackgroundHighlight(paddingBottom));
    else if (propertyId.equals(JRBasePen.PROPERTY_LINE_COLOR)) return new ASHighlightControl(lineColor.getPaintArea(), new BackgroundHighlight(lineColor.getPaintArea()));
    else if (propertyId.equals(JRBasePen.PROPERTY_LINE_WIDTH)) return new ASHighlightControl(lineWidth, new BackgroundHighlight(lineWidth));
    else if (propertyId.equals(JRBasePen.PROPERTY_LINE_STYLE)) return new ASHighlightControl(lineStyle.getControl(), new BackgroundHighlight(lineStyle.getControl()));
    else if (propertyId.equals("BordersDefinitionGroup")) return new ASHighlightControl(rightPanel, new BorderHightLight(rightPanel, Composite.class));
    return null;
}
项目:PDFReporter-Studio    文件:MGraphicElementLineBox.java   
/**
 * Return the graphical properties for an MGraphicalElementLineBox
 */
public HashSet<String> generateGraphicalProperties(){
    HashSet<String> result = super.generateGraphicalProperties();
    result.add(JRBaseLineBox.PROPERTY_BOTTOM_PADDING);
    result.add(JRBaseLineBox.PROPERTY_LEFT_PADDING);
    result.add(JRBaseLineBox.PROPERTY_PADDING);
    result.add(JRBaseLineBox.PROPERTY_RIGHT_PADDING);
    result.add(JRBaseLineBox.PROPERTY_TOP_PADDING);
    result.add(JRBasePen.PROPERTY_LINE_COLOR);
    result.add(JRBasePen.PROPERTY_LINE_STYLE);
    result.add(JRBasePen.PROPERTY_LINE_WIDTH);
    return result;
}
项目:PDFReporter-Studio    文件:MLineBox.java   
public Object getPropertyValue(Object id) {
    // pen
    JRLineBox lineBox = (JRLineBox) getValue();
    if (lineBox != null) {
        if (id.equals(JRBaseLineBox.PROPERTY_PADDING))
            return lineBox.getOwnPadding();
        if (id.equals(JRBaseLineBox.PROPERTY_LEFT_PADDING))
            return lineBox.getOwnLeftPadding();
        if (id.equals(JRBaseLineBox.PROPERTY_RIGHT_PADDING))
            return lineBox.getOwnRightPadding();
        if (id.equals(JRBaseLineBox.PROPERTY_TOP_PADDING))
            return lineBox.getOwnTopPadding();
        if (id.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING))
            return lineBox.getOwnBottomPadding();
        // ----------------------------------------------------
        if (id.equals(LINE_PEN)) {
                return getLinePen(lineBox);
        }
        if (id.equals(LINE_PEN_TOP)) {
                return getTopLinePen(lineBox);
        }
        if (id.equals(LINE_PEN_BOTTOM)) {
                return getBottomLinePen(lineBox);
        }
        if (id.equals(LINE_PEN_LEFT)) {
                return getLeftLinePen(lineBox);
        }
        if (id.equals(LINE_PEN_RIGHT)) {
                return getRightLinePen(lineBox);
        }
    }
    return null;
}
项目: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   
private static JRLineBox buildBox(Node xmlBoxNode){
    NamedNodeMap boxAttributes = xmlBoxNode.getAttributes();
    Integer padding = getSafeIntValue(boxAttributes.getNamedItem("padding").getNodeValue());
    Integer leftPadding = getSafeIntValue(boxAttributes.getNamedItem("leftPadding").getNodeValue());
    Integer rightPadding = getSafeIntValue(boxAttributes.getNamedItem("rightPadding").getNodeValue());
    Integer bottomPadding = getSafeIntValue(boxAttributes.getNamedItem("bottomPadding").getNodeValue());
    Integer topPadding = getSafeIntValue(boxAttributes.getNamedItem("topPadding").getNodeValue());

    JRBaseLineBox result = new JRBaseLineBox(null);
    result.setPadding(padding);
    result.setTopPadding(topPadding);
    result.setBottomPadding(bottomPadding);
    result.setLeftPadding(leftPadding);
    result.setRightPadding(rightPadding);

    Node firstChild = xmlBoxNode.getFirstChild();
    while(firstChild!=null){
        if (firstChild.getNodeName().equals("pen")){
            buildPen(firstChild, result.getPen());
        } else if (firstChild.getNodeName().equals("leftPen")) {
            buildPen(firstChild, result.getLeftPen());
        } else if (firstChild.getNodeName().equals("rightPen")) {
            buildPen(firstChild, result.getRightPen());
        } else if (firstChild.getNodeName().equals("topPen")) {
            buildPen(firstChild, result.getTopPen());
        } else if (firstChild.getNodeName().equals("bottomPen")) {
            buildPen(firstChild, result.getBottomPen());
        } 
        firstChild = firstChild.getNextSibling();
    }
    return result;
}
项目: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    文件:ElementNode.java   
public ElementNode(JasperDesign jd, JRDesignElement element, Children children, Index index, Lookup doLkp)
{
    super (children, index, new ProxyLookup( doLkp, Lookups.fixed(jd,element)));
    elemenNameVisitor = new ElementNameVisitor(jd);
    this.jd = jd;
    this.element = element;

    element.getEventSupport().addPropertyChangeListener(this);

    IReportManager.getPreferences().addPreferenceChangeListener(new WeakPreferenceChangeListener(this,IReportManager.getInstance().getPreferences()));

    if (element instanceof JRDesignGraphicElement)
    {
        JRDesignGraphicElement gele = (JRDesignGraphicElement)element;
        ((JRBasePen)gele.getLinePen()).getEventSupport().addPropertyChangeListener(this);
    }

    if (element instanceof JRBoxContainer)
    {
        JRBoxContainer boxcontainer = (JRBoxContainer)element;
        JRBaseLineBox baseBox = (JRBaseLineBox)boxcontainer.getLineBox();
        baseBox.getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getTopPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getBottomPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getLeftPen()).getEventSupport().addPropertyChangeListener(this);
        ((JRBasePen)baseBox.getRightPen()).getEventSupport().addPropertyChangeListener(this);
    }

    if (element instanceof JRDesignTextElement)
    {
        ((JRBaseParagraph)((JRDesignTextElement)element).getParagraph()).getEventSupport().addPropertyChangeListener(this);

    }

}
项目:ireport-fork    文件:JRDesignImageWidget.java   
@Override
public void propertyChange(PropertyChangeEvent evt) {

    String propertyName = evt.getPropertyName();
    if (propertyName == null) return;

    if (propertyName.equals( JRDesignElement.PROPERTY_HEIGHT) ||
        propertyName.equals( JRDesignElement.PROPERTY_WIDTH) ||
        propertyName.equals( JRBaseStyle.PROPERTY_BACKCOLOR) ||
        propertyName.equals( JRBaseStyle.PROPERTY_FORECOLOR) ||
        propertyName.equals( JRDesignElement.PROPERTY_PARENT_STYLE) ||
        propertyName.equals( JRDesignElement.PROPERTY_PARENT_STYLE_NAME_REFERENCE) ||
        propertyName.equals( JRBaseStyle.PROPERTY_MODE ) ||
        //FIXME propertyName.equals( JRDesignGraphicElement.PROPERTY_PEN) ||
        propertyName.equals( JRBaseStyle.PROPERTY_FILL) ||
        propertyName.equals( JRBaseStyle.PROPERTY_HORIZONTAL_ALIGNMENT) ||
        propertyName.equals( JRBaseStyle.PROPERTY_VERTICAL_ALIGNMENT) ||
        propertyName.equals( JRBaseStyle.PROPERTY_SCALE_IMAGE) ||
        propertyName.equals( JRDesignTextField.PROPERTY_EXPRESSION) ||
        propertyName.equals("pen") ||           // Special property fired by the property sheet
        propertyName.equals("linebox") ||       // Special property fired by the property sheet
        propertyName.equals(JRBasePen.PROPERTY_LINE_COLOR) ||
        propertyName.equals(JRBasePen.PROPERTY_LINE_STYLE) ||
        propertyName.equals(JRBasePen.PROPERTY_LINE_WIDTH) ||
        propertyName.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
        propertyName.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
        propertyName.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING) ||
        propertyName.equals(JRBaseLineBox.PROPERTY_BOTTOM_PADDING)
        )
    {
        // Schedule a repoaint in 3 secs...
        if (running) return;
        Thread t = new Thread(this);
        t.start();
    }

    super.propertyChange(evt);
}
项目:jasperreports    文件:CrosstabConverter.java   
/**
     * 
     */
    private JRPrintFrame getCrosstabCellFrame(
        ReportConverter reportConverter,
        JRCellContents cell, 
        int x, 
        int y, 
        boolean left, 
        boolean right, 
        boolean top
        )
    {
        JRBasePrintFrame frame = new JRBasePrintFrame(cell.getDefaultStyleProvider());
        //frame.setUUID(cell.getUUID());
        frame.setX(x);
        frame.setY(y);
        frame.setWidth(cell.getWidth());
        frame.setHeight(cell.getHeight());

        frame.setMode(cell.getModeValue());
        frame.setBackcolor(cell.getBackcolor());
        frame.setStyle(reportConverter.resolveStyle(cell));

        JRLineBox box = cell.getLineBox();
        if (box != null)
        {
            frame.copyBox(box);

            boolean copyLeft = left && box.getLeftPen().getLineWidth().floatValue() <= 0f && box.getRightPen().getLineWidth().floatValue() > 0f;
            boolean copyRight = right && box.getRightPen().getLineWidth().floatValue() <= 0f && box.getLeftPen().getLineWidth().floatValue() > 0f;
            boolean copyTop = top && box.getTopPen().getLineWidth().floatValue() <= 0f && box.getBottomPen().getLineWidth().floatValue() > 0f;

            if (copyLeft)
            {
                ((JRBaseLineBox)frame.getLineBox()).copyLeftPen(box.getRightPen());
            }

            if (copyRight)
            {
                ((JRBaseLineBox)frame.getLineBox()).copyRightPen(box.getLeftPen());
            }

            if (copyTop)
            {
                ((JRBaseLineBox)frame.getLineBox()).copyTopPen(box.getBottomPen());
            }
        }

//      List children = cell.getChildren();
//      if (children != null)
//      {
//          for (Iterator it = children.iterator(); it.hasNext();)
//          {
//              JRChild child = (JRChild) it.next();
//              if (child instanceof JRElement)
//              {
//                  frame.addElement((JRElement) child);
//              }
//              else if (child instanceof JRElementGroup)
//              {
//                  frame.addElementGroup((JRElementGroup) child);
//              }
//          }
//      }
        List<JRChild> children = cell.getChildren();
        if (children != null && children.size() > 0)
        {
            ConvertVisitor convertVisitor = new ConvertVisitor(reportConverter, frame);
            for(int i = 0; i < children.size(); i++)
            {
                children.get(i).visit(convertVisitor);
            }
        }

        return frame;
    }
项目:jasperreports    文件:JROdsExporter.java   
@Override
    protected void exportLine(
        JRPrintLine line, 
        JRExporterGridCell gridCell,
        int colIndex, 
        int rowIndex
        ) throws JRException 
    {
        JRLineBox box = new JRBaseLineBox(null);
        JRPen pen = null;
        float ratio = line.getWidth() / line.getHeight();
        if (ratio > 1)
        {
            if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
            {
                pen = box.getTopPen();
            }
            else
            {
                pen = box.getBottomPen();
            }
        }
        else
        {
            if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
            {
                pen = box.getLeftPen();
            }
            else
            {
                pen = box.getRightPen();
            }
        }
        pen.setLineColor(line.getLinePen().getLineColor());
        pen.setLineStyle(line.getLinePen().getLineStyleValue());
        pen.setLineWidth(line.getLinePen().getLineWidth());

        gridCell.setBox(box);//CAUTION: only some exporters set the cell box

        tableBuilder.buildCellHeader(styleCache.getCellStyle(gridCell), gridCell.getColSpan(), gridCell.getRowSpan());

//      double x1, y1, x2, y2;
//
//      if (line.getDirection() == JRLine.DIRECTION_TOP_DOWN)
//      {
//          x1 = Utility.translatePixelsToInches(0);
//          y1 = Utility.translatePixelsToInches(0);
//          x2 = Utility.translatePixelsToInches(line.getWidth() - 1);
//          y2 = Utility.translatePixelsToInches(line.getHeight() - 1);
//      }
//      else
//      {
//          x1 = Utility.translatePixelsToInches(0);
//          y1 = Utility.translatePixelsToInches(line.getHeight() - 1);
//          x2 = Utility.translatePixelsToInches(line.getWidth() - 1);
//          y2 = Utility.translatePixelsToInches(0);
//      }

        tempBodyWriter.write("<text:p>");
//FIXMEODS      insertPageAnchor();
//      tempBodyWriter.write(
//              "<draw:line text:anchor-type=\"paragraph\" "
//              + "draw:style-name=\"" + styleCache.getGraphicStyle(line) + "\" "
//              + "svg:x1=\"" + x1 + "in\" "
//              + "svg:y1=\"" + y1 + "in\" "
//              + "svg:x2=\"" + x2 + "in\" "
//              + "svg:y2=\"" + y2 + "in\">"
//              //+ "</draw:line>"
//              + "<text:p/></draw:line>"
//              );
        tempBodyWriter.write("</text:p>");
        tableBuilder.buildCellFooter();
    }
项目:jasperreports    文件:JRDocxExporter.java   
/**
 *
 */
protected void exportLine(DocxTableHelper tableHelper, JRPrintLine line, JRExporterGridCell gridCell)
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = null;
    float ratio = line.getWidth() / line.getHeight();
    if (ratio > 1)
    {
        if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
        {
            pen = box.getTopPen();
        }
        else
        {
            pen = box.getBottomPen();
        }
    }
    else
    {
        if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
        {
            pen = box.getLeftPen();
        }
        else
        {
            pen = box.getRightPen();
        }
    }
    pen.setLineColor(line.getLinePen().getLineColor());
    pen.setLineStyle(line.getLinePen().getLineStyleValue());
    pen.setLineWidth(line.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    tableHelper.getCellHelper().exportHeader(line, gridCell);
    tableHelper.getParagraphHelper().exportEmptyParagraph(startPage, bookmarkIndex, pageAnchor);
    if (startPage)
    {
        // increment the bookmarkIndex for the first cell in the sheet, due to page anchor creation
        bookmarkIndex++;
    }
    tableHelper.getCellHelper().exportFooter();
}
项目:jasperreports    文件:JRXlsxExporter.java   
@Override
protected void exportLine(
    JRPrintLine line, 
    JRExporterGridCell gridCell,
    int colIndex, 
    int rowIndex
    ) throws JRException 
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = null;
    LineDirectionEnum direction = null;
    float ratio = line.getWidth() / line.getHeight();
    if (ratio > 1)
    {
        if(line.getHeight() > 1)
        {
            direction = line.getDirectionValue();
            pen = box.getPen();
        }
        else if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
        {
            pen = box.getTopPen();
        }
        else
        {
            pen = box.getBottomPen();
        }
    }
    else
    {
        if(line.getWidth() > 1)
        {
            direction = line.getDirectionValue();
            pen = box.getPen();
        }
        else if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
        {
            pen = box.getLeftPen();
        }
        else
        {
            pen = box.getRightPen();
        }
    }
    pen.setLineColor(line.getLinePen().getLineColor());
    pen.setLineStyle(line.getLinePen().getLineStyleValue());
    pen.setLineWidth(line.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    cellHelper.exportHeader(gridCell, rowIndex, colIndex, maxColumnIndex, sheetInfo, direction);
    sheetHelper.exportMergedCells(rowIndex, colIndex, maxColumnIndex, gridCell.getRowSpan(), gridCell.getColSpan());
    cellHelper.exportFooter();
}
项目:jasperreports    文件:IconLabelComponent.java   
public IconLabelComponent(JRDefaultStyleProvider defaultStyleProvider) 
{
    lineBox = new JRBaseLineBox(this);
    labelTextField = new JRDesignTextField(defaultStyleProvider);
    iconTextField = new JRDesignTextField(defaultStyleProvider);
}
项目:jasperreports    文件:DesignCell.java   
public DesignCell()
{
    this.box = new JRBaseLineBox(this);
}
项目:jasperreports    文件:CompiledCell.java   
public CompiledCell()
{
    super();

    box = new JRBaseLineBox(this);
}