Changeset 17815

Show
Ignore:
Timestamp:
08/01/08 13:27:10 (1 month ago)
Author:
carlos
Message:

Added reamining columns to the Indented Beta view.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/core/src/net/project/schedule/Schedule.java

    r17804 r17815  
    11321132        columns.add("sequence"); 
    11331133        columns.add("name"); 
     1134        columns.add("description"); 
    11341135        columns.add("work"); 
    11351136        columns.add("workUnits"); 
    11361137        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"); 
    11371151         
    11381152        final NodeFactory factory = new NodeFactory(columns); 
     
    11401154        Node root = factory.nextNode(); 
    11411155        root.setTitle(this.name); 
     1156        root.set("name", this.name); 
    11421157        root.set("id", this.id); 
    11431158         
  • trunk/core/src/net/project/schedule/ScheduleEntry.java

    r17804 r17815  
    15381538    public void addToNode(final NodeFactory factory, final Node root){ 
    15391539        final Node newNode = factory.nextNode(); 
     1540        DateFormat df = SessionManager.getUser().getDateFormatter(); 
     1541         
     1542        //Add all the property values 
    15401543        newNode.setTitle(this.name); 
    15411544        newNode.set("id", this.id); 
    15421545        newNode.set("sequence", this.sequenceNumber); 
    15431546        newNode.set("name", XMLUtils.escape(this.getNameMaxLength40())); 
     1547        newNode.set("description", XMLUtils.escape(this.description)); 
    15441548        newNode.set("work", XMLUtils.escape(this.getWork())); 
    15451549        newNode.set("workUnits", XMLUtils.escape(getWorkUnitsString())); 
    15461550        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        
    15481571        // Determine whether this newNode will be added to received root 
    15491572        if(StringUtils.isNumeric(this.parentTaskID)){ 
  • trunk/core/web/jsp/schedule/Main.jsp

    r17804 r17815  
    270270    } 
    271271     
    272     setRecordDefinition(flatView); 
     272    setGridRecordDefinition(flatView); 
    273273    flatView.setConfigurationReader('id', '*:has(id)'); 
    274274    flatView.setDataStore(JSPRootURL + '/schedule/include/storeFlatListProvider.jsp?module=' + scheduleModule); 
     
    281281 
    282282function 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 
     291function setTreeGridRecordDefinition(grid){ 
    289292    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 
     303function setGridRecordDefinition(grid){ 
     304    if(null != grid){ 
     305        setBaseRecordDefinition(grid); 
     306        grid.addRecord(null, 'idlist', 'idlist', null); 
     307    } 
     308} 
     309 
     310function setBaseRecordDefinition(grid){ 
     311   if(null != grid){ 
    290312        grid.addRecord(null, 'sequence', 'sequence', 'int'); 
    291313        grid.addRecord(null, 'name', 'name', null); 
     
    305327        grid.addRecord(null, 'workComplete', 'workCompleteString', null); 
    306328        grid.addRecord(null, 'assigneeString', 'assignees', null); 
    307         grid.addRecord(null, 'phase_name', 'phase', null); 
     329        grid.addRecord(null, 'phaseName', 'phase', null); 
    308330        grid.addRecord(null, 'priorityString', 'priority', null); 
    309         grid.addRecord(null, 'idlist', 'idlist', null); 
    310331    } 
    311332} 
     
    687708        grid.addColumn('priority', '<display:get name="prm.schedule.list.priority.column" />', true, null, null, null); 
    688709        grid.addColumn('calculationType', '<display:get name="prm.schedule.list.calculationtype.column" />', true, null, null, null); 
     710    } 
     711} 
     712 
     713function 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); 
    689729    } 
    690730} 
  • trunk/core/web/src/indentedView.js

    r17804 r17815  
    1 function Controller(){ 
     1var that = null; 
     2function 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     
    2151} 
    3 Controller.prototype.init = function init(renderTo, dataStoreUrl){ 
     152TreeGrid.prototype.init = function init(renderTo){ 
    4153       
    5154    // Create the data store 
     
    20169    var store = new Ext.ux.maximgb.treegrid.NestedSetStore({ 
    21170            autoLoad : true 
    22             ,reader: new Ext.data.JsonReader({id: 'id'}, record
    23             ,url: dataStoreUrl 
     171            ,reader: new Ext.data.JsonReader(that.getConfigurationReader(), that.getRecords()
     172            ,url: that.getDataStore() 
    24173    }); 
    25174         
     
    50199         
    51200    Ext.onReady(function(){ 
    52              
     201 
    53202        // create the Grid 
    54203        var grid = new Ext.ux.maximgb.treegrid.GridPanel({ 
    55204              store: store, 
    56205              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(), 
    61207              renderTo:renderTo, 
    62208              stripeRows: true,