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

Public Member Functions

void setCustomer (Customer customer)
 
void setSelfSectors (boolean selfSectors)
 
- 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< ActivitySectorgetCollection ()
 
String convertToString (ActivitySector 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 ActivitySectorBox.java.

Member Function Documentation

◆ addChoice()

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

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

Definition at line 93 of file ActivitySectorBox.java.

93  {
94  for(ActivitySector asl : (selfSectors ? customer.getCustomerSectors() : customer.getActivitySectors())) {
95  if(asl.getName().equalsIgnoreCase(choice)) {
96  return;
97  }
98  }
99  ActivitySector as = (ActivitySector) new CrmPU().getSingleResultOrNull(
100  "select a from ActivitySector a where a.name = ?",
101  new Object[] { choice });
102  if(as == null) {
103  Messages.confirmAcceptation().add(choice).show(() -> {
104  ActivitySector nas = new ActivitySector();
105  nas.setName(choice);
106  nas = new CrmPU().saveObject(nas);
107  if(selfSectors) {
108  customer.getCustomerSectors().add(nas);
109  } else {
110  customer.getActivitySectors().add(nas);
111  }
112  if(command != null) command.execute(null);
113  });
114  } else {
115  if(selfSectors) {
116  customer.getCustomerSectors().add(as);
117  } else {
118  customer.getActivitySectors().add(as);
119  }
120  try {
121  if(command != null) command.execute(null);
122  } catch (Exception ex) {
123  Logger.getLogger(ActivitySectorBox.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
124  }
125  }
126  }
Set< ActivitySector > getActivitySectors()
Definition: Customer.java:46
Set< ActivitySector > getCustomerSectors()
Definition: Customer.java:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ changeChoice()

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

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

Definition at line 129 of file ActivitySectorBox.java.

129  {
130  addChoice(choice, new Command() {
131  @Override
132  public Object execute(Context context) {
133  deleteChoice(oldChoice, null);
134  if(command != null) command.execute(null);
135  return true;
136  }
137  });
138  }
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.ActivitySectorBox.checkDelete ( )
protected

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

Definition at line 68 of file ActivitySectorBox.java.

68  {
69  return true;
70  }

◆ checkEditable()

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

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

Definition at line 63 of file ActivitySectorBox.java.

63  {
64  return true;
65  }

◆ checkNew()

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

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

Definition at line 58 of file ActivitySectorBox.java.

58  {
59  return true;
60  }

◆ checkVisible()

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

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

Definition at line 53 of file ActivitySectorBox.java.

53  {
54  return true;
55  }

◆ convertToString()

String org.turro.crm.zul.sector.ActivitySectorBox.convertToString ( ActivitySector  label)
protected

Definition at line 83 of file ActivitySectorBox.java.

83  {
84  return label.getName();
85  }
Here is the call graph for this function:

◆ deleteChoice()

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

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

Definition at line 141 of file ActivitySectorBox.java.

141  {
142  Iterator<ActivitySector> it = (selfSectors ?
143  customer.getCustomerSectors().iterator() :
144  customer.getActivitySectors().iterator());
145  while(it.hasNext()) {
146  if(it.next().getName().equals(oldChoice)) {
147  it.remove();
148  if(command != null) try {
149  command.execute(null);
150  return;
151  } catch (Exception ex) {
152  Logger.getLogger(ActivitySectorBox.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
153  }
154  }
155  }
156  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCollection()

Collection<ActivitySector> org.turro.crm.zul.sector.ActivitySectorBox.getCollection ( )
protected

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

Definition at line 78 of file ActivitySectorBox.java.

78  {
79  return (selfSectors ? customer.getCustomerSectors() : customer.getActivitySectors());
80  }
Here is the call graph for this function:

◆ getLabelChoices()

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

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

Definition at line 88 of file ActivitySectorBox.java.

88  {
89  return new CrmPU().getResultList("select distinct a.name from ActivitySector a");
90  }

◆ getNewImage()

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

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

Definition at line 73 of file ActivitySectorBox.java.

73  {
74  return Images.getImage("sector_new");
75  }
Here is the call graph for this function:

◆ setCustomer()

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

Definition at line 44 of file ActivitySectorBox.java.

44  {
45  this.customer = customer;
46  }

◆ setSelfSectors()

void org.turro.crm.zul.sector.ActivitySectorBox.setSelfSectors ( boolean  selfSectors)

Definition at line 48 of file ActivitySectorBox.java.

48  {
49  this.selfSectors = selfSectors;
50  }

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