public Plugin getPlugin(String id) { if (id == null) { throw new IllegalArgumentException("Argument 'id' may not be null."); } for (Plugin p : getPlugins()) { if (id.equals(p.getId())) { return p; } } return null; }
private List<Workspace> getWorkspaces() { Brix brix = getBrix(); List<Workspace> workspaces = new ArrayList<Workspace>(); Workspace current = getModelObject(); for (Plugin p : brix.getPlugins()) { List<Workspace> filtered = brix.filterVisibleWorkspaces( p.getWorkspaces(current, false), Context.ADMINISTRATION); for (Workspace w : filtered) { workspaces.add(w); } } if (!workspaces.contains(current)) { workspaces.add(current); } return workspaces; }
private List<Workspace> getAvailableWorkspaces() { Brix brix = Brix.get(); List<Workspace> workspaces = new ArrayList<Workspace>(); Workspace current = getModelObject(); for (Plugin p : brix.getPlugins()) { List<Workspace> filtered = brix.filterVisibleWorkspaces( p.getWorkspaces(current, false), Context.ADMINISTRATION); for (Workspace w : filtered) { workspaces.add(w); } } if (!workspaces.contains(current) && current != null) { workspaces.add(current); } return workspaces; }
private List<Workspace> getWorkspaces() { Brix brix = getBrix(); List<Workspace> workspaces = new ArrayList<Workspace>(); Workspace current = getModelObject(); for (Plugin p : brix.getPlugins()) { List<Workspace> filtered = brix.filterVisibleWorkspaces(p.getWorkspaces(current, false), Context.ADMINISTRATION); for (Workspace w : filtered) { if (workspaceNameCache == null) { workspaceNameCache = new HashMap<String, String>(); } workspaceNameCache.put(w.getId(), p.getUserVisibleName(w, false)); workspaces.add(w); } } if (!workspaces.contains(current)) { workspaces.add(current); } return workspaces; }
private String getWorkspaceName(Workspace workspace) { if (workspaceNameCache == null) { workspaceNameCache = new HashMap<String, String>(); } String name = workspaceNameCache.get(workspace.getId()); if (name == null) { for (Plugin p : getBrix().getPlugins()) { if (p.isPluginWorkspace(workspace)) { name = p.getUserVisibleName(workspace, false); } workspaceNameCache.put(workspace.getId(), name); } } return name; }
private void setupTabbedPanel() { if (tabbedPanel != null) { tabbedPanel.remove(); } List<IBrixTab> tabs = new ArrayList<IBrixTab>(); Brix brix = Brix.get(); for (Plugin p : brix.getPlugins()) { List<IBrixTab> pluginTabs = p.newTabs(getModel()); if (pluginTabs != null) { tabs.addAll(pluginTabs); } } tabbedPanel = new BrixNavbarPanel("tabbedPanel", tabs); container.add(tabbedPanel); } }
private List<WorkspaceEntry> loadWorkspaces() { Brix brix = Brix.get(); List<WorkspaceEntry> workspaces = new ArrayList<WorkspaceEntry>(); Workspace currentWorkspace = getCurrentWorkspaceId() != null ? brix.getWorkspaceManager() .getWorkspace(getCurrentWorkspaceId()) : null; for (Plugin p : brix.getPlugins()) { List<Workspace> filtered = brix.filterVisibleWorkspaces(p.getWorkspaces( currentWorkspace, true), Context.PRESENTATION); for (Workspace w : filtered) { WorkspaceEntry we = new WorkspaceEntry(); we.id = w.getId(); we.visibleName = p.getUserVisibleName(w, true); workspaces.add(we); } } return workspaces; }
public void initWorkspace(org.brixcms.workspace.Workspace workspace, JcrSession session) { JcrNode root; if (session.itemExists(getRootPath())) { root = (JcrNode) session.getItem(getRootPath()); } else { root = session.getRootNode().addNode(ROOT_NODE_NAME, "nt:folder"); } if (!root.isNodeType(BrixNode.JCR_TYPE_BRIX_NODE)) { root.addMixin(BrixNode.JCR_TYPE_BRIX_NODE); } for (Plugin p : getPlugins()) { p.initWorkspace(workspace, session); } session.save(); }