BrightSide Workbench Full Report + Source Code
org.turro.contacts.profile.EditCProfileControl Class Reference
Inheritance diagram for org.turro.contacts.profile.EditCProfileControl:
Collaboration diagram for org.turro.contacts.profile.EditCProfileControl:

Public Member Functions

void onWeb ()
 
void onTrade ()
 
void onEvent (UploadEvent t) throws Exception
 
void onSector ()
 
void onSpecialty ()
 
void onNewSector (InputEvent event)
 
void onNewSpecialty (InputEvent event)
 
void onSave ()
 
void onCancel ()
 
String getPath ()
 
void setPath (String path)
 
List< String > getLangModel ()
 
void setAboutModel ()
 
- Public Member Functions inherited from org.turro.elephant.TemplateControl
void setRootTmpl (String rootTmpl)
 
void setTmpl (String tmpl)
 
void afterCompose ()
 

Protected Member Functions

void doFinally ()
 

Detailed Description

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

Definition at line 76 of file EditCProfileControl.java.

Member Function Documentation

◆ doFinally()

void org.turro.contacts.profile.EditCProfileControl.doFinally ( )
protected

Reimplemented from org.turro.elephant.TemplateControl.

Definition at line 257 of file EditCProfileControl.java.

257  {
258  super.doFinally();
259  KeyValueMap kvm = Actions.getRightNowAction(Application.getApplication().getConstructor());
260  if(kvm != null && kvm.containsKey("contact")) {
261  contact = Contacts.getContactById(kvm.get("contact"));
262  }
263  initComponents();
264  }
Here is the call graph for this function:

◆ getLangModel()

List<String> org.turro.contacts.profile.EditCProfileControl.getLangModel ( )

Definition at line 202 of file EditCProfileControl.java.

202  {
203  if(langs == null) {
204  langs = new ArrayList<>();
205  langs.add("#"); // default
206  langs.addAll(Arrays.asList(ElephantContext.getSiteLocales().split(" *, *")));
207  }
208  return langs;
209  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPath()

String org.turro.contacts.profile.EditCProfileControl.getPath ( )

Definition at line 194 of file EditCProfileControl.java.

194  {
195  return path;
196  }

◆ onCancel()

void org.turro.contacts.profile.EditCProfileControl.onCancel ( )

Definition at line 190 of file EditCProfileControl.java.

190  {
191  Application.getApplication().navigateBack();
192  }
Here is the call graph for this function:

◆ onEvent()

void org.turro.contacts.profile.EditCProfileControl.onEvent ( UploadEvent  t) throws Exception

Definition at line 104 of file EditCProfileControl.java.

104  {
105  FileAttach fileAttach = new FileAttach(ContactsPU.getObjectPath(contact.getContact()));
106  File newFile = new File(ElephantContext.getRealPath(fileAttach.getPublishable() + "/profile/face.png"));
107  if(!newFile.getParentFile().exists()) {
108  newFile.getParentFile().mkdirs();
109  }
110  Media media = t.getMedia();
111  if(media != null) {
112  Medias.toFile(media, newFile, Medias.scaling(600));
113  }
114  if(newFile.exists()) {
115  try {
116  face.setContent(new AImage(newFile.getAbsolutePath()));
117  } catch (IOException ex) {
118  Logger.getLogger(EditProfileControl.class.getName()).log(Level.SEVERE, null, ex);
119  }
120  } else {
121  face.setSrc(null);
122  }
123  }
Here is the call graph for this function:

◆ onNewSector()

void org.turro.contacts.profile.EditCProfileControl.onNewSector ( InputEvent  event)

Definition at line 142 of file EditCProfileControl.java.

142  {
143  String value = event.getValue();
144  String entityPath = ContactsPU.getObjectPath(contact.getContact());
145  if(!Strings.isBlank(value)) {
146  Skill skill = new Skill();
147  skill.setSkill(value);
148  skill.setEntityPath(entityPath);
149  skill.setType(SkillType.SKILL_SECTOR);
150  Skills.addSkillFor(entityPath, skill);
151  sector.addToModel(new SkillRoot(skill));
152  }
153  }
void addToModel(SkillRoot value)
Here is the call graph for this function:

◆ onNewSpecialty()

void org.turro.contacts.profile.EditCProfileControl.onNewSpecialty ( InputEvent  event)

Definition at line 156 of file EditCProfileControl.java.

156  {
157  String value = event.getValue();
158  String entityPath = ContactsPU.getObjectPath(contact.getContact());
159  if(!Strings.isBlank(value)) {
160  Skill skill = new Skill();
161  skill.setSkill(value);
162  skill.setEntityPath(entityPath);
163  skill.setType(SkillType.SKILL_SPECIALTY);
164  Skills.addSkillFor(entityPath, skill);
165  specialty.addToModel(new SkillRoot(skill));
166  }
167  }
Here is the call graph for this function:

◆ onSave()

void org.turro.contacts.profile.EditCProfileControl.onSave ( )

Definition at line 170 of file EditCProfileControl.java.

170  {
171  if(contact.isValid()) {
172  Contact c = (Contact) contact.getContact();
173  if(model != null) {
174  for(AboutWrapper wrapper : model) {
175  if(wrapper.isNewComment() && !wrapper.isEmpty()) {
176  Comment comment = wrapper.getComment();
177  comment.setContact(c);
178  comment.setModification(new Date());
179  c.getComments().add(comment);
180  }
181  }
182  }
183  new ContactWrapper(c).save();
184  Application.getApplication().navigateBack();
185  sendNotification((Contact) contact.getContact());
186  }
187  }
Here is the call graph for this function:

◆ onSector()

void org.turro.contacts.profile.EditCProfileControl.onSector ( )

Definition at line 126 of file EditCProfileControl.java.

126  {
127  String entityPath = ContactsPU.getObjectPath(contact.getContact());
128  Skills.setSkillsFor(entityPath, sector.getObjectValues()
129  .stream().map(s -> s.getFor(entityPath)).collect(Collectors.toSet()),
130  SkillType.SKILL_SECTOR);
131  }
Here is the call graph for this function:

◆ onSpecialty()

void org.turro.contacts.profile.EditCProfileControl.onSpecialty ( )

Definition at line 134 of file EditCProfileControl.java.

134  {
135  String entityPath = ContactsPU.getObjectPath(contact.getContact());
136  Skills.setSkillsFor(entityPath, specialty.getObjectValues()
137  .stream().map(s -> s.getFor(entityPath)).collect(Collectors.toSet()),
138  SkillType.SKILL_SPECIALTY);
139  }
Here is the call graph for this function:

◆ onTrade()

void org.turro.contacts.profile.EditCProfileControl.onTrade ( )

Definition at line 99 of file EditCProfileControl.java.

99  {
100  contact.setConnector(IUser.CONNECTOR_TRADE, trade.getValue());
101  }
void setConnector(String id, String value)
Here is the call graph for this function:

◆ onWeb()

void org.turro.contacts.profile.EditCProfileControl.onWeb ( )

Definition at line 94 of file EditCProfileControl.java.

94  {
95  contact.setConnector(Profile.WEB, web.getValue());
96  }
Here is the call graph for this function:

◆ setAboutModel()

void org.turro.contacts.profile.EditCProfileControl.setAboutModel ( )

Definition at line 219 of file EditCProfileControl.java.

219  {
220  if(model == null) {
221  Contact c = (Contact) contact.getContact();
222  model = new ArrayList<>();
223  getLangModel().forEach((lang) -> {
224  boolean done = false;
225  for(Comment comment : c.getComments()) {
226  if(comment.getComment().startsWith("#cv" + lang)) {
227  AboutWrapper wrapper = new AboutWrapper(lang, chooseLabel(lang), comment);
228  model.add(wrapper);
229  done = true;
230  }
231  }
232  if (!done) {
233  AboutWrapper wrapper = new AboutWrapper(lang, chooseLabel(lang), new Comment());
234  model.add(wrapper);
235  }
236  });
237  }
238  model.forEach(a -> {
239  Tab tab = new Tab(a.getLangLabel());
240  tabs.appendChild(tab);
241  Tabpanel tabpanel = new Tabpanel();
242  tabpanels.appendChild(tabpanel);
243  Textbox about = new Textbox();
244  about.setMultiline(true);
245  about.setRows(15);
246  about.setTabbable(true);
247  about.setStyle("-moz-tab-size:4;-o-tab-size:4;tab-size:4;width:100%;height:100%;");
248  about.setValue(a.getCommentString());
249  about.addEventListener(Events.ON_CHANGE, (Event event) -> {
250  a.setCommentString(about.getValue());
251  });
252  tabpanel.appendChild(about);
253  });
254  }
Here is the call graph for this function:

◆ setPath()

void org.turro.contacts.profile.EditCProfileControl.setPath ( String  path)

Definition at line 198 of file EditCProfileControl.java.

198  {
199  this.path = path;
200  }

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