BrightSide Workbench Full Report + Source Code
ParticipationControl.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2021 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.participation;
20 
21 import org.turro.string.Strings;
22 import org.turro.action.IEntityHolder;
23 import org.turro.entities.Entities;
24 import org.turro.entities.IElephantEntity;
25 import org.zkoss.zk.ui.Executions;
26 import org.zkoss.zk.ui.IdSpace;
27 import org.zkoss.zk.ui.ext.AfterCompose;
28 import org.zkoss.zk.ui.select.Selectors;
29 import org.zkoss.zk.ui.select.annotation.Wire;
30 import org.zkoss.zul.Panel;
31 
36 public class ParticipationControl extends Panel implements IEntityHolder, IdSpace, AfterCompose {
37 
38  private String label, entityPath;
39 
40  @Wire("#participationGrid")
41  private ParticipationGrid participationGrid;
42 
44  Executions.createComponents("/WEB-INF/_zul/bs/comps/participation/participationControl.zul", this, null);
45  Selectors.wireComponents(this, this, false);
46  Selectors.wireEventListeners(this, this);
47  }
48 
49  public String getLabel() {
50  return label;
51  }
52 
53  public void setLabel(String label) {
54  this.label = label;
55  }
56 
57  public String getEntityPath() {
58  return entityPath;
59  }
60 
61  public void setEntityPath(String entityPath) {
62  this.entityPath = entityPath;
63  }
64 
65  @Override
66  public void setEntity(Object entity) {
68  entityPath = iee.getPath();
69  if(!Strings.isBlank(entityPath)) {
70  label = iee.getName();
71  }
72  }
73 
74  @Override
75  public void refreshControls() {
76  afterCompose();
77  }
78 
79  @Override
80  public void afterCompose() {
81  participationGrid.setEntityPath(entityPath);
82  participationGrid.reload();
83  }
84 
85 }
static IElephantEntity getController(String path)
Definition: Entities.java:78