Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
372bccc
Node loading fix. Session param fix.
itarato May 6, 2011
ea07f2e
Fix services resource names.
itarato May 6, 2011
7da7389
Fix empty body bug.
itarato May 6, 2011
ce4cc4f
Add node feature fix.
itarato May 6, 2011
9695f21
Fetch attributes depends on attributes/
itarato May 9, 2011
edeb9b1
Update lock for map load in relationships.
itarato May 9, 2011
ef94b27
Add OG plugin. Add events to the features.
itarato May 11, 2011
d2f218e
Temporarily remove OG plugin.
itarato May 11, 2011
642fb94
Organic groups plugin.
itarato May 12, 2011
5b6b612
JS callbacks for the OG plugin.
itarato May 12, 2011
486622f
Fix icon position and visibility on load.
itarato May 12, 2011
7a16cc2
Fix map size.
itarato May 13, 2011
b58efd5
Change panel cross icon.
itarato May 13, 2011
e3379d0
New connection URL handling -> now it is a base path and an endpoint.
itarato May 19, 2011
36ae550
Remove sync and load function from relationship. #BP6.
itarato May 26, 2011
4fa6bc7
Implement hard refresh. #BP6
itarato May 26, 2011
c2ebb8d
Fix update check and hard refresh. #BP6
itarato May 27, 2011
b84d73e
Add refresh lock unlock. #BP6
itarato May 27, 2011
36d553e
Add icon panel exit button. Remove unused vars. #BP6
itarato May 27, 2011
bc4539c
Fix OSD position. Node info panel as a feature. #BP6
itarato May 27, 2011
9ae8f39
Fix og plugin and node load panel. #BP6
itarato May 27, 2011
c2290bf
Make OSD messages taggable. Relationship plugin use it. #BP6
itarato May 30, 2011
de2d4f5
Rename frequency vars. #BP6
itarato May 30, 2011
88a64b5
Title editing feature. #BP6
itarato May 30, 2011
14b0156
Relationship refresh selects the same node or parent. #BP6
itarato May 30, 2011
f15688f
Position node to the center on relationship refresh. #BP6
itarato May 31, 2011
bb054dc
Autosave. #BP6
itarato May 31, 2011
2cd209e
Increase save frequency. #BP6
itarato May 31, 2011
feb60ea
Remove unnecessary restrictions in noneditable mode. #BP6
itarato May 31, 2011
af96ff1
Remove warning on relationships update. #BP6
itarato May 31, 2011
7714a34
Fix menu loading. #BP6
itarato May 31, 2011
ae7702b
Remove trace. #BP6
itarato May 31, 2011
f23386c
Relation ship update chech - time to title. #BP6
itarato May 31, 2011
7c702fb
Fix node edit issue for non admin users.
itarato Jun 7, 2011
9b90af3
Change rel change warning.
itarato Jun 7, 2011
caa7e41
Preserve stat on relationship hard refresh.
itarato Jun 9, 2011
835656b
Improve node context menu generation.
itarato Jun 10, 2011
82e65a5
Add silent save.
itarato Jun 10, 2011
dd1af59
Add save frequency ui.
itarato Jun 10, 2011
9391ff1
Preserve order for relationship on refresh.
itarato Jun 14, 2011
1c2b76e
Change save response text.
itarato Jun 21, 2011
31a98ad
Add remove node feature.
itarato Jun 23, 2011
416d8f6
Refresh cache for the root node.
itarato Jun 24, 2011
74649a4
Remove system.call and unused views request.
itarato Sep 11, 2011
0e7b23b
Hide attributes from the export.
itarato Sep 11, 2011
8498d34
Add newline into the exported file.
itarato Sep 11, 2011
7ae9af2
after refreshing the map freeze this commit fix it
csnattila Mar 19, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/GraphMind.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@
<mx:HBox paddingTop="2" paddingLeft="2" id="mainMenuBar" horizontalGap="0"/>
</mx:Canvas>
<mx:Canvas id="map"
top="30" left="0" right="0" bottom="0"
top="27" left="0" right="0" bottom="0"
horizontalScrollPolicy="off" verticalScrollPolicy="off" />
</mx:Canvas>

<mx:VBox id="OSDContainer" width="300" height="100%" right="6" top="6"/>
<mx:VBox id="OSDContainer" width="300" height="100%" right="22" top="33"/>

<!--<debugger:MonsterDebuggerFlex id="monsterDebugger" />-->

Expand Down
Binary file added src/assets/images/arrow_refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/cross_orange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 45 additions & 38 deletions src/com/graphmind/ApplicationController.as
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ package com.graphmind {
*/
protected var _isEditable:Boolean = false;

/**
* Feature array.
*/
public var features:Array;

/**
* Disk image source for the save button.
*/
Expand Down Expand Up @@ -114,39 +109,27 @@ package com.graphmind {
GraphMind.i.map.addChild(this.treeMapViewController.view);

// Establish connection to the Drupal site.
ConnectionController.mainConnection = ConnectionController.createConnection(getBaseDrupalURL());
ConnectionController.mainConnection.isSessionAuthentication = true;
ConnectionController.mainConnection = ConnectionController.createConnection(getBaseDrupalURL(), getServiceEndpoint());

ConnectionController.mainConnection.addEventListener(ConnectionEvent.CONNECTION_IS_READY, onSuccess_siteIsConnected);
ConnectionController.mainConnection.addEventListener(ConnectionIOErrorEvent.IO_ERROR_EVENT, ConnectionController.defaultIOErrorHandler);
ConnectionController.mainConnection.addEventListener(ConnectionNetStatusEvent.NET_STATUS_EVENT, ConnectionController.defaultNetStatusHandler);
ConnectionController.mainConnection.connect();

EventCenter.subscribe(EventCenterEvent.REQUEST_FOR_FREEMIND_XML, onAppFormRequestForFreemindXml);

MainMenuController.createIconMenuItem(diskImage, 'Save', onClick_saveMenuItem);
MainMenuController.createIconMenuItem(fullScreenImage, 'Full screen', onClick_fullScreenIcon);

applicationSettingsComponent = new ApplicationSettingsComponent();
applicationSettingsPanel = new ConfigPanelController('Map settings');
applicationSettingsPanel.addItem(applicationSettingsComponent);
MainMenuController.createIconMenuItem(gearImage, 'Settings', onClick_ApplicationSettingsMenuItem);
applicationSettingsComponent.desktopScaleHSlider.addEventListener(SliderEvent.CHANGE, onChange_mapScaleSlider);
applicationSettingsComponent.nodeSizeSelect.addEventListener(ListEvent.CHANGE, onDataChange_nodeSizeSelect);
var e:EventCenterEvent = EventCenter.notify(EventCenterEvent.ALTER_SETTINGS_PANEL, []);
for each (var item:UIComponent in e.data) {
applicationSettingsPanel.addItem(item);
}

if (FeatureController.isFeatureEnabled(FeatureController.CONNECTIONS)) {
connectionSettingsComponent = new ConnectionSettingsComponent();
connectionSettingsPanel = new ConfigPanelController('Remote connections');
connectionSettingsPanel.addItem(connectionSettingsComponent);
MainMenuController.createIconMenuItem(connectionImage, 'Connections', onClick_ConnectionsMenuItem);
connectionSettingsComponent.saveButton.addEventListener(MouseEvent.CLICK, onClick_AddNewSiteConnectionButton);
}

NodeViewController.init();

// No necessary to call system.connect. We just start with a normal call.
onSuccess_siteIsConnected(null);
}


Expand All @@ -158,6 +141,14 @@ package com.graphmind {
}


/**
* Returns the URL of the service endpoint.
*/
public static function getServiceEndpoint():String {
return Application.application.parameters.endPoint;
}


/**
* Get hosting node's NID
*/
Expand All @@ -179,20 +170,9 @@ package com.graphmind {
*/
protected function onSuccess_siteIsConnected(event:ConnectionEvent):void {
Log.info("Connection to Drupal is established.");
// Get all the available features
ConnectionController.mainConnection.call('graphmind.getFeatures', onSuccess_featuresAreLoaded, null, getHostNodeID());
ConnectionController.mainConnection.call('graphmind.getViews', onSuccess_viewsListsAreLoaded, null);
ConnectionController.mainConnection.call('node.get', onSuccess_rootNodeIsLoaded, null, getHostNodeID());
}


/**
* Features are loaded.
* Features are disabled by default.
*/
protected function onSuccess_featuresAreLoaded(result:Object):void {
Log.info("Features are loaded: " + result.toString());
this.features = result as Array;
// Views service is not ported to D7 yet.
//ConnectionController.mainConnection.call('graphmind.getViews', onSuccess_viewsListsAreLoaded, ConnectionController.defaultRequestErrorHandler);
ConnectionController.mainConnection.call('graphmind.isNodeEditable', onSuccess_isNodeEditable, ConnectionController.defaultRequestErrorHandler, getHostNodeID());
}


Expand All @@ -206,14 +186,40 @@ package com.graphmind {
new DrupalViews(data, ConnectionController.mainConnection);
}
}


/**
* Event callback - when edit check is back.
*/
protected function onSuccess_isNodeEditable(result:Object):void {
setEditMode(result);

if (isEditable()) {
MainMenuController.createIconMenuItem(diskImage, 'Save', onClick_saveMenuItem);
}

MainMenuController.createIconMenuItem(fullScreenImage, 'Full screen', onClick_fullScreenIcon);

MainMenuController.createIconMenuItem(gearImage, 'Settings', onClick_ApplicationSettingsMenuItem);

if (FeatureController.isFeatureEnabled(FeatureController.CONNECTIONS)) {
connectionSettingsComponent = new ConnectionSettingsComponent();
connectionSettingsPanel = new ConfigPanelController('Remote connections');
connectionSettingsPanel.addItem(connectionSettingsComponent);
MainMenuController.createIconMenuItem(connectionImage, 'Connections', onClick_ConnectionsMenuItem);
connectionSettingsComponent.saveButton.addEventListener(MouseEvent.CLICK, onClick_AddNewSiteConnectionButton);
}

ConnectionController.mainConnection.call('node.retrieve', onSuccess_rootNodeIsLoaded, ConnectionController.defaultRequestErrorHandler, getHostNodeID());
}


/**
* Root node is loaded.
*/
protected function onSuccess_rootNodeIsLoaded(result:Object):void {
Log.info("Root node is loaded: " + result.nid);
setEditMode(result.graphmindEditable == '1');

TreeMapViewController.rootNode = ImportManager.importNodesFromDrupalResponse(result);

// Call map to draw its contents.
Expand Down Expand Up @@ -304,10 +310,11 @@ package com.graphmind {
* Event handler for
*/
public function onClick_AddNewSiteConnectionButton(e:MouseEvent):void {
var url:String = connectionSettingsComponent.connectFormURL.text;
var basePath:String = connectionSettingsComponent.connectFormBasePath.text;
var endPoint:String = connectionSettingsComponent.connectFormEndPoint.text;
var userName:String = connectionSettingsComponent.connectFormUsername.text;
var userPassword:String = connectionSettingsComponent.connectFormPassword.text;
var conn:Connection = ConnectionController.createConnection(url);
var conn:Connection = ConnectionController.createConnection(basePath, endPoint);

conn.userName = userName;
conn.userPassword = userPassword;
Expand Down
10 changes: 5 additions & 5 deletions src/com/graphmind/ConnectionController.as
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package com.graphmind {
private static function addConnection(conn:Connection):void {
// Check if the connection is already added.
for (var idx:* in _connections) {
if ((_connections[idx] as Connection).target == conn.target) {
if ((_connections[idx] as Connection).basePath == conn.basePath && (_connections[idx] as Connection).endPoint == conn.endPoint) {
return;
}
}
Expand Down Expand Up @@ -81,7 +81,7 @@ package com.graphmind {
public static function defaultNetStatusHandler(event:ConnectionNetStatusEvent):void {
OSD.show(
"Network status error." +
"\n Connection: " + event.connection.target +
"\n Connection: " + event.connection.basePath + ' [' + event.connection.endPoint + ']' +
"\n Code: " + event.netStatusEvent.info.code +
"\n Description: " + event.netStatusEvent.info.description +
"\n Details: " + event.netStatusEvent.info.details +
Expand All @@ -93,14 +93,14 @@ package com.graphmind {
/**
* Connection factory.
*/
public static function createConnection(target:String):Connection {
public static function createConnection(basePath:String, endPoint:String):Connection {
for (var idx:* in _connections) {
if ((_connections[idx] as Connection).target == target) {
if ((_connections[idx] as Connection).basePath == basePath && (_connections[idx] as Connection).endPoint == endPoint) {
return _connections[idx];
}
}

var conn:Connection = new Connection(target);
var conn:Connection = new Connection(basePath, endPoint);
addConnection(conn);
return conn;
}
Expand Down
22 changes: 18 additions & 4 deletions src/com/graphmind/ExportController.as
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.graphmind {

import com.graphmind.event.EventCenter;
import com.graphmind.event.EventCenterEvent;
import com.kitten.network.Connection;


public class ExportController {
Expand All @@ -22,15 +21,30 @@ package com.graphmind {
* @return string
*/
public static function getFreeMindXML(node:NodeViewController):String {
return '<map version="0.9.0">' + "\n" + node.exportToFreeMindFormat() + '</map>' + "\n";
return '<map version="0.9.0">' + "\n" +
'<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->' +
'<attribute_registry SHOW_ATTRIBUTES="hide"/>' + "\n" +
node.exportToFreeMindFormat() +
'</map>' + "\n";
}


/**
* Save work into host node
*/
public static function saveFreeMindXMLToDrupal(conn:Connection, xml:String, nid:uint):void {
conn.call('graphmind.saveGraphMind', onSaveFreemindXMLToDrupalSucceed, ConnectionController.defaultRequestErrorHandler, nid, xml, lastSaved * 0.001);
public static function saveFreeMindXMLToDrupal(xml:String, nid:uint):void {
ConnectionController.mainConnection.call('graphmind.saveGraphMind', onSaveFreemindXMLToDrupalSucceed, ConnectionController.defaultRequestErrorHandler, nid, xml, lastSaved * 0.001);
}


/**
* Save map silently.
*/
public static function saveFreeMindXMLToDrupalSilent(xml:String, nid:uint):void {
ConnectionController.mainConnection.call('graphmind.saveGraphMind', function(e:Object):void{
lastSaved = new Date().time;
EventCenter.notify(EventCenterEvent.MAP_SAVED_SILENTLY, e);
}, ConnectionController.defaultRequestErrorHandler, nid, xml, lastSaved * 0.001);
}


Expand Down
8 changes: 7 additions & 1 deletion src/com/graphmind/FeatureController.as
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.graphmind {

import mx.graphics.Stroke;
import com.graphmind.event.EventCenter;
import com.graphmind.event.EventCenterEvent;

public class FeatureController {

Expand All @@ -14,6 +15,8 @@ package com.graphmind {
public static var ATTRIBUTES:String = 'attributes';
public static var CONNECTIONS:String = 'connections';
public static var TOOLTIPS:String = 'tooltips';
public static var NODE_INFO:String = 'nodeInfo';
public static var REMOVE_NODE:String = 'removeNode';

/**
* Inner feature storage.
Expand All @@ -26,6 +29,7 @@ package com.graphmind {
*/
public static function set features(aFeatures:Array):void {
_features = aFeatures;
EventCenter.notify(EventCenterEvent.FEATURES_CHANGED);
}


Expand All @@ -35,6 +39,7 @@ package com.graphmind {
public static function addFeature(feature:String):void {
if (_features.indexOf(feature) == -1) {
_features.push(feature);
EventCenter.notify(EventCenterEvent.FEATURES_CHANGED);
}
}

Expand All @@ -45,6 +50,7 @@ package com.graphmind {
public static function removeFeature(feature:String):void {
if (_features.indexOf(feature) !== -1) {
delete _features[_features.indexOf(feature)];
EventCenter.notify(EventCenterEvent.FEATURES_CHANGED);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/com/graphmind/ImportManager.as
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package com.graphmind {
public static function importNodesFromDrupalResponse(response:Object):NodeViewController {
var rootNode:NodeViewController;
var is_valid_mm_xml:Boolean = false;
var body:String = response.body.toString();
var body:String = response['body'].hasOwnProperty(response.language) ? response.body[response.language][0]['value'].toString() : '';
if (body.length > 0) {
var xmlData:XML = new XML(body);
var nodes:XML = xmlData.child('node')[0];
Expand Down Expand Up @@ -73,7 +73,7 @@ package com.graphmind {
// Site connection
var conn:Connection = null;
if (nodeXML.site) {
conn = ConnectionController.createConnection(unescape(nodeXML.site.@URL));
conn = ConnectionController.createConnection(unescape(nodeXML.site.@BASEPATH), unescape(nodeXML.site.@ENDPOINT));
}

var node:NodeViewController = new NodeViewController(new NodeDataObject(
Expand Down
58 changes: 58 additions & 0 deletions src/com/graphmind/NodeContextMenuController.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.graphmind {

import com.graphmind.data.NodeContextMenu;
import com.graphmind.data.NodeContextMenuSection;

import flash.events.ContextMenuEvent;
import flash.ui.ContextMenuItem;

/**
* Manager of a node's context menus.
* It collects sections and items and outputs the context menu link list.
*/
public class NodeContextMenuController {

/**
* Add new menu item.
*/
public function addItem(name:String, callback:Function, weight:Number = 0, sectionName:String = 'default'):void {
var item:NodeContextMenu = new NodeContextMenu(name, callback, weight);
var section:NodeContextMenuSection = NodeContextMenuSection.getSection(sectionName);
section.addContextMenu(item);
}


/**
* Set weight of a section.
*/
public function setSectionWeight(name:String, weight:Number):void {
var section:NodeContextMenuSection = NodeContextMenuSection.getSection(name);
section.weight = weight;
}


/**
* Get the final item list - used by ContextMenu.customMenu.
*/
public function getContextMenus():Array {
var out:Array = [];
var isFirstFlag:Boolean = false;

NodeContextMenuSection.sortSection();

for each (var section:NodeContextMenuSection in NodeContextMenuSection.sections) {
isFirstFlag = true;
for each (var item:NodeContextMenu in section.contextMenus) {
var contextMenu:ContextMenuItem = new ContextMenuItem(item.name, isFirstFlag);
contextMenu.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, item.callback);
isFirstFlag = false;
out.push(contextMenu);
}
}

return out;
}

}

}
Loading