Java 类net.sf.jasperreports.engine.JRBoxContainer 实例源码

项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
public JRStyle getBaseStyle(JRLineBox box)
{
    if (box != null)
    {
        JRBoxContainer boxContainer = box.getBoxContainer();

        if (boxContainer instanceof JRStyle)
        {
            return getBaseStyle((JRStyle)boxContainer);
        }

        return getBaseStyle(boxContainer);
    }
    return null;
}
项目:PDFReporter-Studio    文件:MGraphicElementLineBox.java   
@Override
public void trasnferProperties(JRElement target){
    super.trasnferProperties(target);

    JRLineBox jrSourceBox = (JRLineBox) getBoxContainer().getLineBox();
    if (jrSourceBox != null && target instanceof JRBoxContainer){
        JRLineBox jrTargetBox = ((JRBoxContainer) target).getLineBox();

        jrTargetBox.setPadding(jrSourceBox.getOwnPadding());
        jrTargetBox.setTopPadding(jrSourceBox.getOwnTopPadding());
        jrTargetBox.setBottomPadding(jrSourceBox.getOwnBottomPadding());
        jrTargetBox.setLeftPadding(jrSourceBox.getOwnLeftPadding());
        jrTargetBox.setRightPadding(jrSourceBox.getOwnRightPadding());

        transferLinePenProeprties(jrTargetBox.getPen(), jrSourceBox.getPen());
        transferLinePenProeprties(jrTargetBox.getLeftPen(), jrSourceBox.getLeftPen());
        transferLinePenProeprties(jrTargetBox.getRightPen(), jrSourceBox.getRightPen());
        transferLinePenProeprties(jrTargetBox.getTopPen(), jrSourceBox.getTopPen());
        transferLinePenProeprties(jrTargetBox.getBottomPen(), jrSourceBox.getBottomPen());
    }
}
项目:PDFReporter-Studio    文件:CustomStyleResolver.java   
private static void copyIntheritedLineBox(JRDesignElement target, JRStyle style){
    JRLineBox styleBox = style.getLineBox();
    if (styleBox != null && target instanceof JRBoxContainer){
        JRLineBox jrTargetBox = ((JRBoxContainer) target).getLineBox();
        if (jrTargetBox.getOwnPadding() == null) jrTargetBox.setPadding(getPadding(styleBox));
        if (jrTargetBox.getOwnTopPadding() == null) jrTargetBox.setTopPadding(getTopPadding(styleBox));
        if (jrTargetBox.getOwnBottomPadding() == null) jrTargetBox.setBottomPadding(getBottomPadding(styleBox));
        if (jrTargetBox.getOwnLeftPadding() == null) jrTargetBox.setLeftPadding(getLeftPadding(styleBox));
        if (jrTargetBox.getOwnRightPadding() == null) jrTargetBox.setRightPadding(getRightPadding(styleBox));

        inheritLinePenProeprties(jrTargetBox.getPen(), styleBox.getPen());
        inheritLinePenProeprties(jrTargetBox.getLeftPen(), styleBox.getLeftPen());
        inheritLinePenProeprties(jrTargetBox.getRightPen(), styleBox.getRightPen());
        inheritLinePenProeprties(jrTargetBox.getTopPen(), styleBox.getTopPen());
        inheritLinePenProeprties(jrTargetBox.getBottomPen(), styleBox.getBottomPen());
    }
}
项目: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    文件:PaddingAndBordersAction.java   
protected boolean enable(org.openide.nodes.Node[] activatedNodes) {
    if (activatedNodes == null || activatedNodes.length == 0) return false;

    // Check if all the elements are a JRBoxContainer
    for (int i=0; i<activatedNodes.length; ++i)
    {
            if (activatedNodes[i] instanceof ElementNode && ((ElementNode)activatedNodes[i]).getElement() instanceof JRBoxContainer)
            {
                continue;
            }

            if (activatedNodes[i] instanceof CellNode)
            {
                continue;
            }
            return false;
    }
    return true;
}
项目:kfs    文件:TravelReportFactoryServiceImpl.java   
protected TravelReportLineBox(JRBoxContainer container) {
    super(container);

    final JRBaseBoxPen pen = new JRBaseBoxPen(this) {
            @Override
            public Color getLineColor() {
                return BLACK;
            }

            @Override
            public Byte getLineStyle() {
                return LINE_STYLE_SOLID;
            }

            @Override
            public Float getLineWidth() {
                return 0.5f;
            }
        };

    this.pen = pen;
}
项目:jasperreports    文件:JRBaseLineBox.java   
/**
 *
 */
public JRBaseLineBox(JRBoxContainer boxContainer)
{
    this.boxContainer = boxContainer;

    pen = new JRBaseBoxPen(this);
    topPen = new JRBaseBoxTopPen(this);
    leftPen = new JRBaseBoxLeftPen(this);
    bottomPen = new JRBaseBoxBottomPen(this);
    rightPen = new JRBaseBoxRightPen(this);
}
项目:jasperreports    文件:ConvertVisitor.java   
/**
 *
 */
protected void addContour(ReportConverter reportConverter, JRBasePrintFrame frame, JRPrintElement element)
{
    if (frame != null)
    {
        boolean hasContour = false;
        JRLineBox box = element instanceof JRBoxContainer ? ((JRBoxContainer)element).getLineBox() : null; 
        if (box == null)
        {
            JRPrintGraphicElement graphicElement = element instanceof JRPrintGraphicElement ? (JRPrintGraphicElement)element : null;
            hasContour = (graphicElement == null) || graphicElement.getLinePen().getLineWidth().floatValue() <= 0f; 
        }
        else
        {
            hasContour = 
                box.getTopPen().getLineWidth().floatValue() <= 0f 
                && box.getLeftPen().getLineWidth().floatValue() <= 0f 
                && box.getRightPen().getLineWidth().floatValue() <= 0f 
                && box.getBottomPen().getLineWidth().floatValue() <= 0f;
        }

        if (hasContour)
        {
            JRBasePrintRectangle rectangle = new JRBasePrintRectangle(reportConverter.getDefaultStyleProvider());
            rectangle.setUUID(element.getUUID());
            rectangle.setX(element.getX());
            rectangle.setY(element.getY());
            rectangle.setWidth(element.getWidth());
            rectangle.setHeight(element.getHeight());
            rectangle.getLinePen().setLineWidth(0.1f);
            rectangle.getLinePen().setLineStyle(LineStyleEnum.DASHED);
            rectangle.getLinePen().setLineColor(ReportConverter.GRID_LINE_COLOR);
            rectangle.setMode(ModeEnum.TRANSPARENT);
            frame.addElement(rectangle);
        }
    }
}
项目:jasperreports    文件:JRBoxFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRBoxContainer boxContainer = (JRBoxContainer) digester.peek();
    JRLineBox box = boxContainer.getLineBox();
    setBoxAttributes(atts, box);
    return box;
}
项目:jasperreports    文件:StyleUtil.java   
public boolean hasBox(JRBoxContainer boxContainer)
{
    return hasBorder(boxContainer, RIGHT_SIDE)
            || hasBorder(boxContainer, TOP_SIDE)
            || hasBorder(boxContainer, LEFT_SIDE)
            || hasBorder(boxContainer, BOTTOM_SIDE)
            || hasPadding(boxContainer, RIGHT_SIDE)
            || hasPadding(boxContainer, TOP_SIDE)
            || hasPadding(boxContainer, LEFT_SIDE)
            || hasPadding(boxContainer, BOTTOM_SIDE);
}
项目:jasperreports    文件:StyleUtil.java   
protected boolean hasBorder(JRBoxContainer boxContainer, BoxSideSelector selector)
{
    JRLineBox lineBox = boxContainer.getLineBox();
    Float rightLineWidth = selector.getPen(lineBox).getOwnLineWidth();
    if (rightLineWidth != null)
    {
        return rightLineWidth > .0f;
    }

    Float lineWidth = lineBox.getPen().getOwnLineWidth();
    if (lineWidth != null)
    {
        return lineWidth > .0f;
    }

    JRStyle style = boxContainer.getStyle();
    if (style != null)
    {
        return hasBorder(style, selector);
    }

    String styleReference = boxContainer.getStyleNameReference();
    if (styleReference != null)
    {
        // we can't resolve the style reference, return pessimistically
        return true;
    }

    return false;
}
项目:jasperreports    文件:StyleUtil.java   
protected boolean hasPadding(JRBoxContainer boxContainer, BoxSideSelector penSelector)
{
    JRLineBox lineBox = boxContainer.getLineBox();
    Integer sidePadding = penSelector.getPadding(lineBox);
    if (sidePadding != null)
    {
        return sidePadding > 0;
    }

    Integer padding = lineBox.getOwnPadding();
    if (padding != null)
    {
        return padding > 0;
    }

    JRStyle style = boxContainer.getStyle();
    if (style != null)
    {
        return hasPadding(style, penSelector);
    }

    String styleReference = boxContainer.getStyleNameReference();
    if (styleReference != null)
    {
        // we can't resolve the style reference, return pessimistically
        return true;
    }

    return false;
}
项目:jasperreports    文件:JRXlsMetadataExporter.java   
public BoxStyle(JRPrintElement element) {
    if(element != null)
    {
        if (element instanceof JRBoxContainer) {
            setBox(((JRBoxContainer)element).getLineBox());
        }
        if (element instanceof JRCommonGraphicElement) {
            setPen(((JRCommonGraphicElement)element).getLinePen());
        }
    }
}
项目:jasperreports    文件:Tabulator.java   
@Override
public TableCell visit(ElementCell cell, TablePosition position)
{
    JRPrintElement element = getCellElement(cell);
    int colSpan = getColumnCellSpan(position, cell).span;
    int rowSpan = getRowCellSpan(position, cell).span;
    Color backcolor = getElementBackcolor(cell);

    JRLineBox elementBox = (element instanceof JRBoxContainer) ? ((JRBoxContainer) element).getLineBox() : null;
    JRLineBox box = copyParentBox(cell, element, elementBox, true, true, true, true);

    TableCell tableCell = new TableCell(Tabulator.this, position, cell, element, colSpan, rowSpan, backcolor, box);
    return tableCell;
}
项目:PDFReporter-Studio    文件:MCell.java   
public Object getPropertyValue(Object id) {
    JRDesignCellContents jrElement = getValue();
    if (jrElement != null) {
        if (id.equals(JRBaseStyle.PROPERTY_MODE))
            return opaqueD.getEnumValue(jrElement.getModeValue());
        if (id.equals(JRBaseStyle.PROPERTY_BACKCOLOR))
            return Colors.getSWTRGB4AWTGBColor(jrElement.getBackcolor());
        if (id.equals(JRDesignCellContents.PROPERTY_STYLE)) {
            if (jrElement.getStyleNameReference() != null)
                return jrElement.getStyleNameReference();
            if (jrElement.getStyle() != null)
                return jrElement.getStyle().getName();
            return ""; //$NON-NLS-1$
        }
        if (id.equals(JRDesignCrosstabCell.PROPERTY_WIDTH))
            return jrElement.getWidth();
        if (id.equals(JRDesignCrosstabCell.PROPERTY_HEIGHT))
            return jrElement.getHeight();
        if (id.equals(LINE_BOX)) {
            JRBoxContainer jrGraphicElement = (JRBoxContainer) getValue();
            if (lineBox == null) {
                lineBox = new MLineBox(jrGraphicElement.getLineBox());
                lineBox.getPropertyChangeSupport().addPropertyChangeListener(this);
            }
            return lineBox;
        }
        if (id.equals(MGraphicElement.PROPERTY_MAP)) {
            // to avoid duplication I remove it first
            return jrElement.getPropertiesMap().cloneProperties();
        }
    }
    return null;
}
项目:PDFReporter-Studio    文件:MCell.java   
@Override
public Object getPropertyValue(Object id) {
    if (cell != null) {
        if (id.equals(DesignCell.PROPERTY_STYLE)) {
            if (cell.getStyleNameReference() != null)
                return cell.getStyleNameReference();
            if (cell.getStyle() != null)
                return cell.getStyle().getName();
            return ""; //$NON-NLS-1$
        }

        if (id.equals(DesignCell.PROPERTY_HEIGHT))
            return cell.getHeight();
        if (id.equals(DesignCell.PROPERTY_ROW_SPAN))
            return cell.getRowSpan();
        if (id.equals(LINE_BOX)) {
            JRBoxContainer jrGraphicElement = (JRBoxContainer) cell;
            if (lineBox == null) {
                lineBox = new MLineBox(jrGraphicElement.getLineBox());
                setChildListener(lineBox);
            }
            return lineBox;
        }
        if (id.equals(MGraphicElement.PROPERTY_MAP)) {
            // to avoid duplication I remove it first
            JRPropertiesMap pmap = cell.getPropertiesMap();
            return pmap;
        }
    }
    return super.getPropertyValue(id);
}
项目:PDFReporter-Studio    文件:MGraphicElementLineBox.java   
private MLineBox getLineBox(){
    JRBoxContainer jrGraphicElement = (JRBoxContainer) getValue();
    if (lineBox == null) {
        lineBox = new MLineBox(jrGraphicElement.getLineBox());
        setChildListener(lineBox);
    }
    return lineBox;
}
项目:PDFReporter-Studio    文件:FrameFigure.java   
/**
 * Gets the line box.
 * 
 * @return the line box
 */
protected JRLineBox getLineBox() {
    JRElement jrElement = getJrElement();
    JRLineBox box = null;
    if (jrElement != null) {
        if (jrElement instanceof JRBoxContainer)
            box = ((JRBoxContainer) jrElement).getLineBox();
        if (box == null && jrElement.getStyle() != null)
            box = jrElement.getStyle().getLineBox();
    } else {
        box = null;
    }
    return box;
}
项目: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    文件:JRLineBoxProperty.java   
@SuppressWarnings("unchecked")
public JRLineBoxProperty(JRBoxContainer container)
{
   super(JRLineBox.class, container.getLineBox());
   setName("linebox");
   setDisplayName(I18n.getString("JRLineBoxProperty.Paddingandborders"));
   setShortDescription(I18n.getString("JRLineBoxProperty.Paddingandborders"));
   setValue("canEditAsText", Boolean.FALSE);
   this.container = container;
}
项目:jasperreports    文件:JRBaseLineBox.java   
@Override
public JRBoxContainer getBoxContainer()
{
    return boxContainer;
}
项目:jasperreports    文件:JRGridLayout.java   
protected void setGridElement(JRPrintElement element, PrintElementIndex parentIndex, int elementIndex,
        int row1, int col1, int row2, int col2)
{
    yCuts.addUsage(row1, Cut.USAGE_NOT_EMPTY);
    xCuts.addUsage(col1, Cut.USAGE_NOT_EMPTY);

    int rowSpan = nature.isSpanCells() ? row2 - row1 : 1;
    int colSpan = nature.isSpanCells() ? col2 - col1 : 1;

    JRExporterGridCell gridCell = new ElementGridCell(
            this,
            parentIndex,
            elementIndex,
            cellSize(
                    element.getWidth(),
                    element.getHeight(),
                    colSpan,
                    rowSpan
            ));

    nature.setXProperties(xCuts, element, row1, col1, row2, col2);
    nature.setYProperties(yCuts, element, row1, col1, row2, col2);

    if (nature.isSpanCells())
    {
        OccupiedGridCell occupiedGridCell = new OccupiedGridCell(gridCell);
        for (int row = row1; row < row2; row++)
        {
            for (int col = col1; col < col2; col++)
            {
                grid.set(row, col, occupiedGridCell);
            }
            yCuts.addUsage(row, Cut.USAGE_SPANNED);
        }

        for (int col = col1; col < col2; col++)
        {
            xCuts.addUsage(col, Cut.USAGE_SPANNED);
        }
    }

    if (col2 - col1 != 0 && row2 - row1 != 0)
    {
        JRLineBox box = (element instanceof JRBoxContainer)?((JRBoxContainer)element).getLineBox():null;
        gridCell.setStyle(cellStyle(null, null, box));

        if (nature.isBreakBeforeRow(element))
        {
            yCuts.addUsage(row1,  Cut.USAGE_BREAK);
        }
        if (nature.isBreakAfterRow(element))
        {
            yCuts.addUsage(row1 + rowSpan,  Cut.USAGE_BREAK);
        }

        grid.set(row1, col1, gridCell);
    }
}
项目:jasperreports    文件:CachingLineBox.java   
@Override
public JRBoxContainer getBoxContainer()
{
    return base.getBoxContainer();
}
项目:jasperreports    文件:CachingLineBox.java   
@Override
public JRLineBox clone(JRBoxContainer boxContainer)
{
    // cloning the base line box
    return base.clone(boxContainer);
}
项目:PDFReporter-Studio    文件:MCell.java   
public JRBoxContainer getBoxContainer() {
    return (JRBoxContainer) getValue();
}
项目:PDFReporter-Studio    文件:MCell.java   
public JRBoxContainer getBoxContainer() {
    return cell;
}
项目:PDFReporter-Studio    文件:MGraphicElementLineBox.java   
public JRBoxContainer getBoxContainer() {
    return (JRBoxContainer) getValue();
}
项目:ireport-fork    文件:JRDesignElementWidget.java   
public JRDesignElementWidget(AbstractReportObjectScene scene, JRDesignElement element) {
    super(scene);
    this.element = element;
    setBorder(new SimpleLineBorder(this));
    updateBounds();

    try {
        if (crosstabImage == null) crosstabImage = new javax.swing.ImageIcon(getClass().getResource("/com/jaspersoft/ireport/designer/resources/crosstab-32.png"));
        if (subreportImage == null) subreportImage = new javax.swing.ImageIcon(getClass().getResource("/com/jaspersoft/ireport/designer/resources/subreport-32.png"));
        if (multiaxisImage == null) multiaxisImage = new javax.swing.ImageIcon(getClass().getResource("/com/jaspersoft/ireport/designer/resources/chartaxis-32.png"));
        if (genericElementImage == null) genericElementImage = new javax.swing.ImageIcon(getClass().getResource("/com/jaspersoft/ireport/designer/resources/genericelement-48.png"));
    } catch (Exception ex) {  }

    selectionWidget = new SelectionWidget(scene, this);
    notifyStateChanged(null, ObjectState.createNormal());
    selectionWidget.addDependency(new Dependency() {

        public void revalidateDependency() {
            //setPreferredLocation(selectionWidget.getPreferredLocation() );
            //setPreferredBounds(selectionWidget.getPreferredBounds());
            //System.out.println("Revaludated");
        }
    });

    element.getEventSupport().addPropertyChangeListener(this);

    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);

    }
}
项目:PDFReporter-Studio    文件:ILineBox.java   
public JRBoxContainer getBoxContainer();