BrightSide Workbench Full Report + Source Code
FinancialsUserMenu.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2019 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Affero General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Affero General Public License for more details.
14
*
15
* You should have received a copy of the GNU Affero General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
package
org.turro.financials.user.menu;
20
21
import
org.turro.action.UserSummaries;
22
import
org.turro.elephant.context.Application;
23
import
org.turro.elephant.user.menu.DefaultUserMenu;
24
import
org.turro.elephant.user.menu.UserMenu;
25
30
@
UserMenu
31
public
class
FinancialsUserMenu
extends
DefaultUserMenu
{
32
33
public
FinancialsUserMenu
() {
34
super(
"Billing"
,
null
,
null
, 3);
35
}
36
37
@Override
38
public
void
initMenu
() {
39
addChild
(
new
DefaultUserMenu
(
"Contracts"
,
null
,
"/user/contracts"
) {
40
@Override
41
public
boolean
isInRole
() {
42
return
UserSummaries
.
isNotZero
(
"contractCount"
);
43
}
44
@Override
45
public
Object
getDetail
() {
46
return
UserSummaries
.
getAttribute
(
"contractCount"
);
47
}
48
});
49
addChild
(
new
DefaultUserMenu
(
"Documents"
,
null
,
"/user/documents"
) {
50
@Override
51
public
boolean
isInRole
() {
52
return
UserSummaries
.
isNotZero
(
"contractCount"
);
53
}
54
@Override
55
public
Object
getDetail
() {
56
return
null
;
57
}
58
});
59
addChild
(
new
DefaultUserMenu
(
"Logistic"
,
null
,
"/user/logistic"
) {
60
@Override
61
public
boolean
isInRole
() {
62
return
UserSummaries
.
isNotZero
(
"notPreparedCount"
) ||
63
UserSummaries
.
isNotZero
(
"notDeliveredCount"
);
64
}
65
@Override
66
public
Object
getDetail
() {
67
return
((Long)
UserSummaries
.
getAttribute
(
"notPreparedCount"
, 0)) +
68
((Long)
UserSummaries
.
getAttribute
(
"notDeliveredCount"
, 0));
69
}
70
});
71
}
72
73
@Override
74
public
boolean
isInRole
() {
75
return
!
Application
.
getApplication
().
getConstructor
().
isOutsider
() && (
76
UserSummaries
.
isNotZero
(
"contractCount"
) ||
77
UserSummaries
.
isNotZero
(
"notPreparedCount"
) ||
78
UserSummaries
.
isNotZero
(
"notDeliveredCount"
));
79
}
80
81
@Override
82
public
Object
getDetail
() {
83
return
null
;
84
}
85
86
}
org.turro.action.UserSummaries
Definition:
UserSummaries.java:35
org.turro.action.UserSummaries.isNotZero
static boolean isNotZero(String attribute)
Definition:
UserSummaries.java:62
org.turro.action.UserSummaries.getAttribute
static Object getAttribute(String attribute)
Definition:
UserSummaries.java:78
org.turro.elephant.context.Application
Definition:
Application.java:49
org.turro.elephant.context.Application.getConstructor
IConstructor getConstructor()
Definition:
Application.java:206
org.turro.elephant.context.Application.getApplication
static Application getApplication()
Definition:
Application.java:71
org.turro.elephant.user.menu.DefaultUserMenu
Definition:
DefaultUserMenu.java:33
org.turro.elephant.user.menu.DefaultUserMenu.addChild
IUserMenu addChild(IUserMenu menu)
Definition:
DefaultUserMenu.java:139
org.turro.elephant.user.menu.DefaultUserMenu.DefaultUserMenu
DefaultUserMenu(String label, String image)
Definition:
DefaultUserMenu.java:41
org.turro.financials.user.menu.FinancialsUserMenu
Definition:
FinancialsUserMenu.java:31
org.turro.financials.user.menu.FinancialsUserMenu.getDetail
Object getDetail()
Definition:
FinancialsUserMenu.java:82
org.turro.financials.user.menu.FinancialsUserMenu.isInRole
boolean isInRole()
Definition:
FinancialsUserMenu.java:74
org.turro.financials.user.menu.FinancialsUserMenu.FinancialsUserMenu
FinancialsUserMenu()
Definition:
FinancialsUserMenu.java:33
org.turro.financials.user.menu.FinancialsUserMenu.initMenu
void initMenu()
Definition:
FinancialsUserMenu.java:38
org.turro.elephant.context.IConstructor.isOutsider
boolean isOutsider()
org.turro.elephant.user.menu.UserMenu
Definition:
UserMenu.java:32
TurroProjects
Public
BrightSide
bsfinancials-core
src
main
java
org
turro
financials
user
menu
FinancialsUserMenu.java
Generated on Tue Mar 12 2024 07:01:19 for BrightSide by
1.9.1