Changeset 26666 in osm for applications/editors


Ignore:
Timestamp:
2011-09-17T19:40:13+02:00 (13 years ago)
Author:
jttt
Message:

Minimum change to make plugin recompile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/turnrestrictions/src/org/openstreetmap/josm/plugins/turnrestrictions/editor/RelationMemberTable.java

    r23526 r26666  
    3939
    4040/**
    41  * RelationMemberTable is the table for editing the raw member list of 
     41 * RelationMemberTable is the table for editing the raw member list of
    4242 * a turn restriction.
    43  * 
     43 *
    4444 */
    4545public class RelationMemberTable extends JTable {
    46     static private final Logger logger = Logger.getLogger(RelationMemberTable.class.getName());
    47    
    4846    private TurnRestrictionEditorModel model;
    4947    private DeleteAction actDelete;
     
    5250    private MoveDownAction actMoveDown;
    5351    private TransferHandler transferHandler;
    54    
     52
    5553    public RelationMemberTable(TurnRestrictionEditorModel model) {
    5654        super(
     
    6765        // register the popup menu launcher
    6866        addMouseListener(new TablePopupLauncher());
    69        
     67
    7068        // transfer handling
    7169        setDragEnabled(true);
    7270        setTransferHandler(new RelationMemberTransferHandler());
    7371        setDropTarget(new RelationMemberTableDropTarget());
    74        
     72
    7573        // initialize the delete action
    7674        //
     
    7876        model.getRelationMemberEditorModel().getRowSelectionModel().addListSelectionListener(actDelete);
    7977        registerKeyboardAction(actDelete, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0), WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    80        
     78
    8179        // initialize the paste action (will be used in the popup, the action map already includes
    82         // the standard paste action for transfer handling) 
     80        // the standard paste action for transfer handling)
    8381        actPaste = new PasteAction();
    84        
     82
    8583        actMoveUp = new MoveUpAction();
    8684        model.getRelationMemberEditorModel().getRowSelectionModel().addListSelectionListener(actMoveUp);
    8785        registerKeyboardAction(actMoveUp,actMoveUp.getKeyStroke(), WHEN_FOCUSED);
    88        
     86
    8987        actMoveDown = new MoveDownAction();
    9088        model.getRelationMemberEditorModel().getRowSelectionModel().addListSelectionListener(actMoveDown);
     
    9391
    9492    /**
    95      * The action for deleting the selected table cells 
    96      * 
     93     * The action for deleting the selected table cells
     94     *
    9795     */
    9896    class DeleteAction extends AbstractAction implements ListSelectionListener{
     
    104102            updateEnabledState();
    105103        }
    106        
     104
    107105        public void updateEnabledState() {
    108106            setEnabled(model.getRelationMemberEditorModel().getRowSelectionModel().getMinSelectionIndex()>=0);
     
    116114            updateEnabledState();
    117115        }
    118     }   
    119    
     116    }
     117
    120118    /**
    121119     * The action for pasting into the relation member table
    122      * 
     120     *
    123121     */
    124     class PasteAction extends AbstractAction{       
     122    class PasteAction extends AbstractAction{
    125123        public PasteAction() {
    126124            putValue(NAME, tr("Paste"));
     
    130128            updateEnabledState();
    131129        }
    132        
     130
    133131        public void updateEnabledState() {
    134132            DataFlavor[] flavors = Toolkit.getDefaultToolkit().getSystemClipboard().getAvailableDataFlavors();
     
    156154            } catch(UnsupportedFlavorException e){
    157155                e.printStackTrace();
    158             } 
    159         }
    160     }   
    161 
    162     class MoveDownAction extends AbstractAction implements ListSelectionListener{   
     156            }
     157        }
     158    }
     159
     160    class MoveDownAction extends AbstractAction implements ListSelectionListener{
    163161        private KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.ALT_DOWN_MASK);
    164162        public MoveDownAction(){
     
    169167            updateEnabledState();
    170168        }
    171        
     169
    172170        public void actionPerformed(ActionEvent e) {
    173171            model.getRelationMemberEditorModel().moveDownSelected();
     
    177175            setEnabled(model.getRelationMemberEditorModel().canMoveDown());
    178176        }
    179        
     177
    180178        public void valueChanged(ListSelectionEvent e) {
    181             updateEnabledState();           
     179            updateEnabledState();
    182180        }
    183181        public KeyStroke getKeyStroke() {
     
    185183        }
    186184    }
    187    
     185
    188186    class MoveUpAction extends AbstractAction implements ListSelectionListener{
    189187        private KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.ALT_DOWN_MASK);
     
    196194            updateEnabledState();
    197195        }
    198        
     196
    199197        public void actionPerformed(ActionEvent e) {
    200198            model.getRelationMemberEditorModel().moveUpSelected();
     
    204202            setEnabled(model.getRelationMemberEditorModel().canMoveUp());
    205203        }
    206        
     204
    207205        public void valueChanged(ListSelectionEvent e) {
    208             updateEnabledState();           
     206            updateEnabledState();
    209207        }
    210208        public KeyStroke getKeyStroke() {
     
    212210        }
    213211    }
    214    
     212
    215213    class TablePopupLauncher extends PopupMenuLauncher {
    216214        @Override
     
    222220            }
    223221            new PopupMenu().show(RelationMemberTable.this, evt.getX(), evt.getY());
    224         }       
    225     }
    226    
     222        }
     223    }
     224
    227225    class PopupMenu extends JPopupMenu {
    228226        public PopupMenu() {
     
    237235        }
    238236    }
    239    
     237
    240238    /**
    241      * The transfer handler for the relation member table. 
     239     * The transfer handler for the relation member table.
    242240     *
    243241     */
    244242    class RelationMemberTransferHandler extends TransferHandler {
    245        
     243
    246244        @Override
    247245        public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
     
    266264            } catch(UnsupportedFlavorException e){
    267265                e.printStackTrace();
    268             } 
     266            }
    269267            return false;
    270268        }
     
    275273        }
    276274    }
    277    
     275
    278276    /**
    279277     * A custom drop target for the relation member table. During dragging we need to
    280      * disable colum selection model. 
     278     * disable colum selection model.
    281279     *
    282280     */
    283     class RelationMemberTableDropTarget extends DropTarget{     
    284         private boolean dropAccepted = false;   
    285        
     281    class RelationMemberTableDropTarget extends DropTarget{
     282        private boolean dropAccepted = false;
     283
    286284        /**
    287285         * Replies true if {@code transferFlavors} includes the data flavor {@link PrimitiveIdTransferable#PRIMITIVE_ID_LIST_FLAVOR}.
     
    295293            }
    296294            return false;
    297         }       
    298        
     295        }
     296
    299297        public synchronized void dragEnter(DropTargetDragEvent dtde) {
    300298            if (isSupportedFlavor(dtde.getCurrentDataFlavors())) {
    301299                if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY_OR_MOVE) != 0){
    302                     dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);     
     300                    dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
    303301                    setColumnSelectionAllowed(false);
    304302                    dropAccepted  = true;
     
    310308            }
    311309        }
    312        
     310
    313311        public synchronized void dragExit(DropTargetEvent dte) {
    314312            setColumnSelectionAllowed(true);
    315313            dropAccepted = false;
    316314        }
    317        
     315
    318316        @Override
    319317        public synchronized void dragOver(DropTargetDragEvent dtde) {
     
    322320            if (row >= 0 && row != selectedRow){
    323321                getSelectionModel().setSelectionInterval(row, row);
    324             }           
     322            }
    325323        }
    326324
    327325        public synchronized void drop(DropTargetDropEvent dtde) {
    328326            try {
    329                 if (!dropAccepted) return; 
     327                if (!dropAccepted) return;
    330328                if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY_OR_MOVE) == 0) {
    331329                    return;
     
    347345            }
    348346        }
    349        
     347
    350348        public synchronized void dropActionChanged(DropTargetDragEvent dtde) {
    351349            if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY_OR_MOVE) == 0) {
Note: See TracChangeset for help on using the changeset viewer.