Java 类net.sf.jasperreports.engine.type.OrientationEnum 实例源码

项目:jasperreports    文件:JRBaseReport.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    styleResolver = StyleResolver.getInstance();

    if (detail != null)
    {
        detailSection = new JRBaseSection(detail);
        detail = null;
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        whenNoDataTypeValue = WhenNoDataTypeEnum.getByValue(whenNoDataType);
        printOrderValue = PrintOrderEnum.getByValue(printOrder);
        orientationValue = OrientationEnum.getByValue(orientation);
    }
}
项目:jasperreports    文件:JRPdfExporter.java   
protected void addBookmark(int level, String title, int x, int y)
{
    Bookmark parent = bookmarkStack.peek();
    // searching for parent
    while(parent.level >= level)
    {
        bookmarkStack.pop();
        parent = bookmarkStack.peek();
    }

    if (!getCurrentItemConfiguration().isCollapseMissingBookmarkLevels())
    {
        // creating empty bookmarks in order to preserve the bookmark level
        for (int i = parent.level + 1; i < level; ++i)
        {
            Bookmark emptyBookmark = new Bookmark(parent, parent.pdfOutline.getPdfDestination(), EMPTY_BOOKMARK_TITLE);
            bookmarkStack.push(emptyBookmark);
            parent = emptyBookmark;
        }
    }
    int height = OrientationEnum.PORTRAIT.equals(pageFormat.getOrientation()) 
            ? pageFormat.getPageHeight() - y 
            : y;
    Bookmark bookmark = new Bookmark(parent, x, height, title);
    bookmarkStack.push(bookmark);
}
项目:jasperreports    文件:JRPdfExporter.java   
protected void setAnchor(Chunk chunk, JRPrintAnchor anchor, JRPrintElement element)
{
    String anchorName = anchor.getAnchorName();
    if (anchorName != null)
    {
        chunk.setLocalDestination(anchorName);

        if (anchor.getBookmarkLevel() != JRAnchor.NO_BOOKMARK)
        {
            int x = OrientationEnum.PORTRAIT.equals(pageFormat.getOrientation()) 
                    ? getOffsetX() + element.getX() 
                    : getOffsetY() + element.getY();
            int y = OrientationEnum.PORTRAIT.equals(pageFormat.getOrientation()) 
                    ? getOffsetY() + element.getY() 
                    : getOffsetX() + element.getX();
            addBookmark(anchor.getBookmarkLevel(), anchor.getAnchorName(), x, y);
        }
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 *
 */
protected void exportPart(Integer pageIndex, PrintPart part) throws JRException, IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_part);

    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_pageIndex, pageIndex);
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, part.getName());
    PrintPageFormat pageFormat = part.getPageFormat();
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_pageWidth, pageFormat.getPageWidth());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_pageHeight, pageFormat.getPageHeight());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_topMargin, pageFormat.getTopMargin());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_leftMargin, pageFormat.getLeftMargin());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_bottomMargin, pageFormat.getBottomMargin());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_rightMargin, pageFormat.getRightMargin());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_orientation, pageFormat.getOrientation(), OrientationEnum.PORTRAIT);

    xmlWriter.closeElement();
}
项目:ireport-fork    文件:PageFormatPanel.java   
public void setJasperDesign(JasperDesign jd)
{
    this.jasperDesign = jd;
    boolean old = setUpdating(true);
    jSpinnerColumns.setValue(jd.getColumnCount());
    multiUnitNumberEditorWidth.setValue( jd.getPageWidth() );
    multiUnitNumberEditorHeight.setValue(jd.getPageHeight());
    multiUnitNumberEditorMarginaTop.setValue(jd.getTopMargin());
    multiUnitNumberEditorMarginBottom.setValue(jd.getBottomMargin());
    multiUnitNumberEditorMarginLeft.setValue(jd.getLeftMargin());
    multiUnitNumberEditorMarginRight.setValue(jd.getRightMargin());
    multiUnitNumberEditorColumnWidth.setValue( jd.getColumnWidth() );
    multiUnitNumberEditorcolumnSpace.setValue(jd.getColumnSpacing());

    jRadioLandscape.setSelected(  jd.getOrientationValue() == OrientationEnum.LANDSCAPE );
    jRadioPortrait.setSelected(  jd.getOrientationValue() == OrientationEnum.PORTRAIT );

    Misc.setComboboxSelectedTagValue(jComboBoxFormat, PageSize.deductPageFormat(jd.getPageWidth(), jd.getPageHeight()));
    setUpdating(old);
    updatePreview();

}
项目:com.opendoorlogistics    文件:ReportBuilderUtils.java   
static JasperDesign createEmpty(String tablename, int pageWidth, int pageHeight, boolean margins) {
    JasperDesign ret = new JasperDesign();
    ret.setName(Strings.removeExportIllegalChars(AppConstants.ORG_NAME + " - " + tablename));
    ret.setWhenNoDataType(WhenNoDataTypeEnum.ALL_SECTIONS_NO_DETAIL);
    ret.setWhenResourceMissingType(WhenResourceMissingTypeEnum.EMPTY);
    ret.setOrientation(OrientationEnum.LANDSCAPE);
    ret.setPageWidth(pageWidth);
    ret.setPageHeight(pageHeight);

    if (!margins) {
        ret.setLeftMargin(0);
        ret.setRightMargin(0);
        ret.setTopMargin(0);
        ret.setBottomMargin(0);
    }

    ret.setColumnWidth(Math.min(getAvailableWidth(ret), ret.getColumnWidth()));

    return ret;
}
项目:dynamicreports-jasper    文件:Report1Test.java   
@Override
public void test() {
    super.test();

    numberOfPagesTest(1);
    columnTitleCountTest(column1, 0);
    columnDetailCountTest(column1, 0);

    elementCountTest("title.textField1", 3);
    elementValueTest("title.textField1", "bundleKey3", "bundleKey3", "bundleValue");

    FontUtil fontUtil = FontUtil.getInstance(DefaultJasperReportsContext.getInstance());
    Assert.assertFalse("fonts", fontUtil.getFontFamilyNames().isEmpty());

    JasperPrint jasperPrint = getJasperPrint();
    Assert.assertEquals("Report", jasperPrint.getName());
    Assert.assertEquals(OrientationEnum.LANDSCAPE, jasperPrint.getOrientationValue());
    Assert.assertEquals(1190, jasperPrint.getPageWidth());
    Assert.assertEquals(842, jasperPrint.getPageHeight());

    Assert.assertEquals(50, scriptlet.count);
}
项目:jasperreports    文件:JasperPrint.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        orientationValue = OrientationEnum.getByValue(orientation);
    }
}
项目:jasperreports    文件:JasperDesign.java   
/**
 * Sets the report orientation.
 * @see net.sf.jasperreports.engine.JRReport ORIENTATION_PORTRAIT,
 * @see net.sf.jasperreports.engine.JRReport ORIENTATION_LANDSCAPE
 */
public void setOrientation(OrientationEnum orientationValue)
{
    Object old = this.orientationValue;
    this.orientationValue = orientationValue;
    getEventSupport().firePropertyChange(PROPERTY_ORIENTATION, old, this.orientationValue);
}
项目:PDFReporter-Studio    文件:PageFormatDialog.java   
private void setJasperDesign(JasperDesign jd) {
    ignoreEvents = true;
    pheigh.setValue(jd.getPageHeight());
    pwidth.setValue(jd.getPageWidth());
    String format = PageSize.deductPageFormat(jd.getPageWidth(), jd.getPageHeight());
    pformat.select(PageSize.getFormatIndx(format));

    tmargin.setValue(jd.getTopMargin());
    bmargin.setValue(jd.getBottomMargin());
    lmargin.setValue(jd.getLeftMargin());
    rmargin.setValue(jd.getRightMargin());

    cwidth.setValue(jd.getColumnWidth());
    space.setValue(jd.getColumnSpacing());
    cols.setSelection(jd.getColumnCount());

    landscape.setSelection(false);
    portrait.setSelection(false);
    if (jd.getOrientationValue().equals(OrientationEnum.LANDSCAPE))
        landscape.setSelection(true);
    else if (jd.getOrientationValue().equals(OrientationEnum.PORTRAIT))
        portrait.setSelection(true);
    ignoreEvents = false;

    String defunit = MReport.getMeasureUnit(jConfig, jd);
    uw.setUnit(defunit);

    pheigh.setUnit(PHolderUtil.getUnit(jd, JasperDesign.PROPERTY_PAGE_HEIGHT, defunit));
    pwidth.setUnit(PHolderUtil.getUnit(jd, JasperDesign.PROPERTY_PAGE_WIDTH, defunit));

    tmargin.setUnit(PHolderUtil.getUnit(jd, JasperDesign.PROPERTY_TOP_MARGIN, defunit));
    bmargin.setUnit(PHolderUtil.getUnit(jd, JasperDesign.PROPERTY_BOTTOM_MARGIN, defunit));
    lmargin.setUnit(PHolderUtil.getUnit(jd, JasperDesign.PROPERTY_LEFT_MARGIN, defunit));
    rmargin.setUnit(PHolderUtil.getUnit(jd, JasperDesign.PROPERTY_RIGHT_MARGIN, defunit));

    cwidth.setUnit(PHolderUtil.getUnit(jd, JasperDesign.PROPERTY_COLUMN_WIDTH, defunit));
    space.setUnit(PHolderUtil.getUnit(jd, JasperDesign.PROPERTY_COLUMN_SPACING, defunit));
}
项目:ireport-fork    文件:ReportNode.java   
protected void performAction(Node[] activatedNodes) {
        JasperDesign jd = activatedNodes[0].getLookup().lookup(JasperDesign.class);
        jd.setName("test name");
        jd.setPageWidth(700);
        jd.setPageHeight(400);
        jd.setOrientation( OrientationEnum.LANDSCAPE);
        jd.setTopMargin(10);
        jd.setBottomMargin(20);
        jd.setLeftMargin(35);
        jd.setRightMargin(5);
}
项目:ireport-fork    文件:ReportNode.java   
@SuppressWarnings("unchecked")
public OrientationProperty(JasperDesign jd)
{
    super(OrientationEnum.class, jd);
    this.jasperDesign = jd;
    setValue("suppressCustomEditor", Boolean.TRUE);
}
项目:ireport-fork    文件:ReportNode.java   
@Override
public List getTagList()
{
    List tags = new java.util.ArrayList();
    tags.add(new Tag(OrientationEnum.PORTRAIT, I18n.getString("ReportNode.Orientation.Portrait")));
    tags.add(new Tag(OrientationEnum.LANDSCAPE, I18n.getString("ReportNode.Orientation.Landscape")));
    return tags;
}
项目:ireport-fork    文件:PageFormatPanel.java   
public void applyChanges(JasperDesign jd) {

        int cols =  ((Number)jSpinnerColumns.getValue()).intValue();

        jd.setPageWidth(multiUnitNumberEditorWidth.getValue());
        jd.setPageHeight(multiUnitNumberEditorHeight.getValue());
        jd.setBottomMargin(multiUnitNumberEditorMarginBottom.getValue());
        jd.setLeftMargin(multiUnitNumberEditorMarginLeft.getValue());
        jd.setRightMargin(multiUnitNumberEditorMarginRight.getValue());
        jd.setTopMargin(multiUnitNumberEditorMarginaTop.getValue());
        jd.setColumnCount(cols);
        jd.setColumnSpacing(multiUnitNumberEditorcolumnSpace.getValue());
        jd.setColumnWidth(multiUnitNumberEditorColumnWidth.getValue());
        jd.setOrientation( jRadioLandscape.isSelected() ? OrientationEnum.LANDSCAPE : OrientationEnum.PORTRAIT  );
    }
项目:com.opendoorlogistics    文件:OrientationSelectorDialog.java   
public OrientationEnum getOrientation(){
    switch(getSelectedIndex()){
    case 0:
        return OrientationEnum.PORTRAIT;

    case 1:
        return OrientationEnum.LANDSCAPE;

    default:
        return null;
    }
}
项目:com.opendoorlogistics    文件:ReportBuilderUtils.java   
static JasperDesign createEmptyA4(String tablename, OrientationEnum orientation, boolean margins, int horizontalReduction) {

        switch (orientation) {
        case LANDSCAPE:
            return createEmpty(tablename, 842 - horizontalReduction, 595, margins);

        case PORTRAIT:
            return createEmpty(tablename, 595 - horizontalReduction, 842, margins);

        default:
            throw new RuntimeException();
        }

    }
项目:dynamicreports-jasper    文件:ConstantTransform.java   
protected static OrientationEnum pageOrientation(PageOrientation orientation) {
    switch (orientation) {
    case PORTRAIT:
        return OrientationEnum.PORTRAIT;
    case LANDSCAPE:
        return OrientationEnum.LANDSCAPE;
    default:
        throw new JasperDesignException("Page orientation " + orientation.name() + " not supported");
    }
}
项目:dynamicreports-jasper    文件:ConstantTransform.java   
public static PageOrientation pageOrientation(OrientationEnum orientation) {
    switch (orientation) {
    case PORTRAIT:
        return PageOrientation.PORTRAIT;
    case LANDSCAPE:
        return PageOrientation.LANDSCAPE;
    default:
        throw new JasperDesignException("Page orientation " + orientation.name() + " not supported");
    }
}
项目:dynamicreports-jasper    文件:IgnorePaginationTest.java   
@Override
public void test() {
    super.test();

    numberOfPagesTest(1);

    JasperPrint jasperPrint = getJasperPrint();
    Assert.assertEquals(OrientationEnum.PORTRAIT, jasperPrint.getOrientationValue());
    Assert.assertEquals(595, jasperPrint.getPageWidth());
    Assert.assertEquals(1636, jasperPrint.getPageHeight());
}
项目:jasperreports    文件:JRBaseReport.java   
@Override
public OrientationEnum getOrientationValue()
{
    return orientationValue;
}
项目:jasperreports    文件:JasperPrint.java   
@Override
public OrientationEnum getOrientation() {
    return JasperPrint.this.getOrientationValue();
}
项目:jasperreports    文件:JasperPrintFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JasperPrint jasperPrint = new JasperPrint();

    jasperPrint.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));

    String pageWidth = atts.getValue(JRXmlConstants.ATTRIBUTE_pageWidth);
    if (pageWidth != null && pageWidth.length() > 0)
    {
        jasperPrint.setPageWidth(Integer.parseInt(pageWidth));
    }

    String pageHeight = atts.getValue(JRXmlConstants.ATTRIBUTE_pageHeight);
    if (pageHeight != null && pageHeight.length() > 0)
    {
        jasperPrint.setPageHeight(Integer.parseInt(pageHeight));
    }

    String topMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_topMargin);
    if (topMargin != null && topMargin.length() > 0)
    {
        jasperPrint.setTopMargin(Integer.valueOf(topMargin));
    }

    String leftMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_leftMargin);
    if (leftMargin != null && leftMargin.length() > 0)
    {
        jasperPrint.setLeftMargin(Integer.valueOf(leftMargin));
    }

    String bottomMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_bottomMargin);
    if (bottomMargin != null && bottomMargin.length() > 0)
    {
        jasperPrint.setBottomMargin(Integer.valueOf(bottomMargin));
    }

    String rightMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_rightMargin);
    if (rightMargin != null && rightMargin.length() > 0)
    {
        jasperPrint.setRightMargin(Integer.valueOf(rightMargin));
    }

    OrientationEnum orientation = OrientationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_orientation));
    if (orientation != null)
    {
        jasperPrint.setOrientation(orientation);
    }

    String formatFactoryClass = atts.getValue(JRXmlConstants.ATTRIBUTE_formatFactoryClass);
    if (formatFactoryClass != null)
    {
        jasperPrint.setFormatFactoryClass(formatFactoryClass);
    }

    String locale = atts.getValue(JRXmlConstants.ATTRIBUTE_locale);
    if (locale != null)
    {
        jasperPrint.setLocaleCode(locale);
    }

    String timezone = atts.getValue(JRXmlConstants.ATTRIBUTE_timezone);
    if (timezone != null)
    {
        jasperPrint.setTimeZoneId(timezone);
    }

    return jasperPrint;
}
项目:jasperreports    文件:PrintPartFactory.java   
@Override
public Object createObject(Attributes atts)
{
    SimplePrintPart part = new SimplePrintPart();

    part.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));

    SimplePrintPageFormat pageFormat = new SimplePrintPageFormat();

    String pageWidth = atts.getValue(JRXmlConstants.ATTRIBUTE_pageWidth);
    if (pageWidth != null && pageWidth.length() > 0)
    {
        pageFormat.setPageWidth(Integer.parseInt(pageWidth));
    }

    String pageHeight = atts.getValue(JRXmlConstants.ATTRIBUTE_pageHeight);
    if (pageHeight != null && pageHeight.length() > 0)
    {
        pageFormat.setPageHeight(Integer.parseInt(pageHeight));
    }

    String topMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_topMargin);
    if (topMargin != null && topMargin.length() > 0)
    {
        pageFormat.setTopMargin(Integer.valueOf(topMargin));
    }

    String leftMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_leftMargin);
    if (leftMargin != null && leftMargin.length() > 0)
    {
        pageFormat.setLeftMargin(Integer.valueOf(leftMargin));
    }

    String bottomMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_bottomMargin);
    if (bottomMargin != null && bottomMargin.length() > 0)
    {
        pageFormat.setBottomMargin(Integer.valueOf(bottomMargin));
    }

    String rightMargin = atts.getValue(JRXmlConstants.ATTRIBUTE_rightMargin);
    if (rightMargin != null && rightMargin.length() > 0)
    {
        pageFormat.setRightMargin(Integer.valueOf(rightMargin));
    }

    OrientationEnum orientation = OrientationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_orientation));
    if (orientation != null)
    {
        pageFormat.setOrientation(orientation);
    }

    part.setPageFormat(pageFormat);

    JasperPrint jasperPrint = (JasperPrint)digester.peek(digester.getCount() - 2);
    jasperPrint.addPart(Integer.valueOf(atts.getValue(JRXmlConstants.ATTRIBUTE_pageIndex)), part);

    return part;
}
项目:jasperreports    文件:SimplePrintPageFormat.java   
/**
 * Returns the page orientation.
 */
@Override
public OrientationEnum getOrientation()
{
    return orientation;
}
项目:jasperreports    文件:SimplePrintPageFormat.java   
/**
 *
 */
public void setOrientation(OrientationEnum orientation)
{
    this.orientation = orientation;
}
项目:jasperreports    文件:DocxDocumentHelper.java   
/**
     *
     */
    public void exportSection(PrintPageFormat pageFormat, JRGridLayout pageGridLayout, boolean lastPage)
    {
        if (!lastPage)
        {
            write("    <w:p>\n");
            write("    <w:pPr>\n");
        }
        write("  <w:sectPr>\n");
        write("   <w:pgSz w:w=\"" + LengthUtil.twip(pageFormat.getPageWidth()) + "\" w:h=\"" + LengthUtil.twip(pageFormat.getPageHeight()) + "\"");
        write(" w:orient=\"" + (pageFormat.getOrientation() == OrientationEnum.LANDSCAPE ? "landscape" : "portrait") + "\"");

        if(OoxmlUtils.getSuitablePaperSize(pageFormat) == PaperSizeEnum.UNDEFINED)
        {
            // unique identifier for the paper size
            write(" w:code=\""+ (1000 + pageFormat.getPageWidth() + pageFormat.getPageHeight()) +"\"");
        }
        write("/>\n");

        CutsInfo xCuts = pageGridLayout.getXCuts();

        Cut leftCut = xCuts.getCut(0);
        int gridLeftPadding = leftCut.isCutNotEmpty() ? 0 : pageGridLayout.getColumnWidth(0);
        int leftMargin = Math.min(gridLeftPadding, pageFormat.getLeftMargin());

        Cut rightCut = xCuts.getCut(xCuts.size() - 2);
        int gridRightPadding = rightCut.isCutNotEmpty() ? 0 : pageGridLayout.getColumnWidth(xCuts.size() - 2);
        int rightMargin = Math.min(gridRightPadding, pageFormat.getRightMargin());

        CutsInfo yCuts = pageGridLayout.getYCuts();

        int topMargin = pageFormat.getTopMargin();
        if (yCuts.size() > 1)
        {
            Cut topCut = yCuts.getCut(0);
            int gridTopPadding = topCut.isCutNotEmpty() ? 0 : pageGridLayout.getRowHeight(0);
            topMargin = Math.min(gridTopPadding, pageFormat.getTopMargin());
        }

        //last y cut is from bottom element, not page height
        int gridBottomPadding = pageFormat.getPageHeight() - yCuts.getLastCutOffset();
        int bottomMargin = LengthUtil.twip(Math.min(gridBottomPadding, pageFormat.getBottomMargin())) - DEFAULT_LINE_PITCH;
        bottomMargin = bottomMargin < 0 ? 0 : bottomMargin;

        write("   <w:pgMar w:top=\""
                + LengthUtil.twip(topMargin)
                + "\" w:right=\""
                + LengthUtil.twip(rightMargin)
                + "\" w:bottom=\""
                + bottomMargin
                + "\" w:left=\""
                + LengthUtil.twip(leftMargin)
                + "\" w:header=\"0\" w:footer=\"0\" w:gutter=\"0\" />\n");
//      write("   <w:cols w:space=\"720\" />\n");
        write("   <w:docGrid w:linePitch=\"" + DEFAULT_LINE_PITCH + "\" />\n");
        write("  </w:sectPr>\n");
        if (!lastPage)
        {
            write("    </w:pPr>\n");
            write("    </w:p>\n");
        }
    }
项目:jasperreports    文件:ReadOnlyPartJasperPrint.java   
@Override
public OrientationEnum getOrientationValue()
{
    return part == null ? parentJasperPrint.getOrientationValue() : part.getPageFormat().getOrientation();
}
项目:jasperreports    文件:ReadOnlyPartJasperPrint.java   
@Override
public void setOrientation(OrientationEnum orientationValue)
{
    throw new UnsupportedOperationException();
}
项目:jasperreports    文件:TableReport.java   
@Override
public OrientationEnum getOrientationValue()
{
    return OrientationEnum.PORTRAIT;
}
项目:PDFReporter-Studio    文件:PageFormatDialog.java   
public void createCommand() {
    command = new JSSCompoundCommand(jnode);
    if (jd.getPageHeight() != pheigh.getValue())
        command.add(createCommand(JasperDesign.PROPERTY_PAGE_HEIGHT, pheigh.getValue()));
    if (jd.getPageWidth() != pwidth.getValue())
        command.add(createCommand(JasperDesign.PROPERTY_PAGE_WIDTH, pwidth.getValue()));

    if (jd.getTopMargin() != tmargin.getValue())
        command.add(createCommand(JasperDesign.PROPERTY_TOP_MARGIN, tmargin.getValue()));
    if (jd.getBottomMargin() != bmargin.getValue())
        command.add(createCommand(JasperDesign.PROPERTY_BOTTOM_MARGIN, bmargin.getValue()));
    if (jd.getLeftMargin() != lmargin.getValue())
        command.add(createCommand(JasperDesign.PROPERTY_LEFT_MARGIN, lmargin.getValue()));
    if (jd.getRightMargin() != rmargin.getValue())
        command.add(createCommand(JasperDesign.PROPERTY_RIGHT_MARGIN, rmargin.getValue()));

    if (jd.getColumnCount() != cols.getSelection())
        command.add(createCommand(JasperDesign.PROPERTY_COLUMN_COUNT, cols.getSelection()));
    if (jd.getColumnWidth() != cwidth.getValue())
        command.add(createCommand(JasperDesign.PROPERTY_COLUMN_WIDTH, cwidth.getValue()));
    if (jd.getColumnSpacing() != space.getValue())
        command.add(createCommand(JasperDesign.PROPERTY_COLUMN_SPACING, space.getValue()));

    if (jd.getOrientationValue().equals(OrientationEnum.LANDSCAPE) && !landscape.getSelection())
        command.add(createCommand(JasperDesign.PROPERTY_ORIENTATION, OrientationEnum.PORTRAIT));
    else if (jd.getOrientationValue().equals(OrientationEnum.PORTRAIT) && !portrait.getSelection())
        command.add(createCommand(JasperDesign.PROPERTY_ORIENTATION, OrientationEnum.LANDSCAPE));

    boolean changes = false;
    JRPropertiesMap pmap = jd.getPropertiesMap().cloneProperties();
    String defunit = uw.getUnit();
    changes = PHolderUtil.setProperty(changes, pmap, "", defunit, null);

    changes = PHolderUtil.setProperty(changes, pmap, JasperDesign.PROPERTY_PAGE_HEIGHT, pheigh.getUnit(), defunit);
    changes = PHolderUtil.setProperty(changes, pmap, JasperDesign.PROPERTY_PAGE_WIDTH, pwidth.getUnit(), defunit);

    changes = PHolderUtil.setProperty(changes, pmap, JasperDesign.PROPERTY_TOP_MARGIN, tmargin.getUnit(), defunit);
    changes = PHolderUtil.setProperty(changes, pmap, JasperDesign.PROPERTY_BOTTOM_MARGIN, bmargin.getUnit(), defunit);
    changes = PHolderUtil.setProperty(changes, pmap, JasperDesign.PROPERTY_LEFT_MARGIN, lmargin.getUnit(), defunit);
    changes = PHolderUtil.setProperty(changes, pmap, JasperDesign.PROPERTY_RIGHT_MARGIN, rmargin.getUnit(), defunit);

    changes = PHolderUtil.setProperty(changes, pmap, JasperDesign.PROPERTY_COLUMN_WIDTH, cwidth.getUnit(), defunit);
    changes = PHolderUtil.setProperty(changes, pmap, JasperDesign.PROPERTY_COLUMN_SPACING, space.getUnit(), defunit);
    if (changes)
        command.add(createCommand(MGraphicElement.PROPERTY_MAP, pmap));
}
项目:ireport-fork    文件:ReportNode.java   
@Override
public Object getDefaultValue()
{
    return OrientationEnum.PORTRAIT;
}
项目:ireport-fork    文件:ReportNode.java   
@Override
public void setPropertyValue(Object alignment)
{
    jasperDesign.setOrientation((OrientationEnum)alignment);

    int pWidth = jasperDesign.getPageWidth();
                int pHeight = jasperDesign.getPageHeight();

                if ((jasperDesign.getOrientationValue() == OrientationEnum.LANDSCAPE && pWidth < pHeight) ||
                    (jasperDesign.getOrientationValue() == OrientationEnum.PORTRAIT && pWidth > pHeight))
                {
                    jasperDesign.setPageWidth(pHeight);
                    jasperDesign.setPageHeight(pWidth);

                    // switch height and width...
                    ObjectPropertyUndoableEdit urob1 =
                        new ObjectPropertyUndoableEdit(
                            jasperDesign,
                            "PageWidth",
                            Integer.TYPE,
                            pWidth,pHeight);
                    IReportManager.getInstance().addUndoableEdit(urob1, true);
                    ObjectPropertyUndoableEdit urob2 =
                        new ObjectPropertyUndoableEdit(
                            jasperDesign,
                            "PageHeight",
                            Integer.TYPE,
                            pHeight,pWidth);
                    IReportManager.getInstance().addUndoableEdit(urob2, true);

                    // Adjust the columns width...
                    if (jasperDesign.getColumnCount() > 0) // Do it always...
                    {
                        int availableSpace = jasperDesign.getPageWidth() - jasperDesign.getLeftMargin() - jasperDesign.getRightMargin();
                        availableSpace -= (jasperDesign.getColumnCount()-1) * jasperDesign.getColumnSpacing();
                        int columnWidth = availableSpace / jasperDesign.getColumnCount();
                        int oldColumnWidth = jasperDesign.getColumnWidth();

                        jasperDesign.setColumnWidth(columnWidth);
                        ObjectPropertyUndoableEdit urob3 =
                        new ObjectPropertyUndoableEdit(
                            jasperDesign,
                            "ColumnWidth",
                            Integer.TYPE,
                            oldColumnWidth,columnWidth);
                        IReportManager.getInstance().addUndoableEdit(urob3, true);
                    }

            }
    }
项目:com.opendoorlogistics    文件:SingleLevelReportBuilder.java   
public JasperPrint buildSingleTablePrintable(ODLTableReadOnly table, OrientationEnum orientation, boolean hasHeaderMap,ContinueProcessingCB continueCb) {
    JasperDesign design = new SingleLevelReportBuilder().buildSingleTableDesign(table,null, orientation, hasHeaderMap);
    return buildSingleTablePrintable(table, design,continueCb);
}
项目:com.opendoorlogistics    文件:SingleLevelReportBuilder.java   
public JRViewer buildSingleTableViewable(ODLTableReadOnly table, OrientationEnum orientation, boolean hasHeaderMap,ContinueProcessingCB continueCb) {
    return new JRViewer(buildSingleTablePrintable(table, orientation, hasHeaderMap, continueCb));
}
项目:com.opendoorlogistics    文件:SingleLevelReportBuilder.java   
public JasperDesign buildSingleTableDesign(ODLTableDefinition table,String title, OrientationEnum orientation, boolean hasHeaderMap) {
    if(title==null){
        if(table!=null){
            title = table.getName();
        }else{
            title = "Report";
        }
    }
    int horizontalReduction = ((flags & FLAG_IS_SUBREPORT) != 0) ? 40 : 0;
    JasperDesign ret = ReportBuilderUtils.createEmptyA4(title, orientation, (flags & FLAG_MARGINS) != 0, horizontalReduction);

    // Add fields
    boolean sub = (flags & FLAG_INCLUDES_SUBREPORT) != 0;
    if(table!=null){
        ReportBuilderUtils.addFields(table, sub, ret);          
    }

    // add subreport template property - see http://stackoverflow.com/questions/9785451/generate-jasper-report-with-subreport-from-java
    if (sub) {
        JRDesignParameter parameter = new JRDesignParameter();
        parameter.setName(ReportConstants.SUBREPORT_TEMPLATE_PARAMETER);
        parameter.setValueClass(net.sf.jasperreports.engine.JasperReport.class);
        try {
            ret.addParameter(parameter);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

    int pageWidth = ret.getPageWidth();
    int leftMargin = ret.getLeftMargin();
    int rightMargin = ret.getRightMargin();
    int elementWidth = pageWidth - leftMargin - rightMargin - horizontalReduction;

    // Add Title
    if ((flags & FLAG_TITLE) != 0) {
        ReportBuilderUtils.addTitle(title, hasHeaderMap,table!=null, ret);
    }

    if (table != null) {
        ReportBuilderUtils.addColumnHeaderSection(table, elementWidth, ret);

        if (sub) {
            ReportBuilderUtils.addDetailBand(table, elementWidth, true, ret);
        } else {
            ReportBuilderUtils.addDetailBand(table, elementWidth, false, ret);
        }
    }

    if ((flags & FLAG_FOOTER) != 0) {
        ReportBuilderUtils.addPageFooter( elementWidth, ret);
    }

    return ret;
}
项目:jasperreports    文件:JasperPrint.java   
/**
 * Returns the page orientation.
 * @see OrientationEnum PORTRAIT,
 * @see OrientationEnum LANDSCAPE
 */
public OrientationEnum getOrientationValue()
{
    return orientationValue;
}
项目:jasperreports    文件:JasperPrint.java   
/**
 * Sets the page orientation.
 * @see OrientationEnum PORTRAIT,
 * @see OrientationEnum LANDSCAPE
 */
public void setOrientation(OrientationEnum orientationValue)
{
    this.orientationValue = orientationValue;
}
项目:jasperreports    文件:JRReport.java   
/**
 * Specifies whether document pages will be rendered in a portrait or landscape layout.
 * @return a value representing one of the orientation constants in {@link OrientationEnum}
 */
public OrientationEnum getOrientationValue();
项目:jasperreports    文件:PrintPageFormat.java   
/**
 * Returns the page orientation.
 */
public OrientationEnum getOrientation();
项目:jasperreports-scala    文件:JRReport.java   
/**
 * Specifies whether document pages will be rendered in a portrait or landscape layout.
 * @return a value representing one of the orientation constants in {@link OrientationEnum}
 */
public OrientationEnum getOrientationValue();