1
0

Updated to latest G3 experimental.

Added drag and drop from desktop.
Added ability to resize before upload / including resize options
Added Thumbnails when uploading.
Moved to latest GWT so some speed improvements
This commit is contained in:
Ben Smith 2010-01-26 17:00:01 +13:00
parent b2c27dc34f
commit bb81dd694d
181 changed files with 16948 additions and 179 deletions

View File

@ -4,8 +4,9 @@
<classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/Users/User/code/gwt-dnd/gwt-dnd-2.6.5.jar"/>
<classpathentry kind="lib" path="C:/Users/User/code/gwt-dnd/gwt-dnd-2.6.5-javadoc.jar"/>
<classpathentry kind="lib" path="C:/Users/User/code/gwt-gears/gwt-gears.jar"/>
<classpathentry kind="lib" path="C:/Users/User/code/gwt-2.0.0/gwt-user.jar"/>
<classpathentry kind="lib" path="C:/Users/User/code/gwt-dnd/gwt-dnd-3.0.0.jar"/>
<classpathentry kind="lib" path="C:/Users/User/code/gwt-dnd/gwt-dnd-3.0.0-javadoc.jar"/>
<classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>

View File

@ -1,3 +1,3 @@
#Sun Aug 30 20:30:24 NZST 2009
#Tue Dec 22 13:14:57 NZDT 2009
eclipse.preferences.version=1
filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.2.2.jar|datanucleus-appengine-1.0.2.final.jar|datanucleus-core-1.1.4-gae.jar|datanucleus-jpa-1.1.4.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-ea.jar
filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.2.5.jar|appengine-api-labs-1.2.5.jar|datanucleus-appengine-1.0.3.jar|datanucleus-core-1.1.5.jar|datanucleus-jpa-1.1.5.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-eb.jar

View File

@ -0,0 +1,3 @@
#Thu Dec 31 12:58:02 NZDT 2009
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=

View File

@ -1,4 +1,5 @@
#Thu Sep 24 11:47:04 NZST 2009
#Tue Jan 26 16:51:26 NZDT 2010
eclipse.preferences.version=1
entryPointModules=
filesCopiedToWebInfLib=gwt-servlet.jar
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48L2d3dC1jb21waWxlLXNldHRpbmdzPg\=\=

View File

@ -0,0 +1,45 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Admin_Upload_Configure_Controller extends Controller
{
/**
* the index page of the user homes admin
*/
public function index()
{
$form = upload_configuration::get_configure_form();
if (request::method() == "post") {
access::verify_csrf();
if ($form->validate()) {
upload_configuration::extractForm($form);
message::success(t("GWTOrganise Module Configured!"));
}
}
else
{
upload_configuration::populateForm($form);
}
print $form;
}
}

View File

@ -34,7 +34,7 @@ class Json_Album_Controller extends Controller {
$item = ORM::factory("item", $item_id);
access::required("view", $item);
$children = $item->children(null, 0, $where);
$children = $item->children(null, null, $where);
$encoded = array();
foreach ($children as $id => $child){
$encoded[$id] = self::child_json_encode($child);
@ -44,7 +44,7 @@ class Json_Album_Controller extends Controller {
}
function is_admin() {
if (user::active()->admin) {
if (identity::active_user()->admin) {
print json_encode(array("result" => "success", "csrf" => access::csrf_token()));
return;
}
@ -53,8 +53,7 @@ class Json_Album_Controller extends Controller {
}
function albums($item_id) {
print $this->child_elements($item_id,array("type" => "album"));
print $this->child_elements($item_id, array(array("type", "=", "album")));
}
function children($item_id){
@ -102,7 +101,11 @@ class Json_Album_Controller extends Controller {
$i = 0;
foreach ($album->children() as $child) {
// Do this directly in the database to avoid sending notifications
Database::Instance()->update("items", array("weight" => ++$i), array("id" => $child->id));
b::build()
->update("items")
->set("weight", ++$i)
->where("id", "=", $child->id)
->execute();
}
$album->sort_column = "weight";
$album->sort_order = "ASC";
@ -118,15 +121,19 @@ class Json_Album_Controller extends Controller {
// Make a hole
$count = count($source_ids);
Database::Instance()->query(
"UPDATE {items} " .
"SET `weight` = `weight` + $count " .
"WHERE `weight` >= $target_weight AND `parent_id` = {$album->id}");
db::build()
->update("items")
->set("weight", new Database_Expression("`weight` + $count"))
->where("weight", ">=", $target_weight)
->where("parent_id", "=", $album->id)
->execute();
// Insert source items into the hole
foreach ($source_ids as $source_id) {
Database::Instance()->update(
"items", array("weight" => $target_weight++), array("id" => $source_id));
db::build()
->update("items")
->set("weight", $target_weight++)
->where("id", "=", $source_id)
->execute();
}
module::event("album_rearrange", $album);
@ -232,7 +239,7 @@ class Json_Album_Controller extends Controller {
}
if ($degrees) {
graphics::rotate($item->file_path(), $item->file_path(), array("degrees" => $degrees));
gallery_graphics::rotate($item->file_path(), $item->file_path(), array("degrees" => $degrees));
list($item->width, $item->height) = getimagesize($item->file_path());
$item->resize_dirty= 1;
@ -253,5 +260,18 @@ class Json_Album_Controller extends Controller {
print json_encode(self::child_json_encode($item));
}
public function resize_config(){
if (upload_configuration::isResize())
{
print json_encode(array(
"resize" => true,
"max_width" => upload_configuration::getMaxWidth(),
"max_height" => upload_configuration::getMaxHeight()));
}
else
{
print json_encode(array("resize" => false));
}
}
}

View File

@ -22,6 +22,9 @@ class gwtorganise_installer
{
static function install(){
module::set_version("gwtorganise", 1);
upload_configuration::setResize(false);
upload_configuration::setMaxWidth(500);
upload_configuration::setMaxHeight(400);
}
static function activate() {
}

View File

@ -0,0 +1,70 @@
<?php
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class upload_configuration_Core {
static function get_configure_form() {
$form = new Forge("admin/upload_configure", "", "post", array("id" => "gConfigureForm"));
$group = $form->group("configure")->label(t("Configure Upload Options"));
$group->checkbox("resize")->label(t("Resize before upload"))->id("gResize");
$group->input("max_width")->label(t("Max Width"))->id("gMaxWidth");
$group->input("max_height")->label(t("Max Height"))->id("gMax Height");
$group->submit("")->value(t("Save"));
return $form;
}
static function populateForm($form){
$form->configure->resize->checked(upload_configuration::isResize());
$form->configure->max_width->value(upload_configuration::getMaxWidth());
$form->configure->max_height->value(upload_configuration::getMaxHeight());
}
static function extractForm($form){
$resize = $form->configure->resize->value;
$max_width = $form->configure->max_width->value;
$max_height= $form->configure->max_height->value;
upload_configuration::setResize($resize);
upload_configuration::setMaxWidth($max_width);
upload_configuration::setMaxHeight($max_height);
}
static function isResize(){
return module::get_var("gwtorganise","resize");
}
static function getMaxWidth(){
return intval(module::get_var("gwtorganise","max_width"));
}
static function getMaxHeight(){
return intval(module::get_var("gwtorganise","max_height"));
}
static function setResize($isResize){
module::set_var("gwtorganise","resize",$isResize);
}
static function setMaxWidth($max_width){
module::set_var("gwtorganise","max_width",$max_width);
}
static function setMaxHeight($max_height){
module::set_var("gwtorganise","max_height",$max_height);
}
}

View File

@ -2,8 +2,10 @@
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='g3viewer'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/><inherits name="com.google.gwt.http.HTTP" /><inherits
name="com.google.gwt.json.JSON" /><inherits name="com.google.gwt.user.theme.standard.Standard" />
<inherits name='com.google.gwt.user.User'/>
<inherits name="com.google.gwt.http.HTTP" />
<inherits name="com.google.gwt.json.JSON" />
<inherits name="com.google.gwt.user.theme.standard.Standard" />
<entry-point class='com.gloopics.g3viewer.client.G3Viewer'/><inherits
name="com.allen_sauer.gwt.dnd.gwt-dnd" /><inherits name="com.google.gwt.gears.Gears" />
@ -11,4 +13,21 @@
<when-type-is class="com.gloopics.g3viewer.client.G3Viewer"/>
<when-property-is name="gears.installed" value="false"/>
</replace-with>
<replace-with class="com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile">
<when-type-is class="com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile"/>
</replace-with>
<source path=''></source>
<public path='public'></public>
<stylesheet src="G3viewer.css"/>
<replace-with class="com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactoryIE">
<when-type-is class="com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactory"/>
<any>
<when-property-is name="user.agent" value="ie6" />
<when-property-is name="user.agent" value="ie8" />
</any>
</replace-with>
</module>

View File

@ -62,7 +62,7 @@ public class Album extends TreeItem {
public Album(JSONObject jsonObject, G3Viewer a_Container)
{
m_ID = (int)((JSONNumber)jsonObject.get("id")).doubleValue();
m_ID = Utils.extractId(jsonObject.get("id"));
m_Title = ((JSONString)jsonObject.get("title")).stringValue();
m_Sort = ((JSONString)jsonObject.get("sort")).stringValue();
@ -233,7 +233,9 @@ public class Album extends TreeItem {
for (int i = 0; i < jsonArray.size(); ++i)
{
JSONObject jso = (JSONObject)jsonArray.get(i);
int id = (int)((JSONNumber)jso.get("id")).doubleValue();
int id = Utils.extractId(jso.get("id"));
if (m_IDtoAlbum.containsKey(id))
{
@ -268,7 +270,7 @@ public class Album extends TreeItem {
* moves the given array of ids to this album
*/
public void moveTo(JSONArray a_Ids){
Loading.getInstance().loading();
Loading.getInstance().loading("Moving Items..");
m_Container.doJSONRequest(G3Viewer.MOVE_TO_ALBUM_URL + getId() + "?sourceids=" + a_Ids.toString(),
new HttpSuccessHandler() {
@ -287,7 +289,7 @@ public class Album extends TreeItem {
*/
public void rearrangeTo(JSONArray a_Ids, Item m_CompareTo, boolean m_Before){
Loading.getInstance().loading();
Loading.getInstance().loading("Re-arranging..");
String bora = m_Before?"before":"after";
m_Container.doJSONRequest(G3Viewer.REARRANGE_URL + m_CompareTo.getID() + "/" + bora
@ -334,7 +336,7 @@ public class Album extends TreeItem {
public void select() {
Loading.getInstance().loading();
Loading.getInstance().loading("Loading Contents..");
m_Container.doJSONRequest(G3Viewer.VIEW_CHILDREN_URL + getId(),
new HttpSuccessHandler() {
@ -362,7 +364,7 @@ public class Album extends TreeItem {
for (int i = 0; i < jsonArray.size(); ++i)
{
jso = (JSONObject)jsonArray.get(i);
id = (int)((JSONNumber)jso.get("id")).doubleValue();
id = Utils.extractId(jso.get("id"));
if (m_IDtoItem.containsKey(id)){
item = m_IDtoItem.get(id);
@ -414,24 +416,40 @@ public class Album extends TreeItem {
desktop.openFiles(new OpenFilesHandler() {
public void onOpenFiles(OpenFilesEvent event) {
File[] files = event.getFiles();
UploadFile uf;
for (File file : files){
uf = new UploadFile(Album.this, file);
m_View.addToView(uf);
m_UploadQueue.addLast(uf);
}
if (!m_Running){
m_Running = true;
next();
}
uploadFiles(event.getFiles());
}
}, false);
}
public void uploadFiles(final File[] files){
m_Container.doJSONRequest(G3Viewer.RESIZE_DETAILS_URL, new HttpSuccessHandler() {
public void success(JSONValue a_Value) {
JSONObject jso = a_Value.isObject();
if (jso != null) {
ResizeOptions ro = new ResizeOptions(jso);
UploadFile uf;
for (File file : files){
uf = new UploadFile(Album.this, file, ro);
m_View.addToView(uf);
m_UploadQueue.addLast(uf);
m_Container.addUpload(uf);
}
if (!m_Running){
m_Running = true;
next();
}
}
}
},false);
}
public void addPendingDownloads()
{
for (UploadFile uf: m_UploadQueue)
@ -443,6 +461,7 @@ public class Album extends TreeItem {
public void finishedUpload(UploadFile uf, JSONValue a_Return)
{
m_UploadQueue.remove(uf);
m_Container.removeUpload(uf);
next();
JSONObject jo = a_Return.isObject();

View File

@ -0,0 +1,58 @@
package com.gloopics.g3viewer.client;
import com.gloopics.g3viewer.client.canvas.Canvas;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.gears.client.blob.Blob;
public class AsyncResizer implements RunAsyncCallback{
private final Blob m_Blob;
private final UploadFile m_UploadFile;
private final ResizeOptions m_ResizeOptions;
public AsyncResizer(Blob a_Blob, UploadFile a_UploadFile){
m_Blob = a_Blob;
m_UploadFile = a_UploadFile;
m_ResizeOptions = a_UploadFile.getResizeOptions();
}
@Override
public void onFailure(Throwable reason) {
G3Viewer.displayError("Error Resizing image", reason.toString());
}
@Override
public void onSuccess() {
// resize file
Canvas upThumb = com.gloopics.g3viewer.client.canvas.Factory.getInstance().createCanvas();
upThumb.decode(m_Blob);
int imageWidth = upThumb.getWidth();
int imageHeight = upThumb.getHeight();
int widthRatio = imageWidth/m_ResizeOptions.getMaxWidth();
int heightRatio = imageHeight/m_ResizeOptions.getMaxHeight();
if (widthRatio > heightRatio){
if (widthRatio > 1) {
upThumb.resize(m_ResizeOptions.getMaxWidth(), imageHeight / widthRatio );
m_UploadFile.uploadBlob(upThumb.encode());
}
}
else
{
if (heightRatio > 1){
upThumb.resize(imageWidth / heightRatio, m_ResizeOptions.getMaxHeight());
m_UploadFile.uploadBlob(upThumb.encode());
}
}
}
}

View File

@ -19,6 +19,7 @@ package com.gloopics.g3viewer.client;
import com.allen_sauer.gwt.dnd.client.PickupDragController;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.http.client.RequestBuilder;
@ -30,6 +31,7 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalSplitPanel;
@ -128,12 +130,22 @@ public class G3Viewer {
* rotate url
*/
public static final String ROTATE_URL = BASE_URL + "index.php/json_album/rotate/";
/**
* Resize details URL
*/
public static final String RESIZE_DETAILS_URL = BASE_URL + "index.php/json_album/resize_config";
/*
* tree
*/
private final AlbumTree m_Tree;
/**
* the info panel
*/
private final InformationBar m_InfoBar;
/**
* the only image dialog box
*/
@ -221,7 +233,9 @@ public class G3Viewer {
m_DragController.setBehaviorDragStartSensitivity(5);
m_DragController.setBehaviorDragProxy(true);
m_InfoBar = new InformationBar(this);
m_Tree = new AlbumTree(this);
checkAdmin();
}
@ -293,6 +307,13 @@ public class G3Viewer {
return m_View;
}
public void addUpload(UploadFile a_UF){
m_InfoBar.addUpload(a_UF);
}
public void removeUpload(UploadFile a_UF){
m_InfoBar.removeUpload(a_UF);
}
public void doDialog(String a_Url, HttpDialogHandler a_Handler)
@ -328,8 +349,24 @@ public class G3Viewer {
@Override
public void onError(Throwable aThrowable) {
displayError("Unexpected Error",
if (aThrowable.getCause() != null)
{
StringBuffer stack = new StringBuffer();
StackTraceElement[] stes = aThrowable.getCause().getStackTrace();
for (StackTraceElement ste: stes){
stack.append(ste.toString());
stack.append(" \n ");
}
displayError("a Unexpected Error ",
aThrowable.toString() + " - " + a_URL + "\n " + stack.toString());
}
else
{
displayError("a Unexpected Error ",
aThrowable.toString() + " - " + a_URL);
}
}}
));
@ -356,8 +393,10 @@ public class G3Viewer {
SimplePanel sp = new SimplePanelEx();
sp.add(m_SplitPanel);
RootPanel.get("main").add(sp);
m_InfoBar.initializeForm();
RootPanel.get("main").add(sp);
RootPanel.get("main").add(m_InfoBar);
}
}

View File

@ -61,7 +61,7 @@ public class HttpDialogBox extends DialogBox{
}
HttpDialogBox.this.hide();
Loading.getInstance().loading();
Loading.getInstance().loading("Please Wait..");
}
});
@ -155,7 +155,7 @@ public class HttpDialogBox extends DialogBox{
public void doDialog(String url, HttpDialogHandler a_Callback){
m_Callback = a_Callback;
Loading.getInstance().loading();
Loading.getInstance().loading("Please Wait");
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
try {

View File

@ -42,7 +42,7 @@ public class ImageDialogBox extends PopupPanel{
public void doDialog(String a_Image){
Loading.getInstance().loading();
Loading.getInstance().loading("Loading Image..");
if (m_Image != null){
m_Image.removeFromParent();

View File

@ -0,0 +1,77 @@
package com.gloopics.g3viewer.client;
import java.util.HashSet;
import java.util.Set;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
public class InformationBar extends FlowPanel{
private final G3Viewer m_Container;
private final Label m_Label = new Label();
private final Set<UploadFile> m_Uploads = new HashSet<UploadFile>();
public InformationBar(G3Viewer a_Container){
m_Container = a_Container;
setStylePrimaryName("infobar");
}
public void initializeForm(){
Anchor button = new Anchor("Upload Options");
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
m_Container.doDialog("index.php/admin/upload_configure", new HttpDialogHandler() {
@Override
public void success(String aResult) {
}
});
}
});
add(button);
updateInformation();
add(m_Label);
}
private void updateInformation()
{
int size = m_Uploads.size();
if (size == 0){
m_Label.setText("");
}
else
{
if (size == 1){
m_Label.setText("Uploading file.");
}
else{
m_Label.setText("Uploading " + size + " files.");
}
}
}
public void addUpload(UploadFile a_Upload)
{
m_Uploads.add(a_Upload);
updateInformation();
}
public void removeUpload(UploadFile a_Upload)
{
m_Uploads.remove(a_Upload);
updateInformation();
}
}

View File

@ -1,5 +1,11 @@
package com.gloopics.g3viewer.client;
import java.util.Iterator;
import com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile;
import com.gloopics.g3viewer.client.dnddesktop.DesktopDroppableWidget;
import com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactory;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.event.dom.client.ContextMenuHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent;
@ -20,6 +26,7 @@ import com.google.gwt.event.dom.client.MouseWheelHandler;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.gears.client.desktop.File;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
@ -34,9 +41,10 @@ import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Widget;
public class Item extends Composite implements HasAllMouseHandlers{
public class Item extends Composite implements HasAllMouseHandlers, DesktopDroppableWidget{
private final int m_ID;
@ -69,7 +77,7 @@ public class Item extends Composite implements HasAllMouseHandlers{
m_Container = a_Container;
m_View = a_Container.getView();
m_Parent = a_Parent;
m_ID = (int)((JSONNumber)a_Value.get("id")).doubleValue();
m_ID = Utils.extractId(a_Value.get("id"));
m_Title = ((JSONString)a_Value.get("title")).stringValue();
m_Thumb = ((JSONString)a_Value.get("thumb")).stringValue();
m_Type = ((JSONString)a_Value.get("type")).stringValue();
@ -78,6 +86,7 @@ public class Item extends Composite implements HasAllMouseHandlers{
m_IsPhoto = m_Type.equals("photo");
FlowPanel dp = new FlowPanel();
m_ThumbImage = new Image(m_Thumb);
dp.add(m_ThumbImage);
@ -114,6 +123,11 @@ public class Item extends Composite implements HasAllMouseHandlers{
},DoubleClickEvent.getType());
a_Container.getDragController().makeDraggable(this);
if (m_IsAlbum)
{
((DndDesktopFactory)GWT.create(DndDesktopFactory.class)).getInstance(this);
}
}
@ -176,6 +190,20 @@ public class Item extends Composite implements HasAllMouseHandlers{
}
public void showPopupMenu(ContextMenuEvent event){
Iterator<Widget> iter = m_Container.getDragController().getSelectedWidgets().iterator();
// show views popup menu if items are selected
if (iter.hasNext())
{
iter.next();
if (iter.hasNext())
{
m_View.showPopupMenu(event);
return;
}
}
this.addStyleName("popped");
final PopupPanel popupPanel = new PopupPanel(true);
popupPanel.setAnimationEnabled(true);
@ -332,6 +360,20 @@ public class Item extends Composite implements HasAllMouseHandlers{
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
return addDomHandler(handler, MouseWheelEvent.getType());
}
@Override
public void dropFiles(File[] aFile) {
if (m_IsAlbum)
{
m_LinkedAlbum.uploadFiles(aFile);
}
}
@Override
public Widget getActualWidget() {
return this;
}

View File

@ -1,54 +1,78 @@
package com.gloopics.g3viewer.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
public class Loading extends AbsolutePanel{
public class Loading{
public static final String URL = GWT.getModuleBaseURL() + "loading.gif";
private static final Loading INSTANCE = new Loading();
public static final String URL = "images/loading.gif";
/**
* the image widget
*/
private Image m_Image = new Image("images/loading.gif");
/**
* the image widget
*/
private final Image m_Image = new Image(URL);
private final Label m_Label = new Label();
private final HTML m_Back = new HTML();
private Loading(){
HTML back = new HTML();
back.addStyleName("loading");
add(back, 0, 0);
Image.prefetch(URL);
}
/**
* get instance
*/
public static Loading getInstance(){
return INSTANCE;
}
public void loading(){
int width = RootPanel.get().getOffsetWidth();
int height = RootPanel.get().getOffsetHeight();
height = height / 2 - 25;
width = width / 2 - 25;
add(m_Image);
this.setWidgetPosition(m_Image, width, height);
RootPanel.get().add(this);
}
public void endLoading(){
if (m_Image.isAttached()){
remove(m_Image);
private Loading(){
m_Back.addStyleName("loading");
m_Label.setStyleName("loading-label");
m_Image.setStyleName("loading-image");
}
RootPanel.get().remove(this);
}
public void hideAnimation(){
remove(m_Image);
}
/**
* get instance
*/
public static Loading getInstance(){
return INSTANCE;
}
public void loading(String message){
RootPanel.get().add(m_Back);
int width = RootPanel.get().getOffsetWidth();
int height = RootPanel.get().getOffsetHeight();
height = height / 2 - 20;
width = width / 2 - 40;
RootPanel.get().add(m_Image, width, height);
if (message != null)
{
m_Label.setText(message);
RootPanel.get().add(m_Label, 0, height + 45);
}
//RootPanel.get().add(this);
}
public void endLoading(){
if (m_Image.isAttached()){
RootPanel.get().remove(m_Image);
}
if (m_Label.isAttached()){
RootPanel.get().remove(m_Label);
}
if (m_Back.isAttached()){
RootPanel.get().remove(m_Back);
}
}
public void hideAnimation(){
if (m_Image.isAttached()){
RootPanel.get().remove(m_Image);
}
if (m_Label.isAttached()){
RootPanel.get().remove(m_Label);
}
}
}

View File

@ -0,0 +1,50 @@
package com.gloopics.g3viewer.client;
import com.google.gwt.json.client.JSONBoolean;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
public class ResizeOptions {
private final boolean m_Resize;
private final int m_MaxWidth;
private final int m_MaxHeight;
public ResizeOptions(JSONObject a_Value){
JSONBoolean jbool = a_Value.get("resize").isBoolean();
if (jbool == null)
{
throw new RuntimeException("JBool was null.");
}
m_Resize = jbool.booleanValue();
if (m_Resize)
{
m_MaxWidth = Integer.parseInt(a_Value.get("max_width").toString());
m_MaxHeight = Integer.parseInt(a_Value.get("max_height").toString());
}
else
{
m_MaxWidth = 0;
m_MaxHeight = 0;
}
}
public boolean isResize()
{
return m_Resize;
}
public int getMaxHeight()
{
return m_MaxHeight;
}
public int getMaxWidth()
{
return m_MaxWidth;
}
}

View File

@ -1,19 +1,28 @@
package com.gloopics.g3viewer.client;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.gloopics.g3viewer.client.canvas.Canvas;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.core.client.GWT;
import com.google.gwt.gears.client.Factory;
import com.google.gwt.gears.client.blob.Blob;
import com.google.gwt.gears.client.desktop.File;
import com.google.gwt.gears.client.httprequest.HttpRequest;
import com.google.gwt.gears.client.httprequest.ProgressEvent;
import com.google.gwt.gears.client.httprequest.ProgressHandler;
import com.google.gwt.gears.client.httprequest.RequestCallback;
import com.google.gwt.gears.client.localserver.ResourceStore;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONValue;
public class UploadFile extends AbsolutePanel{
public class UploadFile extends Composite{
private final static ResourceStore RS = Factory.getInstance().createLocalServer().createStore("temp");
private class ProgressBar extends SimplePanel{
private final SimplePanel m_ProgressInner;
public ProgressBar(){
@ -29,35 +38,66 @@ public class UploadFile extends AbsolutePanel{
}
}
private final File m_LocalFile;
private final ResizeOptions m_ResizeOptions;
private final String m_Name;
private final Album m_Parent;
//private final Label m_PendingLabel = new Label("Upload Pending");
private final Blob m_Blob;
//private final Canvas m_UpThumb;
private final Label m_Label = new Label("Pending..");
private final ProgressBar m_ProgressBar = new ProgressBar();
public UploadFile(Album a_Parent, File a_File){
/**
* Loads an image into this Canvas, replacing the Canvas' current dimensions
* and contents.
*
* @param blob The Blob to decode. The image should be in PNG or JPEG format.
*/
public final native void captureBlob(ResourceStore rs, Blob blob, String a_Url) /*-{
rs.captureBlob(blob, a_Url, "image/JPEG");
}-*/;
/**
* Loads an image into this Canvas, replacing the Canvas' current dimensions
* and contents.
*
* @param blob The Blob to decode. The image should be in PNG or JPEG format.
*/
public final native void removeCapture(ResourceStore rs, String a_Url) /*-{
rs.remove(a_Url);
}-*/;
public UploadFile(Album a_Parent, File a_File, ResizeOptions a_ResizeOptions){
m_ResizeOptions = a_ResizeOptions;
m_Parent = a_Parent;
m_LocalFile = a_File;
m_Name = a_File.getName();
Label name = new Label(m_Name);
name.addStyleName("label");
add(name,5,20);
m_Blob = a_File.getBlob();
captureBlob(RS, m_Blob , m_Name);
Image img = new Image(m_Name);
FlowPanel dp = new FlowPanel();
add(m_ProgressBar,0,80);
dp.add(img);
dp.add(m_ProgressBar);
dp.add(m_Label);
initWidget(dp);
setStylePrimaryName("item");
addStyleName("iUpload");
}
public void startUpload(){
protected void uploadBlob(Blob a_Blob){
m_Label.setText("Uploading..");
HttpRequest request = Factory.getInstance().createHttpRequest();
request.open("POST", G3Viewer.UPLOAD_URL + m_Parent.getId() + "?filename="
+ m_Name + "&csrf=" + G3Viewer.getCSRF());
//request.setRequestHeader("Content-Type", "image/jpg");
//request.setRequestHeader("Content-Type", "image/jpg");
request.getUpload().setProgressHandler(new ProgressHandler() {
@ -78,17 +118,39 @@ public class UploadFile extends AbsolutePanel{
{
G3Viewer.displayError("Upload Error", request.getResponseText() + request.getStatus() + request.getStatusText());
}
removeCapture(RS, m_Name);
try{
JSONValue jv = JSONParser.parse(request.getResponseText());
m_Parent.finishedUpload(UploadFile.this, jv);
} catch (Exception e)
{
JSONValue jv = JSONParser.parse(request.getResponseText());
m_Parent.finishedUpload(UploadFile.this, jv);
}
catch (Exception e){
G3Viewer.displayError("Exception on Upload", e.toString() + " " + request.getResponseText());
}
}
});
request.send(m_LocalFile.getBlob());
request.send(a_Blob);
}
public ResizeOptions getResizeOptions(){
return m_ResizeOptions;
}
public void startUpload(){
if (m_ResizeOptions.isResize())
{
m_Label.setText("Resizing..");
GWT.runAsync(new AsyncResizer(m_Blob, this));
}
else
{
uploadBlob(m_Blob);
}
}
}

View File

@ -0,0 +1,18 @@
package com.gloopics.g3viewer.client;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONValue;
public class Utils {
public static int extractId(JSONValue a_Value){
JSONNumber jn = a_Value.isNumber();
if (jn != null){
return (int) jn.doubleValue();
}
else{
String val = a_Value.isString().stringValue();
return Integer.parseInt(val);
}
}
}

View File

@ -3,17 +3,35 @@ package com.gloopics.g3viewer.client;
import java.util.ArrayList;
import java.util.List;
import com.allen_sauer.gwt.dnd.client.DragController;
import com.allen_sauer.gwt.dnd.client.PickupDragController;
import com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile;
import com.gloopics.g3viewer.client.dnddesktop.DesktopDroppableWidget;
import com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactory;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.gears.client.desktop.File;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Widget;
public class View extends FlowPanel{
public class View extends FlowPanel implements DesktopDroppableWidget{
/**
* the current album being viewed
*/
private Album m_Album;
/**
* the list of drop zones
*/
@ -24,12 +42,15 @@ public class View extends FlowPanel{
public View(G3Viewer a_Container){
m_Container = a_Container;
((DndDesktopFactory)GWT.create(DndDesktopFactory.class)).getInstance(this);
}
private void clearView(){
PickupDragController pdc = m_Container.getDragController();
if (m_DropZones.size() > 0){
for (DropZoneController dropController : m_DropZones){
m_Container.getDragController().unregisterDropController(dropController);
pdc.unregisterDropController(dropController);
}
m_DropZones.clear();
}
@ -39,6 +60,7 @@ public class View extends FlowPanel{
((Item)widget).hidding();
}
}
pdc.clearSelection();
clear();
}
@ -93,6 +115,58 @@ public class View extends FlowPanel{
public Album getCurrentAlbum(){
return m_Album;
}
@Override
public void dropFiles(File[] aFile) {
if (m_Album != null){
m_Album.uploadFiles(aFile);
}
}
@Override
public Widget getActualWidget() {
return this;
}
public void showPopupMenu(ContextMenuEvent event){
final PopupPanel popupPanel = new PopupPanel(true);
popupPanel.setAnimationEnabled(true);
popupPanel.setStyleName("popup");
MenuBar popupMenuBar = new MenuBar(true);
MenuItem deleteItem = new MenuItem("Delete Selected Items", true, new Command() {
@Override
public void execute() {
/*
m_Container.doDialog("index.php/quick/form_delete/" + m_ID, new HttpDialogHandler() {
public void success(String aResult) {
m_View.removeFromView(Item.this);
if (m_LinkedAlbum != null){
m_LinkedAlbum.remove();
}
}
});
*/
popupPanel.hide();
}
});
deleteItem.addStyleName("popup-item");
popupMenuBar.addItem(deleteItem);
popupMenuBar.setVisible(true);
popupPanel.add(popupMenuBar);
int x = DOM.eventGetClientX((Event)event.getNativeEvent());
int y = DOM.eventGetClientY((Event)event.getNativeEvent());
popupPanel.setPopupPosition(x, y);
popupPanel.show();
}
}

View File

@ -0,0 +1,178 @@
/*
* Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.gloopics.g3viewer.client.canvas;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.gears.client.blob.Blob;
/**
* The Canvas module is a graphics API that is inspired by the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html"
* >HTML5 canvas</a>, with additional methods to decode from and encode to
* binary formats (such as PNG and JPEG), represented by Blobs. A Gears Canvas
* is not yet a complete implementation of the HTML5 canvas specification, and
* there are two significant differences:
* <ul>
* <li>A Gears Canvas is off-screen, in that creating a Canvas object doesn't
* directly paint any pixels on the screen. Furthermore, for technical reasons,
* a Gears Canvas is not a DOM Element. On the other hand, you can create a
* Gears Canvas in a Worker.
* <li>A Gears Canvas does not implement <code>getContext</code>, and in
* particular does not provide a 2D context.
* </ul>
* <p>
* <b>Permission</b>
* <p>
* This API requires user permission. If you would like to customize the default
* dialog, you can explicitly call
* {@link com.google.gwt.gears.client.Factory#getPermission()}.
*/
public class Canvas extends JavaScriptObject {
public static final String MIMETYPE_JPEG = "image/jpeg";
public static final String MIMETYPE_PNG = "image/png";
protected Canvas() {
// required for overlay types
}
/**
* Crops the Canvas. The crop happens "in-place", as opposed to returning a
* new Canvas.
*
* @param x The left co-ordinate of the crop rectangle.
* @param y The top co-ordinate of the crop rectangle.
* @param w The width of the crop rectangle.
* @param h The height of the crop rectangle.
*/
public final native void crop(int x, int y, int w, int h) /*-{
this.crop(x, y, w, h);
}-*/;
/**
* Loads an image into this Canvas, replacing the Canvas' current dimensions
* and contents.
*
* @param blob The Blob to decode. The image should be in PNG or JPEG format.
*/
public final native void decode(Blob blob) /*-{
this.decode(blob);
}-*/;
/**
* Saves the Canvas' contents to PNG format.
*
* @return A new Blob encoding the Canvas' image data.
*/
public final native Blob encode() /*-{
return this.encode();
}-*/;
/**
* Saves the Canvas' contents to a binary format, such as PNG or JPEG.
*
* @param mimeType The image format to encode to. Valid values include
* "image/png" and "image/jpeg".
* @return A new Blob encoding the Canvas' image data.
*/
public final native Blob encode(String mimeType) /*-{
return this.encode(mimeType);
}-*/;
/**
* Saves the Canvas' contents to JPEG format.
*
* @param quality the JPEG quality as a number between 0.0 and 1.0 inclusive.
* @return A new Blob encoding the Canvas' image data.
*/
public final native Blob encodeJpeg(float quality) /*-{
return this.encode("image/jpeg", { quality: quality });
}-*/;
/**
* Returns the height of the Canvas. The default value is 150.
*
* @return the canvas height.
*/
public final native int getHeight()/*-{
return this.height;
}-*/;
/**
* Returns the width of the Canvas. The default value is 300.
*
* @return the canvas width.
*/
public final native int getWidth() /*-{
return this.width;
}-*/;
/**
* Resizes the Canvas. The resize happens "in-place", as opposed to returning
* a new Canvas.
* <p>
* Uses bi-linear filtering.
*
* @param w The new width.
* @param h The new height.
*/
public final native void resize(int w, int h) /*-{
this.resize(w, h);
}-*/;
/**
* Resizes the Canvas. The resize happens "in-place", as opposed to returning
* a new Canvas.
*
* @param w The new width.
* @param h The new height.
* @param filter The image filter.
*/
public final void resize(int w, int h, ResizeFilter filter) {
resize(w, h, filter.getFilter());
}
/**
* Resizes the Canvas. The resize happens "in-place", as opposed to returning
* a new Canvas.
*
* @param w The new width.
* @param h The new height.
* @param filter A string specifying the image filter. There are two options:
* "nearest" for nearest-neighbor filtering, and "bilinear" for
* bi-linear filtering.
*/
public final native void resize(int w, int h, String filter) /*-{
this.resize(w, h, filter);
}-*/;
/**
* Sets the height of the Canvas. The default value is 150.
*
* @param height the canvas height.
*/
public final native void setHeight(int height) /*-{
this.height = height;
}-*/;
/**
* Sets the width of the Canvas. The default value is 300.
*
* @param width the canvas width.
*/
public final native void setWidth(int width) /*-{
this.width = width;
}-*/;
}

View File

@ -0,0 +1,69 @@
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.gloopics.g3viewer.client.canvas;
import com.google.gwt.core.client.JavaScriptObject;
/**
* Factory class used to create all other Gears objects.
*/
public final class Factory extends JavaScriptObject {
/**
* String used to request a BlobBuilder instance from Gears.
*/
public static final String BLOBBUILDER = "beta.blobbuilder";
/**
* String used to request a Canvas instance from Gears.
*/
public static final String CANVAS = "beta.canvas";
/**
* Returns the singleton instance of the Factory class or <code>null</code>
* if Gears is not installed or accessible.
*
* @return singleton instance of the Factory class or <code>null</code> if
* Gears is not installed or accessible
*/
public static native Factory getInstance() /*-{
return $wnd.google && $wnd.google.gears && $wnd.google.gears.factory;
}-*/;
protected Factory() {
// Required for overlay types
}
/**
* Creates a new {@link Canvas} instance.
*
* @return a new {@link Canvas} instance
*/
public Canvas createCanvas() {
return create(CANVAS);
}
/**
* Creates an instance of the specified Gears object.
*
* @param <T> Gears object type to return
* @param className name of the object to create
* @return an instance of the specified Gears object
*/
private native <T extends JavaScriptObject> T create(String className) /*-{
return this.create(className);
}-*/;
}

View File

@ -0,0 +1,36 @@
/*
* Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.gloopics.g3viewer.client.canvas;
/**
* Filters used when resizing a Canvas.
*/
public enum ResizeFilter {
NEAREST {
@Override
public String getFilter() {
return "nearest";
}
},
BILINEAR {
@Override
public String getFilter() {
return "bilinear";
}
};
public abstract String getFilter();
}

View File

@ -0,0 +1,61 @@
package com.gloopics.g3viewer.client.dnddesktop;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.gears.client.Factory;
import com.google.gwt.gears.client.desktop.Desktop;
import com.google.gwt.gears.client.desktop.File;
import com.google.gwt.user.client.ui.Widget;
public abstract class DesktopDropBase {
private final DesktopDroppableWidget m_DropFile;
protected final Widget m_Widget;
private final Desktop m_Desktop;
public DesktopDropBase (DesktopDroppableWidget a_Widget){
m_DropFile = a_Widget;
m_Widget = a_Widget.getActualWidget();
m_Desktop = Factory.getInstance().createDesktop();
}
public void onDragEnter(JavaScriptObject e)
{
m_Widget.addStyleName("drop-target");
setDropEffect(m_Desktop, e);
finishDrag(e);
}
public final native void finishDrag(JavaScriptObject e) /*-{
if (e.stopPropagation) e.stopPropagation();
else e.cancelBubble = true;
if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
}-*/;
public void onDragLeave(JavaScriptObject e)
{
m_Widget.removeStyleName("drop-target");
finishDrag(e);
}
public void onDrop(JavaScriptObject e)
{
File[] files = getDragData(m_Desktop, e);
if (files != null)
{
m_DropFile.dropFiles(files);
}
onDragLeave(e);
}
public final native File[] getDragData(Desktop d, JavaScriptObject e) /*-{
var data = d.getDragData(e, 'application/x-gears-files');
return data && data.files;
}-*/;
public final native File[] setDropEffect(Desktop d, JavaScriptObject e) /*-{
var data = d.setDropEffect(e, 'copy');
}-*/;
}

View File

@ -0,0 +1,69 @@
package com.gloopics.g3viewer.client.dnddesktop;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.dom.client.Element;
import com.google.gwt.gears.client.Factory;
import com.google.gwt.gears.client.desktop.Desktop;
import com.google.gwt.gears.client.desktop.File;
import com.google.gwt.user.client.Window.Navigator;
import com.google.gwt.user.client.ui.Widget;
public class DesktopDropFile extends DesktopDropBase{
public DesktopDropFile(DesktopDroppableWidget a_Widget){
super(a_Widget);
String nav = Navigator.getUserAgent().toLowerCase();
addDropEvents(m_Widget.getElement());
}
public native void addDropEvents(Element e) /*-{
var t = this;
e.addEventListener('dragenter',
function(e)
{
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::onDragEnter(Lcom/google/gwt/core/client/JavaScriptObject;)(e);
}
, false);
e.addEventListener('dragleave',
function(e)
{
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::onDragLeave(Lcom/google/gwt/core/client/JavaScriptObject;)(e);
}
, false);
e.addEventListener('dragexit',
function(e)
{
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::onDragLeave(Lcom/google/gwt/core/client/JavaScriptObject;)(e);
}
, false);
e.addEventListener('dragover',
function(e)
{
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::finishDrag(Lcom/google/gwt/core/client/JavaScriptObject;)(e);
}
, false);
e.addEventListener('dragdrop',
function(e)
{
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::onDrop(Lcom/google/gwt/core/client/JavaScriptObject;)(e);
}
, false);
e.addEventListener('drop',
function(e)
{
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::onDrop(Lcom/google/gwt/core/client/JavaScriptObject;)(e);
}
, false);
}-*/;
}

View File

@ -0,0 +1,44 @@
package com.gloopics.g3viewer.client.dnddesktop;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.dom.client.Element;
public class DesktopDropFileIE extends DesktopDropBase{
public DesktopDropFileIE(DesktopDroppableWidget a_Widget){
super(a_Widget);
addDropEvents(m_Widget.getElement());
}
public native void addDropEvents(Element e) /*-{
var t = this;
e.attachEvent('ondragenter',
function(e){
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::onDragEnter(Lcom/google/gwt/core/client/JavaScriptObject;)(e);
return false;
});
e.attachEvent('ondragover',
function(e){
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::finishDrag(Lcom/google/gwt/core/client/JavaScriptObject;)(e);
return false;
});
e.attachEvent('ondragleave',
function(e){
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::onDragLeave(Lcom/google/gwt/core/client/JavaScriptObject;)(e)
return false;
});
e.attachEvent('ondrop',
function(e){
t.@com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile::onDrop(Lcom/google/gwt/core/client/JavaScriptObject;)(e)
return false;
});
}-*/;
}

View File

@ -0,0 +1,11 @@
package com.gloopics.g3viewer.client.dnddesktop;
import com.google.gwt.gears.client.desktop.File;
import com.google.gwt.user.client.ui.Widget;
public interface DesktopDroppableWidget {
Widget getActualWidget();
void dropFiles(File[] a_File);
}

View File

@ -0,0 +1,9 @@
package com.gloopics.g3viewer.client.dnddesktop;
public class DndDesktopFactory {
public DesktopDropBase getInstance(DesktopDroppableWidget a_Widget)
{
return new DesktopDropFile(a_Widget);
}
}

View File

@ -0,0 +1,9 @@
package com.gloopics.g3viewer.client.dnddesktop;
public class DndDesktopFactoryIE extends DndDesktopFactory{
public DesktopDropBase getInstance(DesktopDroppableWidget a_Widget)
{
return new DesktopDropFileIE(a_Widget);
}
}

View File

@ -4,16 +4,20 @@
.error {width:300px; height:200px;}
.item {width:100px; height: 100px; padding:3px; border: 2px solid #FFF; overflow: hidden; float:left; text-align:center; position:relative;margin:3px;}
.item {width:100px; height: 130px; padding:3px; border: 2px solid #FFF; overflow: hidden; float:left; text-align:center; position:relative;margin:3px;}
.item img{max-width:96px; max-height:76px; *width:96px; *height:76px; border:2px solid #AAA;}
.item h3{font-size:10px; font-weight:normal; position:absolute; bottom:5px; left:0px; width:100%; text-align:center; padding:0; margin:0;}
.ialbum {background-color: #e3effb; border: 2px solid #91c0ef; }
.popped {background-color: #e3effb;}
.view {padding:3px;}
.view {height: 100%;}
.DropZone {height: 100px; width:6px; margin: 0 -3px 0 -3px; padding: 0; float:left; text-align:center; position:relative;}
.loading{position:absolute; top:0px; left:0px; width:100%; height: 100%; background-color:#888; opacity: 0.3; filter: alpha(opacity = 30);}
.infobar {background-color: #fff; position: absolute; bottom:0px; border-width: 4px 4px 0 4px; border-style: solid;
border-color: #d2e1f6; height: 15px; width: 240px; right: 50px; font-size:10px; padding: 2px 5px 1px 5px;}
.infobar div {float:right; }
.infobar a {float:left;}
.loading{position:absolute; top:0px; left:0px; width:100%; height: 100%; background-color:#FFF; opacity: 0.7; filter: alpha(opacity = 70);}
.loading-label{z-index:10; position:absolute; width:100%; left:0px; text-align:center;}
.loading-image{z-index:10;}
.gwt-TreeItem-selected .Tree-Album {background-color: #333; color: #FFF;}
.Tree-Album {padding: 1px;}
.Tree-Album:hover{text-decoration:underline;}

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application></application>
<version>1</version>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
<persistence-manager-factory name="transactions-optional">
<property name="javax.jdo.PersistenceManagerFactoryClass"
value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/>
<property name="javax.jdo.option.ConnectionURL" value="appengine"/>
<property name="javax.jdo.option.NontransactionalRead" value="true"/>
<property name="javax.jdo.option.NontransactionalWrite" value="true"/>
<property name="javax.jdo.option.RetainValues" value="true"/>
<property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
</persistence-manager-factory>
</jdoconfig>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='g3viewer'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<inherits name="com.google.gwt.http.HTTP" />
<inherits name="com.google.gwt.json.JSON" />
<inherits name="com.google.gwt.user.theme.standard.Standard" />
<entry-point class='com.gloopics.g3viewer.client.G3Viewer'/><inherits
name="com.allen_sauer.gwt.dnd.gwt-dnd" /><inherits name="com.google.gwt.gears.Gears" />
<replace-with class="com.gloopics.g3viewer.client.NoGears">
<when-type-is class="com.gloopics.g3viewer.client.G3Viewer"/>
<when-property-is name="gears.installed" value="false"/>
</replace-with>
<replace-with class="com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile">
<when-type-is class="com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile"/>
</replace-with>
<source path=''></source>
<public path='public'></public>
<stylesheet src="G3viewer.css"/>
<replace-with class="com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactoryIE">
<when-type-is class="com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactory"/>
<any>
<when-property-is name="user.agent" value="ie6" />
<when-property-is name="user.agent" value="ie8" />
</any>
</replace-with>
</module>

Some files were not shown because too many files have changed in this diff Show More