001/* 002 * (C) Copyright 2006-2007 Nuxeo SAS <http://nuxeo.com> and others 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Jean-Marc Orliaguet, Chalmers 011 * 012 * $Id$ 013 */ 014 015package org.nuxeo.theme.fragments; 016 017import java.util.List; 018 019import org.nuxeo.theme.Manager; 020import org.nuxeo.theme.elements.AbstractElement; 021import org.nuxeo.theme.models.Model; 022import org.nuxeo.theme.models.ModelException; 023import org.nuxeo.theme.perspectives.PerspectiveManager; 024import org.nuxeo.theme.perspectives.PerspectiveType; 025 026public abstract class AbstractFragment extends AbstractElement implements Fragment { 027 028 public abstract Model getModel() throws ModelException; 029 030 private FragmentType fragmentType; 031 032 public void setFragmentType(FragmentType fragmentType) { 033 this.fragmentType = fragmentType; 034 } 035 036 public FragmentType getFragmentType() { 037 return fragmentType; 038 } 039 040 public boolean isVisibleInPerspective(PerspectiveType perspective) { 041 return Manager.getPerspectiveManager().isVisibleInPerspective(this, perspective); 042 } 043 044 public void setVisibleInPerspective(PerspectiveType perspective) { 045 PerspectiveManager.setVisibleInPerspective(this, perspective); 046 } 047 048 public void setAlwaysVisible() { 049 Manager.getPerspectiveManager().setAlwaysVisible(this); 050 } 051 052 public List<PerspectiveType> getVisibilityPerspectives() { 053 return Manager.getPerspectiveManager().getPerspectivesFor(this); 054 } 055 056 public boolean isDynamic() { 057 return fragmentType.isDynamic(); 058 } 059 060}