summaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/tests/featurebrowser/FeatureLink.java
blob: 2b91a4262b6328f633d5c82e730baaf75f009246 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* 
@ITMillApache2LicenseForJavaFiles@
 */

package com.itmill.toolkit.tests.featurebrowser;

import com.itmill.toolkit.terminal.ExternalResource;
import com.itmill.toolkit.ui.Component;
import com.itmill.toolkit.ui.Form;
import com.itmill.toolkit.ui.Link;
import com.itmill.toolkit.ui.OrderedLayout;

public class FeatureLink extends Feature {

    public FeatureLink() {
        super();
    }

    protected Component getDemoComponent() {

        final OrderedLayout l = new OrderedLayout();

        final Link lnk = new Link("Link caption", new ExternalResource(
                "http://www.itmill.com"));
        l.addComponent(lnk);

        // Properties
        propertyPanel = new PropertyPanel(lnk);
        final Form ap = propertyPanel.createBeanPropertySet(new String[] {
                "targetName", "targetWidth", "targetHeight", "targetBorder" });
        ap.replaceWithSelect("targetBorder", new Object[] {
                new Integer(Link.TARGET_BORDER_DEFAULT),
                new Integer(Link.TARGET_BORDER_MINIMAL),
                new Integer(Link.TARGET_BORDER_NONE) }, new Object[] {
                "Default", "Minimal", "None" });
        propertyPanel.addProperties("Link Properties", ap);

        setJavadocURL("ui/Link.html");

        return l;
    }

    protected String getExampleSrc() {
        return "Link link = new Link(\"Link caption\",new ExternalResource(\"http://www.itmill.com\"));\n";
    }

    protected String getDescriptionXHTML() {
        return "The link feature allows for making refences to both internal and external resources. "
                + "The link can open the new resource in a new window, allowing for control of the newly "
                + "opened windows attributes, such as size and border. "
                + "<br /><br />"
                + " For example you can create an application pop-up or create link to external resources.";

    }

    protected String getImage() {
        return "icon_demo.png";
    }

    protected String getTitle() {
        return "Link";
    }
}