Example usage for java.awt.dnd DropTarget setDefaultActions

List of usage examples for java.awt.dnd DropTarget setDefaultActions

Introduction

In this page you can find the example usage for java.awt.dnd DropTarget setDefaultActions.

Prototype


public void setDefaultActions(int ops) 

Source Link

Document

Sets the default acceptable actions for this DropTarget

Usage

From source file:com.eviware.soapui.impl.wsdl.panels.teststeps.support.PropertyHolderTable.java

public PropertyHolderTable(TestPropertyHolder holder) {
    super(new BorderLayout());
    this.holder = holder;

    loadPropertiesAction = new LoadPropertiesAction();
    JScrollPane scrollPane = new JScrollPane(buildPropertiesTable());

    if (getHolder().getModelItem() != null) {
        DropTarget dropTarget = new DropTarget(scrollPane,
                new PropertyHolderTablePropertyExpansionDropTarget());
        dropTarget.setDefaultActions(DnDConstants.ACTION_COPY_OR_MOVE);
    }/*from w  ww. jav a2 s .c om*/

    add(scrollPane, BorderLayout.CENTER);
    add(buildToolbar(), BorderLayout.NORTH);

    projectListener = new ProjectListenerAdapter() {
        public void environmentSwitched(Environment environment) {
            getPropertiesModel().fireTableDataChanged();
        }
    };
}

From source file:com.eviware.soapui.impl.wsdl.panels.teststeps.support.PropertyHolderTable.java

protected JTable buildPropertiesTable() {
    propertiesModel = getPropertyHolderTableModel();
    propertiesTable = new PropertiesHolderJTable();
    propertiesTable.setName(PROPERTIES_HOLDER_TABLE_NAME);
    propertiesTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    propertiesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            int selectedRow = propertiesTable.getSelectedRow();
            if (removePropertyAction != null) {
                removePropertyAction.setEnabled(selectedRow != -1);
            }//from www  .  ja va  2s .c  o m

            if (movePropertyUpAction != null) {
                movePropertyUpAction.setEnabled(selectedRow > 0);
            }

            if (movePropertyDownAction != null) {
                movePropertyDownAction
                        .setEnabled(selectedRow >= 0 && selectedRow < propertiesTable.getRowCount() - 1);
            }
        }
    });

    propertiesTable.setDragEnabled(true);
    propertiesTable.setTransferHandler(new TransferHandler("testProperty"));

    if (getHolder().getModelItem() != null) {
        DropTarget dropTarget = new DropTarget(propertiesTable,
                new PropertyHolderTablePropertyExpansionDropTarget());
        dropTarget.setDefaultActions(DnDConstants.ACTION_COPY_OR_MOVE);
    }

    // Set render this only for value column. In this cell render we handle password shadowing.
    propertiesTable.getColumnModel().getColumn(1).setCellRenderer(new PropertiesTableCellRenderer());
    return propertiesTable;
}