Examples of CardGroup


Examples of factOrFiction.model.CardGroup

   
    List<CardGroup> groups = deck.getChildren();

    // get all cards from all groups
    for (Iterator<CardGroup> iter = groups.iterator(); iter.hasNext();) {
      CardGroup group = iter.next();
      // save all cards
      cards.addAll( group.getAllCards() );
      if( group != deck.sideboard && group != deck.main)
        iter.remove();
      else
        group.clear();
    }
   
    CardGroup groupW = deck.addGroupAfter("White", deck.main);
    CardGroup groupU = deck.addGroupAfter("Blue", groupW);
    CardGroup groupB = deck.addGroupAfter("Black", groupU);
    CardGroup groupR = deck.addGroupAfter("Red", groupB);
    CardGroup groupG = deck.addGroupAfter("Green", groupR);
    CardGroup groupHybrid = deck.addGroupAfter("Hybrid", groupG);
    CardGroup groupGold = deck.addGroupAfter("Gold", groupHybrid);
    CardGroup groupArtifact = deck.addGroupAfter("Artifact", groupGold);
    CardGroup groupLand = deck.addGroupAfter("Land", groupArtifact);
   
    for (Card card : cards) {
      if( card.isLand() )
        groupLand.add(card);
      else if( card.isArtifact())
        groupArtifact.add(card);
      else if( card.isHybrid())
        groupArtifact.add(card);
      else if( card.isGold())
View Full Code Here

Examples of factOrFiction.model.CardGroup

        cards.addAll( group.getAllCards() );
        group.clear();       
      }
    }
   
    CardGroup group = deck.main;
   
    for (Iterator<Card> iter = cards.iterator(); iter.hasNext();) {
      Card card = iter.next();
      String genericType = card.getGenericType();
     
      if(genericType == null) {
        group = deck.main;
      }
      else  {
        // now make more (english) sense from it
        if(genericType.endsWith(("y"))) {
          genericType = genericType.substring(0, genericType.length()-1);
          genericType += "ies";
         
        } else {
          genericType += "s";
        }
       
        if(groupMap.containsKey(genericType)) {
          group = groupMap.get(genericType);
        } else {
          group = deck.addGroupAfter(genericType, group);
          groupMap.put(genericType, group);
        }
      }
      group.add(card);
    }   

    // delete empty groups at end of sort procedure
    for (Iterator<CardGroup> iter = groups.iterator(); iter.hasNext();) {
      CardGroup afterGroup = iter.next();
     
      if( !afterGroup.hasChildren() && afterGroup != deck.sideboard && afterGroup != deck.main)
        iter.remove();
      else
        afterGroup.sort( comparator() );
    }

    deck.doUpdate(true);

    deck.update(false, true);
View Full Code Here

Examples of factOrFiction.model.CardGroup

      text.setAlignment(SWT.CENTER);
      text.add("Sum: " + deck.countMaindeck() + " cards");
  }

  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) {
View Full Code Here

Examples of factOrFiction.model.CardGroup

        return null;
      }
      @Override
      public Font getFont(Object element) {
        if(element instanceof CardGroup) {
          CardGroup group = (CardGroup) element;
 
          if (group.getName() == CardGroup.SIDEBOARD)
            return boldFont;
          else if (group.getName() != CardGroup.MAIN)
            return italicFont;
        }
        return null;
      }
      @Override
      public String getToolTipText(Object element) {
        return null;
      }
    });

    columnGroup.setEditingSupport(new EditingSupport(deckViewer) {
      CellEditor editor = new TextCellEditor(deckViewer.getTree());

      @Override
      protected boolean canEdit(Object element) {
        if (element instanceof CardGroup) {
          CardGroup cardGroup = (CardGroup) element;
          if(CardGroup.SIDEBOARD != cardGroup.getName() )
            return true;
        }
        return false;
      }

      @Override
      protected CellEditor getCellEditor(Object element) {
        return editor;
      }

      @Override
      protected Object getValue(Object element) {
        if (element instanceof CardGroup) {
          CardGroup cardGroup = (CardGroup) element;
          if(CardGroup.SIDEBOARD != cardGroup.getName() )
            return cardGroup.getName();
        }
        return null;
      }

      @Override
      protected void setValue(Object element, Object value) {
// TODO this was needed in 3.1 and old API, still necessary?
//        if (element instanceof Item) {
//          element = ((Item) element).getData();
//        }
        if (element instanceof CardGroup) {
          CardGroup group = (CardGroup) element;

          if (!group.getName().equals(value))
            group.setName((String) value);
        }
      }

    })
   
View Full Code Here

Examples of factOrFiction.model.CardGroup

    if(selection instanceof IStructuredSelection) {
      boolean state = false;
      currentSelection  = (IStructuredSelection)selection;
     
      if(currentSelection.getFirstElement() instanceof CardGroup) {
        CardGroup group = (CardGroup)currentSelection.getFirstElement();
        Deck deck = (Deck)group.getParent();
        CardGroup prior = deck.getPrior(group);
       
        state = ( prior != null) && (prior != deck.main ) && (group != deck.sideboard );
      }
      action.setEnabled( state );
    }
View Full Code Here

Examples of factOrFiction.model.CardGroup

      action.setEnabled( state );
    }
  }

  public void run(IAction action) {
    CardGroup group = (CardGroup)currentSelection.getFirstElement();
   
    if(group != null) {
   
      Deck deck = (Deck)group.getParent();
      CardGroup prior = deck.getPrior(group);
     
      deck.moveGroupAfter(prior, group);
     
      editor.getSite().getSelectionProvider().setSelection( new StructuredSelection( group ) );
    }
View Full Code Here

Examples of factOrFiction.model.CardGroup

      List<Card> toSelect = new ArrayList<Card>(currentSelection.size());
      for (Iterator it = currentSelection.iterator(); it.hasNext(); ) {
        Card card = (Card)it.next();
       
        if(card != null) {
          CardGroup group = (CardGroup)card.getParent();
         
          group.remove( card );
          toSelect.addAll(group.lookup(card));
        }
      }
      editor.getSite().getSelectionProvider().setSelection( new StructuredSelection(toSelect) );
    } else if(groupCount == 1) {
      CardGroup group = (CardGroup)currentSelection.getFirstElement();
      Deck deck = (Deck)group.getParent();
     
      deck.remove(group);
    }

  }
View Full Code Here

Examples of factOrFiction.model.CardGroup

      setDirty(needSave);
     
      // handle changes to subgroups within decks
      if (source instanceof CardGroup) {
        CardGroup group = (CardGroup) source;
        group.addUpdateListener(this);
        viewer.refresh(group, updateLabels);
        viewer.expandToLevel(group, AbstractTreeViewer.ALL_LEVELS);
        updateStatusLine();
      } else if (source instanceof Card) {
        Card card = (Card) source;
View Full Code Here

Examples of factOrFiction.model.CardGroup

    if(cardCount > 0) {
      for (Iterator it = currentSelection.iterator(); it.hasNext(); ) {
        Card card = (Card)it.next();
       
        if(card != null) {
          CardGroup group = (CardGroup)card.getParent();
         
          group.addAfter( Card.newInstance(card), card );
          toSelect.addAll(group.lookup( card ));
        }
      }     
    } else if(groupCount == 1) {
      CardGroup group = (CardGroup)currentSelection.getFirstElement();
     
      if(group != null) {
        Deck deck = (Deck)group.getParent();

        CardGroup newGroup = deck.addGroupAfter("New Section", group );
       
        toSelect.add( newGroup );
      }
    }
   
View Full Code Here

Examples of factOrFiction.model.CardGroup

          }
         
          DeckParticleTransfer.getInstance().setTransferable( transferableCard );
          event.doit = true;
        } else if( selection.getFirstElement() instanceof CardGroup ) {
          CardGroup group = (CardGroup)selection.getFirstElement();
         
          if( !(CardGroup.MAIN == group.getName()) && !(CardGroup.SIDEBOARD == group.getName()) ) {
            CardGroup[] transferableGroup = new CardGroup[1];

            transferableGroup[0= group;
            DeckParticleTransfer.getInstance().setTransferable( transferableGroup );
            event.doit = true;           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.