Examples of VisualListModel


Examples of org.pdfsam.guiclient.commons.models.VisualListModel

      Transferable transferable = info.getTransferable();
      //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{
                //check limits
                int listSize = destModel.getSize();
                if(index>listSize || index<0){
                  addIndex=listSize;
                }else{
                  addIndex = index;
                }
              }
              retVal = true;
            }
            if(retVal){
              Collection<VisualPageListItem> items = Arrays.asList(dataList);
              //if moving to another component
              if(info.getSourceDropActions()==COPY){
                Vector<VisualPageListItem> newList = new Vector<VisualPageListItem>(items.size());
                  for(VisualPageListItem currItem : items){
                    newList.add((VisualPageListItem) currItem.clone());
                  }
                  items = newList;
              }
              destModel.addAllElements(addIndex, items);
            }
          }
        }catch(Exception e){
          retVal = false;
          log.error(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Error during drag and drop."), e);
View Full Code Here

Examples of org.pdfsam.guiclient.commons.models.VisualListModel

                    log.error(GettextResource.gettext(config.getI18nResourceBundle(),"Error setting zoom level."), ex);
                }               
            }
        });   

    thumbnailList.setModel(new VisualListModel());
    thumbnailList.setCellRenderer(new VisualListRenderer());
    thumbnailList.setVisibleRowCount(-1);
    thumbnailList.setSelectionMode(selectionType);   
    JScrollPane listScroller = new JScrollPane(thumbnailList);   
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.