summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/DesignSynchronizable.java
blob: 91533cc93b46fe25550e2b411c45fa1c7cf8d340 (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
/*
 * Copyright 2000-2014 Vaadin Ltd.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.vaadin.ui;

import org.jsoup.nodes.Element;

import com.vaadin.ui.declarative.DesignContext;

/**
 * Interface to be implemented by all the components that can be read from or
 * written to HTML design representation. TODO: add reference to VisualDesigner
 * 
 * @since 7.4
 * 
 * @author Vaadin Ltd
 */
public interface DesignSynchronizable extends Component {

    /**
     * Update the component state based on the given design. The component is
     * responsible not only for updating itself but also ensuring that its
     * children update their state based on the design.
     * <p>
     * This method must not modify the design.
     * 
     * @since 7.4
     * @param design
     *            The design as HTML to obtain the state from
     * @param designContext
     *            The DesignContext instance used for parsing the design
     */
    public void synchronizeFromDesign(Element design,
            DesignContext designContext);

    /**
     * Update the given design based on the component state. The component is
     * responsible not only for updating itself but also for ensuring its
     * children update themselves in the correct position in the design. The
     * caller of this method should not assume that contents of the
     * <code>design</code> parameter are presented.
     * <p>
     * This method must not modify the component state.
     * 
     * @since 7.4
     * @param design
     *            The design as HTML to update with the current state
     * @param designContext
     */
    public void synchronizeToDesign(Element design, DesignContext designContext);
}