Ejemplo n.º 1
0
 protected void exportDone(JComponent c, Transferable data, int action) {
   if (action == MOVE) {
     JList listaOrigem = (JList) c;
     Sistema[] sistemas;
     try {
       sistemas = (Sistema[]) data.getTransferData(SistemaTransferable.getSistemaDataFlavor());
       ModeloListaObjetosGrupo modelo = (ModeloListaObjetosGrupo) listaOrigem.getModel();
       modelo.removerSistemas(sistemas);
     } catch (UnsupportedFlavorException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
 }
Ejemplo n.º 2
0
 public boolean importData(JComponent c, Transferable t) {
   JList listaDestino = (JList) c;
   if (listaDestino == origem) {
     return false;
   }
   if (canImport(c, t.getTransferDataFlavors())) {
     try {
       Sistema[] sistemas =
           (Sistema[]) t.getTransferData(SistemaTransferable.getSistemaDataFlavor());
       ModeloListaObjetosGrupo modelo = (ModeloListaObjetosGrupo) listaDestino.getModel();
       modelo.adicionarSistemas(sistemas);
       return true;
     } catch (UnsupportedFlavorException ufe) {
       System.out.println("importData: unsupported data flavor");
     } catch (IOException ioe) {
       System.out.println("importData: I/O exception");
     }
   }
   return false;
 }