BrightSide Workbench Full Report + Source Code
org.turro.polls.PollControl Class Reference
Inheritance diagram for org.turro.polls.PollControl:
Collaboration diagram for org.turro.polls.PollControl:

Public Member Functions

void onSelectPoll ()
 
void onTitleChange (InputEvent event)
 
void onLocationChange (InputEvent event)
 
void onDeadlineChange ()
 
void onMaxPerOptionChange (InputEvent event)
 
void onMaxVotedOptionsChange (InputEvent event)
 
void onTypeSelect ()
 
void onCheckParticipants ()
 
void onCheckVotes ()
 
void onCheckInsertions ()
 
void onCheckNegatives ()
 
void onWikiChange (InputEvent event)
 
void onCreatePoll ()
 
void onSave ()
 
void onDelete ()
 
void onSendTest ()
 
void onSend ()
 
void setPoll (Poll poll)
 
 PollControl ()
 
String getEntityPath ()
 
void setEntityPath (String entityPath)
 
Object getEntity ()
 
void setEntity (Object entity)
 
void afterCompose ()
 

Static Public Member Functions

static HtmlBasedComponent getEditor (String optionClass, boolean readonly, Object value)
 
static String getFormattedString (String optionClass, Object value)
 
static Object getEditorValue (HtmlBasedComponent hbc)
 

Protected Member Functions

void doSend (AssistantSet participants)
 

Protected Attributes

String entityPath
 
Object entity
 

Detailed Description

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

Definition at line 79 of file PollControl.java.

Constructor & Destructor Documentation

◆ PollControl()

org.turro.polls.PollControl.PollControl ( )

Definition at line 332 of file PollControl.java.

332  {
333  Executions.createComponents("/WEB-INF/_zul/bs/comps/poll/pollControl.zul", this, null);
334  Selectors.wireComponents(this, this, false);
335  Selectors.wireEventListeners(this, this);
336  }

Member Function Documentation

◆ afterCompose()

void org.turro.polls.PollControl.afterCompose ( )

Definition at line 361 of file PollControl.java.

Here is the call graph for this function:

◆ doSend()

void org.turro.polls.PollControl.doSend ( AssistantSet  participants)
protected

Definition at line 368 of file PollControl.java.

368  {
369  IConstructor constructor = Application.getApplication().getConstructor();
370  MailMessagePool pool = MailProviders.instance().getGeneric(constructor);
371  if(pool != null) {
372  for(Assistant assistant : participants) {
373  try {
374  MailMessageTemplate mmt = MailMessageTemplate.of(pool.getProvider());
375  mmt.setSubject(I_.get("Poll") + ": " + poll.getTitle() + " - " + ElephantContext.getSiteName());
376  mmt.addTo(assistant.email, assistant.name);
377  ElephantMarker em = new ElephantMarker(constructor, true);
378  em.put("poll", poll);
379  em.put("contact", assistant.contact);
380  em.put("email", assistant.email);
381  em.put("notifier", this);
382  em.put("iee", Entities.getController(entity));
383  em.put("template", PollIterator.getOptionTemplate(poll));
384  mmt.setRoot("/poll");
385  mmt.setMessage(em, "poll", assistant.contact);
386  pool.addToPool(mmt);
387  pool.sendPool();
388  } catch (EmailException ex) {
389  Logger.getLogger(PollControl.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
390  }
391  }
392  }
393  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEditor()

static HtmlBasedComponent org.turro.polls.PollControl.getEditor ( String  optionClass,
boolean  readonly,
Object  value 
)
static

Definition at line 418 of file PollControl.java.

418  {
419  if(OptionDataType.OPTION_DATETIME.getType().equals(optionClass)) {
420  DateboxShort db = new DateboxShort((Date) OptionDataType.OPTION_DATETIME.getValue((String) value));
421  db.setWithTime(true);
422  db.setReadonly(readonly);
423  return db;
424  } else if(OptionDataType.OPTION_DATE.getType().equals(optionClass)) {
425  DateboxShort db = new DateboxShort((Date) OptionDataType.OPTION_DATE.getValue((String) value));
426  db.setWithTime(false);
427  db.setReadonly(readonly);
428  return db;
429  } else if(OptionDataType.OPTION_TIME.getType().equals(optionClass)) {
430  Timebox db = new Timebox((Date) OptionDataType.OPTION_TIME.getValue((String) value));
431  db.setReadonly(readonly);
432  return db;
433  } else if(OptionDataType.OPTION_LONG.getType().equals(optionClass)) {
434  Longbox db = new Longbox((Long) OptionDataType.OPTION_LONG.getValue((String) value));
435  db.setReadonly(readonly);
436  return db;
437  } else {
438  Textbox tb = new Textbox((String) value);
439  tb.setReadonly(readonly);
440  tb.setMaxlength(255);
441  return tb;
442  }
443  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEditorValue()

static Object org.turro.polls.PollControl.getEditorValue ( HtmlBasedComponent  hbc)
static

Definition at line 449 of file PollControl.java.

449  {
450  if(hbc instanceof Checkbox) {
451  return ((Checkbox) hbc).isChecked();
452  } else if(hbc instanceof Percentbox) {
453  return ((Percentbox) hbc).getValue();
454  } else if(hbc instanceof Longbox) {
455  return ((Longbox) hbc).getValue();
456  } else if(hbc instanceof Datebox) {
457  return ((Datebox) hbc).getValue();
458  } else if(hbc instanceof Timebox) {
459  return ((Timebox) hbc).getValue();
460  } else if(hbc instanceof KnowsID) {
461  return ((KnowsID) hbc).getObjectId();
462  } else if(hbc instanceof GenericListbox) {
463  return ((GenericListbox) hbc).getObjectValue();
464  } else if(hbc instanceof GenericCombobox) {
465  return ((GenericCombobox) hbc).getObjectValue();
466  } else if(hbc instanceof GenericBandbox) {
467  return ((GenericBandbox) hbc).getObjectValue();
468  } else if(hbc instanceof Listbox) {
469  return ((Listbox) hbc).getSelectedItem().getValue();
470  } else {
471  return ((Textbox) hbc).getValue();
472  }
473  }

◆ getEntity()

Object org.turro.polls.PollControl.getEntity ( )

Definition at line 349 of file PollControl.java.

349  {
350  return entity;
351  }

◆ getEntityPath()

String org.turro.polls.PollControl.getEntityPath ( )

Definition at line 341 of file PollControl.java.

341  {
342  return entityPath;
343  }

◆ getFormattedString()

static String org.turro.polls.PollControl.getFormattedString ( String  optionClass,
Object  value 
)
static

Definition at line 445 of file PollControl.java.

445  {
446  return OptionDataType.getOptionType(optionClass).getString(value);
447  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onCheckInsertions()

void org.turro.polls.PollControl.onCheckInsertions ( )

Definition at line 183 of file PollControl.java.

183  {
184  if(poll != null) poll.setAllowInsertions(allowInsertions.isChecked());
185  }
void setAllowInsertions(boolean allowInsertions)
Definition: Poll.java:168
Here is the call graph for this function:

◆ onCheckNegatives()

void org.turro.polls.PollControl.onCheckNegatives ( )

Definition at line 188 of file PollControl.java.

188  {
189  if(poll != null) poll.setAllowNegatives(allowNegatives.isChecked());
190  }
void setAllowNegatives(boolean allowNegatives)
Definition: Poll.java:176
Here is the call graph for this function:

◆ onCheckParticipants()

void org.turro.polls.PollControl.onCheckParticipants ( )

Definition at line 173 of file PollControl.java.

173  {
174  if(poll != null) poll.setShowParticipants(showParticipants.isChecked());
175  }
void setShowParticipants(boolean showParticipants)
Definition: Poll.java:152
Here is the call graph for this function:

◆ onCheckVotes()

void org.turro.polls.PollControl.onCheckVotes ( )

Definition at line 178 of file PollControl.java.

178  {
179  if(poll != null) poll.setShowVotes(showVotes.isChecked());
180  }
void setShowVotes(boolean showVotes)
Definition: Poll.java:160
Here is the call graph for this function:

◆ onCreatePoll()

void org.turro.polls.PollControl.onCreatePoll ( )

Definition at line 198 of file PollControl.java.

198  {
199  Poll poll = new Poll();
200  poll.setEntityPath(entityPath);
201  poll.setOptionClass(OptionDataType.OPTION_STRING.getType());
202  setPoll(poll);
203  }
Here is the call graph for this function:

◆ onDeadlineChange()

void org.turro.polls.PollControl.onDeadlineChange ( )

Definition at line 150 of file PollControl.java.

150  {
151  if(poll != null) poll.setDeadline(deadline.getValue());
152  }
void setDeadline(Date deadline)
Definition: Poll.java:111
Here is the call graph for this function:

◆ onDelete()

void org.turro.polls.PollControl.onDelete ( )

Definition at line 216 of file PollControl.java.

216  {
217  if(poll != null) {
218  Messages.confirmDeletion().add(poll.getTitle()).show(() -> {
219  PollsUtil.removePoll(poll);
220  polls.updateCollection(PollsUtil.getPolls(entityPath));
221  setPoll(polls.getObjectValue());
222  });
223  }
224  }
Here is the call graph for this function:

◆ onLocationChange()

void org.turro.polls.PollControl.onLocationChange ( InputEvent  event)

Definition at line 145 of file PollControl.java.

145  {
146  if(poll != null) poll.setLocation(event.getValue());
147  }
void setLocation(String location)
Definition: Poll.java:95
Here is the call graph for this function:

◆ onMaxPerOptionChange()

void org.turro.polls.PollControl.onMaxPerOptionChange ( InputEvent  event)

Definition at line 155 of file PollControl.java.

155  {
156  if(poll != null) poll.setMaxPerOption(Integer.valueOf(event.getValue()));
157  }
void setMaxPerOption(int maxPerOption)
Definition: Poll.java:136
Here is the call graph for this function:

◆ onMaxVotedOptionsChange()

void org.turro.polls.PollControl.onMaxVotedOptionsChange ( InputEvent  event)

Definition at line 160 of file PollControl.java.

160  {
161  if(poll != null) poll.setMaxVotedOptions(Integer.valueOf(event.getValue()));
162  }
void setMaxVotedOptions(int maxVotedOptions)
Definition: Poll.java:144
Here is the call graph for this function:

◆ onSave()

void org.turro.polls.PollControl.onSave ( )

Definition at line 206 of file PollControl.java.

206  {
207  if(poll != null) {
208  poll = PollsUtil.savePoll(poll, optionGrid.getValues());
209  polls.updateCollection(PollsUtil.getPolls(entityPath));
210  polls.setObjectValue(poll);
211  setPoll(polls.getObjectValue());
212  }
213  }
Here is the call graph for this function:

◆ onSelectPoll()

void org.turro.polls.PollControl.onSelectPoll ( )

Definition at line 135 of file PollControl.java.

135  {
136  setPoll(polls.getObjectValue());
137  }
Here is the call graph for this function:

◆ onSend()

void org.turro.polls.PollControl.onSend ( )

Definition at line 246 of file PollControl.java.

246  {
247  doSend(poll.getParticipants());
248  }
void doSend(AssistantSet participants)
Here is the call graph for this function:

◆ onSendTest()

void org.turro.polls.PollControl.onSendTest ( )

Definition at line 227 of file PollControl.java.

227  {
228  ContactList contacts = new ContactList();
229  contacts.add(Authentication.getIContact());
230  IMailRecipients.selectRecipients(contacts, new Command() {
231  @Override
232  public Object execute(Context context) {
233  IMailRecipients mr = (IMailRecipients) context.get("component");
234  Collection<IContact> emails = mr.getRecipients();
235  if(emails != null) {
236  AssistantSet as = new AssistantSet();
237  as.addContacts(emails);
238  doSend(as);
239  }
240  return null;
241  }
242  });
243  }
Here is the call graph for this function:

◆ onTitleChange()

void org.turro.polls.PollControl.onTitleChange ( InputEvent  event)

Definition at line 140 of file PollControl.java.

140  {
141  if(poll != null) poll.setTitle(event.getValue());
142  }
void setTitle(String title)
Definition: Poll.java:87
Here is the call graph for this function:

◆ onTypeSelect()

void org.turro.polls.PollControl.onTypeSelect ( )

Definition at line 165 of file PollControl.java.

165  {
166  if(poll != null) {
167  poll.setOptionClass(optionType.getObjectValue().getType());
168  createMaxmin(null, null);
169  }
170  }
void setOptionClass(String optionClass)
Definition: Poll.java:184
Here is the call graph for this function:

◆ onWikiChange()

void org.turro.polls.PollControl.onWikiChange ( InputEvent  event)

Definition at line 193 of file PollControl.java.

193  {
194  if(poll != null) poll.setWiki(event.getValue());
195  }
Here is the call graph for this function:

◆ setEntity()

void org.turro.polls.PollControl.setEntity ( Object  entity)

Definition at line 353 of file PollControl.java.

353  {
354  this.entity = entity;
355  if(entity != null) {
356  entityPath = Entities.getController(entity).getPath();
357  }
358  }
Here is the call graph for this function:

◆ setEntityPath()

void org.turro.polls.PollControl.setEntityPath ( String  entityPath)

Definition at line 345 of file PollControl.java.

345  {
346  this.entityPath = entityPath;
347  }

◆ setPoll()

void org.turro.polls.PollControl.setPoll ( Poll  poll)

Definition at line 250 of file PollControl.java.

250  {
251  this.poll = poll;
252  updateControls();
253  }
Here is the caller graph for this function:

Member Data Documentation

◆ entity

Object org.turro.polls.PollControl.entity
protected

Definition at line 339 of file PollControl.java.

◆ entityPath

String org.turro.polls.PollControl.entityPath
protected

Definition at line 338 of file PollControl.java.


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