Package org.locationtech.udig.catalog.document.IHotlinkSource

Examples of org.locationtech.udig.catalog.document.IHotlinkSource.HotlinkDescriptor


    @Test
    public void testCreateHotlink() {

        final ShpDocFactory factory = new ShpDocFactory(null);
       
        HotlinkDescriptor descriptor = new HotlinkDescriptor(LABEL, DESCRIPTION, ATTRIBUTE_NAME, ContentType.FILE, CONFIG);
        IDocument doc = factory.create(INFO, Collections.singletonList(descriptor));
        assertNotNull("Doc is null.", doc);
        assertTrue("Doc's type is not expected.", doc instanceof FileHotlinkDocument);
       
        descriptor = new HotlinkDescriptor(LABEL, DESCRIPTION, ATTRIBUTE_NAME, ContentType.WEB, CONFIG);
        doc = factory.create(INFO, Collections.singletonList(descriptor));
        assertNotNull("Doc is null.", doc);
        assertTrue("Doc's type is not expected.", doc instanceof WebHotlinkDocument);
       
        descriptor = new HotlinkDescriptor(LABEL, DESCRIPTION, ATTRIBUTE_NAME, ContentType.ACTION, CONFIG);
        doc = factory.create(INFO, Collections.singletonList(descriptor));
        assertNotNull("Doc is null.", doc);
        assertTrue("Doc's type is not expected.", doc instanceof ActionHotlinkDocument);
       
        descriptor = new HotlinkDescriptor(LABEL, DESCRIPTION, ATTRIBUTE_NAME, ContentType.ACTION, CONFIG);
        HotlinkDescriptor descriptor2 = new HotlinkDescriptor(LABEL, DESCRIPTION, ATTRIBUTE_NAME, ContentType.ACTION, CONFIG);
        HotlinkDescriptor descriptor3 = new HotlinkDescriptor(LABEL, DESCRIPTION, ATTRIBUTE_NAME, ContentType.ACTION, CONFIG);
        final List<HotlinkDescriptor> descriptors = new ArrayList<HotlinkDescriptor>();
        descriptors.add(descriptor);
        descriptors.add(descriptor2);
        descriptors.add(descriptor3);
        doc = factory.create(INFO, descriptors);
View Full Code Here


        List<IGeoResource> members = (List<IGeoResource>) service
                .resources(new NullProgressMonitor());
        resource = members.get(0);

        final List<HotlinkDescriptor> descriptors = new ArrayList<HotlinkDescriptor>();
        descriptors.add(new HotlinkDescriptor("File", "File Description", "FILE", ContentType.FILE, ""));
        descriptors.add(new HotlinkDescriptor("Web", "Web Description", "LINK", ContentType.WEB, ""));

        parser = new BasicHotlinkDescriptorParser(resource);
        parser.setDescriptors(descriptors);

    }
View Full Code Here

     */
    @Test
    public void testFromString() {

        String descStr = String.format(FORMAT, NAME, TYPE.toString(), CONFIG, LABEL, DESCRIPTION);
        HotlinkDescriptor hotlinkDesc = new HotlinkDescriptor(descStr);
        assertEquals("Name is not expected.", NAME, hotlinkDesc.getAttributeName());
        assertEquals("Type is not expected.", TYPE, hotlinkDesc.getType());
        assertEquals("Config is not expected.", CONFIG, hotlinkDesc.getConfig());
        assertEquals("Label is not expected.", LABEL, hotlinkDesc.getLabel());
        assertEquals("Description is not expected.", DESCRIPTION, hotlinkDesc.getDescription());
       
        descStr = String.format(FORMAT, NAME, TYPE.toString(), CONFIG, "", DESCRIPTION);
        hotlinkDesc = new HotlinkDescriptor(descStr);
        assertEquals("Name is not expected.", NAME, hotlinkDesc.getAttributeName());
        assertEquals("Type is not expected.", TYPE, hotlinkDesc.getType());
        assertEquals("Config is not expected.", CONFIG, hotlinkDesc.getConfig());
        assertEquals("Label is not expected.",  null, hotlinkDesc.getLabel());
        assertEquals("Description is not expected.", DESCRIPTION, hotlinkDesc.getDescription());
       
        descStr = String.format(FORMAT, NAME, TYPE.toString(), "", "", DESCRIPTION);
        hotlinkDesc = new HotlinkDescriptor(descStr);
        assertEquals("Name is not expected.", NAME, hotlinkDesc.getAttributeName());
        assertEquals("Type is not expected.", TYPE, hotlinkDesc.getType());
        assertEquals("Config is not expected.", null, hotlinkDesc.getConfig());
        assertEquals("Label is not expected.",  null, hotlinkDesc.getLabel());
        assertEquals("Description is not expected.", DESCRIPTION, hotlinkDesc.getDescription());
       
    }
View Full Code Here

     */
    @Test
    public void testToString() {
       
        String descStr = String.format(FORMAT, NAME, TYPE.toString(), CONFIG, LABEL, DESCRIPTION);
        HotlinkDescriptor hotlinkDesc = new HotlinkDescriptor(LABEL, DESCRIPTION, NAME, TYPE, CONFIG);
        assertEquals("Description string is not expected.", descStr, hotlinkDesc.toString());
       
        descStr = String.format(FORMAT, NAME, TYPE.toString(), CONFIG, "", DESCRIPTION);
        hotlinkDesc = new HotlinkDescriptor(null, DESCRIPTION, NAME, TYPE, CONFIG);
        assertEquals("Description string is not expected.", descStr, hotlinkDesc.toString());
       
        hotlinkDesc = new HotlinkDescriptor("", DESCRIPTION, NAME, TYPE, CONFIG);
        assertEquals("Description string is not expected.", descStr, hotlinkDesc.toString());
       
        descStr = String.format(FORMAT, NAME, TYPE.toString(), "", "", DESCRIPTION);
        hotlinkDesc = new HotlinkDescriptor(null, DESCRIPTION, NAME, TYPE, null);
        assertEquals("Description string is not expected.", descStr, hotlinkDesc.toString());
       
        hotlinkDesc = new HotlinkDescriptor("", DESCRIPTION, NAME, TYPE, "");
        assertEquals("Description string is not expected.", descStr, hotlinkDesc.toString());
       
    }
View Full Code Here

        fileDocInfo2 = new DocumentInfo("fileDoc2", "fileDocDesc2", file2.getAbsolutePath(), ContentType.FILE, true, Type.ATTACHMENT);
       
        webDocInfo1 = new DocumentInfo("webDoc1", "webDocDesc1", WEB1, ContentType.WEB, false, Type.LINKED);
        webDocInfo2 = new DocumentInfo("webDoc2", "webDocDesc2", WEB2, ContentType.WEB, false, Type.LINKED);
       
        descriptor1 = new HotlinkDescriptor("fileLabel", "description", FILE_ATTR, ContentType.FILE, "config");
        descriptor2 = new HotlinkDescriptor("webLabel", "description", LINK_ATTR, ContentType.WEB, "config");
        descriptor3 = new HotlinkDescriptor("actionLabel", "description", STATE_ATTR, ContentType.ACTION, "config");
       
        setUpInternal();

    }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.document.IHotlinkSource.HotlinkDescriptor

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.