public String getCssClass() { load(); return cssClass; }
public Container(final String id, final Node node) { super(id); final JcrNodeModel nodeModel = new JcrNodeModel(node); stateIconAttributes = new StateIconAttributes(nodeModel); icon = new HippoIconStack("icon", IconSize.L); // icon#addCopyOf generates a new ID, so use a dummy ID for the pluggable type icon final HippoIcon typeIcon = getTypeIcon("dummyId", node); icon.addCopyOf(typeIcon); final Icon[] stateIconOrNull = stateIconAttributes.getIcons(); if (stateIconOrNull != null) { stateIcons[0] = icon.addFromSprite(stateIconOrNull[0], IconSize.M, Position.TOP_LEFT); stateIcons[1] = icon.addFromSprite(stateIconOrNull[1], IconSize.M, Position.BOTTOM_LEFT); } add(icon); }
@Override protected void onDetach() { if (stateIconAttributes != null) { stateIconAttributes.detach(); } super.onDetach(); } }
void load() { if (!loaded) { observable.setTarget(null); try { final Node node = nodeModel.getNode(); if (node != null) { loadAttributes(node); } } catch (RepositoryException ex) { log.error("Unable to obtain state properties", ex); } loaded = true; } }
private void updateStateIcon() { final Icon[] newStateIcons = stateIconAttributes.getIcons(); if (newStateIcons != null) { stateIcons[0] = icon.replaceFromSprite(stateIcons[0], newStateIcons[0], Position.TOP_LEFT); stateIcons[1] = icon.replaceFromSprite(stateIcons[1], newStateIcons[1], Position.BOTTOM_LEFT); } }
summary = typeTranslator.getValueName(HippoStdNodeType.HIPPOSTD_STATESUMMARY, stateModel).getObject(); icons = getStateIcons(state);
@Override public AttributeModifier[] getCellAttributeModifiers(Node node) { StateIconAttributes attrs = new StateIconAttributes(new JcrNodeModel(node)); AttributeModifier[] attributes = new AttributeModifier[2]; attributes[0] = CssClass.appendAndObserve(new ObservablePropertyModel<>(attrs, "cssClass")); attributes[1] = TitleAttribute.append(new ObservablePropertyModel<>(attrs, "summary")); return attributes; } }
public String getSummary() { load(); return summary; }
public Icon[] getIcons() { load(); return icons; }