Remove trunk directory

This commit is contained in:
Paulo Gustavo Veiga
2009-11-06 23:30:29 -02:00
parent 2494133fed
commit 75470a91fd
715 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.AddIconToTopicCommand = mindplot.Command.extend(
{
initialize: function(topicId, iconType)
{
core.assert(topicId, 'topicId can not be null');
core.assert(iconType, 'iconType can not be null');
this._topicId = topicId;
this._iconType = iconType;
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
var iconImg = topic.addIcon(this._iconType, commandContext._designer);
this._iconModel = iconImg.getModel();
topic.updateNode();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.removeIcon(this._iconModel);
topic.updateNode();
}.bind(this);
updated.delay(0);
}
});

View File

@@ -0,0 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.AddLinkToTopicCommand = mindplot.Command.extend(
{
initialize: function(topicId,url)
{
core.assert(topicId, 'topicId can not be null');
this._topicId = topicId;
this._url = url;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.addLink(this._url,commandContext._designer);
topic.updateNode();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.removeLink();
}.bind(this);
updated.delay(0);
}
});

View File

@@ -0,0 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.AddNoteToTopicCommand = mindplot.Command.extend(
{
initialize: function(topicId,text)
{
core.assert(topicId, 'topicId can not be null');
this._topicId = topicId;
this._text = text;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.addNote(this._text,commandContext._designer);
topic.updateNode();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.removeNote();
}.bind(this);
updated.delay(0);
}
});

View File

@@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.AddTopicCommand = mindplot.Command.extend(
{
initialize: function(model, parentTopicId)
{
core.assert(model, 'Model can not be null');
this._model = model;
this._parentId = parentTopicId;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext)
{
// Add a new topic ...
var topic = commandContext.createTopic(this._model);
// Connect to topic ...
if (this._parentId)
{
var parentTopic = commandContext.findTopics(this._parentId)[0];
commandContext.connect(topic, parentTopic);
}
// Finally, focus ...
topic.setOnFocus(true);
},
undoExecute: function(commandContext)
{
// Finally, delete the topic from the workspace ...
var topicId = this._model.getId();
var topic = commandContext.findTopics(topicId)[0];
commandContext.deleteTopic(topic);
}
});

View File

@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.ChangeIconFromTopicCommand = mindplot.Command.extend(
{
initialize: function(topicId, iconId, iconType)
{
core.assert(topicId, 'topicId can not be null');
core.assert(iconId, 'iconId can not be null');
core.assert(iconType, 'iconType can not be null');
this._topicId = topicId;
this._iconModel = iconId;
this._iconType = iconType;
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.removeIcon(this._iconModel);
topic.updateNode();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.addIcon(this._iconModel, commandContext._designer);
topic.updateNode();
}.bind(this);
updated.delay(0);
}
});

View File

@@ -0,0 +1,78 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.DeleteTopicCommand = mindplot.Command.extend(
{
initialize: function(topicsIds)
{
core.assert(topicsIds, "topicsIds must be defined");
this._topicId = topicsIds;
this._deletedTopicModels = [];
this._parentTopicIds = [];
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext)
{
var topics = commandContext.findTopics(this._topicId);
topics.forEach(
function(topic, index)
{
var model = topic.getModel().clone();
this._deletedTopicModels.push(model);
// Is connected?.
var outTopic = topic.getOutgoingConnectedTopic();
var outTopicId = null;
if (outTopic != null)
{
outTopicId = outTopic.getId();
}
this._parentTopicIds.push(outTopicId);
// Finally, delete the topic from the workspace...
commandContext.deleteTopic(topic);
}.bind(this)
)
},
undoExecute: function(commandContext)
{
var topics = commandContext.findTopics(this._topicId);
var parent = commandContext.findTopics(this._parentTopicIds);
this._deletedTopicModels.forEach(
function(model, index)
{
var topic = commandContext.createTopic(model);
// Was the topic connected?
var parentTopic = parent[index];
if (parentTopic != null)
{
commandContext.connect(topic, parentTopic);
}
}.bind(this)
)
this._deletedTopicModels = [];
this._parentTopicIds = [];
}
});

View File

@@ -0,0 +1,104 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.DragTopicCommand = mindplot.Command.extend(
{
initialize: function(topicId)
{
core.assert(topicId, "topicId must be defined");
this._topicId = topicId;
this._parentTopic = null;
this._position = null;
this._order = null;
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext)
{
var topic = commandContext.findTopics([this._topicId])[0];
// Save old position ...
var origParentTopic = topic.getOutgoingConnectedTopic();
var origOrder = null;
var origPosition = null;
if (topic.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE && origParentTopic != null && origParentTopic.getType() == mindplot.NodeModel.MAIN_TOPIC_TYPE)
{
// In this case, topics are positioned using order ...
origOrder = topic.getOrder();
} else
{
origPosition = topic.getPosition().clone();
}
// Disconnect topic ..
if (origParentTopic)
{
commandContext.disconnect(topic);
}
// Set topic position ...
if (this._position != null)
{
// Set position ...
topic.setPosition(this._position);
} else if (this._order != null)
{
topic.setOrder(this._order);
} else
{
core.assert("Illegal commnad state exception.");
}
this._order = origOrder;
this._position = origPosition;
// Finally, connect topic ...
if (this._parentId)
{
var parentTopic = commandContext.findTopics([this._parentId])[0];
commandContext.connect(topic, parentTopic);
}
// Backup old parent id ...
this._parentId = null;
if (origParentTopic)
{
this._parentId = origParentTopic.getId();
}
},
undoExecute: function(commandContext)
{
this.execute(commandContext);
},
setPosition: function(point)
{
this._position = point;
},
setParetTopic: function(topic) {
this._parentId = topic.getId();
},
setOrder: function(order)
{
this._order = order
}
});

View File

@@ -0,0 +1,67 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.GenericFunctionCommand = mindplot.Command.extend(
{
initialize: function(commandFunc,value,topicsIds)
{
core.assert(commandFunc, "commandFunc must be defined");
core.assert(topicsIds, "topicsIds must be defined");
this._value = value;
this._topicId = topicsIds;
this._commandFunc = commandFunc;
this._oldValues = [];
this._id = mindplot.Command._nextUUID();
},
execute: function(commandContext)
{
if (!this.applied)
{
var topics = commandContext.findTopics(this._topicId);
topics.forEach(function(topic)
{
var oldValue = this._commandFunc(topic, this._value);
this._oldValues.push(oldValue);
}.bind(this));
this.applied = true;
} else
{
throw "Command can not be applied two times in a row.";
}
},
undoExecute: function(commandContext)
{
if (this.applied)
{
var topics = commandContext.findTopics(this._topicId);
topics.forEach(function(topic,index)
{
this._commandFunc(topic, this._oldValues[index]);
}.bind(this));
this.applied = false;
this._oldValues = [];
} else
{
throw "undo can not be applied.";
}
}
});

View File

@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.RemoveIconFromTopicCommand = mindplot.Command.extend(
{
initialize: function(topicId, iconModel)
{
core.assert(topicId, 'topicId can not be null');
core.assert(iconModel, 'iconId can not be null');
this._topicId = topicId;
this._iconModel = iconModel;
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.removeIcon(this._iconModel);
topic.updateNode();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
var iconType = this._iconModel.getIconType();
var iconImg = topic.addIcon(iconType, commandContext._designer);
this._iconModel = iconImg.getModel();
topic.updateNode();
}.bind(this);
updated.delay(0);
}
});

View File

@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.RemoveLinkFromTopicCommand = mindplot.Command.extend(
{
initialize: function(topicId)
{
core.assert(topicId, 'topicId can not be null');
this._topicId = topicId;
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
this._url = topic._link.getUrl();
var updated = function() {
topic.removeLink();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.addLink(this._url,commandContext._designer);
topic.updateNode();
}.bind(this);
updated.delay(0);
}
});

View File

@@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*
* $Id: file 64488 2006-03-10 17:32:09Z paulo $
*/
mindplot.commands.RemoveNoteFromTopicCommand = mindplot.Command.extend(
{
initialize: function(topicId)
{
core.assert(topicId, 'topicId can not be null');
this._topicId = topicId;
},
execute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
this._text = topic._note.getText();
var updated = function() {
topic.removeNote();
}.bind(this);
updated.delay(0);
},
undoExecute: function(commandContext)
{
var topic = commandContext.findTopics(this._topicId)[0];
var updated = function() {
topic.addNote(this._text,commandContext._designer);
topic.updateNode();
}.bind(this);
updated.delay(0);
}
});