This repository has been archived by the owner on Jan 1, 2021. It is now read-only.
forked from openstreetmap/potlatch2
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
488 additions
and
68 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
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,65 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<mx:TitleWindow | ||
xmlns:mx="http://www.adobe.com/2006/mxml" | ||
xmlns:potlatch2="net.systemeD.potlatch2.*" | ||
title="Load Relation" width="350" height="160" | ||
creationComplete="requestedID.setFocus()" | ||
showCloseButton="true" close="PopUpManager.removePopUp(this);"> | ||
|
||
<mx:HBox paddingLeft="3" paddingTop="4"> | ||
<mx:Label text="Relation ID: " /> | ||
<mx:TextInput id="requestedID" restrict="0-9" /> | ||
</mx:HBox> | ||
<mx:ControlBar> | ||
<mx:Spacer width="100%"/> | ||
<mx:Button label="Load" click="loadRelation();" styleName="titleWindowButton" /> | ||
</mx:ControlBar> | ||
<mx:Script><![CDATA[ | ||
import net.systemeD.halcyon.*; | ||
import net.systemeD.halcyon.connection.*; | ||
import net.systemeD.potlatch2.*; | ||
import mx.managers.PopUpManager; | ||
private var entity:Entity; | ||
private var relid:Number; | ||
public function setEntity(e:Entity):void { | ||
entity=e; | ||
} | ||
private function loadRelation():void { | ||
relid = Number(requestedID.text); | ||
PopUpManager.removePopUp(this); | ||
var conn:Connection = Connection.getConnectionInstance(); | ||
if (!relid) return; | ||
if (conn.getRelation(relid)) { | ||
relationLoaded(null); | ||
} else { | ||
conn.loadEntityByID("relation",relid); | ||
conn.addEventListener(Connection.LOAD_COMPLETED, relationLoaded); | ||
} | ||
} | ||
private function relationLoaded(event:Event):void { | ||
var conn:Connection = Connection.getConnectionInstance(); | ||
var relation:Relation = conn.getRelation(relid); | ||
conn.removeEventListener(Connection.LOAD_COMPLETED, relationLoaded); | ||
if (!relation) return; | ||
var undo:CompositeUndoableAction = new CompositeUndoableAction("Add to relation"); | ||
if (entity is EntityCollection) { | ||
for each (var e:Entity in EntityCollection(entity).entities) { | ||
if (relation.findEntityMemberIndex(e)==-1) { | ||
relation.appendMember(new RelationMember(e, ''), undo.push); | ||
} | ||
} | ||
} else { | ||
relation.appendMember(new RelationMember(entity, ''), undo.push); | ||
} | ||
MainUndoStack.getGlobalStack().addAction(undo); | ||
} | ||
]]></mx:Script> | ||
</mx:TitleWindow> | ||
|
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
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
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
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
Oops, something went wrong.