Examples of CardGroup


Examples of factOrFiction.model.CardGroup

 
  private boolean performCardTemplateDrop(CardTemplate template) {
    int location = getCurrentLocation();
   
    Card targetCard = null;
    CardGroup targetGroup = null;
   
    Card card = Card.newInstance(template);
   
    // COPY card on card
    if( getCurrentTarget() instanceof Card ) {
      targetCard = (Card)getCurrentTarget();
      targetGroup = (CardGroup)targetCard.getParent();
    // COPY card on group
    } else if( getCurrentTarget() instanceof CardGroup ) {
      targetGroup = (CardGroup)getCurrentTarget();
     
      if( location == LOCATION_BEFORE) {
        Deck deck = (Deck)targetGroup.getParent();
        CardGroup prior = deck.getPrior(targetGroup);
        if( prior != null) {
          targetGroup = prior;
          location = LOCATION_AFTER;
        }
      } else {
View Full Code Here

Examples of factOrFiction.model.CardGroup

  }
 
  private boolean performGroupDrop(CardGroup[] groups) {
    int location = getCurrentLocation();
   
    CardGroup targetGroup = null;
   
    for (CardGroup group : groups) {
      // MOVE/COPY card on card
      if( getCurrentTarget() instanceof Card ) {
        Card targetCard = (Card)getCurrentTarget();
View Full Code Here

Examples of factOrFiction.model.CardGroup

 
  private boolean performCardDrop(Card[] cards) {
    int location = getCurrentLocation();
   
    Card targetCard = null;
    CardGroup targetGroup = null;
   
    // MOVE/COPY card on card
    if( getCurrentTarget() instanceof Card ) {
      targetCard = (Card)getCurrentTarget();
      targetGroup = (CardGroup)targetCard.getParent();
    // MOVE/COPY card on group
    } else if( getCurrentTarget() instanceof CardGroup ) {
      targetGroup = (CardGroup)getCurrentTarget();
     
      if( location == LOCATION_BEFORE) {
        Deck deck = (Deck)targetGroup.getParent();
        CardGroup prior = deck.getPrior(targetGroup);
        if( prior != null) {
          targetGroup = prior;
          location = LOCATION_AFTER;
        }
      } else {
        location = LOCATION_BEFORE;
      }
    } else
      return false;

    for (Card card : cards) {
      List<Card> toInsert = new ArrayList<Card>(4);
     
      CardGroup sourceGroup = (CardGroup)card.getParent();
      if(getCurrentOperation() == DND.DROP_COPY) {
        // check for existing identical cards
        List<Card> targetList = targetGroup.lookup(card);
        if(!targetList.isEmpty()) {
          targetCard = targetList.get(0);
          location = LOCATION_AFTER;
        }
 
        // need to remove one copy from sourceGroup
        // use dragged card
        if( sourceGroup != null )
          sourceGroup.remove( card );
        toInsert.add( card );
      } else if(getCurrentOperation() == DND.DROP_MOVE) {
        // need to remove all copies from sourceGroup
        // add to dragged cards
        if( sourceGroup != null ) {
          toInsert.addAll( sourceGroup.lookup( card ) );
          sourceGroup.removeAll( toInsert );
        }
      }
     
      if( location == LOCATION_BEFORE ) {
        targetGroup.addAllBefore( toInsert, targetCard );         
View Full Code Here

Examples of factOrFiction.model.CardGroup

            ISelectionProvider provider = editor.getSite().getSelectionProvider();
            IStructuredSelection selection = (IStructuredSelection)provider.getSelection();
     
            if(selection != null) {
              DeckParticle particle = (DeckParticle)selection.getFirstElement();
              CardGroup group = null;
             
              if(particle != null && particle instanceof CardGroup) {
                group = (CardGroup)particle;
              } else if(particle != null && particle instanceof Card) {
                group = (CardGroup)particle.getParent();
              } else {
                Deck deck = (Deck)editor.getEditorInput().getAdapter(Deck.class);
               
                if(deck != null)
                  group = deck.main;
              }
             
              if(group != null) {
                Card toAdd = Card.newInstance(newCard);
                group.add(toAdd);
               
                List<Card> list = group.lookup(toAdd);
                provider.setSelection( new StructuredSelection(list) );
              }
            }
          }
        }
View Full Code Here

Examples of factOrFiction.model.CardGroup

    boolean state = false;
    if(selection instanceof IStructuredSelection) {
      currentSelection  = (IStructuredSelection)selection;
     
      if(currentSelection.getFirstElement() instanceof CardGroup) {
        CardGroup group = (CardGroup)currentSelection.getFirstElement();
        Deck deck = (Deck)group.getParent();
        CardGroup next = deck.getNext(group);
       
        state = ( next != null) && (next != deck.sideboard) && (group != deck.main);
      }
      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 next = deck.getNext(group);
     
      deck.moveGroupAfter(group, next);     
     
      editor.getSite().getSelectionProvider().setSelection( new StructuredSelection( group ) );
    }
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.