public NodeModelWrapper(IModel<Node> nodeModel) { if (!(nodeModel instanceof JcrNodeModel)) { this.nodeModel = new JcrNodeModel(nodeModel.getObject()); } else { this.nodeModel = (JcrNodeModel) nodeModel; } }
private JcrNodeModel getParentJcrNodeModel(final IModel<Node> nodeModel) { final JcrNodeModel jcrNodeModel = nodeModel instanceof JcrNodeModel ? (JcrNodeModel) nodeModel : new JcrNodeModel(nodeModel.getObject()); return jcrNodeModel.getParentModel(); }
private void attach() { if (!attached) { String type = getNodeTypeModel().getType(); if (type.contains(":")) { nodeModel = new JcrNodeModel("/hippo:namespaces/" + type.replace(':', '/')); } else { nodeModel = new JcrNodeModel("/hippo:namespaces/system/" + type); } attached = true; } }
@Override public void init(JcrNodeModel model) throws RepositoryException { this.model = new JcrNodeModel(model.getNode()); } }
protected IModel<Node> getInitialNode() { String path = getDefaultModelObjectAsString(); if (path != null && !"".equals(path)) { return new JcrNodeModel(path); } return null; }
protected void openEditor(String type) { IEditorManager editorMgr = plugin.getEditorManager(); if (editorMgr != null) { /* IEditor editor = */ try { editorMgr.openEditor(new JcrNodeModel("/hippo:namespaces/" + type.replace(':', '/'))); } catch (ServiceException ex) { log.warn("Unable to open editor", ex); } } }
@Override public void init(JcrNodeModel model) throws RepositoryException { for (NodeIterator it = model.getNode().getNodes(); it.hasNext();) { Node child = it.nextNode(); if (child.getPrimaryNodeType().isNodeType(HST_SITE)) { this.model = new JcrNodeModel(child); break; } } }
private void addTemplate(JcrItemModel model) throws RepositoryException { Item item = (Item) model.getObject(); String name = item.getName(); Set<String> excluded = descriptor.getExcluded(); if (excluded == null || !excluded.contains(name)) { elements.addLast(new JcrNodeModel(model)); } } }
@Override protected Dialog createRequestDialog() { WorkflowDescriptorModel wdm = (WorkflowDescriptorModel) getDefaultModel(); try { return new ScheduleDepublishDialog(this, new JcrNodeModel(wdm.getNode()), new PropertyModel(this, "date"), getEditorManager()); } catch (RepositoryException e) { log.warn("could not retrieve node for scheduling depublish", e); } return null; }
@Override protected Dialog createRequestDialog() { WorkflowDescriptorModel wdm = (WorkflowDescriptorModel) getDefaultModel(); try { return new SchedulePublishDialog(this, new JcrNodeModel(wdm.getNode()), new PropertyModel(this, "date"), getEditorManager()); } catch (RepositoryException ex) { log.warn("could not retrieve node for scheduling publish", ex); } return null; }
@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; } }
@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; } }
@Override public void onOk() { try { final IModel<Node> nodeModel = getModel(); final Node node = nodeModel.getObject().addNode(name, type); modelReference.setModel(new JcrNodeModel(node)); } catch (RepositoryException ex) { error(ex.toString()); } }
public BrowserPlugin(IPluginContext context, IPluginConfig config) { super(context, config); this.rootNode = new JcrTreeNode(new JcrNodeModel("/"), null); treeModel = new JcrTreeModel(rootNode); context.registerService(treeModel, IObserver.class.getName()); tree = newTree(treeModel); add(tree); add(new ScrollBehavior()); onModelChanged(); }
@Override public AttributeModifier[] getCellAttributeModifiers(Node node) { StateIconAttributes attrs = new StateIconAttributes(new JcrNodeModel(node)); AttributeModifier[] attributes = new AttributeModifier[2]; attributes[0] = new CssClassAppender(new ObservablePropertyModel(attrs, "cssClass")); attributes[1] = new AttributeAppender("title", new ObservablePropertyModel(attrs, "summary"), " "); return attributes; } }
public JcrNodeModel getBrowseModel() { JcrItemModel itemModel = getNodeModel().getItemModel(); while (itemModel != null && !itemModel.exists()) { itemModel = itemModel.getParentModel(); } if (itemModel == null) { return null; } return new JcrNodeModel(itemModel); }
public BrowserPlugin(IPluginContext context, IPluginConfig config) { super(context, config); this.rootNode = new JcrTreeNode(new JcrNodeModel("/"), null, new JcrTreeNodeComparator()); treeModel = new JcrTreeModel(rootNode); context.registerService(treeModel, IObserver.class.getName()); tree = newTree(treeModel); add(tree); add(new ScrollBehavior()); onModelChanged(); }
@Override protected Dialog createRequestDialog() { WorkflowDescriptorModel workflowModel = getModel(); try { JcrNodeModel nodeModel = new JcrNodeModel(workflowModel.getNode()); return new FolderTranslationsDialog(this, new StringResourceModel("folder-translations-title", FolderTranslationsWorkflowPlugin.this, null), nodeModel, getLocaleProvider()); } catch (RepositoryException e) { throw new RuntimeException("Could not retrieve node for workflow", e); } } });
public IDynamicWizardStep next() { JcrNodeModel template = new JcrNodeModel(hstContext.template.absolutePath(newPage.getTemplate())); List<String> containers = JcrUtilities.getMultiValueProperty(template, TemplateDAO.HST_CONTAINERS); if (containers != null && containers.size() > 0) { containersModel = new Containers(containers); return new ComponentDescriptionStep(this); } return new PageDescriptionStep(this); } }
public Container(final String id, final Node node) { super(id, new JcrNodeModel(node)); icon = new HippoIconStack("icon", IconSize.L); icon.addFromSprite(isCompound() ? Icon.FILE_COMPOUND : Icon.FILE, IconSize.L); Icon[] newStateIcons = getStateIcons(); stateIcons[0] = icon.addFromSprite(newStateIcons[0], IconSize.M, Position.TOP_LEFT); stateIcons[1] = icon.addFromSprite(newStateIcons[1], IconSize.M, Position.BOTTOM_LEFT); add(icon); }