BrightSide Workbench Full Report + Source Code
org.turro.crm.zul.sector.TechnologyBox Class Reference
Inheritance diagram for org.turro.crm.zul.sector.TechnologyBox:
Collaboration diagram for org.turro.crm.zul.sector.TechnologyBox:

Public Member Functions

void setCustomer (Customer customer)
 
- Public Member Functions inherited from org.turro.zkoss.input.MultiLabelBox< E >
 MultiLabelBox ()
 
getEntity ()
 
void setEntity (E entity)
 
boolean isReadOnly ()
 
void setReadOnly (boolean readOnly)
 
void afterCompose ()
 
void onEvent (Event event) throws Exception
 

Protected Member Functions

boolean checkVisible ()
 
boolean checkNew ()
 
boolean checkEditable ()
 
boolean checkDelete ()
 
String getNewImage ()
 
Collection< TechnologygetCollection ()
 
String convertToString (Technology label)
 
Collection< String > getLabelChoices ()
 
void addChoice (final String choice, final Command command)
 
void changeChoice (final String oldChoice, String choice, final Command command)
 
void deleteChoice (String oldChoice, Command command)
 
- Protected Member Functions inherited from org.turro.zkoss.input.MultiLabelBox< E >
abstract String convertToString (E label)
 

Detailed Description

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

Definition at line 39 of file TechnologyBox.java.

Member Function Documentation

◆ addChoice()

void org.turro.crm.zul.sector.TechnologyBox.addChoice ( final String  choice,
final Command  command 
)
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 88 of file TechnologyBox.java.

88  {
89  for(Technology asl : customer.getTechnologies()) {
90  if(asl.getName().equalsIgnoreCase(choice)) {
91  return;
92  }
93  }
94  Technology as = (Technology) new CrmPU().getSingleResultOrNull(
95  "select a from Technology a where a.name = ?",
96  new Object[] { choice });
97  if(as == null) {
98  Messages.confirmAcceptation().add(choice).show(() -> {
99  Technology nas = new Technology();
100  nas.setName(choice);
101  nas = new CrmPU().saveObject(nas);
102  customer.getTechnologies().add(nas);
103  if(command != null) command.execute(null);
104  });
105  } else {
106  customer.getTechnologies().add(as);
107  if(command != null) try {
108  command.execute(null);
109  } catch (Exception ex) {
110  Logger.getLogger(TechnologyBox.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
111  }
112  }
113  }
Set< Technology > getTechnologies()
Definition: Customer.java:104
Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeChoice()

void org.turro.crm.zul.sector.TechnologyBox.changeChoice ( final String  oldChoice,
String  choice,
final Command  command 
)
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 116 of file TechnologyBox.java.

116  {
117  addChoice(choice, new Command() {
118  @Override
119  public Object execute(Context context) {
120  deleteChoice(oldChoice, null);
121  if(command != null) command.execute(null);
122  return true;
123  }
124  });
125  }
void deleteChoice(String oldChoice, Command command)
void addChoice(final String choice, final Command command)
Here is the call graph for this function:

◆ checkDelete()

boolean org.turro.crm.zul.sector.TechnologyBox.checkDelete ( )
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 63 of file TechnologyBox.java.

63  {
64  return true;
65  }

◆ checkEditable()

boolean org.turro.crm.zul.sector.TechnologyBox.checkEditable ( )
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 58 of file TechnologyBox.java.

58  {
59  return true;
60  }

◆ checkNew()

boolean org.turro.crm.zul.sector.TechnologyBox.checkNew ( )
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 53 of file TechnologyBox.java.

53  {
54  return true;
55  }

◆ checkVisible()

boolean org.turro.crm.zul.sector.TechnologyBox.checkVisible ( )
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 48 of file TechnologyBox.java.

48  {
49  return true;
50  }

◆ convertToString()

String org.turro.crm.zul.sector.TechnologyBox.convertToString ( Technology  label)
protected

Definition at line 78 of file TechnologyBox.java.

78  {
79  return label.getName();
80  }
Here is the call graph for this function:

◆ deleteChoice()

void org.turro.crm.zul.sector.TechnologyBox.deleteChoice ( String  oldChoice,
Command  command 
)
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 128 of file TechnologyBox.java.

128  {
129  Iterator<Technology> it = customer.getTechnologies().iterator();
130  while(it.hasNext()) {
131  if(it.next().getName().equals(oldChoice)) {
132  it.remove();
133  if(command != null) try {
134  command.execute(null);
135  } catch (Exception ex) {
136  Logger.getLogger(TechnologyBox.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
137  }
138  }
139  }
140  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCollection()

Collection<Technology> org.turro.crm.zul.sector.TechnologyBox.getCollection ( )
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 73 of file TechnologyBox.java.

73  {
74  return customer.getTechnologies();
75  }
Here is the call graph for this function:

◆ getLabelChoices()

Collection<String> org.turro.crm.zul.sector.TechnologyBox.getLabelChoices ( )
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 83 of file TechnologyBox.java.

83  {
84  return new CrmPU().getResultList("select distinct a.name from Technology a");
85  }

◆ getNewImage()

String org.turro.crm.zul.sector.TechnologyBox.getNewImage ( )
protected

Reimplemented from org.turro.zkoss.input.MultiLabelBox< E >.

Definition at line 68 of file TechnologyBox.java.

68  {
69  return Images.getImage("technology_new");
70  }
Here is the call graph for this function:

◆ setCustomer()

void org.turro.crm.zul.sector.TechnologyBox.setCustomer ( Customer  customer)

Definition at line 43 of file TechnologyBox.java.

43  {
44  this.customer = customer;
45  }

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