Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Brockmann2015-06-05 05:11:34 -0400
committerStefan Brockmann2015-06-05 05:11:34 -0400
commitdddd14260c3d24204d6b8c3636aa103af2654dfd (patch)
tree247d58e2d32563c5e2aa92d2db80e80034958a9a
parent0eae432ede42267d14a6a8d22d2f2384e4b1ae02 (diff)
downloadorg.eclipse.openk-platform.openk-repo-dddd14260c3d24204d6b8c3636aa103af2654dfd.tar.gz
org.eclipse.openk-platform.openk-repo-dddd14260c3d24204d6b8c3636aa103af2654dfd.tar.xz
org.eclipse.openk-platform.openk-repo-dddd14260c3d24204d6b8c3636aa103af2654dfd.zip
Adding Grid Tree
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ActivityRestController.java2
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubGeographicalRegionRestController.java5
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/util/JpaUtils.java1
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/webapp/i18n/locale-de.json1
-rw-r--r--openk-platform/openk-eisman-portlet/src/main/webapp/js/app.js82
5 files changed, 73 insertions, 18 deletions
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ActivityRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ActivityRestController.java
index f79bdfd8..264cc129 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ActivityRestController.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/ActivityRestController.java
@@ -49,7 +49,7 @@ public class ActivityRestController {
public static final String ACTIVITY_FIELD_REASON_REDUCTION = "reasonOfReduction";
public static final String ACTIVITY_FIELD_POWER_TO_BE_REDUCED = "powerToBeReduced";
public static final String ACTIVITY_FIELD_SUBSTATIONS = "substationList";
- public final static String SUBSTATION_FIELD_NAME = "name";
+ public static final String SUBSTATION_FIELD_NAME = "name";
@Autowired
private ActivityRepository activityRepository;
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubGeographicalRegionRestController.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubGeographicalRegionRestController.java
index f948d49d..ff0c4e34 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubGeographicalRegionRestController.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/rest/SubGeographicalRegionRestController.java
@@ -41,4 +41,9 @@ public class SubGeographicalRegionRestController {
return subGeographicalRegionRestConsumer.getSubGeographicalRegion();
}
+ @JsonView(IncludeAttribute4Json.SubGeographicalRegion.class)
+ public List<Object> getRegionTree() {
+ return null;
+ }
+
}
diff --git a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/util/JpaUtils.java b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/util/JpaUtils.java
index df301998..2254a07a 100644
--- a/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/util/JpaUtils.java
+++ b/openk-platform/openk-eisman-portlet/src/main/java/org/eclipse/openk/eisman/controller/util/JpaUtils.java
@@ -21,7 +21,6 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.Expression;
-import javax.persistence.criteria.Path;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Locale;
diff --git a/openk-platform/openk-eisman-portlet/src/main/webapp/i18n/locale-de.json b/openk-platform/openk-eisman-portlet/src/main/webapp/i18n/locale-de.json
index 619f36c7..d713b8a2 100644
--- a/openk-platform/openk-eisman-portlet/src/main/webapp/i18n/locale-de.json
+++ b/openk-platform/openk-eisman-portlet/src/main/webapp/i18n/locale-de.json
@@ -20,6 +20,7 @@
"GRID.PRACTISE" : "Übung",
"GRID.ID" : "ID",
"GRID.SUBSTATIONLIST" : "Speisepunkte",
+ "GRID.EDIT" : "Bearbeiten",
"CREATE.REGULATIONTAB" : "Abregelung",
"CREATE.STATIONLIST" : "Netzzustand",
"WORKFLOW.SETTINGS" : "Voreinstellungen",
diff --git a/openk-platform/openk-eisman-portlet/src/main/webapp/js/app.js b/openk-platform/openk-eisman-portlet/src/main/webapp/js/app.js
index db684ae2..e4c5bf09 100644
--- a/openk-platform/openk-eisman-portlet/src/main/webapp/js/app.js
+++ b/openk-platform/openk-eisman-portlet/src/main/webapp/js/app.js
@@ -254,6 +254,36 @@ app.filter('booleanFilter', ['$filter', function ($filter) {
};
}]);
+app.filter('editFilter', ['$filter', function ($filter) {
+ return function (value) {
+
+ var val = $filter('translate')('NO');
+
+ if(value){
+ var val = $filter('translate')('YES');
+ }
+ return val;
+ };
+}]);
+
+app.filter('showFilter', ['dateService', function (dateService) {
+
+ function addZero(digit){
+ return (digit < 10) ? ('0' + digit) :'' + digit;
+ }
+
+ return function (value) {
+
+ var now = new Date();
+ var then = new Date(value.dateStarted);
+
+ var time = addZero(now.getDate()) + '.' + addZero(now.getMonth() + 1) + '.' + now.getFullYear() + ' ' + addZero(now.getHours()) + ':' + addZero(now.getMinutes()) + ':' + addZero(now.getSeconds());
+ var thenTime = addZero(then.getDate()) + '.' + addZero(then.getMonth() + 1) + '.' + then.getFullYear() + ' ' + addZero(then.getHours()) + ':' + addZero(then.getMinutes()) + ':' + addZero(then.getSeconds());
+
+ return dateService.isDateBehind(time, thenTime)? '' : 'display:none;';
+ };
+}]);
+
/*
----------------------------------------------------------------------
*/
@@ -417,11 +447,15 @@ app.controller('DetailController', ['$scope', '$log', '$timeout','$http', '$loca
window.location.search = '?page=create&activityId=' + $scope.avticityId;
}
+ $scope.navigateToCreateWithProposal = function(){
+ window.location.search = '?page=create&activityId=' + $scope.avticityId;
+ }
+
$scope.avticityId = $scope.getParam('activityId');
$scope.detailHTML = '';
- $scope.linkToDetailsTemplate = '<a class="btn btn-primary btn-sm" ng-click="grid.appScope.navigateToDetails(row.entity)" >Details</a>';
+ $scope.editTemplate= '<a class="btn btn-primary btn-sm" style="{{row.entity | showFilter}}" ng-click="grid.appScope.navigateToCreateWithProposal(row.entity)" >Details</a>';
$scope.feederStationTemplate = '<div><span custom-popover popover-placement="bottom" popover-label="{{row.entity.substationList}}"></span></div>';
$scope.detailTemplate = '<div class="col-xs-12 col-sm-6 col-lg-3"><div class="panel panel-default"><div class="panel-heading">'
@@ -461,7 +495,8 @@ app.controller('DetailController', ['$scope', '$log', '$timeout','$http', '$loca
{ name:'reasonOfReduction', headerCellFilter: 'translate', headerCellFilter: 'translate', displayName: 'GRID.REASONOFREDUCTION'},
{ name:'substationList', headerCellFilter: 'translate', displayName:'GRID.SUBSTATIONLIST',
cellTemplate: $scope.feederStationTemplate},
- { name:'practice', headerCellFilter: 'translate', displayName:'GRID.PRACTISE', enableFiltering:false, cellFilter:'booleanFilter'}
+ { name:'practice', headerCellFilter: 'translate', displayName:'GRID.PRACTISE', enableFiltering:false, cellFilter:'booleanFilter'},
+ { name:'edit', headerCellFilter: 'translate', displayName:'GRID.EDIT', enableFiltering:false, cellTemplate: $scope.editTemplate, cellFilter:'editFilter'}
],
onRegisterApi: function( gridApi ) {
$scope.gridApi = gridApi;
@@ -582,7 +617,7 @@ app.controller('DetailController', ['$scope', '$log', '$timeout','$http', '$loca
};
$scope.getDetailEntry = function(head, content){
- return $scope.detailTemplate.replace('{head}', "{{ '" + head + "' | translate }}").replace('{content}', content);
+ return $scope.detailTemplate.replace('{head}', $translate.instant(head)).replace('{content}', content);
};
// Methode zum Laden der serverseitigen Daten
@@ -903,31 +938,46 @@ app.controller('CreateController', ['$scope', '$rootScope', '$http', '$modal', f
}]);
-app.controller('NetworkStateController', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) {
+app.controller('NetworkStateController', ['$scope', '$http', '$timeout', '$translate', function ($scope, $http, $timeout, $translate) {
$scope.treeColumns = [ {
- field: "net",
- displayName: '',
- cellTemplate: "{{ 'STATE.NETWORK' | translate}}"
+ field: "Name",
+ displayName: $translate.instant('STATE.NET')
}, {
- field: "pv",
- displayName: '',
- cellTemplate: "{{ 'STATE.PV' | translate}}"
+ field: "Area",
+ displayName: $translate.instant('STATE.PV')
},{
field: "bio",
- displayName: '',
- cellTemplate: "{{ 'STATE.BIO' | translate}}"
+ displayName: $translate.instant('STATE.BIO')
},{
field: "wind",
- displayName: '',
- cellTemplate: "{{ 'STATE.WIND' | translate}}"
+ displayName: $translate.instant('STATE.WIND')
},{
field: "sum",
- displayName: '',
- cellTemplate: "{{ 'STATE.SUM' | translate}}"
+ displayName: $translate.instant('STATE.SUM')
}];
$scope.treeData = [];
+ $scope.treeData = [
+ {Name:"USA",Area:9826675,Population:318212000,TimeZone:"UTC -5 to -10",
+ children:[
+ {Name:"California", Area:423970,
+ children:[
+ {Name:"San Francisco", Area:231},
+ {Name:"Los Angeles", Area:503}
+ ]
+ },
+ {Name:"Illinois", Area:57914,
+ children:[
+ {Name:"Chicago", Area:234}
+ ]
+ }
+ ]
+ },
+ {Name:"Texas",Area:268581}
+ ];
+
+
}]);
app.controller('PreselectionModalController', function ($scope, $rootScope, $modalInstance, $http, items) {

Back to the top