Skip to content

Commit

Permalink
Created back-end functionality for printing selected plan views; removed
Browse files Browse the repository at this point in the history
debugging system console outs
  • Loading branch information
schirmerc committed Dec 9, 2015
1 parent 0824490 commit 099ff61
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public int print(Graphics g, PageFormat pageFormat, int page) throws PrinterExce
throw new InterruptedPrinterException();
}



Graphics2D g2D = (Graphics2D)g;
g2D.setFont(this.defaultFont);
g2D.setColor(Color.WHITE);
Expand Down Expand Up @@ -372,22 +374,54 @@ public boolean include(Home home, HomePieceOfFurniture piece) {
Level tempLevel = home.getSelectedLevel();
List<Boolean> planLevels = homePrint.getPlanViewList();
PlanView planToPrint;


int numPlansPrinted = page-this.furniturePageCount;
if(numPlansPrinted < planLevels.size() && pageExists == NO_SUCH_PAGE)
{
int count = 0;
for(int i = 0; i<planLevels.size() && count >= 0; i++)
{
if(planLevels.get(i) && (count == numPlansPrinted))
{
home.setSelectedLevel(home.getLevels().get(i));
planToPrint = this.controller.getPlanController().getView();
// Try to print next plan view page
pageExists = ((Printable)planToPrint).print(g2D, pageFormat, 0);//page - this.furniturePageCount);
if (pageExists == PAGE_EXISTS && !this.printablePages.contains(page))
{
this.printablePages.add(page);
this.planPageCount++;
//System.out.print("printed a page: ");
//System.out.print(page);
//System.out.print(" with i: ");
//System.out.println(i);
}

count = -1;
}
else if(planLevels.get(i))
{
count++;
}
}
}
// Loop through levels to be printed
for (int i = 0; i < planLevels.size(); i++) {
/*for (int i = 0; i < planLevels.size(); i++) {
if (planLevels.get(i)) {
home.setSelectedLevel(home.getLevels().get(i));
planToPrint = this.controller.getPlanController().getView();
if (pageExists == NO_SUCH_PAGE ) {
if (pageExists == NO_SUCH_PAGE) {
// Try to print next plan view page
pageExists = ((Printable)planToPrint).print(g2D, pageFormat, page - this.furniturePageCount);
pageExists = ((Printable)planToPrint).print(g2D, pageFormat, 0);//page - this.furniturePageCount);
if (pageExists == PAGE_EXISTS
&& !this.printablePages.contains(page)) {
this.printablePages.add(page);
this.planPageCount++;
}
}
}
}
}*/
home.setSelectedLevel(tempLevel);


Expand All @@ -402,7 +436,7 @@ public boolean include(Home home, HomePieceOfFurniture piece) {
this.printablePages.add(page);
}
}
System.out.println("Test here");
//System.out.println("Test here");
view3D = this.controller.getHomeController3D().getView();
if (pageExists == NO_SUCH_PAGE
&& view3D != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,11 +453,8 @@ private void layoutComponents() {
GridBagConstraints.NONE, new Insets(0, 0, 10, 0) , 0, 0));
Insets lastComponentInsets = new Insets(0, 0, 5, 0);

System.out.println("Hello, world.");
for(Level curLvl : controller.getHomeLevels())
{
System.out.println(curLvl.getName());
}


checkListPanel.add(new JLabel("Plan Views:"), new GridBagConstraints(
0,0,2,1,0,0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0,0,0,20),0,0));
checkListPanel.add(new JLabel("Furniture Tables:"), new GridBagConstraints(
Expand Down

0 comments on commit 099ff61

Please sign in to comment.