Package factOrFiction.print

Examples of factOrFiction.print.FlowDownFrame


  public PageFrame getPrintable(final Deck deck) {
    this.deck = deck;
   
    PageFrame page = new PageFrame(null, 0.8, 0.95);

    FlowDownFrame header = new FlowDownFrame( page, 1, 0.10);
    createHeader(header);
   
    // separator between header and body
    new FlowDownFrame( page, 1, 0.01 );
   
    PrintFrame body = new FlowDownFrame( page, 1, 0.86);
    createBody(body);
   
    // separator between body and footer
    new FlowDownFrame( page, 1, 0.01 );
   
    PrintFrame footer = new FlowDownFrame( page, 1.0, 0.02);
    createFooter(footer);
   
    return page;
  }
View Full Code Here


   
    return page;
  }

  private void createHeader(PrintFrame header) {
    FlowDownFrame down = new FlowDownFrame( header, 1, 0.23);
      ListFrame text = new ListFrame( down, 1, 1);
      text.setFont("Tahoma", 14, SWT.BOLD);
      text.setAlignment(SWT.CENTER);
      text.setMargin( 0.1, 0.1, 0.0, 0.0);
      text.add( "Highlander Registration Sheet" );
    down = new FlowDownFrame( header, 1, 0.02 );
      BorderFrame border = new BorderFrame( down, 1, 1);
      border.setBackground(SWT.COLOR_GRAY);

    down = new FlowDownFrame( header, 1, 0.25);
        FlowRightFrame right = new FlowRightFrame( down, 0.3, 10);
        text = new ListFrame( right, 1, 1);
        text.setFont("Tahoma", 11, SWT.BOLD);
        text.setAlignment(SWT.CENTER);
        text.setMargin( 0.1, 0.1, 0.0, 0.0);
        text.add( "Player Name: " + deck.get(Deck.FEATURE_PLAYER) );
      right = new FlowRightFrame( down, 0.5, 1.0);
        text = new ListFrame( right, 1, 1);
        text.setFont("Tahoma", 11, SWT.BOLD);
        text.setAlignment(SWT.CENTER);
        text.setMargin( 0.1, 0.1, 0.0, 0.0);
        text.add( "DCI: " + deck.get(Deck.FEATURE_DCI));
      right = new FlowRightFrame( down, 0.2, 1);
        text = new ListFrame( right, 1, 1);
        text.setFont("Tahoma", 11, SWT.BOLD);
        text.setAlignment(SWT.CENTER + SWT.RIGHT);
        text.setMargin( 0.1, 0.1, 0.0, 0.0);
        text.add( "Date: " + deck.get(Deck.FEATURE_TOURNAMENT_DATE) );
   
    down = new FlowDownFrame( header, 1.0, 0.25);
        right = new FlowRightFrame( down, 0.3, 1.0);
        text = new ListFrame( right,1, 1);
        text.setFont("Tahoma", 11, SWT.NORMAL);
        text.setAlignment(SWT.CENTER);
        text.setMargin( 0.1, 0.1, 0.0, 0.0);
        text.add( "Tournament: " + deck.get(Deck.FEATURE_TOURNAMENT_TITLE) );
      right = new FlowRightFrame( down, 0.5, 1.0);
        text = new ListFrame( right, 1, 1);
        text.setFont("Tahoma", 11, SWT.NORMAL);
        text.setAlignment(SWT.CENTER);
        text.setMargin( 0.1, 0.1, 0.0, 0.0);
        text.add( "City: " + deck.get(Deck.FEATURE_TOURNAMENT_CITY));
      right = new FlowRightFrame( down, 0.2, 1.0);
        text = new ListFrame( right, 1, 1);
        text.setFont("Tahoma", 11, SWT.NORMAL);
        text.setAlignment(SWT.CENTER + SWT.RIGHT);
        text.setMargin( 0.1, 0.1, 0.0, 0.0);
        text.add( "Type: " + deck.get(Deck.FEATURE_TOURNAMENT_TYPE) );

    down = new FlowDownFrame( header, 1, 0.25);
      right = new FlowRightFrame( down, 0.5, 1.0);
        text = new ListFrame( right, 1, 1);
        text.setFont("Tahoma", 11, SWT.NORMAL);
        text.setAlignment(SWT.CENTER);
        text.setMargin( 0.1, 0.1, 0.0, 0.0);
View Full Code Here

        text.setMargin( 0.1, 0.1, 0.0, 0.0);
        text.add( "Deck Designer: " + deck.get(Deck.FEATURE_DESIGNER) );
  }

  private void createBody(PrintFrame body) {
    FlowDownFrame mainboard = new FlowDownFrame( body, 1.0, 1.0);
      BorderFrame border = new BorderFrame( mainboard, 1, 1);
      border.setBorder(SWT.COLOR_BLACK);
      createMainboard(mainboard);   
  }
View Full Code Here

      border.setBorder(SWT.COLOR_BLACK);
      createMainboard(mainboard);   
  }

  private void createMainboard(PrintFrame frame) {
    FlowDownFrame down = new FlowDownFrame( frame, 1, 0.94 );
   
    new FlowDownFrame( down, 1, 0.01 );

    List<CardGroup> groups = deck.getChildren();
    FlowRightFrame countFrame = null;
    ListFrame countText = null;
    FlowRightFrame cardFrame = null;
    ListFrame cardText = null;
    for (CardGroup group : groups) {
     
      if( !group.getName().equals(CardGroup.SIDEBOARD) ) {
        List<Card> cards = group.getUniqueCards();
        // figure overflow
        if( countText != null && countText.getLineCount() + cards.size() > 41 ) {
          countFrame = null;
          countText = null;
          cardFrame = null;
          cardText = null;
        }
       
        if(countFrame == null) {
          countFrame = new FlowRightFrame( down, 0.05, 1);   
            countText = new ListFrame( countFrame, 1, 1 );
            countText.setFont("Tahoma", 10, SWT.NORMAL);
            countText.setAlignment(SWT.RIGHT);
            countText.setMargin( 0.2, 0.0, 0.02, 0.02);
         
          cardFrame = new FlowRightFrame( down, 0.28, 1);   
            cardText = new ListFrame( cardFrame, 0.9, 1 );
            cardText.setFont("Tahoma", 10, SWT.NORMAL);
            cardText.setMargin( 0.04, 0.0, 0.02, 0.02);
        }
       
        if( !cards.isEmpty() ) {
          if(countText.getLineCount() > 0) {
            countText.add( "" );
            cardText.add( "" );
          }
          if( !"".equals( group.getName()) ) {
            countText.add( "" );
            cardText.add( group.getName() );
          }
         
          for (Card card : cards) {
            int count = group.count( card );
            countText.add( count+"x" );
            cardText.add( card.getName() );
          }         
        }
      }
    }
   
    down = new FlowDownFrame( frame, 1.0, 0.05 );
      ListFrame text = new ListFrame( down, 1.0, 1.0);
      text.setFont("Tahoma", 11, SWT.BOLD);
      text.setMargin( 0.2, 0.2, 0.0, 0.0);
      text.setAlignment(SWT.CENTER);
      text.add("Sum: " + deck.countMaindeck() + " cards");
View Full Code Here

  public PageFrame getPrintable(final Deck deck) {
    this.deck = deck;
   
    PageFrame page = new PageFrame(null, 0.8, 0.95);
     
      FlowDownFrame header = new FlowDownFrame(page, 1, 0.10);
      createHeader(header);
 
      // separator between header and body
      new FlowDownFrame(page, 1, 0.01);
 
      PrintFrame body = new FlowDownFrame(page, 1, 0.86);
      createBody(body);

      // separator between body and footer
      new FlowDownFrame(page, 1, 0.01);

      PrintFrame footer = new FlowDownFrame(page, 1, 0.02);
      createFooter(footer);
   
      page.setAnnotator(new IAnnotator() {
        public String getAnnotation() {
          return deck.getName();
View Full Code Here

      });
    return page;
  }

  private void createHeader(PrintFrame header) {
    FlowDownFrame down = new FlowDownFrame(header, 1, 0.23);
      ListFrame text = new ListFrame(down, 1, 1);
      text.setFont(DEFAULTFONT, 14, SWT.BOLD);
      text.setAlignment(SWT.CENTER);
      text.setMargin(0.1, 0.1, 0.0, 0.0);
      text.add("Deck Registration Sheet");
   
    down = new FlowDownFrame(header, 1, 0.02);
      BorderFrame border = new BorderFrame(down, 1, 1);
      border.setBackground(SWT.COLOR_GRAY);

    down = new FlowDownFrame(header, 1, 0.25);
      FlowRightFrame right = new FlowRightFrame(down, 0.3, 1);
        text = new ListFrame(right, 1, 1);
        text.setFont(DEFAULTFONT, 11, SWT.BOLD);
        text.setAlignment(SWT.CENTER);
        text.setMargin(0.1, 0.1, 0.0, 0.0);
        text.add("Player Name: " + deck.get(DeckConstants.FEATURE_PLAYER));
      right = new FlowRightFrame(down, 0.5, 1);
        text = new ListFrame(right, 1, 1);
        text.setFont(DEFAULTFONT, 11, SWT.BOLD);
        text.setAlignment(SWT.CENTER);
        text.setMargin(0.1, 0.1, 0.0, 0.0);
        text.add("DCI: " + deck.get(DeckConstants.FEATURE_DCI));
      right = new FlowRightFrame(down, 0.2, 1.0);
        text = new ListFrame(right, 1, 1);
        text.setFont(DEFAULTFONT, 11, SWT.BOLD);
        text.setAlignment(SWT.CENTER + SWT.RIGHT);
        text.setMargin(0.1, 0.1, 0.0, 0.0);
        text.add("Date: " + deck.get(DeckConstants.FEATURE_TOURNAMENT_DATE));

    down = new FlowDownFrame(header, 1.0, 0.25);
      right = new FlowRightFrame(down, 0.3, 1.0);
        text = new ListFrame(right, 1, 1);
        text.setFont(DEFAULTFONT, 11, SWT.NORMAL);
        text.setAlignment(SWT.CENTER);
        text.setMargin(0.1, 0.1, 0.0, 0.0);
        text.add("Tournament: " + deck.get(DeckConstants.FEATURE_TOURNAMENT_TITLE));
      right = new FlowRightFrame(down, 0.5, 1.0);
        text = new ListFrame(right, 1, 1);
        text.setFont(DEFAULTFONT, 11, SWT.NORMAL);
        text.setAlignment(SWT.CENTER);
        text.setMargin(0.1, 0.1, 0.0, 0.0);
        text.add("City: " + deck.get(DeckConstants.FEATURE_TOURNAMENT_CITY));
      right = new FlowRightFrame(down, 0.2, 1.0);
        text = new ListFrame(right, 1, 1);
        text.setFont(DEFAULTFONT, 11, SWT.NORMAL);
        text.setAlignment(SWT.CENTER + SWT.RIGHT);
        text.setMargin(0.1, 0.1, 0.0, 0.0);
        text.add("Type: " + deck.get(DeckConstants.FEATURE_TOURNAMENT_TYPE));

    down = new FlowDownFrame(header, 1, 0.25);
      right = new FlowRightFrame(down, 0.5, 1.0);
        text = new ListFrame(right, 1, 1);
        text.setFont(DEFAULTFONT, 11, SWT.NORMAL);
        text.setAlignment(SWT.CENTER);
        text.setMargin(0.1, 0.1, 0.0, 0.0);
View Full Code Here

        text.setMargin(0.1, 0.1, 0.0, 0.0);
        text.add("Deck Designer: " + deck.get(DeckConstants.FEATURE_DESIGNER));
  }

  private void createBody(PrintFrame body) {
    FlowDownFrame mainboard = new FlowDownFrame(body, 1.0, 0.75);
      BorderFrame border = new BorderFrame(mainboard, 1, 1);
      border.setBorder(SWT.COLOR_BLACK);
      createMainboard(mainboard);

    FlowDownFrame sideboard = new FlowDownFrame(body, 1, 0.25);
      border = new BorderFrame(sideboard, 1, 1);
      border.setBorder(SWT.COLOR_BLACK);
      border.setBackground(SWT.COLOR_GREEN);
      createSideboard(sideboard);
  }
View Full Code Here

      border.setBackground(SWT.COLOR_GREEN);
      createSideboard(sideboard);
  }

  private void createMainboard(PrintFrame frame) {
    FlowDownFrame down = new FlowDownFrame(frame, 1, 0.95);

    FlowRightFrame countFrame = null;
    ListFrame countText = null;
    FlowRightFrame cardFrame = null;
    ListFrame cardText = null;
   
    for (CardGroup group : deck.getChildren()) {
      if (!group.getName().equals(CardGroup.SIDEBOARD)) {
        List<Card> cards = group.getUniqueCards();

        // figure out when to overflow to second(next) frame
        if (countText != null && countText.getLineCount() + cards.size() + 3 > 30) {
          countFrame = null;
          countText = null;
          cardFrame = null;
          cardText = null;
        }

        // start new frame
        if (countFrame == null) {
          countFrame = new FlowRightFrame(down, 0.10, 1);
            countText = new ListFrame(countFrame, 1, 1);
            countText.setFont(DEFAULTFONT, 11, SWT.NORMAL);
            countText.setAlignment(SWT.RIGHT);
            countText.setMargin(0.2, 0.0, 0.2, 0.2);

          cardFrame = new FlowRightFrame(down, 0.4, 1);
            cardText = new ListFrame(cardFrame, 0.9, 1);
            cardText.setFont(DEFAULTFONT, 11, SWT.NORMAL);
            cardText.setMargin(0.04, 0.0, 0.2, 0.2);
        }

        if (!cards.isEmpty()) {
          if (countText.getLineCount() > 0) {
            countText.add("");
            cardText.add("");
          }
          if (!"".equals(group.getName())) {
            countText.add("");
            cardText.add(group.getName());
          }

          for (Card card : cards) {
            int count = group.count(card);
            countText.add(count + "x");
            cardText.add(card.getName());
          }
        }
      }
    }

    down = new FlowDownFrame(frame, 1.0, 0.05);
      ListFrame text = new ListFrame(down, 1.0, 1.0);
      text.setFont(DEFAULTFONT, 11, SWT.BOLD);
      text.setMargin(0.2, 0.2, 0.0, 0.0);
      text.setAlignment(SWT.CENTER);
      text.add("Sum: " + deck.countMaindeck() + " cards");
View Full Code Here

  }

  private void createSideboard(PrintFrame frame) {
    CardGroup group = deck.findGroup(CardGroup.SIDEBOARD);

    new FlowDownFrame(frame, 1, 0.01);
    FlowDownFrame down = new FlowDownFrame(frame, 1, 0.09);
      ListFrame text = new ListFrame(down, 1, 1);
      text.setFont(DEFAULTFONT, 11, SWT.BOLD);
      text.setAlignment(SWT.CENTER);
      text.setMargin(0.2, 0.2, 0.0, 0.0);
      text.setBackground(SWT.COLOR_GREEN);
      text.add(group.getName());

    down = new FlowDownFrame(frame, 1, 0.8);
      FlowRightFrame countFrame = null;
      ListFrame countText = null;
      FlowRightFrame cardFrame = null;
      ListFrame cardText = null;
      List<Card> cards = group.getUniqueCards();
      for (Card card : cards) {
        // create the two column frames
        if (countFrame == null && cardFrame == null) {
          countFrame = new FlowRightFrame(down, 0.10, 1);
          countText = new ListFrame(countFrame, 1.0, 1.0);
          countText.setFont(DEFAULTFONT, 11, SWT.NORMAL);
          countText.setAlignment(SWT.RIGHT);
          countText.setMargin(0.2, 0.0, 0.2, 0.2);
          countText.setBackground(SWT.COLOR_GREEN);
 
          cardFrame = new FlowRightFrame(down, 0.40, 1);
          cardText = new ListFrame(cardFrame, 1, 1);
          cardText.setFont(DEFAULTFONT, 11, SWT.NORMAL);
          cardText.setMargin(0.04, 0.0, 0.2, 0.2);
          cardText.setBackground(SWT.COLOR_GREEN);
        }
 
        int count = group.count(card);
        countText.add(count + "x");
        cardText.add(card.getName());
 
        // figure overflow
        if (countText.getLineCount() >= cards.size() / 2) {
          countFrame = null;
          countText = null;
          cardFrame = null;
          cardText = null;
        }
      }

    down = new FlowDownFrame(frame, 1, 0.09);
      ListFrame sumFrame = new ListFrame(down, 1, 1);
      sumFrame.setFont(DEFAULTFONT, 11, SWT.BOLD);
      sumFrame.setMargin(0.2, 0.2, 0.0, 0.0);
      sumFrame.setAlignment(SWT.CENTER);
      sumFrame.setBackground(SWT.COLOR_GREEN);
      sumFrame.add("Sum: " + deck.countSideboard() + " cards");
    new FlowDownFrame(frame, 1, 0.01);
  }
View Full Code Here

TOP

Related Classes of factOrFiction.print.FlowDownFrame

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.