本文整理汇总了Java中sagex.phoenix.vfs.IMediaResource.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java IMediaResource.getParent方法的具体用法?Java IMediaResource.getParent怎么用?Java IMediaResource.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sagex.phoenix.vfs.IMediaResource
的用法示例。
在下文中一共展示了IMediaResource.getParent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GetFactoryId
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
/**
* Given the {@link IMediaResource} return the {@link Factory} that created
* it.
*
* @param res
* @return
*/
public String GetFactoryId(IMediaResource res) {
if (res == null)
return null;
if (res instanceof ViewFolder) {
return ((ViewFolder) res).getViewFactory().getName();
} else if (res.getParent() != null) {
return GetFactoryId(res.getParent());
}
return null;
}
示例2: DeleteItem
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
/**
* Physically deletes a file and removes it from its parent.
* <p/>
* withoutPrejudice is a flag to tell sage tv that this item is being
* deleted as a result of an incorrect recording, etc, so that intelligent
* recordings can function correctly.
*
* @param res
* @param withoutPrejudice
*/
public boolean DeleteItem(IMediaResource res, boolean withoutPrejudice) {
// physically delete the file
boolean deleted = res.delete(new Hints(IMediaResource.HINT_DELETE_WITHOUT_PREJUDICE, String.valueOf(withoutPrejudice)));
if (deleted) {
// remove it from the parent files
if (res.getParent() != null) {
res.getParent().getChildren().remove(res);
}
}
return deleted;
}
示例3: getLocation
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
/**
* Returns the Path for the given resource. If the resouce has a fileystem
* File object, then the path of that File is returned, otherwise, it will
* build up a virtual path as a unix style path, of the given resource and
* its parent resources.
*
* @param res
* @return
*/
public static String getLocation(IMediaResource res) {
String loc = null;
if (res instanceof IMediaFile) {
File f = getFirstFile((IMediaFile) res);
if (f != null) {
loc = f.getAbsolutePath();
}
}
if (loc == null) {
List<String> paths = new ArrayList<String>();
paths.add(res.getTitle());
IMediaResource r = res;
while ((r = r.getParent()) != null) {
paths.add(0, r.getTitle());
}
StringBuffer sb = new StringBuffer();
for (String s : paths) {
sb.append("/");
sb.append(s);
}
loc = sb.toString();
}
return loc;
}
示例4: getPathAsUrl
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
public static String getPathAsUrl(IMediaResource res) {
StringBuilder sb = new StringBuilder();
do {
sb.insert(0, "/" + UrlUtil.encode(res.getTitle()));
} while ((res = res.getParent()) != null);
return sb.toString();
}
示例5: createFolder
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
/**
* Convenience method to create a Folder. If the file is not a directory,
* then a directory of the parent is created.
*/
public static IMediaFolder createFolder(IMediaFolder parent, File f) {
if (f == null)
return null;
IMediaResource r = createResource(parent, f);
if (r instanceof IMediaFolder) {
return (IMediaFolder) r;
} else {
return r.getParent();
}
}
示例6: getParent
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
private String getParent(IMediaResource res) {
if (res == null)
return "NULL";
if (res.getParent() != null)
return res.getParent().getTitle();
return "ROOT";
}
示例7: GetParent
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
/**
* Gets the parent for the given folder
*
* @param res
* @return
*/
public IMediaFolder GetParent(IMediaResource res) {
return res.getParent();
}
示例8: HasParent
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
/**
* Return true if the given folder has a parent.
*
* @param res
* @return
*/
public boolean HasParent(IMediaResource res) {
return res.getParent() != null;
}