/*
* SmartGWT (GWT for SmartClient)
* Copyright 2008 and beyond, Isomorphic Software, Inc.
*
* SmartGWT is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation. SmartGWT is also
* available under typical commercial license terms - see
* http://smartclient.com/license
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
package com.smartgwt.sample.showcase.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.DragAppearance;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
public class Showcase implements EntryPoint {
public void onModuleLoad() {
RootPanel.get().add(getViewPanel());
}
public Canvas getViewPanel() {
Canvas canvas = new Canvas();
DragLabel dragTranslucent = new DragLabel("Translucent", 50);
dragTranslucent.setDragAppearance(DragAppearance.TARGET);
dragTranslucent.setDragOpacity(60);
canvas.addChild(dragTranslucent);
DragLabel dragShadow = new DragLabel("Shadow", 200);
dragShadow.setDragAppearance(DragAppearance.TARGET);
dragShadow.setShowDragShadow(true);
// TODO: dragShadow.setDragShadowDepth(8);
canvas.addChild(dragShadow);
DragLabel dragOutline = new DragLabel("Outline", 350);
dragOutline.setLeft(350);
dragOutline.setDragAppearance(DragAppearance.OUTLINE);
canvas.addChild(dragOutline);
return canvas;
}
public static class DragLabel extends Label {
public DragLabel(String contents, int left) {
setTop(50);
setLeft(left);
setContents(contents);
setAlign(Alignment.CENTER);
setPadding(4);
setShowEdges(true);
setBackgroundColor("#e0e0ff");
setKeepInParentRect(true);
setCanDragReposition(true);
}
}
}
|