Changeset 17815
- Timestamp:
- 08/01/08 13:27:10 (1 month ago)
- Files:
-
- trunk/core/src/net/project/schedule/Schedule.java (modified) (2 diffs)
- trunk/core/src/net/project/schedule/ScheduleEntry.java (modified) (1 diff)
- trunk/core/web/jsp/schedule/Main.jsp (modified) (4 diffs)
- trunk/core/web/src/indentedView.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/core/src/net/project/schedule/Schedule.java
r17804 r17815 1132 1132 columns.add("sequence"); 1133 1133 columns.add("name"); 1134 columns.add("description"); 1134 1135 columns.add("work"); 1135 1136 columns.add("workUnits"); 1136 1137 columns.add("workInHours"); 1138 columns.add("duration"); 1139 columns.add("calculationType"); 1140 columns.add("isMilestone"); 1141 columns.add("actualStart"); 1142 columns.add("startDateTime"); 1143 columns.add("endDateTime"); 1144 columns.add("actualFinish"); 1145 columns.add("durationInHours"); 1146 columns.add("workPercentComplete"); 1147 columns.add("workCompleteString"); 1148 columns.add("assigneeString"); 1149 columns.add("phaseName"); 1150 columns.add("priorityString"); 1137 1151 1138 1152 final NodeFactory factory = new NodeFactory(columns); … … 1140 1154 Node root = factory.nextNode(); 1141 1155 root.setTitle(this.name); 1156 root.set("name", this.name); 1142 1157 root.set("id", this.id); 1143 1158 trunk/core/src/net/project/schedule/ScheduleEntry.java
r17804 r17815 1538 1538 public void addToNode(final NodeFactory factory, final Node root){ 1539 1539 final Node newNode = factory.nextNode(); 1540 DateFormat df = SessionManager.getUser().getDateFormatter(); 1541 1542 //Add all the property values 1540 1543 newNode.setTitle(this.name); 1541 1544 newNode.set("id", this.id); 1542 1545 newNode.set("sequence", this.sequenceNumber); 1543 1546 newNode.set("name", XMLUtils.escape(this.getNameMaxLength40())); 1547 newNode.set("description", XMLUtils.escape(this.description)); 1544 1548 newNode.set("work", XMLUtils.escape(this.getWork())); 1545 1549 newNode.set("workUnits", XMLUtils.escape(getWorkUnitsString())); 1546 1550 newNode.set("workInHours", XMLUtils.escape(this.getAmountUnitInHours(this.work))); 1547 1551 newNode.set("calculationType", XMLUtils.escape(this.calculationType.formatDisplay())); 1552 newNode.set("isMilestone", (isMilestone() ? "1" : "0")); 1553 newNode.set("startDate", df.formatDate(this.startTime)); 1554 newNode.set("startDateTime", XMLUtils.formatISODateTime(this.startTime)); 1555 newNode.set("endDateTime", XMLUtils.formatISODateTime(this.endTime)); 1556 newNode.set("actualStart", XMLUtils.formatISODateTime(this.actualStart)); 1557 newNode.set("actualFinish", XMLUtils.formatISODateTime(this.actualFinish)); 1558 newNode.set("duration", getDurationFormatted()); 1559 newNode.set("durationInHours", XMLUtils.escape(this.isMilestone ? "-1.0" : this.getAmountUnitInHours(this.duration))); 1560 newNode.set("workPercentComplete", this.getWorkPercentCompleteDecimal().multiply(new BigDecimal(100))); 1561 newNode.set("workCompleteString", this.getWorkCompleteTQ().toShortString(0,2)); 1562 try { 1563 newNode.set("assigneeString",XMLUtils.escape(getAssigneeString())); 1564 } catch (PersistenceException pe) { 1565 Logger.getLogger(ScheduleEntry.class).error("Un unexpected exception occurred while attempting to get the Assignee String: " + pe); 1566 throw new XMLConstructionException("Un unexpected exception occurred while attempting to get the Assignee String: " + pe, pe); 1567 } 1568 newNode.set("phaseName", XMLUtils.escape(this.phaseName)); 1569 newNode.set("priorityString", XMLUtils.escape(this.getPriorityString())); 1570 1548 1571 // Determine whether this newNode will be added to received root 1549 1572 if(StringUtils.isNumeric(this.parentTaskID)){ trunk/core/web/jsp/schedule/Main.jsp
r17804 r17815 270 270 } 271 271 272 set RecordDefinition(flatView);272 setGridRecordDefinition(flatView); 273 273 flatView.setConfigurationReader('id', '*:has(id)'); 274 274 flatView.setDataStore(JSPRootURL + '/schedule/include/storeFlatListProvider.jsp?module=' + scheduleModule); … … 281 281 282 282 function setupIndentedAjaxView(){ 283 var indentedView = new Controller(); 284 var dataStoreUrl = JSPRootURL + '/schedule/include/storeIndentedListProvider.jsp?module=' + scheduleModule; 285 indentedView.init('schedule-grid', dataStoreUrl); 286 } 287 288 function setRecordDefinition(grid){ 283 var indentedView = new TreeGrid(); 284 setTreeGridRecordDefinition(indentedView); 285 indentedView.setConfigurationReader('id', 'id'); 286 indentedView.setDataStore(JSPRootURL + '/schedule/include/storeIndentedListProvider.jsp?module=' + scheduleModule); 287 setTreeGridColumns(indentedView); 288 indentedView.init('schedule-grid'); 289 } 290 291 function setTreeGridRecordDefinition(grid){ 289 292 if(null != grid){ 293 grid.addRecord(null, '_id', '_id', 'int'); 294 grid.addRecord(null, '_level', '_level', 'int'); 295 grid.addRecord(null, '_lft', '_lft', 'int'); 296 grid.addRecord(null, '_rgt', '_rgt', 'int'); 297 grid.addRecord(null, '_is_leaf', '_is_leaf', 'bool'); 298 grid.addRecord(null, 'id', 'id', 'int'); 299 setBaseRecordDefinition(grid); 300 } 301 } 302 303 function setGridRecordDefinition(grid){ 304 if(null != grid){ 305 setBaseRecordDefinition(grid); 306 grid.addRecord(null, 'idlist', 'idlist', null); 307 } 308 } 309 310 function setBaseRecordDefinition(grid){ 311 if(null != grid){ 290 312 grid.addRecord(null, 'sequence', 'sequence', 'int'); 291 313 grid.addRecord(null, 'name', 'name', null); … … 305 327 grid.addRecord(null, 'workComplete', 'workCompleteString', null); 306 328 grid.addRecord(null, 'assigneeString', 'assignees', null); 307 grid.addRecord(null, 'phase _name', 'phase', null);329 grid.addRecord(null, 'phaseName', 'phase', null); 308 330 grid.addRecord(null, 'priorityString', 'priority', null); 309 grid.addRecord(null, 'idlist', 'idlist', null);310 331 } 311 332 } … … 687 708 grid.addColumn('priority', '<display:get name="prm.schedule.list.priority.column" />', true, null, null, null); 688 709 grid.addColumn('calculationType', '<display:get name="prm.schedule.list.calculationtype.column" />', true, null, null, null); 710 } 711 } 712 713 function setTreeGridColumns(grid){ 714 if(null != grid){ 715 grid.addColumn('name', 'name', '<display:get name="prm.schedule.list.task.column" />', false, nameRenderer, null, null); 716 grid.addColumn(null, 'description', '<display:get name="prm.schedule.list.taskdescription.column" />', true, null, null, null); 717 grid.addColumn(null, 'startDate', '<display:get name="prm.schedule.list.startdate.column" />', false, Ext.util.Format.dateRenderer('n/j/y'), null, null); 718 grid.addColumn(null, 'actualStartDate', '<display:get name="prm.schedule.list.actualstartdate.column" />', true, Ext.util.Format.dateRenderer('n/j/y'), null, null); 719 grid.addColumn(null, 'endDate', '<display:get name="prm.schedule.list.enddate.column" />', false, Ext.util.Format.dateRenderer('n/j/y'), null, null); 720 grid.addColumn(null, 'actualEndDate', '<display:get name="prm.schedule.list.actualenddate.column" />', true, Ext.util.Format.dateRenderer('n/j/y'), null, null); 721 grid.addColumn(null, 'workInHours', '<display:get name="prm.schedule.list.work.column" />', false, workRenderer, null, null); 722 grid.addColumn(null, 'durationInHours', '<display:get name="prm.schedule.list.duration.column" />', false, durationRenderer, null, null); 723 grid.addColumn(null, 'workComplete', '<display:get name="prm.schedule.list.workcomplete.column" />', true, null, null, null); 724 grid.addColumn(null, 'workPercentComplete', '<display:get name="prm.schedule.list.complete.column" />', false, formatPercentRenderer, null, null); 725 grid.addColumn(null, 'assignees', '<display:get name="prm.schedule.list.resources.column" />', true, null, null, null); 726 grid.addColumn(null, 'phase', '<display:get name="prm.schedule.list.phase.column" />', true, null, null, null); 727 grid.addColumn(null, 'priority', '<display:get name="prm.schedule.list.priority.column" />', true, null, null, null); 728 grid.addColumn(null, 'calculationType', '<display:get name="prm.schedule.list.calculationtype.column" />', true, null, null, null); 689 729 } 690 730 } trunk/core/web/src/indentedView.js
r17804 r17815 1 function Controller(){ 1 var that = null; 2 function TreeGrid(){ 3 var _columns = new Array(); // Contains the Grid's columns 4 var _colModel = null; 5 var _configurationReader = null; 6 var _dataStore = null; 7 var _treeGrid = null; 8 var _records = new Array(); 9 var _store = null; 10 var _selModel = null; 11 12 13 this.getTreeGrid = function(){ 14 if(null != _treeGrid){ 15 return _treeGrid; 16 } 17 } 18 19 this.setTreeGrid = function(treeGrid){ 20 _treeGrid = treeGrid; 21 } 22 23 this.getColumnModel = function(){ 24 if(null != _colModel){ 25 return _colModel; 26 } 27 } 28 29 this.setColumnModel = function(cm){ 30 _colModel = cm; 31 } 32 33 this.setSelectionModel = function(sm){ 34 _selModel = sm; 35 } 36 37 this.getSelectionModel = function(){ 38 if(null != _selModel){ 39 return _selModel; 40 } 41 } 42 43 this.getStore = function(){ 44 if(null != _store){ 45 return _store; 46 } 47 } 48 49 this.setStore = function(store){ 50 _store = store; 51 } 52 53 this.getDataStore = function(){ 54 if(null != _dataStore){ 55 return _dataStore; 56 } 57 }; 58 59 this.setDataStore = function(dataStore){ 60 _dataStore = dataStore; 61 }; 62 63 this.setConfigurationReader = function (id, record){ 64 _configurationReader = {}; 65 if(null != id){ 66 _configurationReader.id = id; 67 } 68 if(null != record){ 69 _configurationReader.record = record; 70 } 71 }; 72 73 this.getColumns = function(){ 74 return _columns; 75 }; 76 77 this.getConfigurationReader = function(){ 78 return _configurationReader; 79 }; 80 81 this.getRecords = function(){ 82 return _records; 83 }; 84 85 this.addColumn = function (id, dataIndex, header, hidden, renderer, width, editor){ 86 var column = {}; 87 if(null != id){ 88 column.id = id; 89 } 90 if(null != dataIndex){ 91 column.dataIndex = dataIndex; 92 } 93 if(null != header){ 94 column.header = header; 95 } 96 if(null != hidden){ 97 column.hidden = hidden; 98 } 99 if(null != renderer){ 100 column.renderer = renderer; 101 } 102 if(null != width){ 103 column.width = width; 104 } 105 106 107 // Check whether it is needed to set an editor for this column 108 if(null != editor){ 109 column.editor = editor; 110 } 111 _columns[_columns.length] = column; 112 }; 113 114 this.addRecord = function (dateFormat, mapping, name, type){ 115 var record = {}; 116 if(null != dateFormat){ 117 record.dateFormat = dateFormat; 118 } 119 if(null != mapping){ 120 record.mapping = mapping; 121 } 122 if(null != name){ 123 record.name = name; 124 } 125 if(null != type){ 126 record.type = type; 127 } 128 _records[_records.length] = record; 129 }; 130 131 this.addRowContextMenu = function(menuItems){ 132 if(null != menuItems && menuItems.length > 0){ 133 _treeGrid.addListener({ 134 'rowcontextmenu' : { 135 fn : function(treeGrid, rowIndex, event) { 136 event.stopEvent(); 137 var contextMenu = new Ext.menu.Menu({ 138 items: menuItems 139 }); 140 contextMenu.show(_treeGrid); 141 } 142 } 143 }); 144 _treeGrid.render(); 145 } 146 } 147 148 // "That" reference is needed to access the above functions from inside the Ext.onReady() 149 that = this; 150 2 151 } 3 Controller.prototype.init = function init(renderTo, dataStoreUrl){152 TreeGrid.prototype.init = function init(renderTo){ 4 153 5 154 // Create the data store … … 20 169 var store = new Ext.ux.maximgb.treegrid.NestedSetStore({ 21 170 autoLoad : true 22 ,reader: new Ext.data.JsonReader( {id: 'id'}, record)23 ,url: dataStoreUrl171 ,reader: new Ext.data.JsonReader(that.getConfigurationReader(), that.getRecords()) 172 ,url: that.getDataStore() 24 173 }); 25 174 … … 50 199 51 200 Ext.onReady(function(){ 52 201 53 202 // create the Grid 54 203 var grid = new Ext.ux.maximgb.treegrid.GridPanel({ 55 204 store: store, 56 205 master_column_id : 'name', 57 columns: [ 58 {id:'name', header: "Name", sortable: true, dataIndex: 'name'} 59 ,{header: "Work", sortable: true, renderer: workRenderer, dataIndex: 'workInHours'} 60 ], 206 columns: that.getColumns(), 61 207 renderTo:renderTo, 62 208 stripeRows: true,
