BrightSide Workbench Full Report + Source Code
org.turro.erp.time.TaskSelector Class Reference
Inheritance diagram for org.turro.erp.time.TaskSelector:
Collaboration diagram for org.turro.erp.time.TaskSelector:

Public Member Functions

void setHumanResource (HumanResource humanResource)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 44 of file TaskSelector.java.

Member Function Documentation

◆ setHumanResource()

void org.turro.erp.time.TaskSelector.setHumanResource ( HumanResource  humanResource)

Definition at line 46 of file TaskSelector.java.

46  {
47  boolean canGetIn = true;
48 
49  Rows rows = getRows();
50  if(rows != null) {
51  rows.getChildren().clear();
52  } else {
53  rows = new Rows();
54  appendChild(rows);
55  }
56 
57  TimeControlUtil tcu = new TimeControlUtil();
58  tcu.setHumanResource(humanResource);
59  List<TimeControl> pending = tcu.getPendingControl();
60 
61  for(TimeControl tc : pending) {
62  final Row row = new Row();
63  row.setValue(tc);
64  rows.appendChild(row);
65 
66  row.appendChild(new LabelExtended().setDateTime(tc.getStartTime()));
67 
68  if(tc.getTask() != null) {
69  row.appendChild(new Label(tc.getTask().getFullDescription()));
70  } else {
71  row.appendChild(new Space());
72  canGetIn = false;
73  }
74 
75  Button select = new Button(tc.getTask() == null ? Application.getString("lGetOut") : Application.getString("lFinalize") + " " +Application.getString("lTask"));
76  select.setHflex("true");
77  select.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
78  @Override
79  public void onEvent(Event event) throws Exception {
80  Events.postEvent(new Event(Events.ON_CHANGE, TaskSelector.this, row.getValue()));
81  }
82  });
83  row.appendChild(select);
84  }
85 
86  if(canGetIn) {
87  final Row rowStart = new Row();
88  rows.appendChild(rowStart);
89 
90  rowStart.appendChild(new Label(Application.getString("lNow")));
91 
92  rowStart.appendChild(new Space());
93 
94  Button butStart = new Button(Application.getString("lGetIn"));
95  butStart.setHflex("true");
96  butStart.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
97  @Override
98  public void onEvent(Event event) throws Exception {
99  Events.postEvent(new Event(Events.ON_USER, TaskSelector.this, null));
100  }
101  });
102  rowStart.appendChild(butStart);
103  }
104 
105  final Row rowCancel = new Row();
106  rows.appendChild(rowCancel);
107 
108  rowCancel.appendChild(new Space());
109  rowCancel.appendChild(new Space());
110 
111  Button butCancel = new Button(Application.getString("lCancel"));
112  butCancel.setHflex("true");
113  butCancel.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
114  @Override
115  public void onEvent(Event event) throws Exception {
116  Events.postEvent(new Event(Events.ON_CANCEL, TaskSelector.this));
117  }
118  });
119  rowCancel.appendChild(butCancel);
120 
121  WorkloadSet wls = new WorkloadSet(humanResource, true);
122 
123  for(Workload wl : wls) {
124  final Row row = new Row();
125  row.setValue(wl);
126  rows.appendChild(row);
127 
128  row.appendChild(new Label(Application.getString("lNow")));
129 
130  Vlayout vbox = new Vlayout();
131  row.appendChild(vbox);
132  vbox.appendChild(new Label(wl.getTask().getName()));
133  vbox.appendChild(LabelTypes.getSoftLabel(wl.getTask().getDescription()));
134  vbox.appendChild(new Label(wl.getTask().getOrderReference().getWorkOrder().getFullDescription()));
135  vbox.appendChild(new Label(wl.getTask().getOrderReference().getWorkOrder().getContract().getName()));
136 
137  Button select = new Button(Application.getString("lStart") + " " +Application.getString("lTask"));
138  select.setHflex("true");
139  select.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
140  @Override
141  public void onEvent(Event event) throws Exception {
142  Events.postEvent(new Event(Events.ON_CHANGE, TaskSelector.this, row.getValue()));
143  }
144  });
145  row.appendChild(select);
146  }
147  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: