本文整理汇总了Java中org.teleal.cling.support.model.container.Container类的典型用法代码示例。如果您正苦于以下问题:Java Container类的具体用法?Java Container怎么用?Java Container使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Container类属于org.teleal.cling.support.model.container包,在下文中一共展示了Container类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeItemsFormPath
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public boolean removeItemsFormPath(String path) {
boolean removeSuccess = false;
File file = new File(path);
if (file.isFile() || file.isDirectory()) {
DIDLObject item = content.findObjectWithId(createId(path));
if (item == null)
return false;
String parentId = item.getParentID();
Container parent = (Container) content.findObjectWithId(parentId);
removeSuccess = parent.getItems().remove(item);
if (!removeSuccess) {
removeSuccess = parent.getContainers().remove(item);
}
parent.setChildCount(parent.getChildCount() - 1);
}
return removeSuccess;
}
示例2: onListItemClick
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
/**
* Enters directory browsing mode or enters a deeper level directory.
*/
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
if (getListAdapter() == mServerAdapter) {
browsingMode(mServerAdapter.getItem(position));
}
else if (getListAdapter() == mFileAdapter) {
if (mFileAdapter.getItem(position) instanceof Container)
getFiles(((Container) mFileAdapter.getItem(position)).getId());
else {
List<Item> playlist = new ArrayList<Item>();
for (int i = 0; i < mFileAdapter.getCount(); i++) {
if (mFileAdapter.getItem(i) instanceof Item) {
playlist.add((Item) mFileAdapter.getItem(i));
}
}
MainActivity activity = (MainActivity) getActivity();
activity.play(playlist, position);
}
}
}
示例3: goBack
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
private void goBack() {
if (mType != FileSource.UPNP)
browse(GO_BACK, false);
else {
if (mBrowser == null)
return;
Container parentContainer = new Container();
String id = "0";
if (((BrowserUpnp) mBrowser).getContainer() != null) {
id = ((BrowserUpnp) mBrowser).getParentId(((BrowserUpnp) mBrowser).getContainer().getId());
}
parentContainer.setId(id);
if (((BrowserUpnp) mBrowser).getService() != null)
upnpService.getControlPoint().execute(new ContentBrowseCallback(getActivity(), ((BrowserUpnp) mBrowser).getService(), parentContainer, contentListAdapter, false));
}
}
示例4: received
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void received(ActionInvocation arg0, DIDLContent didl) {
try {
for (Container childContainer : didl.getContainers()) {
mFolderCount++;
mUpnpService.getControlPoint().execute(new BrowseCallback((mPrefix.startsWith("/") ? mPrefix : "/" + mPrefix) + childContainer.getTitle(), mService, childContainer.getId()));
}
for (Item childItem : didl.getItems()) {
addToResults(mPrefix + childItem.getTitle() + "<MiZ>" + childItem.getFirstResource().getValue(), childItem.getFirstResource().getSize(), results);
}
mScannedCount++;
if (mFolderCount == mScannedCount) {
mLatch.countDown();
mContext.unbindService(serviceConnection);
}
} catch (Exception e) {}
}
示例5: received
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void received(ActionInvocation arg0, DIDLContent didl) {
try {
for (Container childContainer : didl.getContainers()) {
mFolderCount++;
mUpnpService.getControlPoint().execute(new BrowseCallback(mPrefix + "/" + childContainer.getTitle(), mService, childContainer.getId()));
}
for (Item childItem : didl.getItems()) {
addToResults(mPrefix + "/" + childItem.getTitle() + "<MiZ>" + childItem.getFirstResource().getValue(), childItem.getFirstResource().getSize(), results);
}
mScannedCount++;
if (mFolderCount == mScannedCount) {
mLatch.countDown();
mContext.unbindService(serviceConnection);
}
} catch (Exception e) {}
}
示例6: findObjectWithId
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public DIDLObject findObjectWithId(String id) {
for (Container container : getContainers()) {
if (container.getId().equals(id))
return container;
DIDLObject obj = findObjectWithId(id, container);
if (obj != null)
return obj;
}
return null;
}
示例7: CustomContainer
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public CustomContainer(Container parent, String id, String title) {
setId(id);
setParentID(parent.getId());
setTitle(title);
setCreator(MediaStoreContent.CREATOR);
setClazz(MediaStoreContent.CLASS_CONTAINER);
setRestricted(true);
setSearchable(false);
setWriteStatus(WriteStatus.NOT_WRITABLE);
}
示例8: startBrowse
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
private void startBrowse(Device<?, ?, ?> device) {
Service<?, ?> service = device.findService(new UDAServiceType("ContentDirectory"));
((BrowserUpnp) mBrowser).setService(service);
Container rootContainer = new Container();
rootContainer.setId("0");
rootContainer.setTitle(device.getDetails().getFriendlyName());
upnpService.getControlPoint().execute(new ContentBrowseCallback(getActivity(), service, rootContainer, contentListAdapter, true));
}
示例9: ContentBrowseCallback
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public ContentBrowseCallback(Activity activity, Service service, Container container, ArrayAdapter<ContentItem> listadapter, boolean addToStack) {
super(service, container.getId(), BrowseFlag.DIRECT_CHILDREN, "*", 0, null, new SortCriterion(true, "dc:title"));
this.activity = activity;
this.service = service;
this.listAdapter = listadapter;
mContainer = container;
}
示例10: received
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public void received(final ActionInvocation actionInvocation, final DIDLContent didl) {
if (activity != null)
activity.runOnUiThread(new Runnable() {
public void run() {
try {
listAdapter.clear();
// Containers first
for (Container childContainer : didl.getContainers()) {
listAdapter.add(new ContentItem(childContainer, service));
}
// Now items
for (Item childItem : didl.getItems()) {
listAdapter.add(new ContentItem(childItem, service));
}
((BrowserUpnp) mBrowser).setContainer(mContainer);
((BrowserUpnp) mBrowser).addParentId(mContainer.getId(), mContainer.getParentID());
mLoading = false;
} catch (Exception ex) {
mLoading = false;
}
}
});
}
示例11: getContainer
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public Container getContainer() {
if(isContainer)
return (Container) content;
else {
return null;
}
}
示例12: browse
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
@Override
public BrowseResult browse(String objectID, BrowseFlag browseFlag,
String filter, long firstResult, long maxResults,
SortCriterion[] orderby) throws ContentDirectoryException {
log.info("browseId --> " + objectID);
log.info("browseFlag --> " + browseFlag);
DIDLContent didl = new DIDLContent();
try {
if (!content.isShareEnable()) {
log.info("dms will not share anything.");
return new BrowseResult(new DIDLParser().generate(didl), 0, 0);
}
DIDLObject object = content.findObjectWithId(objectID);
if (object == null) {
log.info("object not found:" + objectID);
return new BrowseResult(new DIDLParser().generate(didl), 0, 0);
}
log.info("find object. id-->" + object.getId() + " title-->"
+ object.getTitle());
int count = 0;
int totalMatches = 0;
if (browseFlag.equals(BrowseFlag.METADATA)) {
if (object instanceof Container) {
log.info("Browsing metadata of container: "
+ object.getId());
didl.addContainer((Container) object);
count++;
totalMatches++;
} else if (object instanceof Item) {
log.info("Browsing metadata of item: " + object.getId());
didl.addItem((Item) object);
count++;
totalMatches++;
}
} else if (browseFlag.equals(BrowseFlag.DIRECT_CHILDREN)) {
if (object instanceof Container) {
log.info("Browsing children of container: "
+ object.getId());
Container container = (Container) object;
boolean maxReached = maxResults == 0;
totalMatches = totalMatches
+ container.getContainers().size();
for (Container subContainer : container.getContainers()) {
if (maxReached)
break;
if (firstResult > 0 && count == firstResult)
continue;
didl.addContainer(subContainer);
count++;
if (count >= maxResults)
maxReached = true;
}
totalMatches = totalMatches + container.getItems().size();
for (Item item : container.getItems()) {
if (maxReached)
break;
if (firstResult > 0 && count == firstResult)
continue;
didl.addItem(item);
count++;
if (count >= maxResults)
maxReached = true;
}
}
}
log.info("Browsing result count: " + count + " and total matches: "
+ totalMatches);
return new BrowseResult(new DIDLParser().generate(didl), count,
totalMatches);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
示例13: removeAllShareFile
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public boolean removeAllShareFile() {
setContainers(new ArrayList<Container>());
RootContainer root = new RootContainer(this);
addContainer(root);
return true;
}
示例14: createContainer
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
private CustomContainer createContainer(File file, Container parent) {
return new CustomContainer(parent, createId(file.getPath()),
file.getName());
}
示例15: setContainer
import org.teleal.cling.support.model.container.Container; //导入依赖的package包/类
public void setContainer(Container container) {
mContainer = container;
}