Quantcast
Channel: SCN : All Content - SAP BusinessObjects Design Studio
Viewing all articles
Browse latest Browse all 4216

Design Studio SDK: Drag Drop Area Component

$
0
0

Purpose

Generic Drag & Drop Control for all use cases. I have styled it a bit, now it can be used.

 

This component is based on the techniques as in blog SDK development - I want to drag drop in SDK component

 

How does it looks like?

basically, current representation is by toggle buttons and drop areas (simple layouts) before, between and after the buttons:

Capture.PNG

 

Styles
scn-pack-DragDropAreathe area
scn-pack-DragDropArea-Layouthorizontal or vertical layout
scn-pack-DragDropArea-Dropdrop space
scn-pack-DragDropArea-DropEffectfor on hoover event in drop action
scn-pack-DragDropArea-Dragdrag button


Available Properties

 

Property NameDescription
orientation

the orientation (horizontal, vertical) - can be changed only once - reload/refresh required

itemWidth

item width in px

dragKeygeneric string for drag key (which is passed to second area as drop key)
dragContextgeneric string for drag context (which is passed to second area as drop context)
dropIdid of dropped item (only accessible via get function)
dropKeykey of dropped item (only accessible via get function)
dropContextcontext of dropped item (only accessible via get function)
dropAfterKeythe key which is before the dropped space (empty if the drop is on index 0)
dropIndexdrop index (0 is before first item)

 

Scripting Functions (preview)

 

ScriptsShort Description

String getDropId ()

returns the drop id
String getDropKey ()returns the drop key
String getDropContext ()returns the drop context
String getDropAfterKey ()returns the drop ke of the element before drop (empty in case drop was done in the index 0)
int getDropIndex ()returns the drop index, 0-based
String getDragKey ()returns the drag key
String getDragContext ()returns the drag content


Work with content is same as in other components FishEye, ImageCarousel - just see at the ImageCarousel doc:

Design Studio SDK: Image Carousel Component


Work with Images

From release 1.0.10 you can use images as thirs parameter as well. The images will be used as icon on the button. Keep size small (eg 16x16px)


New Method (added also to ImageCarousell and FishEye)

     String getKeyAtIndex (int index)


Events


EventDescription
onDrop

triggered when user drops something


Example Implementation for Drop:

 

var id = DRAGDROPAREA_COLUMNS.getDropId();
var key = DRAGDROPAREA_COLUMNS.getDropKey();
var context = DRAGDROPAREA_COLUMNS.getDropContext();
if(context == DRAGDROPAREA_COLUMNS.getDragContext()) {  var afterKey = DRAGDROPAREA_COLUMNS.getDropAfterKey();  var afterIndex = DRAGDROPAREA_COLUMNS.getDropIndex();  var keyOnIndex = DRAGDROPAREA_COLUMNS.getKeyAtIndex(afterIndex);  APPLICATION.createInfoMessage("Move: " + id + " to " + keyOnIndex);  if(afterKey != "") {  DS_1.moveDimensionAfter(id, afterKey);  } else {  if(keyOnIndex == "") {  DS_1.moveDimensionToColumns(id);  } else {  DS_1.moveDimensionBefore(id, keyOnIndex);  }  }
}

In the example application you can use drag & drop now to change the drill down


Example Application

An Application with example can be downloaded at the BIAPP Repository:

Releases

 

Source Code & Licensing

This component is for free use. It is under the Open Source Apache Version 2.0 License.

 

Important MaintenanceNotice (... as I am SAP Employee)

The component is NOT delivered under SAP maintenance license.

You cannot claim any Support on this component from SAP!


The components are created on "private" basis - you can use them as is. I can modify, correct or improve - but there is no obligation to do it. Of course I will try to correct bugs or improve the component as long I can.

 

Have Fun!

 

for other components see: Karol's SDK Components


Viewing all articles
Browse latest Browse all 4216

Trending Articles