public FolderTreePlugin(IPluginContext context, IPluginConfig config) { super(context, config); JcrNodeModel model = new JcrNodeModel(config.getString("path", "/")); ModelReference<Node> modelService = new ModelReference<Node>(context.getReference(this).getServiceId(), model); modelService.init(context); } }
public C getModel() { return (C) modelRef.getModel(); }
protected ViewController(IPluginContext context, IPluginConfig config, String hstContextId, JcrNodeModel rootModel) { this.config = config; this.context = context; this.hstContextId = hstContextId; if (config.containsKey(MODEL_ROOT)) { this.rootModel = new JcrNodeModel(config.getString(MODEL_ROOT)); } else { this.rootModel = rootModel; } @SuppressWarnings("unchecked") IModelReference<Node> modelService = context.getService(config.getString(MODEL), IModelReference.class); if (modelService != null) { onModelChanged(modelService.getModel()); } else { final ModelReference<Node> modelRef = new ModelReference<Node>(config.getString(MODEL), this.rootModel); modelRef.init(context); context.registerService(new IObserver<IModelReference<?>>() { private static final long serialVersionUID = 1L; public IModelReference<?> getObservable() { return modelRef; } public void onEvent(Iterator<? extends IEvent<IModelReference<?>>> event) { onModelChanged(modelRef.getModel()); } }, IObserver.class.getName()); onModelChanged(modelRef.getModel()); } }
modelService = new ModelReference<>(modelId, getEditorModel()); modelService.init(context); baseService = new ModelReference<>(baseId, getBaseModel()); baseService.init(context); context.unregisterService(this, editorId); context.unregisterService(editorContext.getEditorManager(), editorId); modelService.destroy(); throw new EditorException("No IRenderService found");
public void updateModel(IModel<Node> model) { super.setModel(model); }
public void detach() { model.detach(); if (modelService != null) { modelService.detach(); } }
protected ViewController(IPluginContext context, IPluginConfig config, JcrNodeModel rootModel) { this.config = config; this.context = context; if (config.containsKey(MODEL_ROOT)) { this.rootModel = new JcrNodeModel(config.getString(MODEL_ROOT)); } else { this.rootModel = rootModel; } @SuppressWarnings("unchecked") IModelReference<Node> modelService = context.getService(config.getString(MODEL), IModelReference.class); if (modelService != null) { onModelChanged(modelService.getModel()); } else { final ModelReference<Node> modelRef = new ModelReference<Node>(config.getString(MODEL), this.rootModel); modelRef.init(context); context.registerService(new IObserver<IModelReference<?>>() { private static final long serialVersionUID = 1L; public IModelReference<?> getObservable() { return modelRef; } public void onEvent(Iterator<? extends IEvent<IModelReference<?>>> event) { onModelChanged(modelRef.getModel()); } }, IObserver.class.getName()); onModelChanged(modelRef.getModel()); } }
public void updateModel(IModel<Node> model) { super.setModel(model); }
@Override protected void onDetach() { IModel<Node> model = this.getModel(); if (model != null) { model.detach(); } engineFactory.detach(); if (modelService != null) { modelService.detach(); } super.onDetach(); }
public FolderTreePlugin(IPluginContext context, IPluginConfig config) { super(context, disableIfNoPathPresent(config)); JcrNodeModel model = new JcrNodeModel(config.getString("path")); ModelReference<Node> modelService = new ModelReference<Node>(context.getReference(this).getServiceId(), model); modelService.init(context); } }
void stop() { control.stop(); modelService.destroy(); } }
@Override public void setObject(final String object) { selectedPluginService.setModel(new Model<String>(object)); }
public IRenderService startRenderer(IPluginConfig config, WorkflowDescriptorModel wdm) { if (config == null) { return null; } String wicketModelId = baseServiceName + "." + "model" + clusters.size(); ModelReference modelRef = new ModelReference(wicketModelId, wdm); modelRef.init(context); JavaClusterConfig childClusterConfig = new JavaClusterConfig(); IPluginConfig childPluginConfig = new JavaPluginConfig(new InheritingPluginConfig(config, this.config)); String wicketRenderId = baseServiceName + "." + "id" + clusters.size(); childPluginConfig.put(RenderService.WICKET_ID, wicketRenderId); childPluginConfig.put(RenderService.MODEL_ID, wicketModelId); childClusterConfig.addPlugin(childPluginConfig); IClusterControl control = context.newCluster(childClusterConfig, null); control.start(); clusters.add(new Cluster(control, modelRef)); return context.getService(wicketRenderId, IRenderService.class); }
@Override public void onModelChanged() { super.onModelChanged(); if (cluster != null) { cluster.stop(); modelService.destroy(); } createTemplate(); }
if (historicDocument == null) { infoComponent.setDefaultModel(new Model("There was no document published during this period")); subModel.setModel(null); } else { infoComponent.setDefaultModel(new Model("")); subModel.setModel(new JcrNodeModel(document.getSession().getNodeByUUID( historicDocument.getIdentity())));
public void onEvent(Iterator<? extends IEvent<IModelReference<?>>> event) { onModelChanged(modelRef.getModel()); }
subModel = new ModelReference(config.getString("wicket.submodel"), null); subModel.init(context); } else { log.warn("");
public void destroy() { if (cluster != null) { cluster.stop(); modelService.destroy(); } context.unregisterTracker(fieldTracker, engineId + ".wicket.root"); context.unregisterService(engineFactory, ITemplateEngine.class.getName()); validation.stop(); }