Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 64 lines (43 sloc) 2.006 kb
27e2d5a add dnd library
lkcl authored
1 """
2 * Copyright 2009 Fred Sauer
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * the License at
7 *
8 * http:#www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 """
16
17
18 from pyjamas.ui.AbsolutePanel import AbsolutePanel
19
20 from pyjamas.dnd import PickupDragController
21 from pyjamas.dnd.drop import AbsolutePositionDropController
22
23
24 """*
25 * {@link com.allen_sauer.gwt.dnd.client.drop.AbsolutePositionDropController}
26 * example.
27 """
28
29 # XXX must import Example class - it provides e.g.the createDraggable function
30 class AbsolutePositionExample(Example):
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
31
27e2d5a add dnd library
lkcl authored
32 CSS_DEMO_ABSOLUTE_POSITION_EXAMPLE = "demo-AbsolutePositionExample"
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
33
27e2d5a add dnd library
lkcl authored
34 def __init__(self, dragController):
35
36 Example.__init__(self, dragController)
37 self.addStyleName(self.CSS_DEMO_ABSOLUTE_POSITION_EXAMPLE)
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
38
27e2d5a add dnd library
lkcl authored
39 # use the drop target as this composite's widget
40 positioningDropTarget = AbsolutePanel()
41 positioningDropTarget.setPixelSize(400, 200)
42 self.setWidget(positioningDropTarget)
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
43
27e2d5a add dnd library
lkcl authored
44 # instantiate our drop controller
45 self.absposdc = AbsolutePositionDropController(positioningDropTarget)
46 dragController.registerDropController(self.absposdc)
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
47
48
27e2d5a add dnd library
lkcl authored
49 def getDescription(self):
50 return "Draggable widgets can be placed anywhere on the gray drop target."
51
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
52
27e2d5a add dnd library
lkcl authored
53 def getInvolvedClasses(self):
54 return [AbsolutePositionExample, AbsolutePositionDropController]
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
55
56
27e2d5a add dnd library
lkcl authored
57 def onInitialLoad(self):
58 self.absposdc.drop(self.createDraggable(), 10, 30)
59 self.absposdc.drop(self.createDraggable(), 60, 8)
60 self.absposdc.drop(self.createDraggable(), 190, 60)
64eff55 @xtfxme find * -name '*.py' | xargs sed -i -r 's,\s+$,,'
xtfxme authored
61
27e2d5a add dnd library
lkcl authored
62
63
Something went wrong with that request. Please try again.