Package org.pdfsam.guiclient.commons.dnd.transferables.VisualPageListTransferable

Examples of org.pdfsam.guiclient.commons.dnd.transferables.VisualPageListTransferable.TransferableData


    //clean only if MOVE
    //it works only if the selection type of the JList is ListSelectionModel.SINGLE_INTERVAL_SELECTION
    if(action==MOVE){
        try{
          JVisualSelectionList listComponent = (JVisualSelectionList) source;
              TransferableData transferredData = (TransferableData)data.getTransferData(DnDSupportUtility.VISUAL_LIST_FLAVOR);
              if(transferredData != null && transferredData.getIndexesList()!=null){
                int[] dataList = transferredData.getIndexesList();
                int delta = (dataList[0] > addIndex)? dataList.length: 0;
                ((VisualListModel)listComponent.getModel()).removeElements(dataList[0]+delta, dataList[dataList.length-1]+delta, true);
              }
          addIndex = 0;
        }catch(Exception e){
View Full Code Here


      //source and destination are equals or the handler accepts different components
        try{
          JList.DropLocation dropLocation = (JList.DropLocation)info.getDropLocation();
              int index = dropLocation.getIndex();
              VisualListModel destModel =  ((VisualListModel)((JVisualSelectionList)info.getComponent()).getModel());
              TransferableData transferredData = (TransferableData)transferable.getTransferData(DnDSupportUtility.VISUAL_LIST_FLAVOR);
              if(transferredData!=null){
                VisualPageListItem[] dataList = transferredData.getDataList();
            if(dataList!=null && dataList.length>0){
              //drop at the end
              if(index==-1){
                addIndex = destModel.getSize();
              }else{
View Full Code Here

      }
      else if(info.getComponent() instanceof JVisualSelectionList){
      if(info.isDataFlavorSupported(DnDSupportUtility.VISUAL_LIST_FLAVOR)){
        if(info.getSourceDropActions()==MOVE){
          try{
            TransferableData transferredData = (TransferableData)info.getTransferable().getTransferData(DnDSupportUtility.VISUAL_LIST_FLAVOR);
            JList.DropLocation dropLocation = (JList.DropLocation)info.getDropLocation();
                  int index = dropLocation.getIndex();
                  if(transferredData!=null){
                    int[] indices = transferredData.getIndexesList();
                    //prevent dropping over itself
              retVal =  !(indices != null && index >= indices[0] && index <= indices[indices.length -1]+1);
                  }
                }catch (UnsupportedFlavorException e) {
            retVal = false;
View Full Code Here

TOP

Related Classes of org.pdfsam.guiclient.commons.dnd.transferables.VisualPageListTransferable.TransferableData

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.