BrightSide Workbench Full Report + Source Code
org.turro.elephant.web.actions.WebActions Class Reference

Public Member Functions

WebActions constructor (IConstructor constructor)
 
WebActions image (String image)
 
WebLink link ()
 
void silentExecute ()
 
void execute () throws IOException
 

Static Public Member Functions

static WebActions of (String action)
 

Detailed Description

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

Definition at line 34 of file WebActions.java.

Member Function Documentation

◆ constructor()

WebActions org.turro.elephant.web.actions.WebActions.constructor ( IConstructor  constructor)

Definition at line 36 of file WebActions.java.

36  {
37  this.constructor = constructor;
38  return this;
39  }

◆ execute()

void org.turro.elephant.web.actions.WebActions.execute ( ) throws IOException

Definition at line 110 of file WebActions.java.

110  {
111  WebLink wl = link();
112  if(!wl.isEmpty()) {
113  switch(wl.getType()) {
114  case NAVIGATE -> constructor.redirect(wl.getUrl());
115  case URL, MAIL, TEL -> constructor.redirect(wl.getUrl());
116  case ACTION -> constructor.redirect(wl.getUrl());
117  case TAG -> constructor.redirect(wl.getUrl());
118  }
119  }
120  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ image()

WebActions org.turro.elephant.web.actions.WebActions.image ( String  image)

Definition at line 41 of file WebActions.java.

41  {
42  this.image = image;
43  return this;
44  }

◆ link()

WebLink org.turro.elephant.web.actions.WebActions.link ( )

Definition at line 46 of file WebActions.java.

46  {
47  WebActionType type = WebActionType.typeOf(action);
48  if(type != null) {
49  String command = WebActionType.actionOf(action);
50  if(image == null) image = WebActionType.imageOf(action);
51  String caption = null, url = null, icon = null;
52  switch(type) {
53  case NAVIGATE -> {
54  ElContext elctx = ElContextMap.getContext(command);
55  if(elctx != null) {
56  caption = elctx.getName();
57  url = elctx.getFullPath();
58  }
59  }
60  case TAG -> {
61  ElContext elctx = ElContextMap.getContextFromWebTag(command);
62  if(elctx != null) {
63  caption = elctx.getName();
64  url = elctx.getFullPath();
65  }
66  }
67  case URL -> {
68  caption = command;
69  url = command;
70  }
71  case MAIL -> {
72  caption = I_.get("Email");
73  url = action;
74  }
75  case TEL -> {
76  caption = I_.get("Call");
77  url = action;
78  }
79  case ACTION -> {
80  return switch(command) {
81  case "signup" -> WebActions.of("nav:/user/signup").link();
82  case "tellsomeone" -> WebActions.of("nav:/user/tellsomeone").link();
83  default -> null;
84  };
85  }
86  case WHATS -> {
87  caption = "Whatsapp";
88  url = "https://api.whatsapp.com/send?phone=" + command;
89  }
90  case TGRAM -> {
91  caption = "Telegram";
92  url = "https://t.me/" + command;
93  }
94  }
95  if(!Strings.isBlank(url)) {
96  return new WebLink(type, caption, url, Strings.isBlank(image, icon));
97  }
98  }
99  return new WebLink(null, null, null);
100  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ of()

static WebActions org.turro.elephant.web.actions.WebActions.of ( String  action)
static

Definition at line 124 of file WebActions.java.

124  {
125  return new WebActions(action);
126  }
Here is the caller graph for this function:

◆ silentExecute()

void org.turro.elephant.web.actions.WebActions.silentExecute ( )

Definition at line 102 of file WebActions.java.

102  {
103  try {
104  execute();
105  } catch (IOException ex) {
106  Logger.getLogger(WebActions.class.getName()).log(Level.SEVERE, null, ex);
107  }
108  }
Here is the call graph for this function:

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