Skip to content

Commit

Permalink
Add: SaveStrategy, RefreshStrategy, FixedStrategy, PagingStrategy, Na…
Browse files Browse the repository at this point in the history
…vigationHistory, DeleteFeature
  • Loading branch information
Pinocchio committed Apr 19, 2011
1 parent 3878326 commit 95e7572
Show file tree
Hide file tree
Showing 13 changed files with 460 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.gwtopenmaps.openlayers.client.control;

import org.gwtopenmaps.openlayers.client.control.Control;
import org.gwtopenmaps.openlayers.client.layer.Vector;
import org.gwtopenmaps.openlayers.client.util.JSObject;

/**
*
* @author Maciej Jezierski - Pinocchio
* Download plugin OpenLayers.Control.DeleteFeature from internet
* or use plugin from repository
*
*/
public class DeleteFeature extends Control {

public DeleteFeature(JSObject element) {
super(element);
}

public DeleteFeature(Vector vector) {
this(DeleteFeatureImpl.create(vector.getJSObject()));
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.gwtopenmaps.openlayers.client.control;

import org.gwtopenmaps.openlayers.client.util.JSObject;

public class DeleteFeatureImpl {
public native static JSObject create(JSObject vector) /*-{
return new $wnd.OpenLayers.Control.DeleteFeature(vector);
}-*/;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package org.gwtopenmaps.openlayers.client.control;

import org.gwtopenmaps.openlayers.client.control.Control;
import org.gwtopenmaps.openlayers.client.util.JSObject;

/**
*
* @author Maciej Jezierski - Pinocchio
*
*/
public class NavigationHistory extends Control {

public NavigationHistory(JSObject element) {
super(element);
}

public NavigationHistory() {
this(NavigationHistoryImpl.create());
}

/**
* Switch map view to a previous step in browser's history.
*
*/
public void previous() {
NavigationHistoryImpl.previous(this.getJSObject());
}
/**
* Switch map view to next step in browser's history.
*
*/
public void next() {
NavigationHistoryImpl.next(this.getJSObject());
}

/**
* Optional limit on the number of history items to retain.
* If null, there is no limit. Default is 50.
*
* @param limit - number of items
* @return void
*/
public void limit(int limit) {
NavigationHistoryImpl.limit(this.getJSObject(), limit);
}

/**
* Activate the control when it is added to a map.
* Default is true. If set to false, activate() method must
* be fired in order to use the control with map.
*
* @param autoActivate - set automatic activation true or false
* @return void
*/
public void autoActivate(boolean autoActivate) {
NavigationHistoryImpl.autoActivate(this.getJSObject(), autoActivate);
}

/**
* Restore the next state. If no items are in the next history
* stack, this has no effect. The next history stack is populated
* as states are restored from the previous history stack.
*
*
* @param void
* @return JSObject - Item representing state that was restored. Undefined if no items are in the next history stack.
*/
public JSObject nextTrigger() {
return NavigationHistoryImpl.nextTrigger(this.getJSObject());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.gwtopenmaps.openlayers.client.control;

import org.gwtopenmaps.openlayers.client.util.JSObject;

public class NavigationHistoryImpl {
public native static JSObject create() /*-{
return new $wnd.OpenLayers.Control.NavigationHistory();
}-*/;

public native static void previous(JSObject self) /*-{
self.previous.trigger();
}-*/;

public native static void next(JSObject self) /*-{
self.next.trigger();
}-*/;

public native static void limit(JSObject self, int limit) /*-{
self.limit = limit;
}-*/;

public native static void autoActivate(JSObject self, boolean autoActivate) /*-{
self.autoActivate = autoActivate;
}-*/;

public native static JSObject nextTrigger(JSObject self) /*-{
return self.nextTrigger();
}-*/;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.gwtopenmaps.openlayers.client.strategy;

import org.gwtopenmaps.openlayers.client.strategy.Strategy;
import org.gwtopenmaps.openlayers.client.util.JSObject;

/**
*
* @author Maciej Jezierski - Pinocchio
* A simple strategy that requests features once and never requests new data
*
*/
public class FixedStrategy extends Strategy{

/**
* Clean up the strategy.
*/
public void destroy() {
FixedStrategyImpl.destroy(this.getJSObject());
}

/**
* Load data before layer made visible. Enabling this may result in considerable overhead if your application loads many data layers that are not visible by default. Default is false.
* @param preload
*/
public void preload(boolean preload) {
FixedStrategyImpl.preload(this.getJSObject(), preload);
}

public FixedStrategy(JSObject strategy, boolean preload) {
super(strategy);
preload(preload);
}

public FixedStrategy(JSObject strategy) {
super(strategy);
}

public FixedStrategy(boolean preload) {
this(FixedStrategyImpl.create(), preload);
}

public FixedStrategy() {
this(FixedStrategyImpl.create());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.gwtopenmaps.openlayers.client.strategy;

import org.gwtopenmaps.openlayers.client.util.JSObject;

public class FixedStrategyImpl {
public native static JSObject create() /*-{
return new $wnd.OpenLayers.Strategy.Fixed();
}-*/;

public native static void preload(JSObject self, boolean load) /*-{
self.preload(load);
}-*/;

public native static void destroy(JSObject self) /*-{
self.destroy();
}-*/;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.gwtopenmaps.openlayers.client.strategy;

import org.gwtopenmaps.openlayers.client.util.JSObject;

/**
*
* @author Maciej Jezierski - Pinocchio
*
*/
public class PagingStrategy extends Strategy {

public boolean activate() {
return PagingStrategyImpl.activate(this.getJSObject());
}

public boolean deactivate() {
return PagingStrategyImpl.deactivate(this.getJSObject());
}

public int pageCount() {
return PagingStrategyImpl.pageCount(this.getJSObject());
}

public int pageNum() {
return PagingStrategyImpl.pageNum(this.getJSObject());
}

public int pageLength() {
return PagingStrategyImpl.pageLength(this.getJSObject());
}

public int pageLength(int length) {
return PagingStrategyImpl.pageLength(this.getJSObject(), length);
}

public boolean pageNext() {
return PagingStrategyImpl.pageNext(this.getJSObject());
}

public boolean pagePrevious() {
return PagingStrategyImpl.pagePrevious(this.getJSObject());
}

public PagingStrategy(JSObject strategy) {
super(strategy);
}

public PagingStrategy() {
this(PagingStrategyImpl.create());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.gwtopenmaps.openlayers.client.strategy;

import org.gwtopenmaps.openlayers.client.util.JSObject;

public class PagingStrategyImpl {

public native static JSObject create() /*-{
return $wnd.OpenLayers.Strategy.Paging();
}-*/;

public native static boolean activate(JSObject self) /*-{
return self.activate();
}-*/;

public native static boolean deactivate(JSObject self) /*-{
return self.deactivate();
}-*/;

public native static int pageCount(JSObject self) /*-{
return self.pageCount();
}-*/;

public native static int pageNum(JSObject self) /*-{
return self.pageNum();
}-*/;

public native static int pageLength(JSObject self) /*-{
return self.pageLength();
}-*/;

public native static int pageLength(JSObject self, int length) /*-{
return self.pageLength(length);
}-*/;

public native static boolean pageNext(JSObject self) /*-{
return self.pageNext();
}-*/;

public native static boolean pagePrevious(JSObject self) /*-{
return self.pagePrevious();
}-*/;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.gwtopenmaps.openlayers.client.strategy;

import org.gwtopenmaps.openlayers.client.util.JSObject;

/**
*
* @author Maciej Jezierski - Pinocchio
*
*/
public class RefreshStrategy extends Strategy {

public boolean activate() {
return RefreshStrategyImpl.activate(this.getJSObject());
}

public boolean deactivate() {
return RefreshStrategyImpl.deactivate(this.getJSObject());
}

public void refresh() {
RefreshStrategyImpl.refresh(this.getJSObject());
}

public RefreshStrategy(JSObject strategy) {
super(strategy);
}

public RefreshStrategy() {
this(RefreshStrategyImpl.create());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.gwtopenmaps.openlayers.client.strategy;

import org.gwtopenmaps.openlayers.client.util.JSObject;

public class RefreshStrategyImpl {

public native static JSObject create() /*-{
return $wnd.OpenLayers.Strategy.Refresh();
}-*/;

public native static boolean activate(JSObject self) /*-{
return self.activate();
}-*/;

public native static boolean deactivate(JSObject self) /*-{
return self.deactivate();
}-*/;

public native static void refresh(JSObject self) /*-{
self.refresh();
}-*/;
}
Loading

0 comments on commit 95e7572

Please sign in to comment.