Browse Source

DD related refactorings and javadocs

svn changeset:11960/svn branch:6.3
tags/6.7.0.beta1
Matti Tahvonen 14 years ago
parent
commit
db212adfc1

+ 27
- 5
src/com/vaadin/ui/Table.java View File

@@ -70,8 +70,16 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Modes that Table support as drag sourse.
*/
public enum DragModes {
NONE, ROWS
public enum TableDragMode {
/**
* Table does not start drag and drop events. HTM5 style events started
* by browser may still happen.
*/
NONE,
/**
* Table starts drag from rows.
*/
ROWS
}

private static final int CELL_KEY = 0;
@@ -345,7 +353,7 @@ public class Table extends AbstractSelect implements Action.Container,

private double cacheRate = CACHE_RATE_DEFAULT;

private DragModes dragMode = DragModes.NONE;
private TableDragMode dragMode = TableDragMode.NONE;

private DropHandler dropHandler;

@@ -2040,7 +2048,7 @@ public class Table extends AbstractSelect implements Action.Container,
target.addAttribute("tabindex", getTabIndex());
}

if (dragMode != DragModes.NONE) {
if (dragMode != TableDragMode.NONE) {
target.addAttribute("dragmode", dragMode.ordinal());
}

@@ -3335,11 +3343,25 @@ public class Table extends AbstractSelect implements Action.Container,
}
}

public void setDragMode(DragModes newDragMode) {
/**
* Sets the drag start mode of the Table. Drag start mode controls how Table
* behaves as a drag source.
*
* @param newDragMode
*/
public void setDragMode(TableDragMode newDragMode) {
dragMode = newDragMode;
requestRepaint();
}

/**
* @return the current start mode of the Table. Drag start mode controls how
* Table behaves as a drag source.
*/
public TableDragMode getDragMode() {
return dragMode;
}

/**
* Concrete implementation of {@link DataBoundTransferable} for data
* transferred from a table.

+ 2
- 2
tests/src/com/vaadin/tests/dd/DDTest1.java View File

@@ -21,7 +21,7 @@ import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
import com.vaadin.ui.Table;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Table.DragModes;
import com.vaadin.ui.Table.TableDragMode;
import com.vaadin.ui.Tree.TreeDragMode;
import com.vaadin.ui.Tree.TreeDropTargetDetails;

@@ -237,7 +237,7 @@ public class DDTest1 extends TestBase {
ta.addContainerProperty("Bars", String.class, "Bar");
ta.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
ta.setSizeFull();
ta.setDragMode(DragModes.ROWS);
ta.setDragMode(TableDragMode.ROWS);

main.addComponent(pane1);
main.addComponent(pane2);

+ 1
- 1
tests/src/com/vaadin/tests/dd/DDTest2.java View File

@@ -118,7 +118,7 @@ public class DDTest2 extends TestBase {
/*
* Make table rows draggable
*/
table.setDragMode(Table.DragModes.ROWS);
table.setDragMode(Table.TableDragMode.ROWS);

OverFolderNode onNode = new OverFolderNode();
DragSourceIs fromTable = new DragSourceIs(table);

+ 1
- 1
tests/src/com/vaadin/tests/dd/DDTest4.java View File

@@ -59,7 +59,7 @@ public class DDTest4 extends TestBase {
/*
* Make table rows draggable
*/
table.setDragMode(Table.DragModes.ROWS);
table.setDragMode(Table.TableDragMode.ROWS);

table.setDropHandler(new DropHandler() {
// accept only drags from this table

Loading…
Cancel
Save