forked from geosdi/GWT-OpenLayers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: SaveStrategy, RefreshStrategy, FixedStrategy, PagingStrategy, Na…
…vigationHistory, DeleteFeature
- Loading branch information
Pinocchio
committed
Apr 19, 2011
1 parent
3878326
commit 95e7572
Showing
13 changed files
with
460 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...nlayers-client/src/main/java/org/gwtopenmaps/openlayers/client/control/DeleteFeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | ||
} | ||
|
||
} | ||
|
9 changes: 9 additions & 0 deletions
9
...ers-client/src/main/java/org/gwtopenmaps/openlayers/client/control/DeleteFeatureImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}-*/; | ||
} |
71 changes: 71 additions & 0 deletions
71
...ers-client/src/main/java/org/gwtopenmaps/openlayers/client/control/NavigationHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...client/src/main/java/org/gwtopenmaps/openlayers/client/control/NavigationHistoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}-*/; | ||
} |
45 changes: 45 additions & 0 deletions
45
...layers-client/src/main/java/org/gwtopenmaps/openlayers/client/strategy/FixedStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...rs-client/src/main/java/org/gwtopenmaps/openlayers/client/strategy/FixedStrategyImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}-*/; | ||
} |
51 changes: 51 additions & 0 deletions
51
...ayers-client/src/main/java/org/gwtopenmaps/openlayers/client/strategy/PagingStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...s-client/src/main/java/org/gwtopenmaps/openlayers/client/strategy/PagingStrategyImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}-*/; | ||
} |
31 changes: 31 additions & 0 deletions
31
...yers-client/src/main/java/org/gwtopenmaps/openlayers/client/strategy/RefreshStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...-client/src/main/java/org/gwtopenmaps/openlayers/client/strategy/RefreshStrategyImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}-*/; | ||
} |
Oops, something went wrong.