IDEMPIERE-1354 widget drag and drop handling standardisation

This commit is contained in:
Carlos Ruiz 2013-09-19 18:59:05 -05:00
parent cb2624fbef
commit bc03f30c0c
2 changed files with 22 additions and 6 deletions

View File

@ -62,6 +62,7 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.MaximizeEvent;
import org.zkoss.zul.Anchorchildren;
import org.zkoss.zul.Anchorlayout;
import org.zkoss.zul.Caption;
import org.zkoss.zul.Html;
import org.zkoss.zul.Iframe;
import org.zkoss.zul.Include;
@ -159,12 +160,13 @@ public class DashboardController implements EventListener<Event> {
}
Panel panel = new Panel();
Caption caption = new Caption(dc.get_Translation(MDashboardContent.COLUMNNAME_Name));
panel.appendChild(caption);
panel.setAttribute("PA_DashboardContent_ID", dp.getPA_DashboardContent_ID());
panel.setAttribute("PA_DashboardPreference_ID", dp.getPA_DashboardPreference_ID());
panelList.add(panel);
panel.addEventListener(Events.ON_MAXIMIZE, this);
panel.setSclass("dashboard-widget");
panel.setTitle(dc.get_Translation(MDashboardContent.COLUMNNAME_Name));
panel.setMaximizable(true);
String description = dc.get_Translation(MDashboardContent.COLUMNNAME_Description);
@ -176,7 +178,7 @@ public class DashboardController implements EventListener<Event> {
panel.addEventListener(Events.ON_OPEN, this);
panel.setDroppable("true");
panel.setDraggable("true");
panel.getCaption().setDraggable("true");
panel.addEventListener(Events.ON_DROP, this);
panel.setBorder("normal");
@ -455,11 +457,16 @@ public class DashboardController implements EventListener<Event> {
DropEvent de = (DropEvent) event;
Component dragged = de.getDragged();
if(dragged instanceof Panel)
if(dragged instanceof Caption)
{
Panel panel = (Panel) dragged;
Caption caption = (Caption) dragged;
Panel panel = null;
if (caption.getParent() instanceof Panel)
panel = (Panel) caption.getParent();
if(comp instanceof Panel)
if (panel == null)
;
else if(comp instanceof Panel)
{
Panel target = (Panel) comp;

View File

@ -592,10 +592,19 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
.z-panel-hl .z-panel-header {
padding: 0 0 2px 0;
color: #262626;
background: #F4F4F4;
font-weight: 300;
font-size: 13px;
}
.z-caption .z-caption-l, .z-caption .z-caption-r {
padding: 0 0 2px 0;
color: #262626;
font-weight: 300;
font-size: 13px;
cursor: move;
}
.desktop-home-tabpanel .z-panel-tl, .desktop-home-tabpanel .z-panel-tr,
.desktop-home-tabpanel .z-panel-hr, .desktop-home-tabpanel .z-panel-hl,
.desktop-home-tabpanel .z-panel-hm {