-
Notifications
You must be signed in to change notification settings - Fork 3
/
LogoHeader.java
45 lines (37 loc) · 1.19 KB
/
LogoHeader.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package io.jenkins.plugins.customizable_header.headers;
import hudson.Extension;
import hudson.markup.RawHtmlMarkupFormatter;
import io.jenkins.plugins.customizable_header.CustomHeaderConfiguration;
import io.jenkins.plugins.customizable_header.logo.Logo;
import java.io.IOException;
import java.io.StringWriter;
import jenkins.views.PartialHeader;
@Extension(ordinal = 99999)
public class LogoHeader extends PartialHeader implements SystemMessageProvider {
@Override
public boolean isEnabled() {
return CustomHeaderConfiguration.get().getActiveHeader() instanceof LogoSelector;
}
public String getTitle() {
StringWriter writer = new StringWriter();
try {
RawHtmlMarkupFormatter.INSTANCE.translate(CustomHeaderConfiguration.get().getTitle(), writer);
return writer.toString();
} catch (IOException e) {
return "";
}
}
public String getLogoText() {
return CustomHeaderConfiguration.get().getLogoText();
}
public boolean hasLinks() {
return CustomHeaderConfiguration.get().hasLinks();
}
public Logo getLogo() {
return CustomHeaderConfiguration.get().getLogo();
}
@Override
public int getSupportedHeaderVersion() {
return 1;
}
}