19 package org.turro.security;
22 import java.util.stream.Collectors;
23 import org.turro.i18n.I_;
24 import org.zkoss.zk.ui.event.Event;
25 import org.zkoss.zk.ui.event.Events;
26 import org.zkoss.zk.ui.ext.AfterCompose;
27 import org.zkoss.zul.Div;
28 import org.zkoss.zul.Label;
29 import org.zkoss.zul.Separator;
35 public class SecPanel extends Div implements AfterCompose {
43 appendChild(
new Separator(
"horizontal"));
56 private void drawSecs(
long maxUsage) {
57 allSecs.getChildren().clear();
60 String font = sec.isSelected() ?
"bold" :
"normal";
61 String color = sec.isSelected() ?
"#333" :
"#156dc6";
62 label.setStyle(
"cursor:pointer;font-size:" + (
int) (11 +
63 (5 * (
double)((
double)sec.getUsage() / (
double)maxUsage))) +
64 "px;font-weight:" + font +
";color:" + color);
65 label.setAttribute(
"sec", sec);
66 label.addEventListener(Events.ON_CLICK, (Event event) -> {
67 SecItem sec1 = (SecItem) label.getAttribute(
"sec");
68 sec1.setSelected(!sec1.isSelected());
69 Events.postEvent(new Event(Events.ON_CHANGE, SecPanel.this));
73 Set.of(sec.getSecName())).stream().map(t -> t.getSecName())
74 .collect(Collectors.joining(
", ")));
75 allSecs.appendChild(label);
76 allSecs.appendChild(
new Separator(
"vertical"));
static String get(String msg)
Set< SecItem > getSelected()
TreeSet< SecItem > getSelected()
static SecSet getSiblings(Set< String > secNames)
static SecSet getAvailables()
static SecurityGroup get(String id)