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

Public Member Functions

 WebLink (WebActionType type, String caption, String url)
 
 WebLink (WebActionType type, String caption, String url, String icon)
 
WebActionType getType ()
 
String getCaption ()
 
String getUrl ()
 
String getIcon ()
 
String getHelp ()
 
Icons getIcons ()
 
boolean isExternal ()
 
boolean isEmpty ()
 

Static Public Member Functions

static WebLink from (WebLink webLink, String newCaption)
 

Detailed Description

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

Definition at line 29 of file WebLink.java.

Constructor & Destructor Documentation

◆ WebLink() [1/2]

org.turro.elephant.web.actions.WebLink.WebLink ( WebActionType  type,
String  caption,
String  url 
)

Definition at line 34 of file WebLink.java.

34  {
35  this(type, caption, url, null);
36  }
Here is the caller graph for this function:

◆ WebLink() [2/2]

org.turro.elephant.web.actions.WebLink.WebLink ( WebActionType  type,
String  caption,
String  url,
String  icon 
)

Definition at line 38 of file WebLink.java.

38  {
39  this.type = type;
40  this.caption = caption;
41  this.url = url;
42  this.icon = icon;
43  }

Member Function Documentation

◆ from()

static WebLink org.turro.elephant.web.actions.WebLink.from ( WebLink  webLink,
String  newCaption 
)
static

Definition at line 113 of file WebLink.java.

113  {
114  if(webLink.getType() == WebActionType.WRONG) return webLink;
115  return new WebLink(webLink.getType(), newCaption, webLink.getUrl(), webLink.getIcon());
116  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCaption()

String org.turro.elephant.web.actions.WebLink.getCaption ( )

Definition at line 49 of file WebLink.java.

49  {
50  if(Strings.isBlank(caption)) return switch(type) {
51  case NAVIGATE, ACTION, TAG, URL -> url;
52  case MAIL -> I_.get("Email");
53  case TEL -> I_.get("Call");
54  case WHATS -> "Whatsapp";
55  case TGRAM -> "Telegram";
56  case WRONG -> "Wrong";
57  };
58  return caption;
59  }
Here is the call graph for this function:

◆ getHelp()

String org.turro.elephant.web.actions.WebLink.getHelp ( )

Definition at line 82 of file WebLink.java.

82  {
83  return switch(type) {
84  case NAVIGATE, TAG, ACTION, URL -> url;
85  case MAIL, TEL -> Strings.pastFirst(url, ":");
86  case WHATS -> Strings.pastLast(url, "=");
87  case TGRAM -> Strings.pastLast(url, "/");
88  case WRONG -> "Wrong action found";
89  };
90  }

◆ getIcon()

String org.turro.elephant.web.actions.WebLink.getIcon ( )

Definition at line 65 of file WebLink.java.

65  {
66  if(Strings.isBlank(icon)) return switch(type) {
67  case NAVIGATE, URL, TAG -> "globe";
68  case MAIL -> "envelope";
69  case TEL -> "phone";
70  case ACTION -> switch(url) {
71  case "singup" -> "sign in alternate";
72  case "tellsomeone" -> "satellite dish";
73  default -> "bolt";
74  };
75  case WHATS -> "whatsapp";
76  case TGRAM -> "telegram";
77  case WRONG -> "warning";
78  };
79  return icon;
80  }
Here is the caller graph for this function:

◆ getIcons()

Icons org.turro.elephant.web.actions.WebLink.getIcons ( )

Definition at line 92 of file WebLink.java.

92  {
93  return Icons.from(getIcon());
94  }
Here is the call graph for this function:

◆ getType()

WebActionType org.turro.elephant.web.actions.WebLink.getType ( )

Definition at line 45 of file WebLink.java.

45  {
46  return type;
47  }
Here is the caller graph for this function:

◆ getUrl()

String org.turro.elephant.web.actions.WebLink.getUrl ( )

Definition at line 61 of file WebLink.java.

61  {
62  return url;
63  }
Here is the caller graph for this function:

◆ isEmpty()

boolean org.turro.elephant.web.actions.WebLink.isEmpty ( )

Definition at line 100 of file WebLink.java.

100  {
101  return type == null || Strings.isBlank(caption) || Strings.isBlank(url);
102  }
Here is the caller graph for this function:

◆ isExternal()

boolean org.turro.elephant.web.actions.WebLink.isExternal ( )

Definition at line 96 of file WebLink.java.

96  {
97  return url.matches("(http|https|ftp|sftp|ftps):.+");
98  }

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