mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-04-16 21:30:08 +00:00
Change script location.
Split js code. Added cache and changed loading mechanism for js sources.
This commit is contained in:
66
script/features/show_adjacency_matrix/index.js
Normal file
66
script/features/show_adjacency_matrix/index.js
Normal file
@@ -0,0 +1,66 @@
|
||||
doInclude ([
|
||||
include ("features/base_handler/index.js")
|
||||
])
|
||||
|
||||
/**
|
||||
* Save/Load graph from matrix.
|
||||
*
|
||||
*/
|
||||
function ShowAdjacencyMatrix(app)
|
||||
{
|
||||
BaseHandler.apply(this, arguments);
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
// inheritance.
|
||||
ShowAdjacencyMatrix.prototype = Object.create(BaseHandler.prototype);
|
||||
// First selected.
|
||||
ShowAdjacencyMatrix.prototype.firstObject = null;
|
||||
// Path
|
||||
ShowAdjacencyMatrix.prototype.pathObjects = null;
|
||||
|
||||
ShowAdjacencyMatrix.prototype.show = function()
|
||||
{
|
||||
var handler = this;
|
||||
var dialogButtons = {};
|
||||
|
||||
$('#AdjacencyMatrixField').unbind();
|
||||
$( "#AdjacencyMatrixField" ).on('keyup change', function (eventObject)
|
||||
{
|
||||
if (!handler.app.TestAdjacencyMatrix($( "#AdjacencyMatrixField" ).val(), [], []))
|
||||
{
|
||||
$( "#BadMatrixFormatMessage" ).show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$( "#BadMatrixFormatMessage" ).hide();
|
||||
}
|
||||
});
|
||||
|
||||
dialogButtons[g_save] = function() {
|
||||
handler.app.PushToStack("ChangeAdjacencyMatrix");
|
||||
handler.app.SetAdjacencyMatrixSmart($( "#AdjacencyMatrixField" ).val());
|
||||
$( this ).dialog( "close" );
|
||||
};
|
||||
dialogButtons[g_cancel] = function() {
|
||||
$( this ).dialog( "close" );
|
||||
};
|
||||
|
||||
$( "#AdjacencyMatrixField" ).val(this.app.GetAdjacencyMatrix());
|
||||
$( "#BadMatrixFormatMessage" ).hide();
|
||||
|
||||
if (this.app.graph.isMulti())
|
||||
$( "#AdjacencyMatrixMultiGraphDesc").show();
|
||||
else
|
||||
$( "#AdjacencyMatrixMultiGraphDesc").hide();
|
||||
|
||||
$( "#adjacencyMatrix" ).dialog({
|
||||
resizable: false,
|
||||
height: "auto",
|
||||
width: "auto",
|
||||
modal: true,
|
||||
title: g_adjacencyMatrixText,
|
||||
buttons: dialogButtons,
|
||||
dialogClass: 'EdgeDialog'
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user