Package org.locationtech.udig.catalog.document

Examples of org.locationtech.udig.catalog.document.IDocumentFolder


        }

        @Override
        public Object[] getChildren( Object element ) {
            if (element instanceof IDocumentFolder) {
                final IDocumentFolder folder = (IDocumentFolder) element;
                return folder.getItems().toArray(new Object[0]);
            }
            return null;
        }
View Full Code Here


        }

        @Override
        public boolean hasChildren( Object element ) {
            if (element instanceof IDocumentFolder) {
                final IDocumentFolder folder = (IDocumentFolder) element;
                return folder.getItems().size() > 0;
            }
            return false;
        }
View Full Code Here

        }
       
        public IDocumentFolder getFolder(IDocument doc) {
            for (Object item : items) {
                if (item instanceof IDocumentFolder) {
                    final IDocumentFolder folder = (IDocumentFolder) item;
                    for (IDocument folderDoc : folder.getDocuments()) {
                        if (folderDoc.equals(doc)) {
                            return folder;
                        }
                    }
                    // if (folder.getSource().equals(doc.getSource())) {
View Full Code Here

       
        private List<IDocument> getTemplatesInternal(IDocument refDoc) {
            final List<IDocument> templates = new ArrayList<IDocument>();
            for (Object item : items) {
                if (item instanceof IDocumentFolder) {
                    final IDocumentFolder folder = (IDocumentFolder) item;
                    templates.addAll(getTemplatesInternal(folder, refDoc));
                }
            }
            return templates;
        }
View Full Code Here

                    final IAttachmentSource attachmentSource = toSource(geoResource, IAttachmentSource.class, monitor);
                    isFeatureEnabled = attachmentSource != null && attachmentSource.isEnabled();
                   
                    if (isFeatureEnabled || isHotlinkEnabled) {
                        final String featureLabel = getFeatureLabel(geoResource, feature);
                        final IDocumentFolder folder = ShpDocFactory.createFolder(feature, featureLabel, attachmentSource);
                        if (isFeatureEnabled) {
                            // Set so that source's document list is same with folder's
                            folder.setDocuments(attachmentSource.getDocuments(feature, monitor));   
                        }
                        if (isHotlinkEnabled) {
                            folder.insertDocuments(hotlinkSource.getDocuments(feature, monitor), 0);
                        }
                        items.add(folder);
                    }
                   
                }
               
                final IDocumentSource docSource = toSource(geoResource, IDocumentSource.class, monitor);
                isResourceEnabled = docSource != null && docSource.isEnabled();
               
                if (isResourceEnabled) {
                    final IDocumentFolder folder = ShpDocFactory.createFolder(null, geoResource.getTitle(), docSource);
                    // Set so that source's document list is same with folder's
                    folder.setDocuments(docSource.getDocuments(monitor));
                    items.add(folder);
                }
               
            }
        }
View Full Code Here

     * Adds a new document. This opens the {@link DocumentDialog} to allow the user to input details
     * of the document to be added.
     */
    private void attach() {

        final IDocumentFolder folder = getDocumentFolder();
        if (folder != null) {
            final Map<String, Object> params = new HashMap<String, Object>();
            params.put(DocumentDialog.P_TYPE, Type.ATTACHMENT);
            params.put(DocumentDialog.P_MODE, Mode.ADD);
            params.put(DocumentDialog.P_TEMPLATES, itemModel.getTemplates(folder));

            final IAbstractDocumentSource source = folder.getSource();
            final boolean isFeatureDoc = (source instanceof IAttachmentSource);
            final DocumentDialog docDialog = openDocDialog(new HashMap<String, Object>(), params, isFeatureDoc);
            if (docDialog != null) {
                addDocument(folder, docDialog.getDocInfo());
            }           
View Full Code Here

     * Links a new document. This opens the {@link DocumentDialog} to allow the user to input details
     * of the document to be linked.
     */
    private void link() {

        final IDocumentFolder folder = getDocumentFolder();
        if (folder != null) {
            final IAbstractDocumentSource source = folder.getSource();
           
            final Map<String, Object> params = new HashMap<String, Object>();
            params.put(DocumentDialog.P_TYPE, Type.LINKED);
            params.put(DocumentDialog.P_MODE, Mode.ADD);
            params.put(DocumentDialog.P_TEMPLATES, itemModel.getTemplates(folder));
View Full Code Here

     * @return document folder
     */
    private IDocumentFolder getDocumentFolder() {
        if (viewerSelection != null) {
            final Object obj = viewerSelection.getFirstElement();
            IDocumentFolder folder = null;
            if (obj instanceof IDocumentFolder) {
                folder = (IDocumentFolder) obj;
            } else if (obj instanceof IDocument) {
                folder = itemModel.getFolder((IDocument) obj);
            }
View Full Code Here

     * the same document source of the current selection if it is not a folder.
     *
     * @return document source
     */
    private IAbstractDocumentSource getDocumentSource() {
        final IDocumentFolder folder = getDocumentFolder();
        if (folder != null) {
            return folder.getSource();   
        }
        return null;
    }
View Full Code Here

        }

        @Override
        public String getColumnText(Object element, int columnIndex) {
            if (element instanceof IDocumentFolder) {
                final IDocumentFolder folder = (IDocumentFolder) element;
                switch (columnIndex) {
                case DOCUMENT_INDEX:
                    return DocUtils.toCamelCase(folder.getName());
                }
            } else if (element instanceof IDocument) {
                final IDocument doc = (IDocument) element;
                switch (columnIndex) {
                case DOCUMENT_INDEX:
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.document.IDocumentFolder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.