View unanswered posts | View active topics It is currently Fri May 26, 2017 5:59 pm



This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
 West CategoryHeader Bean truncated when printing 
Author Message

Joined: Wed May 11, 2011 1:22 pm
Posts: 1
Post West CategoryHeader Bean truncated when printing
Hi,

This is a BUG report.

When fixing the heigth of each leaf row, with GridDimensionLayoutBean, and having more categories than fit in the window, the print preview truncate the print area and only shows the ones showing on screen.

See attached pictures showing part of the been and print preview, the only difference between the first and second one is that we move the slide bar up.

Thanks,
Patrice

Attachment:
File comment: Screen copy, left=bean, right=preview
1.jpg
1.jpg [ 199.24 KiB | Viewed 24901 times ]

Attachment:
File comment: Screen copy, left=bean, right=preview
2.JPG
2.JPG [ 99.35 KiB | Viewed 24901 times ]


Same kind of issue, but for a West Header, as :
http://migcalendar.com/forums/viewtopic.php?f=5&t=1470&p=2951&hilit=header+print#p2951


I have adapted the example to show the error:

Code:
import com.miginfocom.beans.GridDimensionLayoutBean;
import com.miginfocom.util.dates.DateRange;
import com.miginfocom.util.dates.DateRangeI;
import com.miginfocom.util.gfx.geometry.numbers.AtFixed;
import com.miginfocom.util.gfx.geometry.AbsRect;
import com.miginfocom.util.gfx.geometry.SizeSpec;
import com.miginfocom.calendar.category.CategoryStructureEvent;
import com.miginfocom.calendar.category.CategoryDepository;
import com.miginfocom.calendar.category.Category;
import com.miginfocom.calendar.datearea.DateAreaContainer;
import java.awt.*;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
import java.util.Date;

public class TestCategoryHeader extends javax.swing.JFrame {
public class PrintPreviewDialog extends javax.swing.JDialog {

private javax.swing.JScrollPane previewScrollPane;
private com.miginfocom.beans.PrintPreviewBean printPreviewBean;
private com.miginfocom.beans.PrintSpecificationBean printSpecification;


public PrintPreviewDialog(java.awt.Frame parent, DateAreaContainer dac) {
super(parent, true);
printSpecification = new com.miginfocom.beans.PrintSpecificationBean();
previewScrollPane = new javax.swing.JScrollPane();
printPreviewBean = new com.miginfocom.beans.PrintPreviewBean();
printSpecification.setPageCountX(new java.lang.Integer(3));
printSpecification.setPageCountY(new java.lang.Integer(2));
printSpecification.setPagePlaceRectangle(new com.miginfocom.util.gfx.geometry.AbsRect(new com.miginfocom.util.gfx.geometry.numbers.AtStart(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtStart(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtEnd(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtEnd(-36.0f), null, null, null));
printSpecification.setPlaceRectangle(new com.miginfocom.util.gfx.geometry.AbsRect(new com.miginfocom.util.gfx.geometry.numbers.AtStart(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtStart(72.0f), new com.miginfocom.util.gfx.geometry.numbers.AtEnd(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtEnd(0.0f), null, null, null));
printPreviewBean.setLayoutAlignmentX(0.5F);
printPreviewBean.setLayoutAlignmentY(0.5F);
printPreviewBean.setPrintSpecification(printSpecification);
printPreviewBean.setZoomMinimum(0.2);
printPreviewBean.setZoomPreferred(0.4);
previewScrollPane.setViewportView(printPreviewBean);
getContentPane().add(previewScrollPane, java.awt.BorderLayout.CENTER);
pack();

PageFormat pf = new PageFormat();
Paper paper = new Paper();
int width = 5000;
int height = 5000;
paper.setSize(width, height);
int margin = 5;
AbsRect marginRect = new AbsRect(new Insets(margin, margin, margin, margin));
Rectangle ia = marginRect.getRect(new Rectangle(0, 0, width, height));
paper.setImageableArea(ia.x, ia.y, ia.width, ia.height);
pf.setPaper(paper);
printPreviewBean.setPageFormat(pf);

printPreviewBean.setDateAreaContainer(dac);
}
}

private com.miginfocom.beans.NorthCategoryHeaderBean categoryHeader;
private com.miginfocom.beans.WestCategoryHeaderBean categoryHeader2;
private com.miginfocom.beans.DateAreaBean dateAreaBean;
private com.miginfocom.beans.DateHeaderBean northDateHeader;
private javax.swing.JButton previewButton;
private com.miginfocom.beans.GridDimensionLayoutBean verticalLayout;
public TestCategoryHeader() {
initComponents();

// GridDimensionLayoutBean verticalMonthViewLayout = new GridDimensionLayoutBean();
// verticalMonthViewLayout.setRowSizeNormal(new com.miginfocom.util.gfx.geometry.SizeSpec(new AtFixed(100.0f), null, null));
// dateAreaBean.setSecondaryDimensionLayout(verticalMonthViewLayout);
int ev = CategoryStructureEvent.ADDED_CREATED;
CategoryDepository.addBrokedCategory(new Category(1, "a", null), TestCategoryHeader.class, ev);
CategoryDepository.addBrokedCategory(new Category(2, "b", null), TestCategoryHeader.class, ev);
CategoryDepository.addBrokedCategory(new Category(3, "c", null), TestCategoryHeader.class, ev);
CategoryDepository.addBrokedCategory(new Category(4, "d", null), TestCategoryHeader.class, ev);
CategoryDepository.addBrokedCategory(new Category(5, "e", null), TestCategoryHeader.class, ev);
CategoryDepository.addBrokedCategory(new Category(6, "f", null), TestCategoryHeader.class, ev);
CategoryDepository.addBrokedCategory(new Category(7, "g", null), TestCategoryHeader.class, ev);
CategoryDepository.addBrokedCategory(new Category(8, "h", null), TestCategoryHeader.class, ev);
CategoryDepository.addBrokedCategory(new Category(9, "i", null), TestCategoryHeader.class, ev);
dateAreaBean.revalidate();
dateAreaBean.repaint();
}

private void initComponents() {
northDateHeader = new com.miginfocom.beans.DateHeaderBean();
// categoryHeader = new com.miginfocom.beans.NorthCategoryHeaderBean();
categoryHeader2 = new com.miginfocom.beans.WestCategoryHeaderBean();
verticalLayout = new com.miginfocom.beans.GridDimensionLayoutBean();
dateAreaBean = new com.miginfocom.beans.DateAreaBean();
previewButton = new javax.swing.JButton();

northDateHeader.setHeaderRows(new com.miginfocom.calendar.header.CellDecorationRow[] {
new com.miginfocom.calendar.header.CellDecorationRow(
com.miginfocom.util.dates.DateRangeI.RANGE_TYPE_DAY,
new com.miginfocom.util.dates.DateFormatList("EE MM/dd/yy", null),
new com.miginfocom.util.gfx.geometry.numbers.AtFixed(25.0f),
new com.miginfocom.util.gfx.geometry.AbsRect(new com.miginfocom.util.gfx.geometry.numbers.AtStart(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtStart(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtEnd(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtEnd(0.0f), null, null, null),
(java.awt.Paint[]) null,
new java.awt.Paint[] {new java.awt.Color(102, 102, 102)},
new com.miginfocom.util.repetition.DefaultRepetition(0, 1, null, null),
new java.awt.Font[] {new java.awt.Font("Tahoma", 1, 11)},
new java.lang.Integer[] {null},
new com.miginfocom.util.gfx.geometry.numbers.AtFraction(0.5f),
new com.miginfocom.util.gfx.geometry.numbers.AtFraction(0.5f))});
northDateHeader.setBackgroundPaint(new java.awt.Color(255, 255, 255));
categoryHeader2.setHeaderLevels(new com.miginfocom.calendar.header.DefaultSubRowLevel[] {
new com.miginfocom.calendar.header.DefaultSubRowLevel(
"$gridRowName$",
new com.miginfocom.util.gfx.geometry.numbers.AtFixed(25.0f),
new com.miginfocom.util.gfx.geometry.AbsRect(new com.miginfocom.util.gfx.geometry.numbers.AtStart(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtStart(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtEnd(0.0f), new com.miginfocom.util.gfx.geometry.numbers.AtEnd(0.0f), null, null, null),
(java.awt.Paint[]) null,
new java.awt.Paint[] {new java.awt.Color(0, 0, 0)},
null,
1,
new java.awt.Font[] {new java.awt.Font("Dialog", 0, 12)},
new java.lang.Integer[] {null},
new com.miginfocom.util.gfx.geometry.numbers.AtFraction(0.5f),
new com.miginfocom.util.gfx.geometry.numbers.AtStart(6.0f),
1,
com.miginfocom.calendar.header.SubRowLevel.APPLY_TO_ALL)});
categoryHeader2.setBackgroundPaint(new java.awt.Color(255, 255, 255));
categoryHeader2.setCellBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
categoryHeader2.setForcedHeaderSize(new java.lang.Integer(80));
categoryHeader2.setLabelCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

verticalLayout.setSubRowSizeLeaf(new SizeSpec(new AtFixed(100.0f), null, null));
dateAreaBean.setSecondaryDimensionLayout(verticalLayout);

GridDimensionLayoutBean dLayout = new GridDimensionLayoutBean();
dLayout.setRowSizeNormal(
new SizeSpec(
new AtFixed(50f),
null,
null)
);
dateAreaBean.setPrimaryDimensionLayout(dLayout);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
//dateAreaBean.setCategoryHeader(categoryHeader);
dateAreaBean.setCategoryHeader(categoryHeader2);
dateAreaBean.setNorthDateHeader(northDateHeader);
//dateAreaBean.setPrimaryDimension(javax.swing.SwingConstants.VERTICAL);
dateAreaBean.setPrimaryDimensionCellType(com.miginfocom.util.dates.DateRangeI.RANGE_TYPE_HOUR);
dateAreaBean.setPrimaryDimensionCellTypeCount(6);
//dateAreaBean.setWrapBoundary(new Integer(com.miginfocom.util.dates.DateRangeI.RANGE_TYPE_DAY));
dateAreaBean.setDesignTimeHelp(false);
dateAreaBean.setSelectionBoundaryType(com.miginfocom.util.dates.DateRangeI.RANGE_TYPE_SECOND);
dateAreaBean.setSelectionType(com.miginfocom.calendar.datearea.DateArea.SELECTION_TYPE_NORMAL);
dateAreaBean.setShowNoFitIcon(true);
dateAreaBean.setWrapBoundary(null);
dateAreaBean.getDateArea().setVisibleDateRange(new DateRange(new Date().getTime(), DateRangeI.RANGE_TYPE_MONTH, 1, null, null));
getContentPane().add(dateAreaBean, java.awt.BorderLayout.CENTER);

previewButton.setLabel("Preview");
previewButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
previewButtonActionPerformed(evt);
}
});

getContentPane().add(previewButton, java.awt.BorderLayout.PAGE_START);

pack();
}

private void previewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_previewButtonActionPerformed
PrintPreviewDialog pd = new PrintPreviewDialog(this,dateAreaBean);
pd.setVisible(true);
}

public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TestCategoryHeader().setVisible(true);
}
});
}
}


Wed May 11, 2011 1:58 pm
Profile
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 1 post ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.