Author: julien(a)jboss.com
Date: 2008-07-09 10:56:01 -0400 (Wed, 09 Jul 2008)
New Revision: 11369
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
Log:
add droppable interface
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09
14:14:40 UTC (rev 11368)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-07-09
14:56:01 UTC (rev 11369)
@@ -157,10 +157,10 @@
case Event.ONMOUSEOVER:
case Event.ONMOUSEOUT:
{
- if (drag != null && element == getElement())
- {
- stopDrag();
- }
+// if (drag != null && element == getElement())
+// {
+// stopDrag();
+// }
break;
}
}
@@ -197,7 +197,7 @@
private void stopDrag()
{
- log.debug("Stopping drag with draggable " + drag.draggable);
+ log.debug("Stopping drag with draggable " + drag.draggable + " and
droppable " + droppable);
//
if (droppable != null)
@@ -208,10 +208,12 @@
//
if (droppable.accept(drag.draggable))
{
+ log.debug("Droppable " + droppable + " accepted the draggable
" + drag.draggable);
drag.draggable.accepted(droppable);
}
else
{
+ log.debug("Droppable " + droppable + " rejected the draggable
" + drag.draggable);
drag.draggable.rejected(droppable);
}
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-09
14:14:40 UTC (rev 11368)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-07-09
14:56:01 UTC (rev 11369)
@@ -130,6 +130,35 @@
public boolean accept(Draggable draggable)
{
+ if (draggable instanceof AjaxWindow.DraggableWindow)
+ {
+ AjaxWindow.DraggableWindow draggableWindow =
(AjaxWindow.DraggableWindow)draggable;
+ AjaxWindow window = draggableWindow.getWindow();
+
+ //
+ if (!getChildren().contains(window))
+ {
+ AjaxObject parent = window.getParent();
+
+ //
+ log.info("Moving window " + window.getId() + " from parent
" + parent.getId() + " to layout " + getId());
+
+ //
+ parent.removeChild(window);
+
+ //
+ addChild(window);
+
+ //
+ return true;
+ }
+ else
+ {
+ log.info("Do not contain child " + window.getId());
+ }
+ }
+
+ //
return false;
}
};
@@ -149,22 +178,6 @@
return null;
}
- private boolean contains(Element container, Element contained)
- {
- if (container == contained)
- {
- return true;
- }
- for (int i = DOM.getChildCount(container) - 1;i >= 0;i--)
- {
- if (contains(DOM.getChild(container, i), contained))
- {
- return true;
- }
- }
- return false;
- }
-
protected Draggable doFindDraggable(Element element)
{
return null;
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-09
14:14:40 UTC (rev 11368)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-07-09
14:56:01 UTC (rev 11369)
@@ -68,12 +68,16 @@
/** . */
private boolean stale;
+ /** . */
+ protected final Logger log;
+
protected AjaxObject(String id, Map properties)
{
this.id = id;
this.children = new HashMap();
this.properties = properties;
this.stale = true;
+ this.log = Logger.getLogger("AjaxObject." + id);
}
public final void createWidget()
@@ -175,7 +179,7 @@
refreshRecursive(force);
}
- private void addChild(AjaxObject child)
+ public void addChild(AjaxObject child)
{
// Create relationship
children.put(child.getId(), child);
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09
14:14:40 UTC (rev 11368)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-09
14:56:01 UTC (rev 11369)
@@ -69,48 +69,64 @@
private HTML markup;
/** . */
- private Draggable draggable;
+ private DraggableWindow draggable;
- public AjaxWindow(String id, Map properties)
+ static class DraggableWindow implements Draggable
{
- super(id, properties);
- //
- draggable = new Draggable()
+ /** . */
+ private final AjaxWindow window;
+
+ DraggableWindow(AjaxWindow window)
{
- public Element getContainer()
- {
- return widget.getElement();
- }
+ this.window = window;
+ }
- public void startDragging()
- {
- widget.addStyleName("dnd-dragged");
- }
+ public AjaxWindow getWindow()
+ {
+ return window;
+ }
- public void stopDragging()
- {
- widget.removeStyleName("dnd-dragged");
- }
+ public Element getContainer()
+ {
+ return window.widget.getElement();
+ }
- public void enter(Droppable droppable)
- {
- }
+ public void startDragging()
+ {
+ window.widget.addStyleName("dnd-dragged");
+ }
- public void leave(Droppable droppable)
- {
- }
+ public void stopDragging()
+ {
+ window.widget.removeStyleName("dnd-dragged");
+ }
- public void accepted(Droppable droppable)
- {
- }
+ public void enter(Droppable droppable)
+ {
+ }
- public void rejected(Droppable droppable)
- {
- }
- };
+ public void leave(Droppable droppable)
+ {
+ }
+
+ public void accepted(Droppable droppable)
+ {
+ }
+
+ public void rejected(Droppable droppable)
+ {
+ }
}
+ public AjaxWindow(String id, Map properties)
+ {
+ super(id, properties);
+
+ //
+ draggable = new DraggableWindow(this);
+ }
+
protected Draggable doFindDraggable(Element element)
{
if (title.getElement() == element)
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
===================================================================
---
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-09
14:14:40 UTC (rev 11368)
+++
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-09
14:56:01 UTC (rev 11369)
@@ -2,7 +2,8 @@
white-space:pre;
font-family:Courier New;
font-size:12px;
- font-weight:bold;
+ font-weight:normal;
+ background-color:black;
}
.log-ERROR {
@@ -10,15 +11,15 @@
}
.log-INFO {
- color:black;
+ color:greenyellow;
}
.log-DEBUG {
- color:gray;
+ color:lightgreen;
}
.log-TRACE {
- color:lightgray;
+ color:green;
}
.pf-Pane {
Show replies by date