import com.vaadin.ui.Component;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
*
*/
@SuppressWarnings("unchecked")
-public class BasicRandomTest extends com.vaadin.Application implements
- Button.ClickListener {
+public class BasicRandomTest extends com.vaadin.Application implements Button.ClickListener {
// Seed with fixed number to ensure predeterministic AUT behaviour
private Random rand;
private static int COMPONENT_MAX_GROUPED_NUMBER = 5;
- private final OrderedLayout mainLayout = new OrderedLayout();
+ private final VerticalLayout mainLayout = new VerticalLayout();
private Layout testingLayout;
private final TextField randomSeedValue = new TextField("Seed for random");
- private final Button seedShuffle = new Button("Shuffle with seed", this,
- "seedShuffle");
+ private final Button seedShuffle = new Button("Shuffle with seed", this, "seedShuffle");
- private final Button randomShuffle = new Button(
- "Seed randomly and shuffle", this, "randomShuffle");
+ private final Button randomShuffle = new Button("Seed randomly and shuffle", this, "randomShuffle");
private Label display = null;
// Setup contains restart button and deterministic component shuffler
// Test requirement: test cases must be reproducable (use seed)
- mainLayout.addComponent(new Label(
- "<H3>ATFTest with randomized Calculator functionality</H3>"
- + "Buttons with X captions contain calculator number, "
- + "minus, add, multiply, divisor or clear "
- + "button functionalities.<br />Layouts, \"noise\" "
- + "components and component placing is randomized "
- + "after each application restart.<br />"
- + "Test cases should exercise calculator functions "
- + "through X buttons and ensure that Result label "
- + "contains correct value.", Label.CONTENT_XHTML));
-
- final OrderedLayout setupLayout = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ mainLayout.addComponent(new Label("<H3>ATFTest with randomized Calculator functionality</H3>" + "Buttons with X captions contain calculator number, " + "minus, add, multiply, divisor or clear " + "button functionalities.<br />Layouts, \"noise\" " + "components and component placing is randomized " + "after each application restart.<br />" + "Test cases should exercise calculator functions " + "through X buttons and ensure that Result label " + "contains correct value.", Label.CONTENT_XHTML));
+
+ final HorizontalLayout setupLayout = new HorizontalLayout();
final Panel statusPanel = new Panel("Status");
statusPanel.setWidth(200);
setupLayout.addComponent(statusPanel);
}
try {
// randomize using user given value
- rand = new Random(Long.parseLong((String) randomSeedValue
- .getValue()));
+ rand = new Random(Long.parseLong((String) randomSeedValue.getValue()));
} catch (final Exception e) {
randomize();
}
addComponents(testingLayout);
eventCounter = 0;
- statusLabel.setValue("#" + eventCounter + ": button <none>"
- + ", value " + Double.toString(current));
+ statusLabel.setValue("#" + eventCounter + ": button <none>" + ", value " + Double.toString(current));
}
// initialize random with random seed and shuffle
components.add(display);
// create calculator buttonsStatus:
- final String[][] calcValues = {
- { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-",
- "*", "/", "=", "C" },
- { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "plus",
- "minus", "multiple", "divisor", "equals", "clear" } };
+ final String[][] calcValues = { { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-", "*", "/", "=", "C" }, { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "plus", "minus", "multiple", "divisor", "equals", "clear" } };
// final String[] randomizedCaptions = { "a", "b", "c", "y", "8", "3" };
// String[] randomizedCaptions = { "X" };
buttonValues = new HashMap<Button, String>();
private void addComponents(Layout layout) {
while (components.size() > 0) {
// Get random container
- final ComponentContainer container = randomComponents
- .getRandomComponentContainer("" + captionCounter++);
+ final ComponentContainer container = randomComponents.getRandomComponentContainer("" + captionCounter++);
layout.addComponent(container);
// Get random amount of components for above container
final int groupsize = rand.nextInt(COMPONENT_MAX_GROUPED_NUMBER) + 1;
final Component c = getComponent();
if (c != null) {
if (container instanceof TabSheet) {
- final ComponentContainer tab = (ComponentContainer) ((TabSheet) container)
- .getSelectedTab();
+ final ComponentContainer tab = (ComponentContainer) ((TabSheet) container).getSelectedTab();
tab.addComponent(c);
} else if (container instanceof GridLayout) {
final GridLayout gl = (GridLayout) container;
// Number button pressed
current = current * 10 + Double.parseDouble(value);
display.setValue(Double.toString(current));
- statusLabel.setValue("#" + eventCounter + ": button " + value
- + ", value " + Double.toString(current));
- System.out.println("#" + eventCounter + ": button " + value
- + ", value " + Double.toString(current));
+ statusLabel.setValue("#" + eventCounter + ": button " + value + ", value " + Double.toString(current));
+ System.out.println("#" + eventCounter + ": button " + value + ", value " + Double.toString(current));
} catch (final java.lang.NumberFormatException e) {
// Operation button pressed
if (operation.equals("+")) {
operation = value;
current = 0.0;
display.setValue(Double.toString(stored));
- statusLabel.setValue("#" + eventCounter + ": button " + value
- + ", value " + Double.toString(stored));
- System.out.println("#" + eventCounter + ": button " + value
- + ", value " + Double.toString(stored));
+ statusLabel.setValue("#" + eventCounter + ": button " + value + ", value " + Double.toString(stored));
+ System.out.println("#" + eventCounter + ": button " + value + ", value " + Double.toString(stored));
}
}
@Override
public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) {
final Throwable e = event.getThrowable();
- System.err.println(getUser().toString() + " terminalError: "
- + e.toString());
+ System.err.println(getUser().toString() + " terminalError: " + e.toString());
e.printStackTrace();
}
}
* @since 4.0.0
*
*/
-public class CustomLayoutDemo extends com.vaadin.Application implements
- Listener {
+public class CustomLayoutDemo extends com.vaadin.Application implements Listener {
private CustomLayout mainLayout = null;
// Create custom layout, themes/example/layout/mainLayout.html
mainLayout = new CustomLayout("mainLayout");
// wrap custom layout inside a panel
- final Panel customLayoutPanel = new Panel(
- "Panel containing custom layout (mainLayout.html)");
+ final Panel customLayoutPanel = new Panel("Panel containing custom layout (mainLayout.html)");
customLayoutPanel.addComponent(mainLayout);
// Login components
setBody("Welcome");
// Add heading label and custom layout panel to main window
- mainWindow.addComponent(new Label("<h3>Custom layout demo</h3>",
- Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label("<h3>Custom layout demo</h3>", Label.CONTENT_XHTML));
mainWindow.addComponent(customLayoutPanel);
}
if (username.getValue().toString().length() < 1) {
username.setValue("Anonymous");
}
- mainLayout.replaceComponent(loginButton, new Label("Welcome user <em>"
- + username.getValue() + "</em>", Label.CONTENT_XHTML));
+ mainLayout.replaceComponent(loginButton, new Label("Welcome user <em>" + username.getValue() + "</em>", Label.CONTENT_XHTML));
}
/**
import com.vaadin.ui.Component;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
//
// Create horizontal ordered layout
//
- final OrderedLayout layoutA = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ final HorizontalLayout layoutA = new HorizontalLayout();
// Add 4 panels
fillLayout(layoutA, 4);
//
// Create vertical ordered layout
//
- final OrderedLayout layoutB = new OrderedLayout(
- OrderedLayout.ORIENTATION_VERTICAL);
+ final VerticalLayout layoutB = new VerticalLayout();
// Add 4 panels
fillLayout(layoutB, 4);
//
// Add demo layouts to main window
//
- mainWindow.addComponent(new Label(
- "<h3>Horizontal ordered layout</h3>Added four components.",
- Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label("<h3>Horizontal ordered layout</h3>Added four components.", Label.CONTENT_XHTML));
mainWindow.addComponent(layoutA);
- mainWindow.addComponent(new Label(
- "<br /><h3>Vertical ordered layout</h3>Added four components.",
- Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label("<br /><h3>Vertical ordered layout</h3>Added four components.", Label.CONTENT_XHTML));
mainWindow.addComponent(layoutB);
- mainWindow.addComponent(new Label(
- "<br /><h3>Grid Layout (4 x 4)</h3>Added 16 components.",
- Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label("<br /><h3>Grid Layout (4 x 4)</h3>Added 16 components.", Label.CONTENT_XHTML));
mainWindow.addComponent(layoutG);
- mainWindow
- .addComponent(new Label("<br /><h3>Grid Layout (4 x 4)</h3>"
- + "Added four panels and four embedded components "
- + "diagonally with absolute coordinates.",
- Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label("<br /><h3>Grid Layout (4 x 4)</h3>" + "Added four panels and four embedded components " + "diagonally with absolute coordinates.", Label.CONTENT_XHTML));
mainWindow.addComponent(layoutG2);
- mainWindow.addComponent(new Label(
- "<br /><h3>TabSheet</h3>Added above layouts as tabs.",
- Label.CONTENT_XHTML));
+ mainWindow.addComponent(new Label("<br /><h3>TabSheet</h3>Added above layouts as tabs.", Label.CONTENT_XHTML));
mainWindow.addComponent(tabsheet);
}
private Component getExampleComponent(String caption) {
final Panel panel = new Panel();
panel.setCaption("Panel component " + caption);
- panel.addComponent(new Label(
- "Panel is a container for other components, by default it draws a frame around it's "
- + "extremities and may have a caption to clarify the nature of the contained components' purpose."
- + " Panel contains an layout where the actual contained components are added, "
- + "this layout may be switched on the fly.",
- Label.CONTENT_XHTML));
+ panel.addComponent(new Label("Panel is a container for other components, by default it draws a frame around it's " + "extremities and may have a caption to clarify the nature of the contained components' purpose." + " Panel contains an layout where the actual contained components are added, " + "this layout may be switched on the fly.", Label.CONTENT_XHTML));
panel.setWidth(222);
return panel;
}
import com.vaadin.ui.Select;
import com.vaadin.ui.Window;
-public class ListenerOrder extends com.vaadin.Application implements
- Button.ClickListener, PropertySetChangeListener, ItemSetChangeListener,
- ValueChangeListener {
+public class ListenerOrder extends com.vaadin.Application implements Button.ClickListener, PropertySetChangeListener, ItemSetChangeListener, ValueChangeListener {
Button b1;
}
public void buttonClick(ClickEvent event) {
- String msg = "ClickEvent from MyClickListener " + name + ", id="
- + count;
+ String msg = "ClickEvent from MyClickListener " + name + ", id=" + count;
System.out.println(msg);
getMainWindow().showNotification(msg);
}
* @see com.vaadin.ui.Window
* @see com.vaadin.ui.Label
*/
-public class ModalWindow extends com.vaadin.Application implements
- ClickListener {
+public class ModalWindow extends com.vaadin.Application implements ClickListener {
private Window test;
private Button reopen;
if (event.getButton() == reopen) {
openSubWindow();
}
- getMainWindow().addComponent(
- new Label("Button click: " + event.getButton().getCaption()));
+ getMainWindow().addComponent(new Label("Button click: " + event.getButton().getCaption()));
}
private void openSubWindow() {
test = new Window("Modal window");
test.setModal(true);
getMainWindow().addWindow(test);
- test.addComponent(new Label(
- "You have to close this window before accessing others."));
+ test.addComponent(new Label("You have to close this window before accessing others."));
// Textfield for modal window
final TextField f = new TextField();
setMainWindow(main);
- main.addComponent(new Button("Add new subwindow",
- new Button.ClickListener() {
+ main.addComponent(new Button("Add new subwindow", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ final Window w = new Window("sw " + System.currentTimeMillis());
+ main.addWindow(w);
+ w.setPositionX(100);
+ w.setPositionY(100);
+ w.setWidth(200);
+ w.setHeight(200);
+
+ w.setWidth(100);
+ w.setHeight(400);
+
+ final Button closebutton = new Button("Close " + w.getCaption(), new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- final Window w = new Window("sw "
- + System.currentTimeMillis());
- main.addWindow(w);
- w.setPositionX(100);
- w.setPositionY(100);
- w.setWidth(200);
- w.setHeight(200);
-
- w.setWidth(100);
- w.setHeight(400);
-
- final Button closebutton = new Button("Close "
- + w.getCaption(), new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- main.removeWindow(w);
- }
-
- });
- w.addComponent(closebutton);
-
- w.addComponent(new Label(
- "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>",
- Label.CONTENT_XHTML));
-
+ main.removeWindow(w);
}
- }));
- main.addComponent(new Button(
- "Open a currently uncreated application level window",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- try {
- main.open(
- new com.vaadin.terminal.ExternalResource(
- new URL(
- getURL(),
- "mainwin-"
- + System.currentTimeMillis()
- + "/")), null);
- } catch (final MalformedURLException e) {
- }
- }
- }));
+ });
+ w.addComponent(closebutton);
+
+ w.addComponent(new Label("<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>", Label.CONTENT_XHTML));
+
+ }
+ }));
+
+ main.addComponent(new Button("Open a currently uncreated application level window", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ try {
+ main.open(new com.vaadin.terminal.ExternalResource(new URL(getURL(), "mainwin-" + System.currentTimeMillis() + "/")), null);
+ } catch (final MalformedURLException e) {
+ }
+ }
+ }));
- main.addComponent(new Button(
- "Commit (saves window state: size, place, scrollpos)"));
+ main.addComponent(new Button("Commit (saves window state: size, place, scrollpos)"));
}
@Override
final String postfix = name.substring("mainwin-".length());
final Window ww = new Window("Window: " + postfix);
ww.setName(name);
- ww.addComponent(new Label(
- "This is a application-level window opened with name: "
- + name));
+ ww.addComponent(new Label("This is a application-level window opened with name: " + name));
ww.addComponent(new Button("Click me", new Button.ClickListener() {
int state = 0;
public void buttonClick(ClickEvent event) {
- ww.addComponent(new Label("Button clicked " + (++state)
- + " times"));
+ ww.addComponent(new Label("Button clicked " + (++state) + " times"));
}
}));
addWindow(ww);
import java.util.ArrayList;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
/**
*
*/
public class OrderedLayoutSwapComponents extends CustomComponent {
- private final OrderedLayout main;
+ private final AbstractOrderedLayout main;
ArrayList<MyComponent> order = new ArrayList<MyComponent>();
public OrderedLayoutSwapComponents() {
- main = new OrderedLayout();
+ main = new VerticalLayout();
// main.setSizeFull();
setCompositionRoot(main);
createNewView();
private Button down;
MyComponent(String name) {
- OrderedLayout ol = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ HorizontalLayout ol = new HorizontalLayout();
ol.setDebugId(name.replaceAll(" ", ""));
ol.addComponent(new Label(name));
up = new Button("up");
import com.vaadin.terminal.ExternalResource;
import com.vaadin.terminal.ParameterHandler;
import com.vaadin.terminal.URIHandler;
-import com.vaadin.ui.ExpandLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Link;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
*
* @since 3.1.1
*/
-public class Parameters extends com.vaadin.Application implements URIHandler,
- ParameterHandler {
+public class Parameters extends com.vaadin.Application implements URIHandler, ParameterHandler {
private final Label context = new Label();
main.addURIHandler(this);
main.addParameterHandler(this);
- final ExpandLayout layout = new ExpandLayout();
- final Label info = new Label("To test URI and Parameter Handlers, "
- + "add get parameters to URL. For example try examples below: ");
+ final VerticalLayout layout = new VerticalLayout();
+ final Label info = new Label("To test URI and Parameter Handlers, " + "add get parameters to URL. For example try examples below: ");
info.setCaption("Usage info");
layout.addComponent(info);
try {
final URL u1 = new URL(getURL(), "test/uri?test=1&test=2");
final URL u2 = new URL(getURL(), "foo/bar?mary=john&count=3");
- layout.addComponent(new Link(u1.toString(),
- new ExternalResource(u1)));
+ layout.addComponent(new Link(u1.toString(), new ExternalResource(u1)));
layout.addComponent(new Label("Or this: "));
- layout.addComponent(new Link(u2.toString(),
- new ExternalResource(u2)));
+ layout.addComponent(new Link(u2.toString(), new ExternalResource(u2)));
} catch (final Exception e) {
- System.out.println("Couldn't get hostname for this machine: "
- + e.toString());
+ System.out.println("Couldn't get hostname for this machine: " + e.toString());
e.printStackTrace();
}
params.addContainerProperty("Value", String.class, "");
final Panel panel2 = new Panel("Parameter Handler");
params.setSizeFull();
- panel2.setLayout(new ExpandLayout());
+ panel2.setLayout(new VerticalLayout());
panel2.getLayout().setMargin(true);
params.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID);
layout.addComponent(panel2);
// expand parameter panel and its table
- layout.expand(panel2);
+ layout.setExpandRatio(panel2, 1);
layout.setMargin(true);
layout.setSpacing(true);
*/
public void handleParameters(Map<String, String[]> parameters) {
params.removeAllItems();
- for (final Iterator<String> i = parameters.keySet().iterator(); i
- .hasNext();) {
+ for (final Iterator<String> i = parameters.keySet().iterator(); i.hasNext();) {
final String name = i.next();
final String[] values = parameters.get(name);
String v = "";
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.DateField;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
public class PerformanceTestBasicComponentRendering extends CustomComponent {
- private final OrderedLayout main;
+ private final VerticalLayout main;
- private final OrderedLayout testContainer;
+ private final VerticalLayout testContainer;
private Date startTime;
public PerformanceTestBasicComponentRendering() {
- main = new OrderedLayout();
+ main = new VerticalLayout();
setCompositionRoot(main);
addInfo();
result = new Label();
main.addComponent(result);
- testContainer = new OrderedLayout();
+ testContainer = new VerticalLayout();
- final Table t = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(5, 200);
+ final Table t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(5, 200);
Table t2 = new Table("Test Table with 199 rows rendered initially") {
@Override
- public void changeVariables(Object source,
- Map<String, Object> variables) {
+ public void changeVariables(Object source, Map<String, Object> variables) {
super.changeVariables(source, variables);
// end timing on cache row request
endTest();
import java.util.Date;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
public class PerformanceTestLabelsAndOrderedLayouts extends CustomComponent {
- private final OrderedLayout main;
+ private final AbstractOrderedLayout main;
- private final OrderedLayout testContainer;
+ private final AbstractOrderedLayout testContainer;
private Date startTime;
private static final int INITIAL_COMPONENTS = 1000;
public PerformanceTestLabelsAndOrderedLayouts() {
- main = new OrderedLayout();
+ main = new VerticalLayout();
setCompositionRoot(main);
addInfo();
result = new Label();
main.addComponent(result);
- main.addComponent(new Button("click when rendered",
- new ClickListener() {
+ main.addComponent(new Button("click when rendered", new ClickListener() {
- public void buttonClick(ClickEvent event) {
- endTest();
- }
- }));
+ public void buttonClick(ClickEvent event) {
+ endTest();
+ }
+ }));
- main.addComponent(new Button(
- "Click for layout repaint (cached components)",
- new ClickListener() {
- public void buttonClick(ClickEvent event) {
- testContainer.requestRepaint();
- }
- }));
+ main.addComponent(new Button("Click for layout repaint (cached components)", new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ testContainer.requestRepaint();
+ }
+ }));
- testContainer = new OrderedLayout();
+ testContainer = new VerticalLayout();
for (int i = 0; i < INITIAL_COMPONENTS; i++) {
Label l = new Label("foo" + i);
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
public class PerformanceTestSubTreeCaching extends CustomComponent {
- private final OrderedLayout main;
+ private final VerticalLayout main;
- private final OrderedLayout testContainer;
+ private final VerticalLayout testContainer;
private Date startTime;
private final Label result;
- private static final String DESCRIPTION = "Hypothesis: Toolkit 4 has major architechtural problem when adding "
- + "small incrementall updates to a container which has either a lot or "
- + "some very slow components in it. Toolkit 5 has 'subtree caching' and a"
- + " small amount of logic in containers, so CommunicationManager can assure"
- + " that client do not need information about unchanged components it contains."
- + " Completing test ought to be much faster with Toolkit 5.";
+ private static final String DESCRIPTION = "Hypothesis: Toolkit 4 has major architechtural problem when adding " + "small incrementall updates to a container which has either a lot or " + "some very slow components in it. Toolkit 5 has 'subtree caching' and a" + " small amount of logic in containers, so CommunicationManager can assure" + " that client do not need information about unchanged components it contains." + " Completing test ought to be much faster with Toolkit 5.";
private static final int INITIAL_COMPONENTS = 40;
public PerformanceTestSubTreeCaching() {
- main = new OrderedLayout();
+ main = new VerticalLayout();
setCompositionRoot(main);
addInfo();
result = new Label();
main.addComponent(result);
- testContainer = new OrderedLayout();
+ testContainer = new VerticalLayout();
populateContainer(testContainer, INITIAL_COMPONENTS);
main.addComponent(testContainer);
}
*
* @param testContainer2
*/
- private void populateContainer(OrderedLayout container, int n) {
+ private void populateContainer(VerticalLayout container, int n) {
for (int i = 0; i < n; i++) {
// array_type array_element = [i];
- final Table t = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(5, 100);
+ final Table t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(5, 100);
container.addComponent(t);
}
}
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.DateField;
import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Link;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
setMainWindow(mainWindow);
// Create horizontal ordered layout
- final Panel panelA = new Panel(
- "Panel containing horizontal ordered layout");
- OrderedLayout layoutA = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ final Panel panelA = new Panel("Panel containing horizontal ordered layout");
+ HorizontalLayout layoutA = new HorizontalLayout();
// Add 4 random components
fillLayout(layoutA, componentCountA);
// Add layout to panel
panelA.addComponent(layoutA);
// Create vertical ordered layout
- final Panel panelB = new Panel(
- "Panel containing vertical ordered layout");
- OrderedLayout layoutB = new OrderedLayout(
- OrderedLayout.ORIENTATION_VERTICAL);
+ final Panel panelB = new Panel("Panel containing vertical ordered layout");
+ VerticalLayout layoutB = new VerticalLayout();
// Add 4 random components
fillLayout(layoutB, componentCountB);
// Add layout to panel
// Create grid layout
final int gridSize = (int) java.lang.Math.sqrt(componentCountC);
- final Panel panelG = new Panel("Panel containing grid layout ("
- + gridSize + " x " + gridSize + ")");
+ final Panel panelG = new Panel("Panel containing grid layout (" + gridSize + " x " + gridSize + ")");
GridLayout layoutG = new GridLayout(gridSize, gridSize);
// Add 12 random components
fillLayout(layoutG, componentCountC);
// Create TabSheet
final TabSheet tabsheet = new TabSheet();
tabsheet.setCaption("Tabsheet, above layouts are added to this component");
- layoutA = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ layoutA = new HorizontalLayout();
// Add 4 random components
fillLayout(layoutA, componentCountA);
tabsheet.addTab(layoutA, "Horizontal ordered layout", null);
- layoutB = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+ layoutB = new VerticalLayout();
// Add 4 random components
fillLayout(layoutB, componentCountB);
tabsheet.addTab(layoutB, "Vertical ordered layout", null);
// Link
result = new Panel();
result.setCaption("Panel component " + caption);
- ((Panel) result)
- .addComponent(new Label(
- "Panel is a container for other components, by default it draws a frame around it's "
- + "extremities and may have a caption to clarify the nature of the contained components' purpose."
- + " Panel contains an layout where the actual contained components are added, "
- + "this layout may be switched on the fly."));
+ ((Panel) result).addComponent(new Label("Panel is a container for other components, by default it draws a frame around it's " + "extremities and may have a caption to clarify the nature of the contained components' purpose." + " Panel contains an layout where the actual contained components are added, " + "this layout may be switched on the fly."));
((Panel) result).setWidth(250);
break;
case 6:
context.addItem("Accordion");
context.setValue("Main window");
- final OptionGroup testComponent = new OptionGroup(
- "TestComponent 100%x100%");
+ final OptionGroup testComponent = new OptionGroup("TestComponent 100%x100%");
testComponent.addItem("Label");
testComponent.addItem("Table");
testComponent.setValue("Label");
private Component getTestComponent() {
if (getTable) {
- Table testTable = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(4, 50);
+ Table testTable = TestForTablesInitialColumnWidthLogicRendering.getTestTable(4, 50);
testTable.setSizeFull();
return testTable;
} else {
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.CustomComponent;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Table;\r
+import com.vaadin.ui.VerticalLayout;\r
\r
public class StressComponentsInTable extends CustomComponent {\r
\r
public StressComponentsInTable() {\r
- final OrderedLayout main = new OrderedLayout();\r
+ final VerticalLayout main = new VerticalLayout();\r
setCompositionRoot(main);\r
\r
main.addComponent(getTestTable(4, 1000));\r
\r
public void buttonClick(ClickEvent event) {\r
Button b = event.getButton();\r
- System.out.println(b.getCaption() + " click: "\r
- + (new Date()).toGMTString());\r
+ System.out.println(b.getCaption() + " click: " + (new Date()).toGMTString());\r
System.out.println(b.getApplication());\r
\r
}\r
return t;\r
}\r
\r
- static String[] testString = new String[] { "Jacob", "Michael", "Joshua",\r
- "Matthew", "Ethan", "Andrew", "Daniel", "Anthony", "Christopher",\r
- "Joseph", "William", "Alexander", "Ryan", "David", "Nicholas",\r
- "Tyler", "James", "John", "Jonathan", "Nathan", "Samuel",\r
- "Christian", "Noah", "Dylan", "Benjamin", "Logan", "Brandon",\r
- "Gabriel", "Zachary", "Jose", "Elijah", "Angel", "Kevin", "Jack",\r
- "Caleb", "Justin", "Austin", "Evan", "Robert", "Thomas", "Luke",\r
- "Mason", "Aidan", "Jackson", "Isaiah", "Jordan", "Gavin", "Connor",\r
- "Aiden", "Isaac", "Jason", "Cameron", "Hunter", "Jayden", "Juan",\r
- "Charles", "Aaron", "Lucas", "Luis", "Owen", "Landon", "Diego",\r
- "Brian", "Adam", "Adrian", "Kyle", "Eric", "Ian", "Nathaniel",\r
- "Carlos", "Alex", "Bryan", "Jesus", "Julian", "Sean", "Carter",\r
- "Hayden", "Jeremiah", "Cole", "Brayden", "Wyatt", "Chase",\r
- "Steven", "Timothy", "Dominic", "Sebastian", "Xavier", "Jaden",\r
- "Jesse", "Devin", "Seth", "Antonio", "Richard", "Miguel", "Colin",\r
- "Cody", "Alejandro", "Caden", "Blake", "Carson" };\r
+ static String[] testString = new String[] { "Jacob", "Michael", "Joshua", "Matthew", "Ethan", "Andrew", "Daniel", "Anthony", "Christopher", "Joseph", "William", "Alexander", "Ryan", "David", "Nicholas", "Tyler", "James", "John", "Jonathan", "Nathan", "Samuel", "Christian", "Noah", "Dylan", "Benjamin", "Logan", "Brandon", "Gabriel", "Zachary", "Jose", "Elijah", "Angel", "Kevin", "Jack", "Caleb", "Justin", "Austin", "Evan", "Robert", "Thomas", "Luke", "Mason", "Aidan", "Jackson", "Isaiah", "Jordan", "Gavin", "Connor", "Aiden", "Isaac", "Jason", "Cameron", "Hunter", "Jayden", "Juan", "Charles", "Aaron", "Lucas", "Luis", "Owen", "Landon", "Diego", "Brian", "Adam", "Adrian", "Kyle", "Eric", "Ian", "Nathaniel", "Carlos", "Alex", "Bryan", "Jesus", "Julian", "Sean", "Carter", "Hayden", "Jeremiah", "Cole", "Brayden", "Wyatt", "Chase", "Steven", "Timothy", "Dominic", "Sebastian", "Xavier", "Jaden", "Jesse", "Devin", "Seth", "Antonio", "Richard", "Miguel", "Colin", "Cody", "Alejandro", "Caden", "Blake", "Carson" };\r
\r
public static String rndString() {\r
return testString[(int) (Math.random() * testString.length)];\r
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.CustomComponent;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Table;\r
+import com.vaadin.ui.VerticalLayout;\r
\r
-public class TableChangingDatasource extends CustomComponent implements\r
- ClickListener {\r
+public class TableChangingDatasource extends CustomComponent implements ClickListener {\r
Table t;\r
Table[] ta = new Table[4];\r
private int mode = 0;\r
\r
public TableChangingDatasource() {\r
- final OrderedLayout main = new OrderedLayout();\r
+ final VerticalLayout main = new VerticalLayout();\r
\r
- main.addComponent(new Label(\r
- "Table should look sane after data source changes"));\r
+ main.addComponent(new Label("Table should look sane after data source changes"));\r
\r
t = new Table();\r
\r
t.setWidth(500);\r
t.setHeight(300);\r
\r
- ta[0] = TestForTablesInitialColumnWidthLogicRendering\r
- .getTestTable(3, 0);\r
- ta[1] = TestForTablesInitialColumnWidthLogicRendering\r
- .getTestTable(3, 7);\r
- ta[2] = TestForTablesInitialColumnWidthLogicRendering\r
- .getTestTable(3, 5);\r
- ta[3] = TestForTablesInitialColumnWidthLogicRendering\r
- .getTestTable(3, 1);\r
+ ta[0] = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 0);\r
+ ta[1] = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 7);\r
+ ta[2] = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 5);\r
+ ta[3] = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 1);\r
\r
main.addComponent(t);\r
main.addComponent(new Button("switch DS", this));\r
import com.vaadin.data.Property.ValueChangeEvent;\r
import com.vaadin.ui.CustomComponent;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Table;\r
+import com.vaadin.ui.VerticalLayout;\r
\r
-public class TableSelectTest extends CustomComponent implements\r
- Table.ValueChangeListener {\r
+public class TableSelectTest extends CustomComponent implements Table.ValueChangeListener {\r
\r
public TableSelectTest() {\r
- final OrderedLayout main = new OrderedLayout();\r
+ final VerticalLayout main = new VerticalLayout();\r
setCompositionRoot(main);\r
main.addComponent(new Label("Hello World!"));\r
\r
* @author IT Mill Ltd.
*
*/
-public class TestBench extends com.vaadin.Application implements
- Property.ValueChangeListener {
+public class TestBench extends com.vaadin.Application implements Property.ValueChangeListener {
// Add here packages which are used for finding testable classes
- String[] testablePackages = { "com.vaadin.tests", "com.vaadin.demo",
- "com.vaadin.demo.colorpicker", "com.vaadin.demo.features",
- "com.vaadin.tests.tickets", "com.vaadin.tests.book" };
+ String[] testablePackages = { "com.vaadin.tests", "com.vaadin.demo", "com.vaadin.demo.colorpicker", "com.vaadin.demo.features", "com.vaadin.tests.tickets" };
HierarchicalContainer testables = new HierarchicalContainer();
testables.addItem(testablePackages[p]);
try {
final List<Class<?>> testableClasses = getTestableClassesForPackage(testablePackages[p]);
- for (final Iterator<Class<?>> it = testableClasses.iterator(); it
- .hasNext();) {
+ for (final Iterator<Class<?>> it = testableClasses.iterator(); it.hasNext();) {
final Class<?> t = it.next();
// ignore TestBench itself
if (t.equals(TestBench.class)) {
menu = new Tree("Testables", testables);
- for (final Iterator<Class<?>> i = itemCaptions.keySet().iterator(); i
- .hasNext();) {
+ for (final Iterator<Class<?>> i = itemCaptions.keySet().iterator(); i.hasNext();) {
final Class<?> testable = i.next();
// simplify captions
- final String name = testable.getName().substring(
- testable.getName().lastIndexOf('.') + 1);
+ final String name = testable.getName().substring(testable.getName().lastIndexOf('.') + 1);
menu.setItemCaption(testable, name);
}
// expand all root items
if (next instanceof Class) {
Class<?> c = (Class<?>) next;
String string = c.getSimpleName();
- if (string.toLowerCase().contains(
- fragment.toLowerCase())) {
+ if (string.toLowerCase().contains(fragment.toLowerCase())) {
menu.setValue(c);
mainLayout.setSplitPosition(0);
return;
}
}
- getMainWindow().showNotification(
- "No potential matc for #" + fragment);
+ getMainWindow().showNotification("No potential matc for #" + fragment);
}
} catch (final Exception e1) {
e1.printStackTrace();
VerticalLayout lo = new VerticalLayout();
- lo.addComponent(new Label(
- "Cannot create application / custom component: "
- + e1.toString()));
+ lo.addComponent(new Label("Cannot create application / custom component: " + e1.toString()));
- Link l = new Link("Try opening via app runner",
- new ExternalResource("../run/" + c.getName()));
+ Link l = new Link("Try opening via app runner", new ExternalResource("../run/" + c.getName()));
lo.addComponent(l);
return lo;
* @return
* @throws ClassNotFoundException
*/
- public static List<Class<?>> getTestableClassesForPackage(String packageName)
- throws Exception {
+ public static List<Class<?>> getTestableClassesForPackage(String packageName) throws Exception {
final ArrayList<File> directories = new ArrayList<File>();
try {
- final ClassLoader cld = Thread.currentThread()
- .getContextClassLoader();
+ final ClassLoader cld = Thread.currentThread().getContextClassLoader();
if (cld == null) {
throw new ClassNotFoundException("Can't get class loader.");
}
directories.add(new File(url.getFile()));
}
} catch (final Exception x) {
- throw new Exception(packageName
- + " does not appear to be a valid package.");
+ throw new Exception(packageName + " does not appear to be a valid package.");
}
final ArrayList<Class<?>> classes = new ArrayList<Class<?>>();
// we are only interested in .class files
if (files[j].endsWith(".class")) {
// removes the .class extension
- final String p = packageName + '.'
- + files[j].substring(0, files[j].length() - 6);
+ final String p = packageName + '.' + files[j].substring(0, files[j].length() - 6);
final Class<?> c = Class.forName(p);
if (c.getSuperclass() != null) {
- if ((c.getSuperclass()
- .equals(com.vaadin.Application.class))) {
+ if ((c.getSuperclass().equals(com.vaadin.Application.class))) {
classes.add(c);
- } else if ((c.getSuperclass()
- .equals(com.vaadin.ui.CustomComponent.class))) {
+ } else if ((c.getSuperclass().equals(com.vaadin.ui.CustomComponent.class))) {
classes.add(c);
}
}
}
}
} else {
- throw new ClassNotFoundException(packageName + " ("
- + directory.getPath()
- + ") does not appear to be a valid package");
+ throw new ClassNotFoundException(packageName + " (" + directory.getPath() + ") does not appear to be a valid package");
}
}
VerticalLayout main = new VerticalLayout();
final String eventListenerString = "Component.Listener feedback: ";
- Label eventListenerFeedback = new Label(eventListenerString
- + " <no events occured>");
+ Label eventListenerFeedback = new Label(eventListenerString + " <no events occured>");
int count = 0;
public TestCaptionWrapper() {
public void createNewView() {
main.removeAllComponents();
- main.addComponent(new Label(
- "Each Layout and their contained components should "
- + "have icon, caption, description, user error defined. "
- + "Eeach layout should contain similar components."));
+ main.addComponent(new Label("Each Layout and their contained components should " + "have icon, caption, description, user error defined. " + "Eeach layout should contain similar components."));
main.addComponent(eventListenerFeedback);
final VerticalLayout tab2 = new VerticalLayout();
test(tab2);
populateLayout(tab2);
- tabsheet.addTab(tab1, "TabSheet tab1", new ClassResource("m.gif",
- getApplication()));
- tabsheet.addTab(tab2, "TabSheet tab2", new ClassResource("m.gif",
- getApplication()));
+ tabsheet.addTab(tab1, "TabSheet tab1", new ClassResource("m.gif", getApplication()));
+ tabsheet.addTab(tab2, "TabSheet tab2", new ClassResource("m.gif", getApplication()));
final VerticalLayout expandLayout = new VerticalLayout();
test(expandLayout);
final Label label = new Label("Label " + count++);
test(layout, label);
- final Link link = new Link("Link " + count++, new ExternalResource(
- "www.vaadin.com"));
+ final Link link = new Link("Link " + count++, new ExternalResource("www.vaadin.com"));
test(layout, link);
- final NativeSelect nativeSelect = new NativeSelect("NativeSelect "
- + count++);
+ final NativeSelect nativeSelect = new NativeSelect("NativeSelect " + count++);
test(layout, nativeSelect);
- final OptionGroup optionGroup = new OptionGroup("OptionGroup "
- + count++);
+ final OptionGroup optionGroup = new OptionGroup("OptionGroup " + count++);
test(layout, optionGroup);
final ProgressIndicator pi = new ProgressIndicator();
final Tree tree = new Tree("Tree " + count++);
test(layout, tree);
- final TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect "
- + count++);
+ final TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect " + count++);
test(layout, twinColSelect);
final Upload upload = new Upload("Upload (non-functional)", null);
test(layout, upload);
// Custom components
- layout.addComponent(new Label("<B>Below are few custom components</B>",
- Label.CONTENT_XHTML));
+ layout.addComponent(new Label("<B>Below are few custom components</B>", Label.CONTENT_XHTML));
final TestForUpload tfu = new TestForUpload();
layout.addComponent(tfu);
}
public void componentEvent(Event event) {
- final String feedback = eventListenerString + " source="
- + event.getSource() + ", toString()=" + event.toString();
+ final String feedback = eventListenerString + " source=" + event.getSource() + ", toString()=" + event.toString();
System.out.println("eventListenerFeedback: " + feedback);
eventListenerFeedback.setValue(feedback);
}
import com.vaadin.ui.Label;\r
import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
/**\r
\r
public TestComponentAddAndRecursion() {\r
\r
- OrderedLayout main = new OrderedLayout();\r
+ VerticalLayout main = new VerticalLayout();\r
setCompositionRoot(main);\r
\r
l = new Label("A");\r
public void buttonClick(ClickEvent event) {\r
try {\r
p3.addComponent(p2);\r
- getWindow().showNotification("ERROR",\r
- "This should have failed",\r
- Window.Notification.TYPE_ERROR_MESSAGE);\r
+ getWindow().showNotification("ERROR", "This should have failed", Window.Notification.TYPE_ERROR_MESSAGE);\r
} catch (Exception e) {\r
- getWindow().showNotification("OK", "threw, as expected",\r
- Window.Notification.TYPE_ERROR_MESSAGE);\r
+ getWindow().showNotification("OK", "threw, as expected", Window.Notification.TYPE_ERROR_MESSAGE);\r
}\r
}\r
\r
p.addComponent(p2);\r
try {\r
p3.addComponent(p);\r
- getWindow().showNotification("ERROR",\r
- "This should have failed",\r
- Window.Notification.TYPE_ERROR_MESSAGE);\r
+ getWindow().showNotification("ERROR", "This should have failed", Window.Notification.TYPE_ERROR_MESSAGE);\r
} catch (Exception e) {\r
- getWindow().showNotification("OK", "threw, as expected",\r
- Window.Notification.TYPE_ERROR_MESSAGE);\r
+ getWindow().showNotification("OK", "threw, as expected", Window.Notification.TYPE_ERROR_MESSAGE);\r
}\r
}\r
\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.ComboBox;\r
import com.vaadin.ui.CustomComponent;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Label;\r
import com.vaadin.ui.ListSelect;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.Table;\r
import com.vaadin.ui.Tree;\r
+import com.vaadin.ui.VerticalLayout;\r
\r
/**\r
* @author marc\r
cont.addContainerProperty("Asd", String.class, "qwe");\r
cont.addContainerProperty("Bar", String.class, "foo");\r
\r
- OrderedLayout main = new OrderedLayout();\r
+ VerticalLayout main = new VerticalLayout();\r
setCompositionRoot(main);\r
\r
- main.addComponent(new Label(\r
- "The same IndexedContainer is wrapped in a ordered/hierarchical wrapper and is set as data source for all components . The buttons only affect the 'original' IndexedContainer."));\r
+ main.addComponent(new Label("The same IndexedContainer is wrapped in a ordered/hierarchical wrapper and is set as data source for all components . The buttons only affect the 'original' IndexedContainer."));\r
\r
- OrderedLayout h = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ HorizontalLayout h = new HorizontalLayout();\r
\r
main.addComponent(h);\r
\r
- OrderedLayout v = new OrderedLayout();\r
+ VerticalLayout v = new VerticalLayout();\r
h.addComponent(v);\r
tbl = new Table();\r
tbl.setHeight(200);\r
tbl2.setImmediate(true);\r
tbl2.addListener(new Table.ValueChangeListener() {\r
public void valueChange(ValueChangeEvent event) {\r
- System.err.println("Value now "\r
- + event.getProperty().getValue());\r
+ System.err.println("Value now " + event.getProperty().getValue());\r
\r
}\r
});\r
// non-ordered container will get wrapped\r
tbl2.setContainerDataSource(hierarchical);\r
\r
- OrderedLayout buttons = new OrderedLayout();\r
+ VerticalLayout buttons = new VerticalLayout();\r
v.addComponent(buttons);\r
\r
Button b = new Button("table.commit()", new Button.ClickListener() {\r
});\r
buttons.addComponent(b);\r
\r
- b = new Button("indexedcontainer.addItem()",\r
- new Button.ClickListener() {\r
+ b = new Button("indexedcontainer.addItem()", new Button.ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- cont.addItem(new Integer(cnt++));\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ cont.addItem(new Integer(cnt++));\r
+ }\r
\r
- });\r
+ });\r
buttons.addComponent(b);\r
- b = new Button("indexedcontainer.addItem(null)",\r
- new Button.ClickListener() {\r
+ b = new Button("indexedcontainer.addItem(null)", new Button.ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- cont.addItem(null);\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ cont.addItem(null);\r
+ }\r
\r
- });\r
+ });\r
buttons.addComponent(b);\r
- b = new Button("indexedcontainer.removeItem(table.lastItemId()",\r
- new Button.ClickListener() {\r
+ b = new Button("indexedcontainer.removeItem(table.lastItemId()", new Button.ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- cont.removeItem(tbl.lastItemId());\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ cont.removeItem(tbl.lastItemId());\r
+ }\r
\r
- });\r
+ });\r
buttons.addComponent(b);\r
\r
- b = new Button("indexedcontainer.addContainerProperty()",\r
- new Button.ClickListener() {\r
+ b = new Button("indexedcontainer.addContainerProperty()", new Button.ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- cont.addContainerProperty("prop" + cnt, String.class,\r
- "#" + cnt++);\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ cont.addContainerProperty("prop" + cnt, String.class, "#" + cnt++);\r
+ }\r
\r
- });\r
+ });\r
buttons.addComponent(b);\r
\r
b = new Button("indexedcontainer.clear()", new Button.ClickListener() {\r
\r
});\r
buttons.addComponent(b);\r
- b = new Button("table.setContainerDataSource(indexedcontainer)",\r
- new Button.ClickListener() {\r
+ b = new Button("table.setContainerDataSource(indexedcontainer)", new Button.ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- tbl.setContainerDataSource(cont);\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ tbl.setContainerDataSource(cont);\r
+ }\r
\r
- });\r
+ });\r
buttons.addComponent(b);\r
- b = new Button("table.setContainerDataSource(orderedwrapper)",\r
- new Button.ClickListener() {\r
+ b = new Button("table.setContainerDataSource(orderedwrapper)", new Button.ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- tbl.setContainerDataSource(ordered);\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ tbl.setContainerDataSource(ordered);\r
+ }\r
\r
- });\r
+ });\r
buttons.addComponent(b);\r
- b = new Button("table.setContainerDataSource(hierarchicalwrapper)",\r
- new Button.ClickListener() {\r
+ b = new Button("table.setContainerDataSource(hierarchicalwrapper)", new Button.ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- tbl.setContainerDataSource(hierarchical);\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ tbl.setContainerDataSource(hierarchical);\r
+ }\r
\r
- });\r
+ });\r
buttons.addComponent(b);\r
\r
Panel p = new Panel("Tree");\r
import com.vaadin.ui.CustomComponent;\r
import com.vaadin.ui.DateField;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
+import com.vaadin.ui.VerticalLayout;\r
\r
/**\r
* \r
*/\r
public class TestDateField extends CustomComponent {\r
\r
- OrderedLayout main = new OrderedLayout();\r
+ VerticalLayout main = new VerticalLayout();\r
\r
DateField df;\r
\r
\r
@Override\r
public void attach() {\r
- final ClassResource res = new ClassResource("m.gif",\r
- super.getApplication());\r
+ final ClassResource res = new ClassResource("m.gif", super.getApplication());\r
df.setIcon(res);\r
super.attach();\r
}\r
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.DateField;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
public class TestForAlignments extends CustomComponent {
public TestForAlignments() {
- final OrderedLayout main = new OrderedLayout();
+ final VerticalLayout main = new VerticalLayout();
final Button b1 = new Button("Right");
final Button b2 = new Button("Left");
final DateField d1 = new DateField("Center aligned");
final DateField d2 = new DateField("Center aligned");
- final OrderedLayout vert = new OrderedLayout();
+ final VerticalLayout vert = new VerticalLayout();
vert.addComponent(b1);
vert.addComponent(b2);
vert.addComponent(t1);
vert.addComponent(d1);
// vert.getSize().setWidth(500);
- vert.setComponentAlignment(b1, OrderedLayout.ALIGNMENT_RIGHT,
- OrderedLayout.ALIGNMENT_TOP);
- vert.setComponentAlignment(b2, OrderedLayout.ALIGNMENT_LEFT,
- OrderedLayout.ALIGNMENT_TOP);
- vert.setComponentAlignment(t1, OrderedLayout.ALIGNMENT_RIGHT,
- OrderedLayout.ALIGNMENT_TOP);
- vert.setComponentAlignment(d1,
- OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
- OrderedLayout.ALIGNMENT_TOP);
- final OrderedLayout hori = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ vert.setComponentAlignment(b1, OrderedLayout.ALIGNMENT_RIGHT, OrderedLayout.ALIGNMENT_TOP);
+ vert.setComponentAlignment(b2, OrderedLayout.ALIGNMENT_LEFT, OrderedLayout.ALIGNMENT_TOP);
+ vert.setComponentAlignment(t1, OrderedLayout.ALIGNMENT_RIGHT, OrderedLayout.ALIGNMENT_TOP);
+ vert.setComponentAlignment(d1, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_TOP);
+ final HorizontalLayout hori = new HorizontalLayout();
hori.addComponent(b3);
hori.addComponent(b4);
hori.addComponent(t2);
hori.addComponent(d2);
// hori.getSize().setHeight(200);
- hori.setComponentAlignment(b3, OrderedLayout.ALIGNMENT_LEFT,
- OrderedLayout.ALIGNMENT_BOTTOM);
- hori.setComponentAlignment(b4, OrderedLayout.ALIGNMENT_LEFT,
- OrderedLayout.ALIGNMENT_TOP);
- hori.setComponentAlignment(t2, OrderedLayout.ALIGNMENT_LEFT,
- OrderedLayout.ALIGNMENT_BOTTOM);
- hori.setComponentAlignment(d2, OrderedLayout.ALIGNMENT_LEFT,
- OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+ hori.setComponentAlignment(b3, OrderedLayout.ALIGNMENT_LEFT, OrderedLayout.ALIGNMENT_BOTTOM);
+ hori.setComponentAlignment(b4, OrderedLayout.ALIGNMENT_LEFT, OrderedLayout.ALIGNMENT_TOP);
+ hori.setComponentAlignment(t2, OrderedLayout.ALIGNMENT_LEFT, OrderedLayout.ALIGNMENT_BOTTOM);
+ hori.setComponentAlignment(d2, OrderedLayout.ALIGNMENT_LEFT, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
main.addComponent(vert);
main.addComponent(hori);
package com.vaadin.tests;
import com.vaadin.Application;
-import com.vaadin.ui.ExpandLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.SplitPanel;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
-public class TestForApplicationLayoutThatUsesWholeBrosersSpace extends
- Application {
+public class TestForApplicationLayoutThatUsesWholeBrosersSpace extends Application {
Window main = new Window("Windowing test");
- ExpandLayout rootLayout;
+ VerticalLayout rootLayout;
SplitPanel firstLevelSplit;
public void init() {
setMainWindow(main);
- rootLayout = new ExpandLayout();
+ rootLayout = new VerticalLayout();
main.setLayout(rootLayout);
rootLayout.addComponent(new Label("header"));
firstLevelSplit = new SplitPanel();
- final SplitPanel secondSplitPanel = new SplitPanel(
- SplitPanel.ORIENTATION_HORIZONTAL);
+ final SplitPanel secondSplitPanel = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
secondSplitPanel.setFirstComponent(new Label("left"));
- final ExpandLayout topRight = new ExpandLayout();
+ final VerticalLayout topRight = new VerticalLayout();
topRight.addComponent(new Label("topright header"));
- final Table t = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(4, 100);
+ final Table t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(4, 100);
t.setSizeFull();
topRight.addComponent(t);
- topRight.expand(t);
+ topRight.setExpandRatio(t, 1);
topRight.addComponent(new Label("topright footer"));
secondSplitPanel.setSecondComponent(topRight);
- final ExpandLayout el = new ExpandLayout();
+ final VerticalLayout el = new VerticalLayout();
el.addComponent(new Label("B��"));
firstLevelSplit.setFirstComponent(secondSplitPanel);
firstLevelSplit.setSecondComponent(el);
rootLayout.addComponent(firstLevelSplit);
- rootLayout.expand(firstLevelSplit);
+ rootLayout.setExpandRatio(firstLevelSplit, 1);
rootLayout.addComponent(new Label("footer"));
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.CustomComponent;\r
import com.vaadin.ui.DateField;\r
-import com.vaadin.ui.ExpandLayout;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.SplitPanel;\r
import com.vaadin.ui.TabSheet;\r
import com.vaadin.ui.Table;\r
+import com.vaadin.ui.VerticalLayout;\r
\r
public class TestForBasicApplicationLayout extends CustomComponent {\r
\r
tab = new TabSheet();\r
tab.setSizeFull();\r
\r
- final Panel report = new Panel("Monthly Program Runs",\r
- new ExpandLayout());\r
- final OrderedLayout controls = new OrderedLayout();\r
+ final Panel report = new Panel("Monthly Program Runs", new VerticalLayout());\r
+ final VerticalLayout controls = new VerticalLayout();\r
controls.setMargin(true);\r
controls.addComponent(new Label("Report tab"));\r
controls.addComponent(click);\r
cal.setResolution(DateField.RESOLUTION_DAY);\r
cal.setLocale(new Locale("en", "US"));\r
report.addComponent(cal);\r
- ((ExpandLayout) report.getLayout()).expand(controls);\r
+ ((VerticalLayout) report.getContent()).setExpandRatio(controls, 1);\r
report.addStyleName(Panel.STYLE_LIGHT);\r
report.setHeight(100, SplitPanel.UNITS_PERCENTAGE);\r
\r
sp2.setFirstComponent(report);\r
\r
- final Table table = TestForTablesInitialColumnWidthLogicRendering\r
- .getTestTable(5, 200);\r
+ final Table table = TestForTablesInitialColumnWidthLogicRendering.getTestTable(5, 200);\r
table.setPageLength(15);\r
table.setSelectable(true);\r
table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);\r
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.ui.Link;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
/**
*
*/
public class TestForChildComponentRendering extends CustomComponent {
- private final OrderedLayout main;
+ private final VerticalLayout main;
public TestForChildComponentRendering() {
- main = new OrderedLayout();
+ main = new VerticalLayout();
setCompositionRoot(main);
createNewView();
}
b = new Button("reorder view", this, "randomReorder");
main.addComponent(b);
- b = new Button("remove randomly one component", this,
- "removeRandomComponent");
+ b = new Button("remove randomly one component", this, "removeRandomComponent");
main.addComponent(b);
}
components.add(it.next());
}
- final OrderedLayout v = main;
+ final VerticalLayout v = main;
v.removeAllComponents();
for (int i = components.size(); i > 0; i--) {
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
public class TestForContainerFilterable extends CustomComponent {
- OrderedLayout lo = new OrderedLayout();
+ VerticalLayout lo = new VerticalLayout();
IndexedContainer ic = new IndexedContainer();
Table t = new Table();
- private static String parts[] = { "Neo", "Sa", "rem", "the", "adi", "za",
- "tre", "day", "Ca", "re", "cen", "ter", "mi", "nal" };
+ private static String parts[] = { "Neo", "Sa", "rem", "the", "adi", "za", "tre", "day", "Ca", "re", "cen", "ter", "mi", "nal" };
TextField fooFilter = new TextField("foo-filter");
TextField barFilter = new TextField("bar-filter");
Button filterButton = new Button("Filter");
}
// Init filtering view
- final Panel filterPanel = new Panel("Filter", new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL));
+ final Panel filterPanel = new Panel("Filter", new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL));
filterPanel.setWidth(100, Panel.UNITS_PERCENTAGE);
lo.addComponent(filterPanel);
filterPanel.addComponent(fooFilter);
filterPanel.addComponent(barFilter);
filterPanel.addComponent(filterButton);
- fooFilter
- .setDescription("Filters foo column in case-sensitive contains manner.");
- barFilter
- .setDescription("Filters bar column in case-insensitive prefix manner.");
+ fooFilter.setDescription("Filters foo column in case-sensitive contains manner.");
+ barFilter.setDescription("Filters bar column in case-insensitive prefix manner.");
filterPanel.addComponent(count);
// Table
public void buttonClick(ClickEvent event) {
ic.removeAllContainerFilters();
if (fooFilter.toString().length() > 0) {
- ic.addContainerFilter("foo", fooFilter.toString(), false,
- false);
+ ic.addContainerFilter("foo", fooFilter.toString(), false, false);
}
if (barFilter.toString().length() > 0) {
- ic.addContainerFilter("bar", barFilter.toString(), true,
- true);
+ ic.addContainerFilter("bar", barFilter.toString(), true, true);
}
count.setValue("Rows in table: " + ic.size());
}
});
// Resetbutton
- lo.addComponent(new Button("Rebind table datasource",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- t.setContainerDataSource(ic);
- }
- }));
+ lo.addComponent(new Button("Rebind table datasource", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ t.setContainerDataSource(ic);
+ }
+ }));
}
private String randomWord() {
b = new Button("reorder view", this, "randomReorder");
main.addComponent(b);
- b = new Button("remove randomly one component", this,
- "removeRandomComponent");
+ b = new Button("remove randomly one component", this, "removeRandomComponent");
main.addComponent(b);
}
for (int i = components.size(); i > 0; i--) {
final int index = (int) (Math.random() * i);
if (i == colspanIndex) {
- main.addComponent(components.get(index), 0, (size - i) / 2, 1,
- (size - i) / 2);
+ main.addComponent(components.get(index), 0, (size - i) / 2, 1, (size - i) / 2);
} else {
main.addComponent(components.get(index));
}
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TwinColSelect;
+import com.vaadin.ui.VerticalLayout;
/**
* TODO: Note you need to add Theme under WebContent/VAADIN/Themes/mytheme in
*
* @author IT Mill Ltd.
*/
-public class TestForMultipleStyleNames extends CustomComponent implements
- ValueChangeListener {
+public class TestForMultipleStyleNames extends CustomComponent implements ValueChangeListener {
- private final OrderedLayout main = new OrderedLayout();
+ private final VerticalLayout main = new VerticalLayout();
private Label l;
public void createNewView() {
main.removeAllComponents();
- main.addComponent(new Label(
- "TK5 supports multiple stylenames for components."));
- main.addComponent(new Label("Note you need to add Theme under"
- + " WebContent/VAADIN/Themes/mytheme"
- + " in order to see actual visible results"
- + " on the browser. Currently changes are"
- + " visible only by inspecting DOM."));
+ main.addComponent(new Label("TK5 supports multiple stylenames for components."));
+ main.addComponent(new Label("Note you need to add Theme under" + " WebContent/VAADIN/Themes/mytheme" + " in order to see actual visible results" + " on the browser. Currently changes are" + " visible only by inspecting DOM."));
styleNames2 = new ArrayList<String>();
l.addStyleName(styleName);
}
}
- for (final Iterator<String> iterator2 = curStyles.iterator(); iterator2
- .hasNext();) {
+ for (final Iterator<String> iterator2 = curStyles.iterator(); iterator2.hasNext();) {
final String object = iterator2.next();
l.removeStyleName(object);
}
setMainWindow(main);
- main.addComponent(new Button("Add new subwindow",
- new Button.ClickListener() {
+ main.addComponent(new Button("Add new subwindow", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ final Window w = new Window("sw " + System.currentTimeMillis());
+ main.addWindow(w);
+ w.setPositionX(100);
+ w.setPositionY(100);
+ w.setWidth(200);
+ w.setHeight(200);
+
+ w.setWidth(100);
+ w.setHeight(400);
+
+ final Button closebutton = new Button("Close " + w.getCaption(), new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- final Window w = new Window("sw "
- + System.currentTimeMillis());
- main.addWindow(w);
- w.setPositionX(100);
- w.setPositionY(100);
- w.setWidth(200);
- w.setHeight(200);
-
- w.setWidth(100);
- w.setHeight(400);
-
- final Button closebutton = new Button("Close "
- + w.getCaption(), new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- main.removeWindow(w);
- }
-
- });
- w.addComponent(closebutton);
-
- w.addComponent(new Label(
- "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>"
- + "<p>Lorem ipsum dolor sit amet.</p>",
- Label.CONTENT_XHTML));
-
+ main.removeWindow(w);
}
- }));
- main.addComponent(new Button(
- "Open a currently uncreated application level window",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- try {
- main.open(
- new com.vaadin.terminal.ExternalResource(
- new URL(
- getURL(),
- "mainwin-"
- + System.currentTimeMillis()
- + "/")), null);
- } catch (final MalformedURLException e) {
- }
- }
- }));
+ });
+ w.addComponent(closebutton);
+
+ w.addComponent(new Label("<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>" + "<p>Lorem ipsum dolor sit amet.</p>", Label.CONTENT_XHTML));
+
+ }
+ }));
+
+ main.addComponent(new Button("Open a currently uncreated application level window", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ try {
+ main.open(new com.vaadin.terminal.ExternalResource(new URL(getURL(), "mainwin-" + System.currentTimeMillis() + "/")), null);
+ } catch (final MalformedURLException e) {
+ }
+ }
+ }));
- main.addComponent(new Button(
- "Commit (saves window state: size, place, scrollpos)"));
+ main.addComponent(new Button("Commit (saves window state: size, place, scrollpos)"));
}
@Override
final String postfix = name.substring("mainwin-".length());
final Window ww = new Window("Window: " + postfix);
ww.setName(name);
- ww.addComponent(new Label(
- "This is a application-level window opened with name: "
- + name));
+ ww.addComponent(new Label("This is a application-level window opened with name: " + name));
ww.addComponent(new Button("Click me", new Button.ClickListener() {
int state = 0;
public void buttonClick(ClickEvent event) {
- ww.addComponent(new Label("Button clicked " + (++state)
- + " times"));
+ ww.addComponent(new Label("Button clicked " + (++state) + " times"));
}
}));
addWindow(ww);
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.NativeSelect;
import com.vaadin.ui.OptionGroup;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Tree;
import com.vaadin.ui.TwinColSelect;
+import com.vaadin.ui.VerticalLayout;
/**
* @author IT Mill Ltd.
*/
-public class TestForPreconfiguredComponents extends CustomComponent implements
- Handler {
+public class TestForPreconfiguredComponents extends CustomComponent implements Handler {
- private static final String[] firstnames = new String[] { "John", "Mary",
- "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
+ private static final String[] firstnames = new String[] { "John", "Mary", "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
- private static final String[] lastnames = new String[] { "Torvalds",
- "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding",
- "Einstein" };
+ private static final String[] lastnames = new String[] { "Torvalds", "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding", "Einstein" };
- private final OrderedLayout main = new OrderedLayout();
+ private final VerticalLayout main = new VerticalLayout();
- private final Action[] actions = new Action[] { new Action("edit"),
- new Action("delete") };
+ private final Action[] actions = new Action[] { new Action("edit"), new Action("delete") };
private Panel al;
public void createNewView() {
main.removeAllComponents();
- main.addComponent(new Label(
- "In Toolkit 5 we introduce new components. Previously we"
- + " usually used setStyle or some other methods on possibly "
- + "multiple steps to configure component for ones needs. These new "
- + "server side components are mostly just classes that in constructor "
- + "set base class to state that programmer wants."));
+ main.addComponent(new Label("In Toolkit 5 we introduce new components. Previously we" + " usually used setStyle or some other methods on possibly " + "multiple steps to configure component for ones needs. These new " + "server side components are mostly just classes that in constructor " + "set base class to state that programmer wants."));
main.addComponent(new Button("commit"));
public static void fillSelect(AbstractSelect s, int items) {
for (int i = 0; i < items; i++) {
- final String name = firstnames[(int) (Math.random() * (firstnames.length - 1))]
- + " "
- + lastnames[(int) (Math.random() * (lastnames.length - 1))];
+ final String name = firstnames[(int) (Math.random() * (firstnames.length - 1))] + " " + lastnames[(int) (Math.random() * (lastnames.length - 1))];
s.addItem(name);
}
}
Tree t = new Tree("Tree");
final String[] names = new String[100];
for (int i = 0; i < names.length; i++) {
- names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
- + " "
- + lastnames[(int) (Math.random() * (lastnames.length - 1))];
+ names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))] + " " + lastnames[(int) (Math.random() * (lastnames.length - 1))];
}
// Create tree
ol.addComponent(t);
- final OrderedLayout ol2 = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ final HorizontalLayout ol2 = new HorizontalLayout();
final Panel status = new Panel("Events");
final Button clear = new Button("clear event log");
clear.addListener(new ClickListener() {
t.addListener(new Listener() {
public void componentEvent(Event event) {
status.addComponent(new Label(event.getClass().getName()));
- status.addComponent(new Label("selected: "
- + event.getSource().toString()));
+ status.addComponent(new Label("selected: " + event.getSource().toString()));
}
});
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.VerticalLayout;
/**
*
* @author IT Mill Ltd.
*/
-public class TestForRichTextEditor extends CustomComponent implements
- ValueChangeListener {
+public class TestForRichTextEditor extends CustomComponent implements ValueChangeListener {
- private final OrderedLayout main = new OrderedLayout();
+ private final VerticalLayout main = new VerticalLayout();
private Label l;
public void createNewView() {
main.removeAllComponents();
- main.addComponent(new Label(
- "RTE uses google richtextArea and their examples toolbar."));
+ main.addComponent(new Label("RTE uses google richtextArea and their examples toolbar."));
rte = new RichTextArea();
rte.addListener(this);
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
-public class TestForStyledUpload extends Application implements
- Upload.FinishedListener, FailedListener, SucceededListener,
- StartedListener {
+public class TestForStyledUpload extends Application implements Upload.FinishedListener, FailedListener, SucceededListener, StartedListener {
Layout main = new VerticalLayout();
private final Label memoryStatus;
public TestForStyledUpload() {
- main.addComponent(new Label(
- "Clicking on button b updates information about upload components status or same with garbage collector."));
+ main.addComponent(new Label("Clicking on button b updates information about upload components status or same with garbage collector."));
up = new Upload(null, buffer);
up.setButtonCaption("Select file");
refreshMemUsage();
- transferred.setValue("Transferred " + readBytes + " of "
- + contentLenght);
+ transferred.setValue("Transferred " + readBytes + " of " + contentLenght);
}
});
sb.append("/");
sb.append(up.getUploadSize());
sb.append(" ");
- sb.append(Math.round(100 * up.getBytesRead()
- / (double) up.getUploadSize()));
+ sb.append(Math.round(100 * up.getBytesRead() / (double) up.getUploadSize()));
sb.append("%");
} else {
sb.append("Idle");
status.removeAllComponents();
final InputStream stream = buffer.getStream();
if (stream == null) {
- status.addComponent(new Label(
- "Upload finished, but output buffer is null!!"));
+ status.addComponent(new Label("Upload finished, but output buffer is null!!"));
} else {
- status.addComponent(new Label(
- "<b>Name:</b> " + event.getFilename(), Label.CONTENT_XHTML));
- status.addComponent(new Label("<b>Mimetype:</b> "
- + event.getMIMEType(), Label.CONTENT_XHTML));
- status.addComponent(new Label("<b>Size:</b> " + event.getLength()
- + " bytes.", Label.CONTENT_XHTML));
+ status.addComponent(new Label("<b>Name:</b> " + event.getFilename(), Label.CONTENT_XHTML));
+ status.addComponent(new Label("<b>Mimetype:</b> " + event.getMIMEType(), Label.CONTENT_XHTML));
+ status.addComponent(new Label("<b>Size:</b> " + event.getLength() + " bytes.", Label.CONTENT_XHTML));
- status.addComponent(new Link("Download " + buffer.getFileName(),
- new StreamResource(buffer, buffer.getFileName(), this)));
+ status.addComponent(new Link("Download " + buffer.getFileName(), new StreamResource(buffer, buffer.getFileName(), this)));
status.setVisible(true);
}
}
- public interface Buffer extends StreamResource.StreamSource,
- Upload.Receiver {
+ public interface Buffer extends StreamResource.StreamSource, Upload.Receiver {
String getFileName();
}
private FileInputStream stream;
public TmpFileBuffer() {
- final String tempFileName = "upload_tmpfile_"
- + System.currentTimeMillis();
+ final String tempFileName = "upload_tmpfile_" + System.currentTimeMillis();
try {
file = File.createTempFile(tempFileName, null);
} catch (final IOException e) {
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
-public class TestForTabSheet extends CustomComponent implements
- Button.ClickListener, TabSheet.SelectedTabChangeListener {
+public class TestForTabSheet extends CustomComponent implements Button.ClickListener, TabSheet.SelectedTabChangeListener {
TabSheet tabsheet = new TabSheet();
Button tab1_root = new Button("Push this button");
Label tab2_root = new Label("Contents of Second Tab");
}
public void buttonClick(ClickEvent event) {
- System.out.println("tab2=" + tab2_root.isEnabled() + " tab3="
- + tab3_root.isEnabled());
+ System.out.println("tab2=" + tab2_root.isEnabled() + " tab3=" + tab3_root.isEnabled());
tab2_root.setEnabled(true);
tab3_root.setEnabled(true);
}
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
/**
*
*
* @author IT Mill Ltd.
*/
-public class TestForTablesInitialColumnWidthLogicRendering extends
- CustomComponent {
+public class TestForTablesInitialColumnWidthLogicRendering extends CustomComponent {
- private final OrderedLayout main = new OrderedLayout();
+ private final VerticalLayout main = new VerticalLayout();
public TestForTablesInitialColumnWidthLogicRendering() {
public void createNewView() {
main.removeAllComponents();
- main.addComponent(new Label(
- "Below are same tables that all should render somewhat nice. Also when testing, you might want to try resizing window."));
+ main.addComponent(new Label("Below are same tables that all should render somewhat nice. Also when testing, you might want to try resizing window."));
Table t;
- Layout lo = new OrderedLayout();
+ Layout lo = new VerticalLayout();
lo.setWidth("600px");
lo.setHeight("250px");
return t;
}
- static String[] testString = new String[] { "Jacob", "Michael", "Joshua",
- "Matthew", "Ethan", "Andrew", "Daniel", "Anthony", "Christopher",
- "Joseph", "William", "Alexander", "Ryan", "David", "Nicholas",
- "Tyler", "James", "John", "Jonathan", "Nathan", "Samuel",
- "Christian", "Noah", "Dylan", "Benjamin", "Logan", "Brandon",
- "Gabriel", "Zachary", "Jose", "Elijah", "Angel", "Kevin", "Jack",
- "Caleb", "Justin", "Austin", "Evan", "Robert", "Thomas", "Luke",
- "Mason", "Aidan", "Jackson", "Isaiah", "Jordan", "Gavin", "Connor",
- "Aiden", "Isaac", "Jason", "Cameron", "Hunter", "Jayden", "Juan",
- "Charles", "Aaron", "Lucas", "Luis", "Owen", "Landon", "Diego",
- "Brian", "Adam", "Adrian", "Kyle", "Eric", "Ian", "Nathaniel",
- "Carlos", "Alex", "Bryan", "Jesus", "Julian", "Sean", "Carter",
- "Hayden", "Jeremiah", "Cole", "Brayden", "Wyatt", "Chase",
- "Steven", "Timothy", "Dominic", "Sebastian", "Xavier", "Jaden",
- "Jesse", "Devin", "Seth", "Antonio", "Richard", "Miguel", "Colin",
- "Cody", "Alejandro", "Caden", "Blake", "Carson" };
+ static String[] testString = new String[] { "Jacob", "Michael", "Joshua", "Matthew", "Ethan", "Andrew", "Daniel", "Anthony", "Christopher", "Joseph", "William", "Alexander", "Ryan", "David", "Nicholas", "Tyler", "James", "John", "Jonathan", "Nathan", "Samuel", "Christian", "Noah", "Dylan", "Benjamin", "Logan", "Brandon", "Gabriel", "Zachary", "Jose", "Elijah", "Angel", "Kevin", "Jack", "Caleb", "Justin", "Austin", "Evan", "Robert", "Thomas", "Luke", "Mason", "Aidan", "Jackson", "Isaiah", "Jordan", "Gavin", "Connor", "Aiden", "Isaac", "Jason", "Cameron", "Hunter", "Jayden", "Juan", "Charles", "Aaron", "Lucas", "Luis", "Owen", "Landon", "Diego", "Brian", "Adam", "Adrian", "Kyle", "Eric", "Ian", "Nathaniel", "Carlos", "Alex", "Bryan", "Jesus", "Julian", "Sean", "Carter", "Hayden", "Jeremiah", "Cole", "Brayden", "Wyatt", "Chase", "Steven", "Timothy", "Dominic", "Sebastian", "Xavier", "Jaden", "Jesse", "Devin", "Seth", "Antonio", "Richard", "Miguel", "Colin", "Cody", "Alejandro", "Caden", "Blake", "Carson" };
public static String rndString() {
return testString[(int) (Math.random() * testString.length)];
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
/**
* Some test cases for trees. Events panel logs events that happen server side.
*/
public class TestForTrees extends CustomComponent implements Handler {
- private static final String[] firstnames = new String[] { "John", "Mary",
- "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
+ private static final String[] firstnames = new String[] { "John", "Mary", "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
- private static final String[] lastnames = new String[] { "Torvalds",
- "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding",
- "Einstein" };
+ private static final String[] lastnames = new String[] { "Torvalds", "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding", "Einstein" };
- private final OrderedLayout main = new OrderedLayout();
+ private final VerticalLayout main = new VerticalLayout();
- private final Action[] actions = new Action[] { new Action("edit"),
- new Action("delete") };
+ private final Action[] actions = new Action[] { new Action("edit"), new Action("delete") };
private Panel al;
public void createNewView() {
main.removeAllComponents();
- main.addComponent(new Label(
- "Some test cases for trees. Events panel logs events that happen server side."));
+ main.addComponent(new Label("Some test cases for trees. Events panel logs events that happen server side."));
main.addComponent(new Button("commit"));
Tree t = new Tree("Tree");
final String[] names = new String[100];
for (int i = 0; i < names.length; i++) {
- names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
- + " "
- + lastnames[(int) (Math.random() * (lastnames.length - 1))];
+ names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))] + " " + lastnames[(int) (Math.random() * (lastnames.length - 1))];
}
// Create tree
}
public Component createTestBench(Tree t) {
- final OrderedLayout ol = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ final HorizontalLayout ol = new HorizontalLayout();
ol.addComponent(t);
t.addListener(new Listener() {
public void componentEvent(Event event) {
status.addComponent(new Label(event.getClass().getName()));
- status.addComponent(new Label("selected: "
- + event.getSource().toString()));
+ status.addComponent(new Label("selected: " + event.getSource().toString()));
}
});
import com.vaadin.ui.Upload.StartedListener;
import com.vaadin.ui.VerticalLayout;
-public class TestForUpload extends CustomComponent implements
- Upload.ProgressListener {
+public class TestForUpload extends CustomComponent implements Upload.ProgressListener {
private static final long serialVersionUID = -3400119871764256575L;
private CheckBox beSluggish = new CheckBox("Be sluggish");
- private CheckBox throwExecption = new CheckBox(
- "Throw exception in receiver");
+ private CheckBox throwExecption = new CheckBox("Throw exception in receiver");
private Button interrupt = new Button("Interrupt upload");
public TestForUpload() {
setCompositionRoot(main);
- main.addComponent(new Label(
- "This is a simple test for upload application. "
- + "Upload should work with big files and concurrent "
- + "requests should not be blocked. Button 'b' reads "
- + "current state into label below it. Memory receiver "
- + "streams upload contents into memory. You may track"
- + "consumption."
- + "tempfile receiver writes upload to file and "
- + "should have low memory consumption."));
-
- main.addComponent(new Label(
- "Clicking on button b updates information about upload components status or same with garbage collector."));
+ main.addComponent(new Label("This is a simple test for upload application. " + "Upload should work with big files and concurrent " + "requests should not be blocked. Button 'b' reads " + "current state into label below it. Memory receiver " + "streams upload contents into memory. You may track" + "consumption." + "tempfile receiver writes upload to file and " + "should have low memory consumption."));
+
+ main.addComponent(new Label("Clicking on button b updates information about upload components status or same with garbage collector."));
textField = new TextField("Test field");
textFieldValue = new Label();
pi.setVisible(true);
pi2.setVisible(true);
l.setValue("Started uploading file " + event.getFilename());
- textFieldValue
- .setValue(" TestFields value at the upload start is:"
- + textField.getValue());
+ textFieldValue.setValue(" TestFields value at the upload start is:" + textField.getValue());
}
});
pi2.setVisible(false);
if (event instanceof Upload.FailedEvent) {
Exception reason = ((Upload.FailedEvent) event).getReason();
- l.setValue("Finished with failure ( " + reason
- + " ), idle");
+ l.setValue("Finished with failure ( " + reason + " ), idle");
} else if (event instanceof Upload.SucceededEvent) {
l.setValue("Finished with succes, idle");
} else {
status.removeAllComponents();
final InputStream stream = buffer.getStream();
if (stream == null) {
- status.addComponent(new Label(
- "Upload finished, but output buffer is null"));
+ status.addComponent(new Label("Upload finished, but output buffer is null"));
} else {
- status.addComponent(new Label("<b>Name:</b> "
- + event.getFilename(), Label.CONTENT_XHTML));
- status.addComponent(new Label("<b>Mimetype:</b> "
- + event.getMIMEType(), Label.CONTENT_XHTML));
- status.addComponent(new Label("<b>Size:</b> "
- + event.getLength() + " bytes.",
- Label.CONTENT_XHTML));
-
- status.addComponent(new Link("Download "
- + buffer.getFileName(), new StreamResource(buffer,
- buffer.getFileName(), getApplication())));
+ status.addComponent(new Label("<b>Name:</b> " + event.getFilename(), Label.CONTENT_XHTML));
+ status.addComponent(new Label("<b>Mimetype:</b> " + event.getMIMEType(), Label.CONTENT_XHTML));
+ status.addComponent(new Label("<b>Size:</b> " + event.getLength() + " bytes.", Label.CONTENT_XHTML));
+
+ status.addComponent(new Link("Download " + buffer.getFileName(), new StreamResource(buffer, buffer.getFileName(), getApplication())));
status.setVisible(true);
}
uploadBufferSelector.addItem("memory");
uploadBufferSelector.setValue("memory");
uploadBufferSelector.addItem("tempfile");
- uploadBufferSelector
- .addListener(new AbstractField.ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- setBuffer();
- }
- });
+ uploadBufferSelector.addListener(new AbstractField.ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ setBuffer();
+ }
+ });
main.addComponent(uploadBufferSelector);
main.addComponent(up);
sb.append("/");
sb.append(up.getUploadSize());
sb.append(" ");
- sb.append(Math.round(100 * up.getBytesRead()
- / (double) up.getUploadSize()));
+ sb.append(Math.round(100 * up.getBytesRead() / (double) up.getUploadSize()));
sb.append("%");
} else {
sb.append("Idle");
refreshMemUsage();
}
- public interface Buffer extends StreamResource.StreamSource,
- Upload.Receiver {
+ public interface Buffer extends StreamResource.StreamSource, Upload.Receiver {
String getFileName();
}
private File file;
public TmpFileBuffer() {
- final String tempFileName = "upload_tmpfile_"
- + System.currentTimeMillis();
+ final String tempFileName = "upload_tmpfile_" + System.currentTimeMillis();
try {
file = File.createTempFile(tempFileName, null);
} catch (final IOException e) {
return new FileOutputStream(file) {
@Override
- public void write(byte[] b, int off, int len)
- throws IOException {
+ public void write(byte[] b, int off, int len) throws IOException {
beSluggish();
throwExecption();
super.write(b, off, len);
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
public class TestForWindowOpen extends CustomComponent {
public TestForWindowOpen() {
- final OrderedLayout main = new OrderedLayout();
+ final VerticalLayout main = new VerticalLayout();
setCompositionRoot(main);
- main.addComponent(new Button("Open in this window",
- new Button.ClickListener() {
+ main.addComponent(new Button("Open in this window", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- final ExternalResource r = new ExternalResource(
- "http://www.google.com");
- getApplication().getMainWindow().open(r);
+ public void buttonClick(ClickEvent event) {
+ final ExternalResource r = new ExternalResource("http://www.google.com");
+ getApplication().getMainWindow().open(r);
- }
+ }
- }));
+ }));
- main.addComponent(new Button("Open in target \"mytarget\"",
- new Button.ClickListener() {
+ main.addComponent(new Button("Open in target \"mytarget\"", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- final ExternalResource r = new ExternalResource(
- "http://www.google.com");
- getApplication().getMainWindow().open(r, "mytarget");
+ public void buttonClick(ClickEvent event) {
+ final ExternalResource r = new ExternalResource("http://www.google.com");
+ getApplication().getMainWindow().open(r, "mytarget");
- }
+ }
- }));
+ }));
- main.addComponent(new Button("Open in target \"secondtarget\"",
- new Button.ClickListener() {
+ main.addComponent(new Button("Open in target \"secondtarget\"", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- final ExternalResource r = new ExternalResource(
- "http://www.google.com");
- getApplication().getMainWindow()
- .open(r, "secondtarget");
+ public void buttonClick(ClickEvent event) {
+ final ExternalResource r = new ExternalResource("http://www.google.com");
+ getApplication().getMainWindow().open(r, "secondtarget");
- }
+ }
- }));
+ }));
}
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
import com.vaadin.ui.OptionGroup;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
import com.vaadin.ui.Slider;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class TestForWindowing extends CustomComponent {
public TestForWindowing() {
- final OrderedLayout main = new OrderedLayout();
+ final VerticalLayout main = new VerticalLayout();
- main.addComponent(new Label(
- "Click the button to create a new inline window."));
+ main.addComponent(new Label("Click the button to create a new inline window."));
final CheckBox asModal = new CheckBox("As modal");
main.addComponent(asModal);
- final Button create = new Button("Create a new window",
- new ClickListener() {
+ final Button create = new Button("Create a new window", new ClickListener() {
- public void buttonClick(ClickEvent event) {
- Window w = new Window("Testing Window");
+ public void buttonClick(ClickEvent event) {
+ Window w = new Window("Testing Window");
- if (((Boolean) asModal.getValue()).booleanValue()) {
- w.setModal(true);
- }
+ if (((Boolean) asModal.getValue()).booleanValue()) {
+ w.setModal(true);
+ }
+
+ AbstractSelect s1 = new OptionGroup();
+ s1.setCaption("1. Select output format");
+ s1.addItem("Excel sheet");
+ s1.addItem("CSV plain text");
+ s1.setValue("Excel sheet");
+ s1.setImmediate(true);
+
+ s2 = new Select();
+ s2.addItem("Separate by comma (,)");
+ s2.addItem("Separate by colon (:)");
+ s2.addItem("Separate by semicolon (;)");
+ s2.setEnabled(false);
- AbstractSelect s1 = new OptionGroup();
- s1.setCaption("1. Select output format");
- s1.addItem("Excel sheet");
- s1.addItem("CSV plain text");
- s1.setValue("Excel sheet");
- s1.setImmediate(true);
-
- s2 = new Select();
- s2.addItem("Separate by comma (,)");
- s2.addItem("Separate by colon (:)");
- s2.addItem("Separate by semicolon (;)");
- s2.setEnabled(false);
-
- s1.addListener(new ValueChangeListener() {
-
- public void valueChange(ValueChangeEvent event) {
- String v = (String) event.getProperty()
- .getValue();
- if (v.equals("CSV plain text")) {
- s2.setEnabled(true);
- } else {
- s2.setEnabled(false);
- }
- }
-
- });
-
- w.addComponent(s1);
- w.addComponent(s2);
-
- Slider s = new Slider();
- s.setCaption("Volume");
- s.setMax(13);
- s.setMin(12);
- s.setResolution(2);
- s.setImmediate(true);
- // s.setOrientation(Slider.ORIENTATION_VERTICAL);
- // s.setArrows(false);
-
- w.addComponent(s);
-
- getApplication().getMainWindow().addWindow(w);
+ s1.addListener(new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ String v = (String) event.getProperty().getValue();
+ if (v.equals("CSV plain text")) {
+ s2.setEnabled(true);
+ } else {
+ s2.setEnabled(false);
+ }
}
});
+ w.addComponent(s1);
+ w.addComponent(s2);
+
+ Slider s = new Slider();
+ s.setCaption("Volume");
+ s.setMax(13);
+ s.setMin(12);
+ s.setResolution(2);
+ s.setImmediate(true);
+ // s.setOrientation(Slider.ORIENTATION_VERTICAL);
+ // s.setArrows(false);
+
+ w.addComponent(s);
+
+ getApplication().getMainWindow().addWindow(w);
+
+ }
+
+ });
+
main.addComponent(create);
setCompositionRoot(main);
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
public class TestIFrames extends CustomComponent {
- OrderedLayout main = new OrderedLayout();
+ VerticalLayout main = new VerticalLayout();
public TestIFrames() {
setCompositionRoot(main);
private Label createEmbedded(String URL) {
final int width = 600;
final int height = 250;
- final String iFrame = "<iframe height=\"" + height + "\" width=\""
- + width + "\" src=\"" + URL + "\" />";
+ final String iFrame = "<iframe height=\"" + height + "\" width=\"" + width + "\" src=\"" + URL + "\" />";
return new Label(iFrame, Label.CONTENT_XHTML);
}
MyTest myTest = new MyTest();
- MethodProperty<Integer> methodProperty2 = new MethodProperty<Integer>(
- Integer.TYPE, myTest, "getInt", "setInt", new Object[0],
- new Object[] { null }, 0);
+ MethodProperty<Integer> methodProperty2 = new MethodProperty<Integer>(Integer.TYPE, myTest, "getInt", "setInt", new Object[0], new Object[] { null }, 0);
methodProperty2.setValue("3");
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
/**
* This test has a somewhat deep layout within one page. At the bottom, Select
}
AbstractLayout getOrderedLayout() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
l.setCaption(getCaption("orderedlayout"));
return l;
}
final Window mainWindow = new Window("TestSetVisibleAndCaching");
setMainWindow(mainWindow);
- panelA.addComponent(new Label(
- "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
- panelB.addComponent(new Label(
- "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"));
- panelC.addComponent(new Label(
- "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"));
+ panelA.addComponent(new Label("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
+ panelB.addComponent(new Label("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"));
+ panelC.addComponent(new Label("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"));
- mainWindow
- .addComponent(new Label(
- "Inspect transfered data from server to "
- + "client using firebug (http request / response cycles)."
- + " See how widgets are re-used,"
- + " after each panel is once shown in GUI then"
- + " their contents are not resend."));
+ mainWindow.addComponent(new Label("Inspect transfered data from server to " + "client using firebug (http request / response cycles)." + " See how widgets are re-used," + " after each panel is once shown in GUI then" + " their contents are not resend."));
mainWindow.addComponent(buttonNextPanel);
mainWindow.addComponent(panelA);
mainWindow.addComponent(panelB);
if (prev == null) {
getMainWindow().showNotification("No more test cases");
} else {
- getMainWindow().showNotification(
- "Selected test:" + prev.getTestableName());
+ getMainWindow().showNotification("Selected test:" + prev.getTestableName());
select.setValue(prev);
select.requestRepaint();
}
if (next == null) {
getMainWindow().showNotification("No more test cases");
} else {
- getMainWindow().showNotification(
- "Selected test:" + next.getTestableName());
+ getMainWindow().showNotification("Selected test:" + next.getTestableName());
select.setValue(next);
select.requestRepaint();
}
String[] list2 = (new File(dir.getFile())).list();
for (int i = 0; i < list2.length; i++) {
String f = list2[i];
- if (f.endsWith(".class") && (f.indexOf("CustomComponent") == -1)
- && (f.indexOf("Window") == -1)) {
+ if (f.endsWith(".class") && (f.indexOf("CustomComponent") == -1) && (f.indexOf("Window") == -1)) {
f = f.replaceAll(".class", "");
String className = "com.vaadin.ui." + f;
Class<?> c;
cont.addItem(t);
t = new Testable(c) {
@Override
- public Component getComponent()
- throws InstantiationException,
- IllegalAccessException {
+ public Component getComponent() throws InstantiationException, IllegalAccessException {
Component c = super.getComponent();
- Panel p = new Panel(
- "Wrapper panel (400px*400px)");
+ Panel p = new Panel("Wrapper panel (400px*400px)");
p.setContent(new VerticalLayout());
p.setWidth("400px");
p.setHeight("400px");
StringBuffer sb = new StringBuffer();
sb.append(classToTest.getName().replaceAll("com.vaadin.ui.", ""));
sb.append("[");
- for (Iterator<Configuration> i = configurations.iterator(); i
- .hasNext();) {
+ for (Iterator<Configuration> i = configurations.iterator(); i.hasNext();) {
sb.append((i.next()).getDescription());
if (i.hasNext()) {
sb.append(",");
* @throws InstantiationException
* @throws IllegalAccessException
*/
- public Component getComponent() throws InstantiationException,
- IllegalAccessException {
+ public Component getComponent() throws InstantiationException, IllegalAccessException {
Component c = (Component) classToTest.newInstance();
if (c instanceof Button) {
if (AbstractSelect.class.isAssignableFrom(c.getClass())) {
if (c instanceof Table) {
Table new_name = (Table) c;
- new_name.setContainerDataSource(TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(5, 100).getContainerDataSource());
+ new_name.setContainerDataSource(TestForTablesInitialColumnWidthLogicRendering.getTestTable(5, 100).getContainerDataSource());
} else {
AbstractSelect new_name = (AbstractSelect) c;
- Container cont = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(2, 8).getContainerDataSource();
+ Container cont = TestForTablesInitialColumnWidthLogicRendering.getTestTable(2, 8).getContainerDataSource();
new_name.setContainerDataSource(cont);
- new_name.setItemCaptionPropertyId(cont
- .getContainerPropertyIds().iterator().next());
+ new_name.setItemCaptionPropertyId(cont.getContainerPropertyIds().iterator().next());
}
} else if (c instanceof ComponentContainer) {
((Label) c).setValue("Test label");
}
- for (Iterator<Configuration> i = configurations.iterator(); i
- .hasNext();) {
+ for (Iterator<Configuration> i = configurations.iterator(); i.hasNext();) {
Configuration conf = i.next();
conf.configure(c);
}
* @since 4.0.0
*
*/
-public class TreeFilesystem extends com.vaadin.Application implements
- Tree.ExpandListener {
+public class TreeFilesystem extends com.vaadin.Application implements Tree.ExpandListener {
// Filesystem explorer panel and it's components
private final Panel explorerPanel = new Panel("Filesystem explorer");
* @since 4.0.0
*
*/
-public class TreeFilesystemContainer extends com.vaadin.Application implements
- Listener {
+public class TreeFilesystemContainer extends com.vaadin.Application implements Listener {
// Filesystem explorer panel and it's components
private final Panel explorerPanel = new Panel("Filesystem explorer");
// Check if event is about changing value
if (event.getClass() == Field.ValueChangeEvent.class) {
// Update property panel contents
- final FileItem fileItem = (FileItem) filesystem
- .getItem(filesystem.getValue());
+ final FileItem fileItem = (FileItem) filesystem.getItem(filesystem.getValue());
fileProperties.setIcon(fileItem.getIcon());
- fileProperties.setCaption(fileItem.getName() + ", size "
- + fileItem.getSize() + " bytes.");
+ fileProperties.setCaption(fileItem.getName() + ", size " + fileItem.getSize() + " bytes.");
propertyPanel.setEnabled(true);
}
// here we could check for other type of events for filesystem
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
* @since 3.1.1
* @author IT Mill Ltd.
*/
-public class UpgradingSample extends Application implements
- Property.ValueChangeListener {
+public class UpgradingSample extends Application implements Property.ValueChangeListener {
/* Menu for navigating inside the application. */
private final Tree menu = new Tree();
/* Contents of the website */
- private final String[][] pages = {
- { "Welcome", "Welcome to our website..." },
- { "Products", "Public product information." },
- { "Contact", "Public contact information." },
- { "CRM", "CRM Database requiring login." },
- { "Intranet", "Internal information database." } };
+ private final String[][] pages = { { "Welcome", "Welcome to our website..." }, { "Products", "Public product information." }, { "Contact", "Public contact information." }, { "CRM", "CRM Database requiring login." }, { "Intranet", "Internal information database." } };
/* Application layout */
private final GridLayout layout = new GridLayout(2, 1);
setMainWindow(main);
// Add menu and loginbox to the application
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
layout.addComponent(l, 0, 0);
l.addComponent(menu);
l.addComponent(new LoginBox());
}
// Simple loginbox component for the application
- public class LoginBox extends CustomComponent implements
- Application.UserChangeListener {
+ public class LoginBox extends CustomComponent implements Application.UserChangeListener {
// The components this loginbox is composed of
private final TextField loginName = new TextField("Name");
private final Panel statusPanel = new Panel();
- private final Button logoutButton = new Button("Logout",
- UpgradingSample.this, "close");
+ private final Button logoutButton = new Button("Logout", UpgradingSample.this, "close");
private final Label statusLabel = new Label();
}
public void populateSelect() {
- final String[] names = new String[] { "John", "Mary", "Joe", "Sarah",
- "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
+ final String[] names = new String[] { "John", "Mary", "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
for (int j = 0; j < 4; j++) {
Integer id = new Integer(sequence++);
Item item = select.addItem(id);
- item.getItemProperty("CAPTION").setValue(
- id.toString() + ": "
- + names[random.nextInt() % names.length]);
+ item.getItemProperty("CAPTION").setValue(id.toString() + ": " + names[random.nextInt() % names.length]);
}
}
// here could be db insert or other backend operation
Integer id = new Integer(sequence++);
Item item = select.addItem(id);
- item.getItemProperty("CAPTION").setValue(
- id.toString() + ": " + newItemCaption);
+ item.getItemProperty("CAPTION").setValue(id.toString() + ": " + newItemCaption);
select.setValue(id);
}
import com.vaadin.ui.Select;
import com.vaadin.ui.Window;
-public class UsingObjectsInSelect extends com.vaadin.Application implements
- ValueChangeListener {
+public class UsingObjectsInSelect extends com.vaadin.Application implements ValueChangeListener {
private final Select select = new Select();
- private final Label selectedTask = new Label("Selected task",
- Label.CONTENT_XHTML);
+ private final Label selectedTask = new Label("Selected task", Label.CONTENT_XHTML);
public LinkedList<?> exampleTasks = new LinkedList<Object>();
}
public void createExampleTasks() {
- final String[] assignedTo = new String[] { "John", "Mary", "Joe",
- "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
- final String[] type = new String[] { "Enhancement", "Bugfix",
- "Testing", "Task" };
+ final String[] assignedTo = new String[] { "John", "Mary", "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
+ final String[] type = new String[] { "Enhancement", "Bugfix", "Testing", "Task" };
for (int j = 0; j < 100; j++) {
- final Task task = new Task(
- type[(int) (random.nextDouble() * (type.length - 1))],
- assignedTo[(int) (random.nextDouble() * (assignedTo.length - 1))],
- random.nextInt(100));
+ final Task task = new Task(type[(int) (random.nextDouble() * (type.length - 1))], assignedTo[(int) (random.nextDouble() * (assignedTo.length - 1))], random.nextInt(100));
select.addItem(task);
}
}
public void valueChange(ValueChangeEvent event) {
final Task task = (Task) select.getValue();
- selectedTask.setValue("<b>Type:</b> " + task.getType()
- + "<br /><b>Assigned to:</b> " + task.getAssignedTo()
- + "<br /><b>Estimated hours: </b>" + task.getEstimatedHours());
+ selectedTask.setValue("<b>Type:</b> " + task.getType() + "<br /><b>Assigned to:</b> " + task.getAssignedTo() + "<br /><b>Estimated hours: </b>" + task.getEstimatedHours());
}
/**
import com.vaadin.ui.Label;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
public abstract class Feature extends CustomComponent {
- private static final String PROP_REMINDER_TEXT = ""
- + "<br /><br />Note: Use <b>Properties</b> panel located at the top"
- + " right corner to try out how different properties affect"
- + " the presentation or functionality of currently selected component.";
+ private static final String PROP_REMINDER_TEXT = "" + "<br /><br />Note: Use <b>Properties</b> panel located at the top" + " right corner to try out how different properties affect" + " the presentation or functionality of currently selected component.";
private boolean propsReminder = true;
- private final OrderedLayout layout;
+ private final VerticalLayout layout;
private TabSheet ts;
/** Constuctor for the feature component */
public Feature() {
- layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+ layout = new VerticalLayout();
setCompositionRoot(layout);
}
* @param url
*/
public void setJavadocURL(String url) {
- javadoc.setValue("<iframe width=\"100%\" src=\"http://www.vaadin.com/api/com/vaadin/"
- + url + "\"></iframe>");
+ javadoc.setValue("<iframe width=\"100%\" src=\"http://www.vaadin.com/api/com/vaadin/" + url + "\"></iframe>");
}
/**
// Description tab
final String title = getTitle();
if (getDescriptionXHTML() != null) {
- final OrderedLayout mainLayout = new OrderedLayout(
- OrderedLayout.ORIENTATION_VERTICAL);
- final OrderedLayout layout = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ final OrderedLayout mainLayout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+ final OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
mainLayout.addComponent(layout);
if (getImage() != null) {
- layout.addComponent(new Embedded("", new ClassResource(
- getImage(), getApplication())));
+ layout.addComponent(new Embedded("", new ClassResource(getImage(), getApplication())));
}
String label = "";
label += getDescriptionXHTML();
label += PROP_REMINDER_TEXT;
}
if (title != null) {
- layout.addComponent(new Label("<h3>" + title + "</h3>",
- Label.CONTENT_XHTML));
+ layout.addComponent(new Label("<h3>" + title + "</h3>", Label.CONTENT_XHTML));
}
description = new Label(label, Label.CONTENT_XHTML);
mainLayout.addComponent(description);
// Code Sample tab
final String example = getExampleSrc();
if (example != null) {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
if (getTitle() != null) {
- l.addComponent(new Label(
- "<b>// " + getTitle() + " example</b>",
- Label.CONTENT_XHTML));
+ l.addComponent(new Label("<b>// " + getTitle() + " example</b>", Label.CONTENT_XHTML));
}
l.addComponent(new Label(example, Label.CONTENT_PREFORMATTED));
ts.addTab(l, "Code Sample", null);
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeatureBuffering extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Buffering");
l.addComponent(panel);
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeatureButton extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Button b = new Button("Caption");
l.addComponent(b);
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeatureContainers extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Containers");
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeatureCustomLayout extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Custom Layout");
import com.vaadin.ui.DateField;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeatureDateField extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
l.addComponent(new Label("Your default locale is: "
+ getApplication().getLocale().toString().replace('_', '-')));
import com.vaadin.ui.Component;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Form;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
public class FeatureEmbedded extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final ClassResource flashResource = new ClassResource(
"vaadin_spin.swf", getApplication());
import com.vaadin.ui.DateField;
import com.vaadin.ui.Form;
import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
-public class FeatureForm extends Feature implements
- Property.ValueChangeListener {
+public class FeatureForm extends Feature implements Property.ValueChangeListener {
- OrderedLayout demo = null;
+ VerticalLayout demo = null;
Form test;
protected Component getDemoComponent() {
if (demo == null) {
- demo = new OrderedLayout();
+ demo = new VerticalLayout();
createDemo();
}
}
demo.addComponent(test);
- final OrderedLayout actions = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ final HorizontalLayout actions = new HorizontalLayout();
demo.addComponent(actions);
// form adder
formLayout = new GridLayout(2, 1);
}
if (value.equals("Horizontal (OrderedLayout)")) {
- formLayout = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ formLayout = new HorizontalLayout();
}
createDemo();
@Override
protected String getDescriptionXHTML() {
- return "Form is a flexible, yet simple container for fields. "
- + " It provides support for any layouts and provides buffering interface for"
- + " easy connection of commit- and discard buttons. All the form"
- + " fields can be customized by adding validators, setting captions and icons, "
- + " setting immediateness, etc. Also direct mechanism for replacing existing"
- + " fields with selections is given."
- + " <br /><br />Form provides customizable editor for classes implementing"
- + " Item-interface. Also the form itself"
- + " implements this interface for easier connectivity to other items."
- + " To use the form as editor for an item, just connect the item to"
- + " form.After the item has been connected to the form,"
- + " the automatically created fields can be customized and new fields can"
- + " be added. If you need to connect a class that does not implement"
- + " Item-interface, most properties of any"
- + " class following bean pattern, can be accessed trough"
- + " BeanItem."
- + " <br /><br />The best example of Form usage is the this feature browser itself; "
- + " all the Property-panels in demos are composed of Form-components.";
+ return "Form is a flexible, yet simple container for fields. " + " It provides support for any layouts and provides buffering interface for" + " easy connection of commit- and discard buttons. All the form" + " fields can be customized by adding validators, setting captions and icons, " + " setting immediateness, etc. Also direct mechanism for replacing existing" + " fields with selections is given." + " <br /><br />Form provides customizable editor for classes implementing" + " Item-interface. Also the form itself" + " implements this interface for easier connectivity to other items." + " To use the form as editor for an item, just connect the item to" + " form.After the item has been connected to the form," + " the automatically created fields can be customized and new fields can" + " be added. If you need to connect a class that does not implement" + " Item-interface, most properties of any" + " class following bean pattern, can be accessed trough" + " BeanItem." + " <br /><br />The best example of Form usage is the this feature browser itself; " + " all the Property-panels in demos are composed of Form-components.";
}
@Override
import com.vaadin.ui.DateField;
import com.vaadin.ui.Form;
import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
public class FeatureGridLayout extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final GridLayout gl = new GridLayout(3, 3);
final DateField cal = new DateField("Test component 1", new Date());
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeatureItems extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Items");
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
public class FeatureLabel extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Label lab = new Label("Label text");
l.addComponent(lab);
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Link;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
public class FeatureLink extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Link lnk = new Link("Link caption", new ExternalResource(
"http://www.vaadin.com"));
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
public class FeatureOrderedLayout extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
- final OrderedLayout ol = new OrderedLayout();
+ final VerticalLayout ol = new VerticalLayout();
for (int i = 1; i < 5; i++) {
ol.addComponent(new TextField("Test component " + i));
}
// Properties
propertyPanel = new PropertyPanel(ol);
- final Form ap = propertyPanel
- .createBeanPropertySet(new String[] { "orientation" });
- ap.replaceWithSelect("orientation", new Object[] {
- new Integer(OrderedLayout.ORIENTATION_HORIZONTAL),
- new Integer(OrderedLayout.ORIENTATION_VERTICAL) },
- new Object[] { "Horizontal", "Vertical" });
+ final Form ap = propertyPanel.createBeanPropertySet(new String[] { "orientation" });
+ ap.replaceWithSelect("orientation", new Object[] { new Integer(OrderedLayout.ORIENTATION_HORIZONTAL), new Integer(OrderedLayout.ORIENTATION_VERTICAL) }, new Object[] { "Horizontal", "Vertical" });
final Select themes = (Select) propertyPanel.getField("style");
- themes.addItem("form")
- .getItemProperty(themes.getItemCaptionPropertyId())
- .setValue("form");
+ themes.addItem("form").getItemProperty(themes.getItemCaptionPropertyId()).setValue("form");
propertyPanel.addProperties("OrderedLayout Properties", ap);
setJavadocURL("ui/OrderedLayout.html");
@Override
protected String getExampleSrc() {
- return "OrderedLayout ol = new OrderedLayout(OrderedLayout.ORIENTATION_FLOW);\n"
- + "ol.addComponent(new TextField(\"Textfield caption\"));\n"
- + "ol.addComponent(new Label(\"Label\"));\n";
+ return "OrderedLayout ol = new OrderedLayout(OrderedLayout.ORIENTATION_FLOW);\n" + "ol.addComponent(new TextField(\"Textfield caption\"));\n" + "ol.addComponent(new Label(\"Label\"));\n";
}
*/
@Override
protected String getDescriptionXHTML() {
- return "This feature provides a container for laying out components either "
- + "vertically, horizontally or flowingly. The orientation may be changed "
- + "during runtime. It also defines a special style for themes to implement called \"form\""
- + "that is used for input forms where the components are laid-out side-by-side "
- + "with their captions."
- + "<br /><br />"
- + "On the demo tab you can try out how the different properties "
- + "affect the presentation of the component.";
+ return "This feature provides a container for laying out components either " + "vertically, horizontally or flowingly. The orientation may be changed " + "during runtime. It also defines a special style for themes to implement called \"form\"" + "that is used for input forms where the components are laid-out side-by-side " + "with their captions." + "<br /><br />" + "On the demo tab you can try out how the different properties " + "affect the presentation of the component.";
}
@Override
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeaturePanel extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
// Example panel
final Panel show = new Panel("Panel caption");
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
import com.vaadin.ui.Link;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
public class FeatureParameters extends Feature implements URIHandler,
ParameterHandler {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Label info = new Label("To test this feature, try to "
+ "add some get parameters to URL. For example if you have "
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeatureProperties extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Data Model");
package com.vaadin.tests.featurebrowser;
import com.vaadin.ui.Component;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeatureSelect extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Select s = new Select("Select employee");
for (int i = 0; i < 50; i++) {
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
public class FeatureTabSheet extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final TabSheet ts = new TabSheet();
ts.addTab(
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
public class FeatureTable extends Feature implements Action.Handler {
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
// Sample table
t = new Table("Corporate Employees");
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
public class FeatureTree extends Feature implements Action.Handler {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final String[] names = new String[100];
for (int i = 0; i < names.length; i++) {
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.Link;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Upload;
import com.vaadin.ui.Upload.FinishedEvent;
+import com.vaadin.ui.VerticalLayout;
public class FeatureUpload extends Feature implements Upload.FinishedListener {
Buffer buffer = new Buffer();
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Upload up = new Upload("Upload", buffer);
up.setImmediate(true);
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class FeatureValidators extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Validators");
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Window.CloseEvent;
@Override
protected Component getDemoComponent() {
- final OrderedLayout layoutRoot = new OrderedLayout();
- final OrderedLayout layoutUpper = new OrderedLayout();
- final OrderedLayout layoutLower = new OrderedLayout();
+ final VerticalLayout layoutRoot = new VerticalLayout();
+ final VerticalLayout layoutUpper = new VerticalLayout();
+ final VerticalLayout layoutLower = new VerticalLayout();
demoWindow = new Window("Feature Test Window");
demoWindow.addListener(this);
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class IntroBasic extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Basic UI components");
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class IntroComponents extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("UI component diagram");
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class IntroDataHandling extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Data Handling");
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class IntroDataModel extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Data Model");
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class IntroItemContainers extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Item Containers");
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class IntroLayouts extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Panel panel = new Panel();
panel.setCaption("Layouts");
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
public class IntroTerminal extends Feature {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
final Label lab = new Label();
lab.setStyle("featurebrowser-none");
import com.vaadin.ui.Component;
import com.vaadin.ui.Form;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
public class IntroWelcome extends Feature implements URIHandler,
ParameterHandler {
@Override
protected Component getDemoComponent() {
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
panel.setCaption("Welcome to the Vaadin feature tour!");
l.addComponent(panel);
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Tree;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class PropertyPanel extends Panel implements Button.ClickListener,
private Select addComponent;
- private final OrderedLayout formsLayout = new OrderedLayout();
+ private final VerticalLayout formsLayout = new VerticalLayout();
private final LinkedList<Form> forms = new LinkedList<Form>();
public class OrderedLayoutBasics extends TestBase {\r
\r
String valignName[] = new String[] { "top", "middle", "bottom" };\r
- int valign[] = new int[] { AlignmentHandler.ALIGNMENT_TOP,\r
- AlignmentHandler.ALIGNMENT_VERTICAL_CENTER,\r
- AlignmentHandler.ALIGNMENT_BOTTOM };\r
+ int valign[] = new int[] { AlignmentHandler.ALIGNMENT_TOP, AlignmentHandler.ALIGNMENT_VERTICAL_CENTER, AlignmentHandler.ALIGNMENT_BOTTOM };\r
\r
Set<AbstractOrderedLayout> layouts = new HashSet<AbstractOrderedLayout>();\r
private AbstractOrderedLayout layoutContainer;\r
ol.setWidth("");\r
ol.setCaption("Fixed height (50px) and dynamic width");\r
\r
- TextField tf = new TextField(\r
- "100px high TextField, valign: bottom, should be partly outside");\r
+ TextField tf = new TextField("100px high TextField, valign: bottom, should be partly outside");\r
tf.setHeight("100px");\r
tf.setWidth("");\r
ol.addComponent(tf);\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);\r
\r
- tf = new TextField(\r
- "100% high, 50px wide TextField, valign: bottom, should fill full height");\r
+ tf = new TextField("100% high, 50px wide TextField, valign: bottom, should fill full height");\r
tf.setHeight("100%");\r
tf.setWidth("50px");\r
ol.addComponent(tf);\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);\r
\r
- Label l = new Label(\r
- "100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");\r
+ Label l = new Label("100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");\r
tf.setHeight("100%");\r
tf.setWidth("50px");\r
ol.addComponent(l);\r
ol.addComponent(tf);\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);\r
\r
- Label l = new Label(\r
- "100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");\r
+ Label l = new Label("100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");\r
tf.setHeight("100%");\r
tf.setWidth("50px");\r
ol.addComponent(l);\r
}\r
\r
private Layout layout3New() {\r
- AbstractOrderedLayout ol = new HorizontalLayout();\r
+ HorizontalLayout ol = new HorizontalLayout();\r
ol.setHeight("300px");\r
// ol.setWidth("500px");\r
ol.setWidth("");\r
ol.addComponent(tf);\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);\r
\r
- Label l = new Label(\r
- "100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");\r
+ Label l = new Label("100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");\r
tf.setHeight("100%");\r
tf.setWidth("50px");\r
ol.addComponent(l);\r
int w = i * 100;\r
tf = new TextField("Field " + i);\r
tf.setRows(2);\r
- tf.setValue(w + "px high, " + w + "px wide TextField, valign: "\r
- + valignName[i % 3]);\r
+ tf.setValue(w + "px high, " + w + "px wide TextField, valign: " + valignName[i % 3]);\r
tf.setWidth(w + "px");\r
tf.setHeight(w + "px");\r
ol.addComponent(tf);\r
- ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_LEFT,\r
- valign[i % 3]);\r
+ ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_LEFT, valign[i % 3]);\r
\r
}\r
\r
ol.setSpacing(true);\r
\r
// ol.setWidth("");\r
- ol.setCaption("Fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight()\r
- + "px) / layout_field_100pct_button_field");\r
+ ol.setCaption("Fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px) / layout_field_100pct_button_field");\r
TextField tf;\r
\r
tf = new TextField("300px x 300px Field");\r
ol.setSpacing(true);\r
\r
// ol.setWidth("");\r
- ol.setCaption("Fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight()\r
- + "px) / layout_basic_test");\r
+ ol.setCaption("Fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px) / layout_basic_test");\r
TextField tf;\r
\r
tf = new TextField("300px x 300px Field");\r
ol.setSpacing(false);\r
\r
// ol.setWidth("");\r
- ol.setCaption("Fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight()\r
- + "px) / layout_symmetric_fields");\r
+ ol.setCaption("Fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px) / layout_symmetric_fields");\r
TextField tf;\r
\r
tf = new TextField("300px x 300px Field");\r
ol.setSpacing(true);\r
\r
// ol.setWidth("");\r
- ol.setCaption("Fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight()\r
- + "px) / layout_leftAndRight");\r
+ ol.setCaption("Fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px) / layout_leftAndRight");\r
TextField tf;\r
\r
// tf = new TextField("100%x100% Field");\r
ol.setSpacing(true);\r
\r
// ol.setWidth("");\r
- ol.setCaption("Filled with fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight() + "px)");\r
+ ol.setCaption("Filled with fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px)");\r
TextField tf;\r
\r
tf = new TextField("60%x100% Field");\r
tf.setRequired(true);\r
ol.addComponent(tf);\r
ol.setExpandRatio(tf, 1f);\r
- ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_LEFT,\r
- AlignmentHandler.ALIGNMENT_VERTICAL_CENTER);\r
+ ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_LEFT, AlignmentHandler.ALIGNMENT_VERTICAL_CENTER);\r
// tf.setComponentError(new UserError("It's broken!"));\r
\r
// tf.setHeight("100%");\r
ol.setSpacing(true);\r
\r
// ol.setWidth("");\r
- ol.setCaption("OverFilled with fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight() + "px)");\r
+ ol.setCaption("OverFilled with fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px)");\r
TextField tf;\r
\r
for (int i = 0; i < 5; i++) {\r
ol.setSpacing(true);\r
\r
// ol.setWidth("");\r
- ol.setCaption("OverFilled with fixed width (" + ol.getWidth()\r
- + "px) and dynamic height");\r
+ ol.setCaption("OverFilled with fixed width (" + ol.getWidth() + "px) and dynamic height");\r
TextField tf;\r
\r
for (int i = 0; i < 10; i++) {\r
ol.setSpacing(true);\r
\r
// ol.setWidth("");\r
- ol.setCaption("Fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight()\r
- + "px) / layout_add_remove_components");\r
+ ol.setCaption("Fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px) / layout_add_remove_components");\r
\r
for (int i = 0; i < 2; i++) {\r
AbstractOrderedLayout inner = createAddRemove(ol, "", "");\r
tf = new TextField("Short caption");\r
ol.addComponent(tf);\r
\r
- tf = new TextField(\r
- "A very long caption which is probably much longer than the field");\r
+ tf = new TextField("A very long caption which is probably much longer than the field");\r
ol.addComponent(tf);\r
\r
- tf = new TextField(\r
- "A very long caption which is probably much longer than the field and includes indicators");\r
+ tf = new TextField("A very long caption which is probably much longer than the field and includes indicators");\r
tf.setRequired(true);\r
tf.setComponentError(new UserError("abc123"));\r
ol.addComponent(tf);\r
ol.addComponent(tf);\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);\r
\r
- tf = new TextField(\r
- "A long caption which is probably much longer than the field");\r
+ tf = new TextField("A long caption which is probably much longer than the field");\r
tf.setValue("Undefined width");\r
tf.setRequired(true);\r
tf.setComponentError(new UserError("123"));\r
ol.addComponent(tf);\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);\r
\r
- tf = new TextField(\r
- "A very long caption which is probably much longer than the field and includes indicators");\r
+ tf = new TextField("A very long caption which is probably much longer than the field and includes indicators");\r
tf.setValue("Undefined width");\r
tf.setIcon(new ThemeResource("icons/16/document-add.png"));\r
tf.setRequired(true);\r
\r
}\r
\r
- private Layout layout_captions_fixed_size_and_relative_size(\r
- AbstractOrderedLayout ol) {\r
+ private Layout layout_captions_fixed_size_and_relative_size(AbstractOrderedLayout ol) {\r
ol.setWidth("700px");\r
ol.setHeight("250px");\r
\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);\r
ol.setExpandRatio(tf, 1);\r
\r
- tf = new TextField(\r
- "A long caption which is probably much longer than the field");\r
+ tf = new TextField("A long caption which is probably much longer than the field");\r
tf.setValue("100% wide field, ratio 2");\r
tf.setSizeFull();\r
tf.setRequired(true);\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);\r
ol.setExpandRatio(tf, 2);\r
\r
- tf = new TextField(\r
- "A very long caption which is probably much longer than the field and includes indicators");\r
+ tf = new TextField("A very long caption which is probably much longer than the field and includes indicators");\r
tf.setValue("100% wide field, ratio 3");\r
tf.setSizeFull();\r
tf.setIcon(new ThemeResource("icons/16/document-add.png"));\r
\r
}\r
\r
- private Layout layout_captions_fixed_size_and_fixed_size(\r
- AbstractOrderedLayout ol) {\r
+ private Layout layout_captions_fixed_size_and_fixed_size(AbstractOrderedLayout ol) {\r
ol.setWidth("700px");\r
ol.setHeight("250px");\r
\r
ol.addComponent(tf);\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);\r
\r
- tf = new TextField(\r
- "A long caption which is probably much longer than the field");\r
+ tf = new TextField("A long caption which is probably much longer than the field");\r
tf.setWidth("250px");\r
tf.setValue("250px wide field");\r
tf.setRequired(true);\r
ol.addComponent(tf);\r
ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);\r
\r
- tf = new TextField(\r
- "A very long caption which is probably much longer than the field and includes indicators");\r
+ tf = new TextField("A very long caption which is probably much longer than the field and includes indicators");\r
tf.setValue("200px wide field");\r
tf.setWidth("200px");\r
tf.setIcon(new ThemeResource("icons/16/document-add.png"));\r
ol.setCaption("Caption test with fixed width");\r
\r
Label l;\r
- l = new Label(\r
- "This is a long text and should remain on one line as there is nothing forcing line breaks");\r
+ l = new Label("This is a long text and should remain on one line as there is nothing forcing line breaks");\r
ol.addComponent(l);\r
// ol.setComponentAlignment(l, AlignmentHandler.ALIGNMENT_RIGHT,\r
// AlignmentHandler.ALIGNMENT_BOTTOM);\r
\r
}\r
\r
- private AbstractOrderedLayout createAddRemove(AbstractOrderedLayout ol,\r
- String width, String buttonSuffix) {\r
+ private AbstractOrderedLayout createAddRemove(AbstractOrderedLayout ol, String width, String buttonSuffix) {\r
Button b = createAddButton(ol);\r
Button wb = createWideAddButton(ol);\r
Button r = createRemoveButton(ol, buttonSuffix);\r
Button b = new Button("Add before", new ClickListener() {\r
\r
public void buttonClick(ClickEvent event) {\r
- addBefore((AbstractOrderedLayout) event.getButton().getData(),\r
- event.getButton().getParent(), "");\r
+ addBefore((AbstractOrderedLayout) event.getButton().getData(), event.getButton().getParent(), "");\r
}\r
\r
});\r
Button b = new Button("Add 100% before", new ClickListener() {\r
\r
public void buttonClick(ClickEvent event) {\r
- addBefore((AbstractOrderedLayout) event.getButton().getData(),\r
- event.getButton().getParent(), "100%");\r
+ addBefore((AbstractOrderedLayout) event.getButton().getData(), event.getButton().getParent(), "100%");\r
}\r
\r
});\r
Button b = new Button("Remove this " + suffix, new ClickListener() {\r
\r
public void buttonClick(ClickEvent event) {\r
- remove((AbstractOrderedLayout) event.getButton().getData(),\r
- event.getButton().getParent());\r
+ remove((AbstractOrderedLayout) event.getButton().getData(), event.getButton().getParent());\r
}\r
\r
});\r
}\r
index++;\r
}\r
- AbstractOrderedLayout inner = createAddRemove(ol, width,\r
- String.valueOf(suffix++));\r
+ AbstractOrderedLayout inner = createAddRemove(ol, width, String.valueOf(suffix++));\r
ol.addComponent(inner, index);\r
if (width.contains("%")) {\r
ol.setExpandRatio(inner, 1.0f);\r
ol.setSpacing(true);\r
\r
// ol.setWidth("");\r
- ol.setCaption("100 % filled with fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight() + "px)");\r
+ ol.setCaption("100 % filled with fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px)");\r
TextField tf;\r
\r
tf = new TextField();\r
ol.setSpacing(false);\r
\r
// ol.setWidth("");\r
- ol.setCaption("100 % filled with fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight() + "px)");\r
+ ol.setCaption("100 % filled with fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px)");\r
TextField tf;\r
\r
tf = new TextField();\r
ol.setSpacing(true);\r
\r
// ol.setWidth("");\r
- ol.setCaption("Underfilled with fixed width (" + ol.getWidth()\r
- + "px) and fixed height (" + ol.getHeight() + "px)");\r
+ ol.setCaption("Underfilled with fixed width (" + ol.getWidth() + "px) and fixed height (" + ol.getHeight() + "px)");\r
TextField tf;\r
\r
tf = new TextField("60%x100% Field");\r
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
public class RobustnessSimple extends Robustness implements
Button.ClickListener {
}
// create new stress layout
- stressLayout = new OrderedLayout();
+ stressLayout = new VerticalLayout();
// CASE single orderedlayout with a label containing 1Mb of data
// fill with random components
\r
import com.vaadin.data.Property.ValueChangeEvent;\r
import com.vaadin.data.Property.ValueChangeListener;\r
+import com.vaadin.data.Property.ValueChangeNotifier;\r
import com.vaadin.data.util.ObjectProperty;\r
import com.vaadin.ui.AbstractField;\r
\r
import com.vaadin.Application;
import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering;
-import com.vaadin.ui.ExpandLayout;
+import com.vaadin.ui.Alignment;
import com.vaadin.ui.Label;
import com.vaadin.ui.SplitPanel;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
@Override
public void init() {
- final Window mainWin = new Window(
- "Test app to break layout fuction in IE7");
+ final Window mainWin = new Window("Test app to break layout fuction in IE7");
setMainWindow(mainWin);
SplitPanel sp = new SplitPanel();
sp.setFirstComponent(new Label("First"));
- ExpandLayout el = new ExpandLayout();
+ VerticalLayout el = new VerticalLayout();
sp.setSecondComponent(el);
el.setMargin(true);
el.addComponent(new Label("Top"));
- Table testTable = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(5, 50);
+ Table testTable = TestForTablesInitialColumnWidthLogicRendering.getTestTable(5, 50);
testTable.setSizeFull();
TabSheet ts = new TabSheet();
ts.setSizeFull();
- Label red = new Label(
- "<div style='background:red;width:100%;height:100%;'>??</div>",
- Label.CONTENT_XHTML);
+ Label red = new Label("<div style='background:red;width:100%;height:100%;'>??</div>", Label.CONTENT_XHTML);
// red.setCaption("cap");
// red.setSizeFull();
// el.addComponent(testTable);
- // el.expand(testTable);
+ // el.setExpandRatio(testTable,1);
el.addComponent(ts);
- el.expand(ts);
+ el.setExpandRatio(ts, 1);
ts.addComponent(red);
- ts.setTabCaption(red, "REd tab");
+ ts.getTab(red).setCaption("REd tab");
- Label l = new Label("<div style='background:blue;'>sdf</div>",
- Label.CONTENT_XHTML);
+ Label l = new Label("<div style='background:blue;'>sdf</div>", Label.CONTENT_XHTML);
el.addComponent(l);
- el.setComponentAlignment(l, ExpandLayout.ALIGNMENT_RIGHT,
- ExpandLayout.ALIGNMENT_VERTICAL_CENTER);
+ el.setComponentAlignment(l, Alignment.MIDDLE_RIGHT);
- mainWin.setLayout(sp);
+ mainWin.setContent(sp);
}
}
\ No newline at end of file
}
- w.addComponent(new Button("print select values",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- printState();
- }
- }));
+ w.addComponent(new Button("print select values", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ printState();
+ }
+ }));
}
private Select createSelect() {
}
void printState() {
- System.out.println(" Select without null item "
- + selectWithoutNullItem.getValue());
- System.out.println(" Select with null item "
- + selectWithNullItem.getValue());
+ System.out.println(" Select without null item " + selectWithoutNullItem.getValue());
+ System.out.println(" Select with null item " + selectWithNullItem.getValue());
}
import com.vaadin.ui.AbstractSelect;\r
import com.vaadin.ui.CustomComponent;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.TextField;\r
import com.vaadin.ui.Tree;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1245 extends com.vaadin.Application {\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
main.addComponent(new TreeExample());\r
Tree tree;\r
\r
public TreeExample() {\r
- final OrderedLayout main = new OrderedLayout();\r
+ final VerticalLayout main = new VerticalLayout();\r
setCompositionRoot(main);\r
\r
// Panel w/ Tree\r
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Embedded;
-import com.vaadin.ui.ExpandLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.Window.Notification;
ApplicationResource loginPage = new ApplicationResource() {
- private byte[] loginHTML = (""
- + "<html>"
- + "<head><script type='text/javascript'>"
- + "var setTarget = function() {document.getElementById('loginf').action = top.location;};"
- + "</script></head>"
- + "<body onload='setTarget();'>"
- + "Iframe generated by LoginBox. PW managers can autofill form. Form handled by LoginBox "
- + "that will fire LoginEvents. Will post into another iframe, from where the script "
- + "will find Vaadin client that will be force synced. <form id='loginf' target='logintarget'>"
- + "Username : <input type='text' name='username'>"
- + "Password : <input type='password' name='password'>"
- + "<input type='submit' value='login'>" + "</form>"
- + "<iframe name='logintarget'></iframe>" + "</body>"
- + "</html>").getBytes();
+ private byte[] loginHTML = ("" + "<html>" + "<head><script type='text/javascript'>" + "var setTarget = function() {document.getElementById('loginf').action = top.location;};" + "</script></head>" + "<body onload='setTarget();'>" + "Iframe generated by LoginBox. PW managers can autofill form. Form handled by LoginBox " + "that will fire LoginEvents. Will post into another iframe, from where the script " + "will find Vaadin client that will be force synced. <form id='loginf' target='logintarget'>" + "Username : <input type='text' name='username'>" + "Password : <input type='password' name='password'>" + "<input type='submit' value='login'>" + "</form>" + "<iframe name='logintarget'></iframe>" + "</body>" + "</html>").getBytes();
public Application getApplication() {
return LoginBox.this.getApplication();
}
public DownloadStream getStream() {
- return new DownloadStream(new ByteArrayInputStream(loginHTML),
- getMIMEType(), getFilename());
+ return new DownloadStream(new ByteArrayInputStream(loginHTML), getMIMEType(), getFilename());
}
public String getMIMEType() {
HashMap<String, String> params = new HashMap<String, String>();
// expecting single params
- for (Iterator<String> it = parameters.keySet().iterator(); it
- .hasNext();) {
+ for (Iterator<String> it = parameters.keySet().iterator(); it.hasNext();) {
String key = it.next();
String value = (parameters.get(key))[0];
params.put(key, value);
}
LoginEvent event = new LoginEvent(params);
- for (Iterator<LoginListener> iterator = listeners
- .iterator(); iterator.hasNext();) {
+ for (Iterator<LoginListener> iterator = listeners.iterator(); iterator.hasNext();) {
LoginListener listener = iterator.next();
listener.onLogin(event);
}
if (window != null) {
window.removeURIHandler(this);
}
- return new DownloadStream(
- new ByteArrayInputStream(
- "<html><body>Login form handeled.<script type='text/javascript'>top.vaadin.forceSync();</script></body></html>"
- .getBytes()), "text/html",
- "loginSuccesfull.html");
+ return new DownloadStream(new ByteArrayInputStream("<html><body>Login form handeled.<script type='text/javascript'>top.vaadin.forceSync();</script></body></html>".getBytes()), "text/html", "loginSuccesfull.html");
}
};
private Panel mainPanel;
- private ExpandLayout el;
+ private VerticalLayout el;
@Override
public void init() {
- final Window mainWin = new Window(
- "Test app with password manager savvy login functionality");
+ final Window mainWin = new Window("Test app with password manager savvy login functionality");
- el = new ExpandLayout();
+ el = new VerticalLayout();
currentUser.setCaption("Currennt user");
el.addComponent(currentUser);
el.addComponent(loginBox);
- el.expand(loginBox);
+ el.setExpandRatio(loginBox, 1);
mainWin.setLayout(el);
if (pw.equals("1234")) {
setUser(username);
currentUser.setValue(username);
- currentUser.getWindow().showNotification(
- "Logged in user: " + username);
- getMainWindow().getLayout().replaceComponent(loginBox,
- mainPanel);
- el.expand(mainPanel);
+ currentUser.getWindow().showNotification("Logged in user: " + username);
+ getMainWindow().getLayout().replaceComponent(loginBox, mainPanel);
+ el.setExpandRatio(mainPanel, 1);
} else {
- getMainWindow().showNotification(
- "Wrong password. Hint, try '1234' ",
- Notification.TYPE_WARNING_MESSAGE);
+ getMainWindow().showNotification("Wrong password. Hint, try '1234' ", Notification.TYPE_WARNING_MESSAGE);
}
}
});
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
main.addComponent(f);\r
\r
}\r
\r
- final static private Action[] actions = new Action[] {\r
- new ShortcutAction("Enter", ShortcutAction.KeyCode.ENTER,\r
- new int[] {}),\r
- new ShortcutAction("CTRL-S", ShortcutAction.KeyCode.S,\r
- new int[] { ShortcutAction.ModifierKey.CTRL }), };\r
+ final static private Action[] actions = new Action[] { new ShortcutAction("Enter", ShortcutAction.KeyCode.ENTER, new int[] {}), new ShortcutAction("CTRL-S", ShortcutAction.KeyCode.S, new int[] { ShortcutAction.ModifierKey.CTRL }), };\r
\r
public Action[] getActions(Object target, Object sender) {\r
return actions;\r
}\r
\r
public void handleAction(Action action, Object sender, Object target) {\r
- status.setValue("Pressed " + action.getCaption()\r
- + " to fire shortcut. Texfield value: " + f.getValue());\r
+ status.setValue("Pressed " + action.getCaption() + " to fire shortcut. Texfield value: " + f.getValue());\r
f.focus();\r
}\r
\r
Panel panel = new Panel("PopupTest");
// First test component
- final ObjectProperty<String> prop = new ObjectProperty<String>(
- "fooTextField");
+ final ObjectProperty<String> prop = new ObjectProperty<String>("fooTextField");
PopupView.Content content = new PopupView.Content() {
public String getMinimizedValueAsHTML() {
panel.addComponent(pe2);
// Third test component
- final ObjectProperty<StringBuffer> prop2 = new ObjectProperty<StringBuffer>(
- new StringBuffer("Text for button"));
+ final ObjectProperty<StringBuffer> prop2 = new ObjectProperty<StringBuffer>(new StringBuffer("Text for button"));
class myButton extends Button {
public myButton() {
// Fourth test component
final Panel panel3 = new Panel("Editor popup for a property");
TextField tf2 = new TextField("TextField for editing a property");
- final ObjectProperty<String> op = new ObjectProperty<String>(
- "This is property text.");
+ final ObjectProperty<String> op = new ObjectProperty<String>("This is property text.");
tf2.setPropertyDataSource(op);
panel3.addComponent(tf2);
PopupView.Content content3 = new PopupView.Content() {
TextField tf = new TextField("Editor for line " + lineNum,
- "Try to edit the contents for this textfield on line "
- + lineNum
- + " and see how the overview-version changes.");
+ "Try to edit the contents for this textfield on line " + lineNum + " and see how the overview-version changes.");
public String getMinimizedValueAsHTML() {
return "" + tf.toString().length() + " characters of info";
}
});
- table.addItem(new Object[] { "1 " + i, "2 " + i, "3 " + i,
- "4 " + i, "5 " + i, pp, pp2 }, new Integer(i));
+ table.addItem(new Object[] { "1 " + i, "2 " + i, "3 " + i, "4 " + i, "5 " + i, pp, pp2 }, new Integer(i));
}
main.addComponent(table);
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.ExpandLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1435 extends Application {
*/
public class ButtonPanel extends CustomComponent {
- ExpandLayout root = new ExpandLayout();
+ VerticalLayout root = new VerticalLayout();
// In header are the panel's title and the control buttons.
// Panel title is expanded by default.
- ExpandLayout header = new ExpandLayout(
- ExpandLayout.ORIENTATION_HORIZONTAL);
+ HorizontalLayout header = new HorizontalLayout();
// This is where the actual data is put.
Panel container = new Panel();
buttonContainer = header;
} else {
- buttonContainer = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ buttonContainer = new HorizontalLayout();
header.addComponent(buttonContainer);
}
} else {
root.setHeight(lastHeight, lastHeightUnit);
}
- event.getButton().setCaption(
- visible ? "Expand" : "Collapse");
+ event.getButton().setCaption(visible ? "Expand" : "Collapse");
}
}
});
container.getLayout().setMargin(false);
container.getLayout().setSizeFull();
root.addComponent(container);
- root.expand(container);
+ root.setExpandRatio(container,1);
}
public void setHeight(int height, int unit) {
for (int i = 0; i < 10; i++) {
String name = "Name " + i;
- table.addItem(new Object[] { new CheckBox(), name,
- "02-22-2007 13:37" }, new Integer(i));
+ table.addItem(new Object[] { new CheckBox(), name, "02-22-2007 13:37" }, new Integer(i));
}
panel.setPanelComponent(table);
import com.vaadin.Application;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1444 extends Application {
@Override
public void init() {
- final Window mainWin = new Window(
- "Test app to break layout fuction in IE7");
+ final Window mainWin = new Window("Test app to break layout fuction in IE7");
setMainWindow(mainWin);
- OrderedLayout ol = new OrderedLayout();
+ VerticalLayout ol = new VerticalLayout();
ol.setHeight("250px");
ol.setWidth("500px");
- Label red = new Label(
- "<div style='background:red;width:100%;height:100%;'>??</div>",
- Label.CONTENT_XHTML);
+ Label red = new Label("<div style='background:red;width:100%;height:100%;'>??</div>", Label.CONTENT_XHTML);
red.setSizeFull();
ol.addComponent(red);
final Window modal = new Window("Modal window");
modal.setModal(true);
- Button b = new Button("click to show notification",
- new Button.ClickListener() {
+ Button b = new Button("click to show notification", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- modal.showNotification(
- "Try clicking the button in main window!",
- Window.Notification.TYPE_ERROR_MESSAGE);
+ public void buttonClick(ClickEvent event) {
+ modal.showNotification("Try clicking the button in main window!", Window.Notification.TYPE_ERROR_MESSAGE);
- }
- });
+ }
+ });
modal.addComponent(b);
- b = new Button("click to warning notification",
- new Button.ClickListener() {
+ b = new Button("click to warning notification", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- modal.showNotification(
- "Try clicking the button in main window!",
- Window.Notification.TYPE_WARNING_MESSAGE);
- }
- });
+ public void buttonClick(ClickEvent event) {
+ modal.showNotification("Try clicking the button in main window!", Window.Notification.TYPE_WARNING_MESSAGE);
+ }
+ });
modal.addComponent(b);
- b = new Button("click to Humanized notification",
- new Button.ClickListener() {
+ b = new Button("click to Humanized notification", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- modal.showNotification(
- "Try clicking the button in main window!",
- Window.Notification.TYPE_HUMANIZED_MESSAGE);
- }
- });
+ public void buttonClick(ClickEvent event) {
+ modal.showNotification("Try clicking the button in main window!", Window.Notification.TYPE_HUMANIZED_MESSAGE);
+ }
+ });
modal.addComponent(b);
b = new Button("click to test modality!", new Button.ClickListener() {
public class Ticket1506_Panel extends Panel {\r
\r
public Ticket1506_Panel() {\r
- ObjectProperty<String> property1 = new ObjectProperty<String>(null,\r
- String.class);\r
- addComponent(initSelect(new Ticket1506_TestContainer(), "Test select",\r
- property1));\r
+ ObjectProperty<String> property1 = new ObjectProperty<String>(null, String.class);\r
+ addComponent(initSelect(new Ticket1506_TestContainer(), "Test select", property1));\r
addComponent(initButton(property1));\r
- addComponent(initSelect(new Ticket1506_TestContainer2(),\r
- "Test select 2", new ObjectProperty<String>(null, String.class)));\r
+ addComponent(initSelect(new Ticket1506_TestContainer2(), "Test select 2", new ObjectProperty<String>(null, String.class)));\r
}\r
\r
private Component initButton(final ObjectProperty<?> property) {\r
return button;\r
}\r
\r
- private Component initSelect(Container containerDataSource, String caption,\r
- ObjectProperty<?> property) {\r
+ private Component initSelect(Container containerDataSource, String caption, ObjectProperty<?> property) {\r
Select select = new Select(caption);\r
select.setFilteringMode(Select.FILTERINGMODE_CONTAINS);\r
select.setImmediate(true);\r
\r
private void loadItems() {\r
final PropertysetItem item1 = new PropertysetItem();\r
- item1.addItemProperty(PROPERTY_1_ID, new ObjectProperty<String>(\r
- "value 1", String.class));\r
- item1.addItemProperty(PROPERTY_2_ID, new ObjectProperty<String>(\r
- "name 1", String.class));\r
+ item1.addItemProperty(PROPERTY_1_ID, new ObjectProperty<String>("value 1", String.class));\r
+ item1.addItemProperty(PROPERTY_2_ID, new ObjectProperty<String>("name 1", String.class));\r
items.put(ITEM_1_ID, item1);\r
\r
final PropertysetItem item2 = new PropertysetItem();\r
- item2.addItemProperty(PROPERTY_1_ID, new ObjectProperty<String>(\r
- "value 2", String.class));\r
- item2.addItemProperty(PROPERTY_2_ID, new ObjectProperty<String>(\r
- "name 2", String.class));\r
+ item2.addItemProperty(PROPERTY_1_ID, new ObjectProperty<String>("value 2", String.class));\r
+ item2.addItemProperty(PROPERTY_2_ID, new ObjectProperty<String>("name 2", String.class));\r
items.put(ITEM_2_ID, item2);\r
}\r
\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean removeItem(Object itemId)\r
- throws UnsupportedOperationException {\r
+ public boolean removeItem(Object itemId) throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean addContainerProperty(Object propertyId, Class<?> type,\r
- Object defaultValue) throws UnsupportedOperationException {\r
+ public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean removeContainerProperty(Object propertyId)\r
- throws UnsupportedOperationException {\r
+ public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
private void loadItems() {\r
for (int i = 1; i < 15; i++) {\r
final PropertysetItem item = new PropertysetItem();\r
- item.addItemProperty(PROPERTY_1_ID, new ObjectProperty<String>(\r
- "value " + i, String.class));\r
- item.addItemProperty(PROPERTY_2_ID, new ObjectProperty<String>(\r
- "name " + i, String.class));\r
+ item.addItemProperty(PROPERTY_1_ID, new ObjectProperty<String>("value " + i, String.class));\r
+ item.addItemProperty(PROPERTY_2_ID, new ObjectProperty<String>("name " + i, String.class));\r
items.put(String.valueOf(i), item);\r
}\r
}\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean removeItem(Object itemId)\r
- throws UnsupportedOperationException {\r
+ public boolean removeItem(Object itemId) throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean addContainerProperty(Object propertyId, Class<?> type,\r
- Object defaultValue) throws UnsupportedOperationException {\r
+ public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue) throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
- public boolean removeContainerProperty(Object propertyId)\r
- throws UnsupportedOperationException {\r
+ public boolean removeContainerProperty(Object propertyId) throws UnsupportedOperationException {\r
throw new UnsupportedOperationException("Not implemented");\r
}\r
\r
@Override\r
public void init() {\r
\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
Panel p = new Panel("Test wrapper for gridlayout margin/spacing");\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
main.addComponent(new Label("Test the second issue in ticket #1581"));\r
\r
w.addURIHandler(res);\r
\r
- w.addComponent(new Link(\r
- "Test (without Content-Disposition, should suggest generatedFile.png when saving, browser default for actual disposition)",\r
- new ExternalResource("myresource")));\r
+ w.addComponent(new Link("Test (without Content-Disposition, should suggest generatedFile.png when saving, browser default for actual disposition)", new ExternalResource("myresource")));\r
\r
- w.addComponent(new Link(\r
- "Test (with Content-Disposition, should popup download dialog that suggests filename downloadedPNG.png)",\r
- new ExternalResource("myresource_download")));\r
+ w.addComponent(new Link("Test (with Content-Disposition, should popup download dialog that suggests filename downloadedPNG.png)", new ExternalResource("myresource_download")));\r
}\r
}\r
\r
}\r
\r
// Create an image and draw some background on it.\r
- BufferedImage image = new BufferedImage(200, 200,\r
- BufferedImage.TYPE_INT_RGB);\r
+ BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);\r
Graphics drawable = image.getGraphics();\r
drawable.setColor(Color.lightGray);\r
drawable.fillRect(0, 0, 200, 200);\r
ImageIO.write(image, "png", imagebuffer);\r
\r
// Return a stream from the buffer.\r
- ByteArrayInputStream istream = new ByteArrayInputStream(\r
- imagebuffer.toByteArray());\r
- DownloadStream downloadStream = new DownloadStream(istream,\r
- "image/png", "generatedFile.png");\r
+ ByteArrayInputStream istream = new ByteArrayInputStream(imagebuffer.toByteArray());\r
+ DownloadStream downloadStream = new DownloadStream(istream, "image/png", "generatedFile.png");\r
\r
if (relativeUri.startsWith("myresource_download")) {\r
- downloadStream.setParameter("Content-Disposition",\r
- "attachment; filename=\"downloadedPNG.png\"");\r
+ downloadStream.setParameter("Content-Disposition", "attachment; filename=\"downloadedPNG.png\"");\r
}\r
return downloadStream;\r
} catch (IOException e) {\r
MenuItem firstSubItem1 = first.getChildren().get(1);
for (int i = 0; i < 3; i++) {
- firstSubItem1.addItem(new String("Subsubmenu item" + i), null,
- new Command() {
-
- public void menuSelected(MenuItem selected) {
- main.showNotification("Action "
- + selected.getText());
- }
- });
+ firstSubItem1.addItem(new String("Subsubmenu item" + i), null, new Command() {
+
+ public void menuSelected(MenuItem selected) {
+ main.showNotification("Action " + selected.getText());
+ }
+ });
}
MenuItem firstSubItem2 = first.getChildren().get(3);
for (int i = 0; i < 3; i++) {
- firstSubItem2.addItem(new String("Subsubmenu item" + i), null,
- new Command() {
-
- public void menuSelected(MenuItem selected) {
- main.showNotification("Action "
- + selected.getText());
- }
- });
+ firstSubItem2.addItem(new String("Subsubmenu item" + i), null, new Command() {
+
+ public void menuSelected(MenuItem selected) {
+ main.showNotification("Action " + selected.getText());
+ }
+ });
}
MenuItem second = menuBar.getItems().get(1);
for (int i = 0; i < 5; i++) {
- second.addItem(new String("Second submenu item" + i), null,
- new Command() {
-
- public void menuSelected(MenuItem selected) {
- main.showNotification("Action "
- + selected.getText());
- }
- });
+ second.addItem(new String("Second submenu item" + i), null, new Command() {
+
+ public void menuSelected(MenuItem selected) {
+ main.showNotification("Action " + selected.getText());
+ }
+ });
}
MenuItem third = menuBar.getItems().get(2);
public void init() {
final Window mainWin = new Window();
setMainWindow(mainWin);
- mainWin.addComponent(new Button(
- "Change URI using Application.getURL()",
- new Button.ClickListener() {
+ mainWin.addComponent(new Button("Change URI using Application.getURL()", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- mainWin.open(new ExternalResource(getURL() + "#"
- + System.currentTimeMillis()));
- }
- }));
- mainWin.addComponent(new Button("Change URI uring Window.getURL()",
- new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ mainWin.open(new ExternalResource(getURL() + "#" + System.currentTimeMillis()));
+ }
+ }));
+ mainWin.addComponent(new Button("Change URI uring Window.getURL()", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- mainWin.open(new ExternalResource(mainWin.getURL()
- + "#" + System.currentTimeMillis()));
- }
- }));
+ public void buttonClick(ClickEvent event) {
+ mainWin.open(new ExternalResource(mainWin.getURL() + "#" + System.currentTimeMillis()));
+ }
+ }));
}
}
\r
TextField tf = new TextField("First name");\r
tf.setDescription("The first name is used for the administration user interfaces only.");\r
- tf.setComponentError(new SystemError(\r
- "You must enter only one first name."));\r
+ tf.setComponentError(new SystemError("You must enter only one first name."));\r
\r
main.addComponent(tf);\r
}\r
import com.vaadin.data.Property;\r
import com.vaadin.data.Property.ValueChangeEvent;\r
import com.vaadin.data.util.MethodProperty;\r
-import com.vaadin.terminal.Sizeable;\r
import com.vaadin.terminal.SystemError;\r
import com.vaadin.terminal.ThemeResource;\r
import com.vaadin.ui.AbstractComponent;\r
import com.vaadin.ui.Component;\r
import com.vaadin.ui.ComponentContainer;\r
import com.vaadin.ui.DateField;\r
-import com.vaadin.ui.ExpandLayout;\r
import com.vaadin.ui.Form;\r
import com.vaadin.ui.GridLayout;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Label;\r
import com.vaadin.ui.Layout;\r
import com.vaadin.ui.Layout.AlignmentHandler;\r
import com.vaadin.ui.NativeSelect;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.TextField;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1710 extends com.vaadin.Application {\r
\r
setTheme("tests-tickets");\r
\r
- OrderedLayout lo = new OrderedLayout();\r
+ VerticalLayout lo = new VerticalLayout();\r
setMainWindow(new Window("#1710", lo));\r
lo.setMargin(true);\r
lo.setSpacing(true);\r
lo.setWidth("100%");\r
\r
// Hiding controls\r
- OrderedLayout hidingControls = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ HorizontalLayout hidingControls = new HorizontalLayout();\r
lo.addComponent(hidingControls);\r
\r
// OrderedLayout\r
- final OrderedLayout orderedLayout = new OrderedLayout();\r
- LayoutTestingPanel oltp = new LayoutTestingPanel("OrderedLayout",\r
- orderedLayout);\r
- hidingControls.addComponent(new Button("OrderedLayout",\r
- new MethodProperty<Boolean>(oltp, "visible")));\r
+ final VerticalLayout orderedLayout = new VerticalLayout();\r
+ LayoutTestingPanel oltp = new LayoutTestingPanel("OrderedLayout", orderedLayout);\r
+ hidingControls.addComponent(new Button("OrderedLayout", new MethodProperty<Boolean>(oltp, "visible")));\r
lo.addComponent(oltp);\r
orderedLayout.setSpacing(false);\r
addFields(orderedLayout);\r
- final Button orientationButton = new Button("horizontal orientation",\r
- false);\r
- orientationButton.addListener(new Property.ValueChangeListener() {\r
- public void valueChange(ValueChangeEvent event) {\r
- orderedLayout.setOrientation(orientationButton.booleanValue() ? OrderedLayout.ORIENTATION_HORIZONTAL\r
- : OrderedLayout.ORIENTATION_VERTICAL);\r
- }\r
- });\r
- orientationButton.setImmediate(true);\r
- oltp.controls.addComponent(orientationButton);\r
\r
// GridLayout\r
GridLayout grid = new GridLayout(1, 1);\r
Panel g1tp = new LayoutTestingPanel("Gridlayout with 1 column", grid);\r
- hidingControls.addComponent(new Button("GridLayout (1col)",\r
- new MethodProperty<Boolean>(g1tp, "visible")));\r
+ hidingControls.addComponent(new Button("GridLayout (1col)", new MethodProperty<Boolean>(g1tp, "visible")));\r
g1tp.setVisible(false);\r
lo.addComponent(g1tp);\r
grid.setSpacing(true);\r
addFields(grid);\r
GridLayout grid2 = new GridLayout(2, 1);\r
Panel g2tp = new LayoutTestingPanel("Gridlayout with 2 columns", grid2);\r
- hidingControls.addComponent(new Button("GridLayout (2cols)",\r
- new MethodProperty<Boolean>(g2tp, "visible")));\r
+ hidingControls.addComponent(new Button("GridLayout (2cols)", new MethodProperty<Boolean>(g2tp, "visible")));\r
g2tp.setVisible(false);\r
lo.addComponent(g2tp);\r
grid2.setSpacing(true);\r
addFields(grid2);\r
\r
// ExpandLayout\r
- ExpandLayout el = new ExpandLayout();\r
- Panel elp = new LayoutTestingPanel(\r
- "ExpandLayout width first component expanded", el);\r
- hidingControls.addComponent(new Button("ExpandLayout (vertical)",\r
- new MethodProperty<Boolean>(elp, "visible")));\r
+ VerticalLayout el = new VerticalLayout();\r
+ Panel elp = new LayoutTestingPanel("ExpandLayout width first component expanded", el);\r
+ hidingControls.addComponent(new Button("ExpandLayout (vertical)", new MethodProperty<Boolean>(elp, "visible")));\r
elp.setVisible(false);\r
- el.setHeight(700);\r
+ el.setHeight("700px");\r
addFields(el);\r
Component firstComponent = el.getComponentIterator().next();\r
firstComponent.setSizeFull();\r
- el.expand(firstComponent);\r
+ el.setExpandRatio(firstComponent, 1);\r
lo.addComponent(elp);\r
- ExpandLayout elh = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);\r
- Panel elhp = new LayoutTestingPanel(\r
- "ExpandLayout width first component expanded; horizontal", elh);\r
- hidingControls.addComponent(new Button("ExpandLayout (horizontal)",\r
- new MethodProperty<Boolean>(elhp, "visible")));\r
+ HorizontalLayout elh = new HorizontalLayout();\r
+ Panel elhp = new LayoutTestingPanel("ExpandLayout width first component expanded; horizontal", elh);\r
+ hidingControls.addComponent(new Button("ExpandLayout (horizontal)", new MethodProperty<Boolean>(elhp, "visible")));\r
elhp.setVisible(false);\r
elhp.setScrollable(true);\r
- elh.setWidth(2000);\r
- elh.setHeight(100);\r
+ elh.setWidth("2000px");\r
+ elh.setHeight("100px");\r
addFields(elh);\r
Component firstComponentElh = elh.getComponentIterator().next();\r
firstComponentElh.setSizeFull();\r
- elh.expand(firstComponentElh);\r
+ elh.setExpandRatio(firstComponentElh, 1);\r
lo.addComponent(elhp);\r
\r
// CustomLayout\r
- OrderedLayout cl = new OrderedLayout();\r
+ VerticalLayout cl = new VerticalLayout();\r
Panel clp = new LayoutTestingPanel("CustomLayout", cl);\r
- hidingControls.addComponent(new Button("CustomLayout",\r
- new MethodProperty<Boolean>(clp, "visible")));\r
+ hidingControls.addComponent(new Button("CustomLayout", new MethodProperty<Boolean>(clp, "visible")));\r
clp.setVisible(false);\r
lo.addComponent(clp);\r
cl.addComponent(new Label("<<< Add customlayout testcase here >>>"));\r
\r
// Form\r
Panel formPanel = new Panel("Form");\r
- hidingControls.addComponent(new Button("Form",\r
- new MethodProperty<Boolean>(formPanel, "visible")));\r
+ hidingControls.addComponent(new Button("Form", new MethodProperty<Boolean>(formPanel, "visible")));\r
formPanel.setVisible(false);\r
formPanel.addComponent(getFormPanelExample());\r
lo.addComponent(formPanel);\r
\r
- for (Iterator<Component> i = hidingControls.getComponentIterator(); i\r
- .hasNext();) {\r
+ for (Iterator<Component> i = hidingControls.getComponentIterator(); i.hasNext();) {\r
((AbstractComponent) i.next()).setImmediate(true);\r
}\r
\r
TextField t5 = new TextField();\r
t5.setValue("Without caption, WIDE");\r
t5.setComponentError(new SystemError("Error"));\r
- t5.setWidth(100);\r
- t5.setWidthUnits(Sizeable.UNITS_PERCENTAGE);\r
+ t5.setWidth("100%");\r
lo.addComponent(t5);\r
\r
TextField t6 = new TextField();\r
t6.setValue("Without caption, With required, WIDE");\r
t6.setComponentError(new SystemError("Error"));\r
t6.setRequired(true);\r
- t6.setWidth(100);\r
- t6.setWidthUnits(Sizeable.UNITS_PERCENTAGE);\r
+ t6.setWidth("100%");\r
lo.addComponent(t6);\r
\r
TextField t7 = new TextField();\r
t7.setIcon(new ThemeResource("../runo/icons/16/ok.png"));\r
lo.addComponent(t7);\r
\r
- DateField d1 = new DateField(\r
- "Datefield with caption and icon, next one without caption");\r
+ DateField d1 = new DateField("Datefield with caption and icon, next one without caption");\r
d1.setComponentError(new SystemError("Error"));\r
d1.setRequired(true);\r
d1.setIcon(new ThemeResource("../runo/icons/16/ok.png"));\r
\r
Layout testedLayout;\r
\r
- OrderedLayout controls = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ HorizontalLayout controls = new HorizontalLayout();\r
Button marginLeft = new Button("m-left", false);\r
Button marginRight = new Button("m-right", false);\r
Button marginTop = new Button("m-top", false);\r
Button marginBottom = new Button("m-bottom", false);\r
Button spacing = new Button("spacing", false);\r
- OrderedLayout testPanelLayout = new OrderedLayout();\r
+ VerticalLayout testPanelLayout = new VerticalLayout();\r
\r
LayoutTestingPanel(String caption, Layout layout) {\r
super(caption);\r
- OrderedLayout internalLayout = new OrderedLayout();\r
+ VerticalLayout internalLayout = new VerticalLayout();\r
internalLayout.setWidth("100%");\r
- setLayout(internalLayout);\r
+ setContent(internalLayout);\r
testedLayout = layout;\r
testPanelLayout.setWidth("100%");\r
Panel controlWrapper = new Panel();\r
controls.setSpacing(true);\r
controls.setMargin(false);\r
controls.addComponent(new Label("width"));\r
- controls.addComponent(new TextField(new MethodProperty<Float>(\r
- testedLayout, "width")));\r
- controls.addComponent(new Button("%", new MethodProperty<Boolean>(\r
- this, "widthPercents")));\r
+ controls.addComponent(new TextField(new MethodProperty<Float>(testedLayout, "width")));\r
+ controls.addComponent(new Button("%", new MethodProperty<Boolean>(this, "widthPercents")));\r
controls.addComponent(new Label("height"));\r
- controls.addComponent(new TextField(new MethodProperty<Float>(\r
- testedLayout, "height")));\r
- controls.addComponent(new Button("%", new MethodProperty<Boolean>(\r
- this, "heightPercents")));\r
+ controls.addComponent(new TextField(new MethodProperty<Float>(testedLayout, "height")));\r
+ controls.addComponent(new Button("%", new MethodProperty<Boolean>(this, "heightPercents")));\r
controls.addComponent(marginLeft);\r
controls.addComponent(marginRight);\r
controls.addComponent(marginTop);\r
testedLayout.setStyleName("tested-layout");\r
setStyleName("layout-testing-panel");\r
\r
- for (Iterator<Component> i = controls.getComponentIterator(); i\r
- .hasNext();) {\r
+ for (Iterator<Component> i = controls.getComponentIterator(); i.hasNext();) {\r
((AbstractComponent) i.next()).setImmediate(true);\r
}\r
}\r
\r
+ @SuppressWarnings("deprecation")\r
private void addAlignmentControls() {\r
if (!(testedLayout instanceof Layout.AlignmentHandler)) {\r
return;\r
vAlign.setNullSelectionAllowed(false);\r
\r
vAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_TOP));\r
- vAlign.setItemCaption(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_TOP), "top");\r
- vAlign.addItem(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_VERTICAL_CENTER));\r
- vAlign.setItemCaption(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_VERTICAL_CENTER),\r
- "center");\r
+ vAlign.setItemCaption(new Integer(Layout.AlignmentHandler.ALIGNMENT_TOP), "top");\r
+ vAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_VERTICAL_CENTER));\r
+ vAlign.setItemCaption(new Integer(Layout.AlignmentHandler.ALIGNMENT_VERTICAL_CENTER), "center");\r
vAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_BOTTOM));\r
- vAlign.setItemCaption(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_BOTTOM), "bottom");\r
+ vAlign.setItemCaption(new Integer(Layout.AlignmentHandler.ALIGNMENT_BOTTOM), "bottom");\r
\r
hAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_LEFT));\r
- hAlign.setItemCaption(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_LEFT), "left");\r
- hAlign.addItem(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER));\r
- hAlign.setItemCaption(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),\r
- "center");\r
+ hAlign.setItemCaption(new Integer(Layout.AlignmentHandler.ALIGNMENT_LEFT), "left");\r
+ hAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER));\r
+ hAlign.setItemCaption(new Integer(Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER), "center");\r
hAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_RIGHT));\r
- hAlign.setItemCaption(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_RIGHT), "right");\r
+ hAlign.setItemCaption(new Integer(Layout.AlignmentHandler.ALIGNMENT_RIGHT), "right");\r
\r
Property.ValueChangeListener alignmentChangeListener = new Property.ValueChangeListener() {\r
public void valueChange(ValueChangeEvent event) {\r
- updateAlignments(((Integer) hAlign.getValue()).intValue(),\r
- ((Integer) vAlign.getValue()).intValue());\r
+ updateAlignments(((Integer) hAlign.getValue()).intValue(), ((Integer) vAlign.getValue()).intValue());\r
}\r
\r
};\r
controls.addComponent(lAlign);\r
lAlign.setNullSelectionAllowed(false);\r
lAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_LEFT));\r
- lAlign.setItemCaption(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_LEFT), "left");\r
- lAlign.addItem(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER));\r
- lAlign.setItemCaption(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),\r
- "center");\r
+ lAlign.setItemCaption(new Integer(Layout.AlignmentHandler.ALIGNMENT_LEFT), "left");\r
+ lAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER));\r
+ lAlign.setItemCaption(new Integer(Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER), "center");\r
lAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_RIGHT));\r
- lAlign.setItemCaption(new Integer(\r
- Layout.AlignmentHandler.ALIGNMENT_RIGHT), "right");\r
+ lAlign.setItemCaption(new Integer(Layout.AlignmentHandler.ALIGNMENT_RIGHT), "right");\r
\r
lAlign.addListener(new Property.ValueChangeListener() {\r
public void valueChange(ValueChangeEvent event) {\r
- testPanelLayout.setComponentAlignment(testedLayout,\r
- ((Integer) lAlign.getValue()).intValue(),\r
- OrderedLayout.ALIGNMENT_TOP);\r
+ testPanelLayout.setComponentAlignment(testedLayout, ((Integer) lAlign.getValue()).intValue(), VerticalLayout.ALIGNMENT_TOP);\r
}\r
});\r
}\r
\r
+ @SuppressWarnings("deprecation")\r
private void updateAlignments(int h, int v) {\r
- for (Iterator<Component> i = testedLayout.getComponentIterator(); i\r
- .hasNext();) {\r
- ((Layout.AlignmentHandler) testedLayout).setComponentAlignment(\r
- i.next(), h, v);\r
+ for (Iterator<Component> i = testedLayout.getComponentIterator(); i.hasNext();) {\r
+ ((Layout.AlignmentHandler) testedLayout).setComponentAlignment(i.next(), h, v);\r
}\r
}\r
\r
private void updateMarginsAndSpacing() {\r
- testedLayout.setMargin(\r
- ((Boolean) marginTop.getValue()).booleanValue(),\r
- ((Boolean) marginRight.getValue()).booleanValue(),\r
- ((Boolean) marginBottom.getValue()).booleanValue(),\r
- ((Boolean) marginLeft.getValue()).booleanValue());\r
+ testedLayout.setMargin(((Boolean) marginTop.getValue()).booleanValue(), ((Boolean) marginRight.getValue()).booleanValue(), ((Boolean) marginBottom.getValue()).booleanValue(), ((Boolean) marginLeft.getValue()).booleanValue());\r
if (testedLayout instanceof Layout.SpacingHandler) {\r
- ((Layout.SpacingHandler) testedLayout)\r
- .setSpacing(((Boolean) spacing.getValue())\r
- .booleanValue());\r
+ ((Layout.SpacingHandler) testedLayout).setSpacing(((Boolean) spacing.getValue()).booleanValue());\r
}\r
}\r
\r
- public boolean getWidthPercents() {\r
- return testedLayout.getWidthUnits() == Sizeable.UNITS_PERCENTAGE;\r
- }\r
-\r
- public void setWidthPercents(boolean b) {\r
- testedLayout.setWidthUnits(b ? Sizeable.UNITS_PERCENTAGE\r
- : Sizeable.UNITS_PIXELS);\r
- }\r
-\r
- public boolean getHeightPercents() {\r
- return testedLayout.getHeightUnits() == Sizeable.UNITS_PERCENTAGE;\r
- }\r
-\r
- public void setHeightPercents(boolean b) {\r
- testedLayout.setHeightUnits(b ? Sizeable.UNITS_PERCENTAGE\r
- : Sizeable.UNITS_PIXELS);\r
- }\r
}\r
}\r
import com.vaadin.terminal.DownloadStream;
import com.vaadin.terminal.Resource;
import com.vaadin.ui.Embedded;
-import com.vaadin.ui.ExpandLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1737 extends Application {
@Override
public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));
setMainWindow(main);
- ExpandLayout el = new ExpandLayout();
+ VerticalLayout el = new VerticalLayout();
main.setLayout(el);
Panel p = new Panel("Test panel");
p.setSizeFull();
- p.addComponent(new Label(
- "Second component is embedded with a slow resource "
- + "and thus should break layout if Embedded cannot"
- + " request re-layout after load."));
+ p.addComponent(new Label("Second component is embedded with a slow resource " + "and thus should break layout if Embedded cannot" + " request re-layout after load."));
Embedded em = new Embedded("TestEmbedded", slowRes);
@Override\r
public void init() {\r
\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
ComboBox cb = new ComboBox(" '<' item is not seen in populist?");\r
@Override\r
public void init() {\r
\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
Button b = new Button("Add content");\r
\r
public void buttonClick(ClickEvent event) {\r
\r
- gridLayout\r
- .addComponent(new TextField("Content " + (++counter)));\r
+ gridLayout.addComponent(new TextField("Content " + (++counter)));\r
\r
}\r
});\r
s = new Select("Testcase from the ticket #1804");\r
s.setNullSelectionAllowed(false);\r
s.setPropertyDataSource(new MethodProperty<String>(new TestPojo(), "id"));\r
- s.addValidator(new EmptyStringValidator(\r
- "Selection required for test-field"));\r
+ s.addValidator(new EmptyStringValidator("Selection required for test-field"));\r
s.setRequired(true);\r
listOfAllFields.add(s);\r
\r
s.setRequired(true);\r
listOfAllFields.add(s);\r
\r
- s = new Select(\r
- "Testcase from the ticket #1804, but with required=false");\r
+ s = new Select("Testcase from the ticket #1804, but with required=false");\r
s.setNullSelectionAllowed(false);\r
s.setPropertyDataSource(new MethodProperty<String>(new TestPojo(), "id"));\r
- s.addValidator(new EmptyStringValidator(\r
- "Selection required for test-field"));\r
+ s.addValidator(new EmptyStringValidator("Selection required for test-field"));\r
listOfAllFields.add(s);\r
\r
- s = new Select(\r
- "Testcase from the ticket #1804, but without validator and with required=false");\r
+ s = new Select("Testcase from the ticket #1804, but without validator and with required=false");\r
s.setNullSelectionAllowed(false);\r
s.setPropertyDataSource(new MethodProperty<String>(new TestPojo(), "id"));\r
listOfAllFields.add(s);\r
\r
- s = new Select(\r
- "Required=true, custom error message, null selection not allowed");\r
+ s = new Select("Required=true, custom error message, null selection not allowed");\r
s.setRequired(true);\r
s.setNullSelectionAllowed(false);\r
s.setPropertyDataSource(new MethodProperty<String>(new TestPojo(), "id"));\r
\r
public void buttonClick(ClickEvent event) {\r
StringBuffer msg = new StringBuffer();\r
- for (Iterator<Select> i = listOfAllFields.iterator(); i\r
- .hasNext();) {\r
+ for (Iterator<Select> i = listOfAllFields.iterator(); i.hasNext();) {\r
AbstractField af = i.next();\r
msg.append("<h1>" + af.getCaption() + "</h1>\n");\r
msg.append("Value=" + af.getValue() + "<br/>\n");\r
if (af.isValid()) {\r
msg.append("VALID\n<hr/>");\r
} else {\r
- msg.append("INVALID<br/><i>" + af.getErrorMessage()\r
- + "</i><hr/>");\r
+ msg.append("INVALID<br/><i>" + af.getErrorMessage() + "</i><hr/>");\r
}\r
}\r
Window w = new Window("Status of the fields");\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
main.getLayout().setMargin(false);\r
\r
- Label description = new Label(\r
- "GridLayout with 100% (no height), is wanted to "\r
- + "share all available width with columns "\r
- + "relatively to their natural width. And it "\r
- + "should still work with margins and spacings");\r
+ Label description = new Label("GridLayout with 100% (no height), is wanted to " + "share all available width with columns " + "relatively to their natural width. And it " + "should still work with margins and spacings");\r
main.addComponent(description);\r
\r
final GridLayout grid = new GridLayout(4, 1);\r
grid.addComponent(new Label("VEEEEEEEEEEERY_WIDE"));\r
Label label = new Label("|");\r
grid.addComponent(label);\r
- grid.setComponentAlignment(label, GridLayout.ALIGNMENT_RIGHT,\r
- GridLayout.ALIGNMENT_TOP);\r
+ grid.setComponentAlignment(label, GridLayout.ALIGNMENT_RIGHT, GridLayout.ALIGNMENT_TOP);\r
main.addComponent(grid);\r
}\r
\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
final ObjectProperty<String> prop = new ObjectProperty<String>("");\r
- final TextField tf1 = new TextField(\r
- "Buffered TextField bound to ObjectProperty");\r
+ final TextField tf1 = new TextField("Buffered TextField bound to ObjectProperty");\r
tf1.setWriteThrough(false);\r
tf1.setReadThrough(false);\r
tf1.setPropertyDataSource(prop);\r
main.addComponent(tf1);\r
- main.addComponent(new Button(\r
- "This button does nothing (but flushes queued variable changes)"));\r
- main.addComponent(new Button("Commit the field to property",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- tf1.commit();\r
- }\r
- }));\r
- main.addComponent(new Button("Show property value",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- main.showNotification("'" + prop.getValue() + "'");\r
- }\r
- }));\r
- main.addComponent(new Button("Show field value",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- main.showNotification("'" + tf1.getValue() + "'");\r
- }\r
- }));\r
+ main.addComponent(new Button("This button does nothing (but flushes queued variable changes)"));\r
+ main.addComponent(new Button("Commit the field to property", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ tf1.commit();\r
+ }\r
+ }));\r
+ main.addComponent(new Button("Show property value", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ main.showNotification("'" + prop.getValue() + "'");\r
+ }\r
+ }));\r
+ main.addComponent(new Button("Show field value", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ main.showNotification("'" + tf1.getValue() + "'");\r
+ }\r
+ }));\r
}\r
}
\ No newline at end of file
final Window main = new Window("#1811");\r
setMainWindow(main);\r
\r
- Validator strLenValidator = new StringLengthValidator(\r
- "String must be at least 3 chars long and non-null", 3, -1,\r
- false);\r
+ Validator strLenValidator = new StringLengthValidator("String must be at least 3 chars long and non-null", 3, -1, false);\r
\r
- TextField tf1 = new TextField(\r
- "Text field with default settings (required=false)");\r
+ TextField tf1 = new TextField("Text field with default settings (required=false)");\r
listOfAllFields.add(tf1);\r
\r
TextField tf2 = new TextField("Text field with required=true");\r
tf2.setRequired(true);\r
listOfAllFields.add(tf2);\r
\r
- TextField tf3 = new TextField(\r
- "Text field with required=true and strlen >= 3");\r
+ TextField tf3 = new TextField("Text field with required=true and strlen >= 3");\r
tf3.setRequired(true);\r
tf3.addValidator(strLenValidator);\r
listOfAllFields.add(tf3);\r
\r
- TextField tf4 = new TextField(\r
- "Text field with required=false (default) and strlen >= 3");\r
+ TextField tf4 = new TextField("Text field with required=false (default) and strlen >= 3");\r
tf4.addValidator(strLenValidator);\r
listOfAllFields.add(tf4);\r
\r
\r
public void buttonClick(ClickEvent event) {\r
StringBuffer msg = new StringBuffer();\r
- for (Iterator<TextField> i = listOfAllFields\r
- .iterator(); i.hasNext();) {\r
+ for (Iterator<TextField> i = listOfAllFields.iterator(); i.hasNext();) {\r
TextField tf = i.next();\r
msg.append("<h1>" + tf.getCaption() + "</h1>\n");\r
if (tf.isValid()) {\r
msg.append("VALID\n<hr/>");\r
} else {\r
- msg.append("INVALID<br/><i>" + tf.getErrorMessage()\r
- + "</i><hr/>");\r
+ msg.append("INVALID<br/><i>" + tf.getErrorMessage() + "</i><hr/>");\r
}\r
}\r
Window w = new Window("Status of the fields");\r
\r
public void buttonClick(ClickEvent event) {\r
StringBuffer msg = new StringBuffer();\r
- for (Iterator<Select> i = listOfAllFields.iterator(); i\r
- .hasNext();) {\r
+ for (Iterator<Select> i = listOfAllFields.iterator(); i.hasNext();) {\r
AbstractField af = i.next();\r
msg.append("<h1>" + af.getCaption() + "</h1>\n");\r
msg.append("Value=" + af.getValue() + "<br/>\n");\r
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Button.ClickListener;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.Window;\r
\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
- OrderedLayout currentState = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ HorizontalLayout currentState = new HorizontalLayout();\r
\r
currentState.addComponent(state);\r
Button b = new Button("update");\r
currentState.addComponent(b);\r
b.addListener(new ClickListener() {\r
public void buttonClick(ClickEvent event) {\r
- state.setValue("ScrollTop: " + p.getScrollTop()\r
- + " ScrollLeft: " + p.getScrollLeft());\r
+ state.setValue("ScrollTop: " + p.getScrollTop() + " ScrollLeft: " + p.getScrollLeft());\r
}\r
});\r
main.addComponent(currentState);\r
public void buttonClick(ClickEvent event) {\r
p.setScrollLeft(p.getScrollLeft() + 50);\r
p.setScrollTop(p.getScrollTop() + 50);\r
- state.setValue("ScrollTop: " + p.getScrollTop()\r
- + " ScrollLeft: " + p.getScrollLeft());\r
+ state.setValue("ScrollTop: " + p.getScrollTop() + " ScrollLeft: " + p.getScrollLeft());\r
}\r
});\r
\r
p.setScrollable(true);\r
\r
for (int i = 0; i < ROWS; i++) {\r
- p.addComponent(new Label(\r
- "Label"\r
- + i\r
- + "................................................................................................................."));\r
+ p.addComponent(new Label("Label" + i + "................................................................................................................."));\r
}\r
\r
p.setHeight("300px");\r
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.ui.Button;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1857 extends Application implements Handler {
setTheme("tests-tickets");
- ExpandLayout el = new ExpandLayout();
+ VerticalLayout el = new VerticalLayout();
Window main = new Window("Testcase for #1857", el);
setMainWindow(main);
el.setMargin(true);
final Table t = new Table();
el.addComponent(t);
- el.expand(t);
+ el.setExpandRatio(t,1);
t.setSizeFull();
addContentsToTable(t);
t.setStyleName("foo");
- OrderedLayout footer = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ HorizontalLayout footer = new HorizontalLayout();
el.addComponent(footer);
footer.setSpacing(true);
if (((Boolean) cellStylesEnabler.getValue()).booleanValue()) {
t.setCellStyleGenerator(new Table.CellStyleGenerator() {
public String getStyle(Object itemId, Object propertyId) {
- Object cell = t.getContainerProperty(itemId,
- propertyId).getValue();
+ Object cell = t.getContainerProperty(itemId, propertyId).getValue();
if (!(cell instanceof Integer)) {
return null;
}
int age = ((Integer) cell).intValue();
- return age > 65 ? "old" : (age < 18 ? "young"
- : null);
+ return age > 65 ? "old" : (age < 18 ? "young" : null);
}
});
} else {
t.addContainerProperty("Last name", String.class, "");
t.addContainerProperty("Age", Integer.class, "");
- String firstNames[] = { "Quentin", "Marc", "Peter", "David", "Mary",
- "Jani", "Jane", "Brita" };
- String lastNames[] = { "Heiskanen", "Bjorn", "Torwalds", "Autere",
- "Smith", "Lindström" };
+ String firstNames[] = { "Quentin", "Marc", "Peter", "David", "Mary", "Jani", "Jane", "Brita" };
+ String lastNames[] = { "Heiskanen", "Bjorn", "Torwalds", "Autere", "Smith", "Lindström" };
for (int i = 0; i < 1000; i++) {
- t.addItem(new Object[] {
- firstNames[((int) (Math.random() * firstNames.length))],
- lastNames[((int) (Math.random() * lastNames.length))],
- new Integer((int) (Math.random() * 100) + 10) },
- new Integer(i));
+ t.addItem(new Object[] { firstNames[((int) (Math.random() * firstNames.length))], lastNames[((int) (Math.random() * lastNames.length))], new Integer((int) (Math.random() * 100) + 10) }, new Integer(i));
}
}
\r
setMainWindow(new Window("#1868"));\r
\r
- Panel p = new Panel(\r
- "This is a really long caption for the panel, too long in fact!");\r
+ Panel p = new Panel("This is a really long caption for the panel, too long in fact!");\r
p.setWidth(300);\r
p.setHeight(300);\r
\r
package com.vaadin.tests.tickets;\r
\r
-import java.util.LinkedList;\r
-\r
import com.vaadin.ui.Button;\r
-import com.vaadin.ui.ExpandLayout;\r
import com.vaadin.ui.GridLayout;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Panel;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1869 extends com.vaadin.Application {\r
lo.setMargin(true);\r
lo.setSpacing(true);\r
\r
- ExpandLayout el = new ExpandLayout();\r
- Panel elp = new Panel(\r
- "Vertical ExpandLayout /w first component expanded", el);\r
+ VerticalLayout el = new VerticalLayout();\r
+ Panel elp = new Panel("Vertical ExpandLayout /w first component expanded", el);\r
el.setHeight(1000);\r
for (int i = 0; i < 3; i++) {\r
Button b = new Button("x");\r
el.addComponent(b);\r
if (i == 0) {\r
b.setSizeFull();\r
- el.expand(b);\r
+ el.setExpandRatio(b,1);\r
}\r
}\r
lo.addComponent(elp);\r
elp.setHeight(300);\r
elp.setScrollable(true);\r
\r
- ExpandLayout elh = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);\r
- Panel elph = new Panel(\r
- "Horizontal ExpandLayout /w first component expanded", elh);\r
+ HorizontalLayout elh = new HorizontalLayout();\r
+ Panel elph = new Panel("Horizontal ExpandLayout /w first component expanded", elh);\r
elh.setWidth(1000);\r
for (int i = 0; i < 3; i++) {\r
Button b = new Button("x");\r
elh.addComponent(b);\r
if (i == 0) {\r
b.setSizeFull();\r
- elh.expand(b);\r
+ elh.setExpandRatio(b,1);\r
}\r
}\r
lo.addComponent(elph);\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.Component;\r
-import com.vaadin.ui.ExpandLayout;\r
import com.vaadin.ui.Field;\r
import com.vaadin.ui.Form;\r
import com.vaadin.ui.FormLayout;\r
import com.vaadin.ui.GridLayout;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Layout;\r
import com.vaadin.ui.Layout.AlignmentHandler;\r
import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.TextField;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1878 extends Application {\r
gridLayout = createGL();\r
formLayout = createForms();\r
\r
- switchToGridButton = new Button("Switch to GridLayout",\r
- new ClickListener() {\r
+ switchToGridButton = new Button("Switch to GridLayout", new ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- changeLayout(switchToGridButton, gridLayout);\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ changeLayout(switchToGridButton, gridLayout);\r
+ }\r
\r
- });\r
- switchToOrderedButton = new Button("Switch to OrderedLayout",\r
- new ClickListener() {\r
+ });\r
+ switchToOrderedButton = new Button("Switch to OrderedLayout", new ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- changeLayout(switchToOrderedButton, orderedLayout);\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ changeLayout(switchToOrderedButton, orderedLayout);\r
+ }\r
\r
- });\r
+ });\r
switchToOrderedButton.setEnabled(false);\r
\r
switchToFormsButton = new Button("Switch to Form", new ClickListener() {\r
\r
});\r
\r
- OrderedLayout buttonLayout = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ HorizontalLayout buttonLayout = new HorizontalLayout();\r
buttonLayout.addComponent(switchToOrderedButton);\r
buttonLayout.addComponent(switchToGridButton);\r
buttonLayout.addComponent(switchToFormsButton);\r
GridLayout layout = new GridLayout(1, 5);\r
\r
GridLayout l1 = new GridLayout(1, 3);\r
- createLayout(l1,\r
- new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL),\r
- "1000px", "150px", "100%", null, true);\r
- createLayout(l1,\r
- new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL),\r
- "1000px", "150px", "50px", null, false);\r
+ createLayout(l1, new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL), "1000px", "150px", "100%", null, true);\r
+ createLayout(l1, new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL), "1000px", "150px", "50px", null, false);\r
GridLayout l2 = new GridLayout(6, 1);\r
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),\r
- "200px", "500px", true);\r
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),\r
- "200px", "500px", "100%", null, true);\r
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),\r
- "150px", "500px", true);\r
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),\r
- "150px", "500px", "100%", null, true);\r
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),\r
- "100px", "500px", true);\r
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),\r
- "100px", "500px", "100%", null, true);\r
+ createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL), "200px", "500px", true);\r
+ createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL), "200px", "500px", "100%", null, true);\r
+ createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL), "150px", "500px", true);\r
+ createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL), "150px", "500px", "100%", null, true);\r
+ createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL), "100px", "500px", true);\r
+ createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL), "100px", "500px", "100%", null, true);\r
layout.addComponent(l1);\r
layout.addComponent(l2);\r
\r
GridLayout layout = new GridLayout(1, 5);\r
\r
GridLayout l1 = new GridLayout(1, 3);\r
- createLayout(l1, new GridLayout(8, 1), "1000px", "150px", "100%", null,\r
- true);\r
- createLayout(l1, new GridLayout(8, 1), "1000px", "150px", "50px", null,\r
- false);\r
+ createLayout(l1, new GridLayout(8, 1), "1000px", "150px", "100%", null, true);\r
+ createLayout(l1, new GridLayout(8, 1), "1000px", "150px", "50px", null, false);\r
GridLayout l2 = new GridLayout(6, 1);\r
createLayout(l2, new GridLayout(1, 8), "200px", "500px", true);\r
- createLayout(l2, new GridLayout(1, 8), "200px", "500px", "100%", null,\r
- true);\r
+ createLayout(l2, new GridLayout(1, 8), "200px", "500px", "100%", null, true);\r
createLayout(l2, new GridLayout(1, 8), "150px", "500px", true);\r
- createLayout(l2, new GridLayout(1, 8), "150px", "500px", "100%", null,\r
- true);\r
+ createLayout(l2, new GridLayout(1, 8), "150px", "500px", "100%", null, true);\r
createLayout(l2, new GridLayout(1, 8), "100px", "500px", true);\r
- createLayout(l2, new GridLayout(1, 8), "100px", "500px", "100%", null,\r
- true);\r
+ createLayout(l2, new GridLayout(1, 8), "100px", "500px", "100%", null, true);\r
layout.addComponent(l1);\r
layout.addComponent(l2);\r
\r
mainLayout.replaceComponent(l, newLayout);\r
}\r
\r
- private static void createLayout(GridLayout parentLayout, Layout newLayout,\r
- String w, String h, boolean align) {\r
+ private static void createLayout(GridLayout parentLayout, Layout newLayout, String w, String h, boolean align) {\r
createLayout(parentLayout, newLayout, w, h, null, null, align);\r
}\r
\r
- private static void createLayout(GridLayout parentLayout, Layout newLayout,\r
- String w, String h, String componentWidth, String componentHeight,\r
- boolean align) {\r
+ private static void createLayout(GridLayout parentLayout, Layout newLayout, String w, String h, String componentWidth, String componentHeight, boolean align) {\r
int dir;\r
String type;\r
- if (newLayout instanceof ExpandLayout) {\r
- dir = ((ExpandLayout) newLayout).getOrientation();\r
- type = "EL";\r
+ if (newLayout instanceof VerticalLayout) {\r
+ dir = OrderedLayout.ORIENTATION_VERTICAL;\r
+ type = "OL";\r
} else if (newLayout instanceof OrderedLayout) {\r
- dir = ((OrderedLayout) newLayout).getOrientation();\r
+ dir = OrderedLayout.ORIENTATION_HORIZONTAL;\r
type = "OL";\r
} else {\r
- dir = ((GridLayout) newLayout).getColumns() == 1 ? OrderedLayout.ORIENTATION_VERTICAL\r
- : OrderedLayout.ORIENTATION_HORIZONTAL;\r
+ dir = ((GridLayout) newLayout).getColumns() == 1 ? OrderedLayout.ORIENTATION_VERTICAL : OrderedLayout.ORIENTATION_HORIZONTAL;\r
type = "GL";\r
}\r
- String dirText = (dir == OrderedLayout.ORIENTATION_HORIZONTAL ? "H"\r
- : "V");\r
+ String dirText = (dir == OrderedLayout.ORIENTATION_HORIZONTAL ? "H" : "V");\r
String alignText = align ? "-A" : "";\r
String cWidth = componentWidth == null ? "" : " - " + componentWidth;\r
- Panel p = new Panel(type + "/" + dirText + alignText + " " + w + "x"\r
- + h + cWidth, newLayout);\r
+ Panel p = new Panel(type + "/" + dirText + alignText + " " + w + "x" + h + cWidth, newLayout);\r
\r
p.setWidth(w);\r
p.setHeight(h);\r
newLayout.setSizeFull();\r
\r
String captions[] = new String[] { "TextField with caption", null };\r
- Resource icons[] = new Resource[] {\r
- new ThemeResource("icons/16/document-delete.png"), null };\r
+ Resource icons[] = new Resource[] { new ThemeResource("icons/16/document-delete.png"), null };\r
boolean required[] = new boolean[] { true, false };\r
TextField fields[][] = new TextField[captions.length][icons.length];\r
for (int caption = 0; caption < captions.length; caption++) {\r
for (int icon = 0; icon < icons.length; icon++) {\r
for (int req = 0; req < required.length; req++) {\r
- TextField tf = createTextFieldWithError(captions[caption],\r
- icons[icon], required[req]);\r
+ TextField tf = createTextFieldWithError(captions[caption], icons[icon], required[req]);\r
\r
fields[caption][icon] = tf;\r
if (componentWidth != null) {\r
p.addComponent(tf);\r
\r
if (align) {\r
- ((AlignmentHandler) newLayout).setComponentAlignment(\r
- tf, OrderedLayout.ALIGNMENT_RIGHT,\r
- OrderedLayout.ALIGNMENT_BOTTOM);\r
+ ((AlignmentHandler) newLayout).setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT, OrderedLayout.ALIGNMENT_BOTTOM);\r
}\r
}\r
}\r
//\r
// }\r
\r
- private static TextField createTextFieldWithError(String caption,\r
- Resource icon, boolean required) {\r
+ private static TextField createTextFieldWithError(String caption, Resource icon, boolean required) {\r
TextField tf = new TextField();\r
tf.setCaption(caption);\r
tf.setIcon(icon);\r
main.addComponent(f[i]);
f[i].addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- main.showNotification("Validity test", "Testcase " + j
- + " is " + (f[j].isValid() ? "valid" : "invalid"));
+ main.showNotification("Validity test", "Testcase " + j + " is " + (f[j].isValid() ? "valid" : "invalid"));
}
});
f[i].addValidator(new ContainsValidator("1"));
f[2].setDescription("Field is non-empty, validators do not give validation error: *");
f[2].setValue("valid 12");
- f[3].setDescription("Field is non-empty, requiredError(null), validators "
- + "give validation error: * ! (popup shows the validation error)");
+ f[3].setDescription("Field is non-empty, requiredError(null), validators " + "give validation error: * ! (popup shows the validation error)");
f[3].setValue("invalid");
- f[4].setDescription("Field is non-empty, requiredError(\"foo\"), validators "
- + "give validation error: * ! (popup shows the validation error)");
+ f[4].setDescription("Field is non-empty, requiredError(\"foo\"), validators " + "give validation error: * ! (popup shows the validation error)");
f[4].setValue("invalid");
f[4].setRequiredError("The field must not be empty");
package com.vaadin.tests.tickets;
import com.vaadin.Application;
+import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1904 extends Application {
}
private void addOL(String descr, String style, boolean horizontal) {
- OrderedLayout ol = new OrderedLayout();
+ AbstractOrderedLayout ol;
+ if (horizontal) {
+ ol = new HorizontalLayout();
+ } else {
+ ol = new VerticalLayout();
+ }
ol.setMargin(true);
ol.setSpacing(true);
if (style != null) {
}
ol.addComponent(b);
}
- if (horizontal) {
- ol.setOrientation(OrderedLayout.ORIENTATION_HORIZONTAL);
- }
getMainWindow().addComponent(ol);
}
import com.vaadin.Application;
import com.vaadin.terminal.UserError;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Window;
@Override
public void init() {
- OrderedLayout test = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ HorizontalLayout test = new HorizontalLayout();
test.setSizeFull();
TextField tf = new TextField();
tf.setComponentError(new UserError("Error message"));
test.addComponent(tf);
- test.setComponentAlignment(tf,
- OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER,
- OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
+ test.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
Window w = new Window("Test #1916", test);
setMainWindow(w);
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
main.setTheme("tests-tickets");\r
import com.vaadin.terminal.ParameterHandler;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1921 extends Application implements ParameterHandler {
int state = -1;
int round = 1;
Button button;
- OrderedLayout outer, inner;
+ VerticalLayout outer, inner;
@Override
public void init() {
- outer = new OrderedLayout();
+ outer = new VerticalLayout();
setMainWindow(new Window("#1921", outer));
setTheme("tests-tickets");
- inner = new OrderedLayout();
+ inner = new VerticalLayout();
outer.addComponent(inner);
button = new Button("foo", this, "newState");
inner.addComponent(button);
public void newState() {
- if (state >= 8) {
+ if (state >= 6) {
state = 0;
round++;
} else {
break;
case 6:
- inner.setOrientation(inner.getOrientation() == OrderedLayout.ORIENTATION_HORIZONTAL ? OrderedLayout.ORIENTATION_VERTICAL
- : OrderedLayout.ORIENTATION_HORIZONTAL);
- getMainWindow()
- .showNotification(
- "inner swithed to "
- + (inner.getOrientation() == OrderedLayout.ORIENTATION_HORIZONTAL ? "horizontal"
- : "vertical"));
- break;
-
- case 7:
outer.addComponent(new Label("Added at " + button.getCaption()));
break;
- case 8:
- outer.setOrientation(outer.getOrientation() == OrderedLayout.ORIENTATION_HORIZONTAL ? OrderedLayout.ORIENTATION_VERTICAL
- : OrderedLayout.ORIENTATION_HORIZONTAL);
- getMainWindow()
- .showNotification(
- "outer swithed to "
- + (outer.getOrientation() == OrderedLayout.ORIENTATION_HORIZONTAL ? "horizontal"
- : "vertical"));
- break;
}
}
int rr = Integer.parseInt(v[0]);
int rs = Integer.parseInt(v[1]);
if (rr < round || (rr == round && rs < state)) {
- getMainWindow().showNotification(
- "Already past requested " + s[0]);
+ getMainWindow().showNotification("Already past requested " + s[0]);
return;
}
while (round < rr || state < rs) {
package com.vaadin.tests.tickets;\r
\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1923 extends com.vaadin.Application {\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
p = new Panel("TestPanel 250x300");\r
p.setScrollable(true);\r
// p.setLayout(new GridLayout(1, 100));\r
for (int i = 0; i < ROWS; i++) {\r
- p.addComponent(new Label(\r
- "Label"\r
- + i\r
- + " 5067w09adsfasdjfahlsdfjhalfjhaldjfhalsjdfhlajdhflajhdfljahdslfjahldsjfhaljdfhaljfdhlajsdhflajshdflkajhsdlfkjahsldfkjahsldfhalskjfdhlksjfdh857idifhaljsdfhlajsdhflajhdflajhdfljahldfjhaljdfhalsjdfhalkjdhflkajhdfljahsdlfjahlsdjfhaldjfhaljfdhlajdhflajshdfljahsdlfjhalsjdfhalskjhfdlhusfglksuhdflgjshflgjhslfghslfjghsljfglsjhfglsjhfgljshfgljshflgjhslfghsljfgsljdfglsdjhfglsjhflgkjshfldjgh"));\r
+ p.addComponent(new Label("Label" + i + " 5067w09adsfasdjfahlsdfjhalfjhaldjfhalsjdfhlajdhflajhdfljahdslfjahldsjfhaljdfhaljfdhlajsdhflajshdflkajhsdlfkjahsldfkjahsldfhalskjfdhlksjfdh857idifhaljsdfhlajsdhflajhdflajhdfljahldfjhaljdfhalsjdfhalkjdhflkajhdfljahsdlfjahlsdjfhaldjfhaljfdhlajdhflajshdfljahsdlfjhalsjdfhalskjhfdlhusfglksuhdflgjshflgjhslfghslfjghsljfglsjhfglsjhfgljshfgljshflgjhslfghsljfgsljdfglsdjhfglsjhflgkjshfldjgh"));\r
}\r
// main.getLayout().setSizeFull();\r
\r
\r
main.addComponent(p);\r
\r
- OrderedLayout ol = new OrderedLayout();\r
+ VerticalLayout ol = new VerticalLayout();\r
p = new Panel("a");\r
p.addComponent(new Label("Longer than caption"));\r
ol.addComponent(p);\r
\r
main.addComponent(ol);\r
\r
- ol = new OrderedLayout();\r
+ ol = new VerticalLayout();\r
p = new Panel("captionasdfjahsdjfh this should be clipped god damn it");\r
// p.getLayout().setSizeFull();\r
p.setWidth("50px");\r
p.setHeight("100px");\r
- p.addComponent(new Label(\r
- "aasdfaasdfja dslkfj lakfdj lakjdf lkaj dflkaj ldfkj alsdfj laksdj flkajs dflkj sdfsadfasdfasd"));\r
+ p.addComponent(new Label("aasdfaasdfja dslkfj lakfdj lakjdf lkaj dflkaj ldfkj alsdfj laksdj flkajs dflkj sdfsadfasdfasd"));\r
ol.addComponent(p);\r
\r
main.addComponent(ol);\r
\r
- ol = new OrderedLayout();\r
+ ol = new VerticalLayout();\r
p = new Panel("300x-1");\r
// p.getLayout().setSizeFull();\r
p.setWidth("300px");\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
l.setStyleName("red");\r
import com.vaadin.Application;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1939 extends Application {
Window w = new Window(getClass().getName());
setMainWindow(w);
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
l.setWidth(400);
l.setHeight(100);
l.addComponent(new TextField("This one works fine"));
l.addComponent(t);
w.addComponent(l);
- w.addComponent(new Button("show me the bug",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- l.setWidth(-1);
- }
- }));
+ w.addComponent(new Button("show me the bug", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ l.setWidth(-1);
+ }
+ }));
}
package com.vaadin.tests.tickets;
import com.vaadin.Application;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1940 extends Application {
final Window w = new Window(getClass().getName());
setMainWindow(w);
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
l.setWidth(200);
l.setHeight(-1);
TextField t = new TextField();
@Override
public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));
setMainWindow(main);
main.setTheme("tests-tickets");
import java.util.Map;\r
\r
import com.vaadin.Application;\r
+import com.vaadin.ui.AbstractOrderedLayout;\r
import com.vaadin.ui.Button;\r
import com.vaadin.ui.GridLayout;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Layout;\r
import com.vaadin.ui.Layout.AlignmentHandler;\r
import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1966 extends Application {\r
Panel p = new Panel("OrderedLayout");\r
layout.addComponent(p);\r
\r
- OrderedLayout ol = new OrderedLayout();\r
+ AbstractOrderedLayout ol = new VerticalLayout();\r
ol.setCaption("Horizontal");\r
// ol.setWidth("100%");\r
\r
\r
/* VERTICAL */\r
\r
- ol = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ ol = new HorizontalLayout();\r
ol.setCaption("Vertical");\r
\r
addButtons(ol);\r
}\r
\r
private Button getButton(Layout l, int hAlign, int vAlign) {\r
- Button b = new Button("Narrow Button - "\r
- + names.get(new Integer(hAlign)) + " - "\r
- + names.get(new Integer(vAlign)));\r
+ Button b = new Button("Narrow Button - " + names.get(new Integer(hAlign)) + " - " + names.get(new Integer(vAlign)));\r
b.setWidth("100px");\r
((AlignmentHandler) l).setComponentAlignment(b, hAlign, vAlign);\r
\r
import java.util.Map;\r
\r
import com.vaadin.Application;\r
+import com.vaadin.ui.AbstractOrderedLayout;\r
import com.vaadin.ui.Button;\r
-import com.vaadin.ui.ExpandLayout;\r
import com.vaadin.ui.GridLayout;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Layout;\r
import com.vaadin.ui.Layout.AlignmentHandler;\r
import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1966_2 extends Application {\r
p.getLayout().setWidth("100%");\r
layout.addComponent(p);\r
\r
- OrderedLayout ol = new OrderedLayout();\r
+ AbstractOrderedLayout ol = new VerticalLayout();\r
// ol.setCaption("Horizontal");\r
ol.setWidth("100%");\r
addButtons(ol);\r
\r
/* VERTICAL */\r
\r
- ol = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ ol = new HorizontalLayout();\r
// ol.setCaption("Vertical");\r
ol.setHeight(200);\r
addButtons(ol);\r
p.getLayout().setWidth("500");\r
p.getLayout().setHeight("400");\r
\r
- ExpandLayout el = new ExpandLayout(ExpandLayout.ORIENTATION_VERTICAL);\r
+ AbstractOrderedLayout el = new VerticalLayout();\r
// el.setCaption("Horizontal");\r
// el.setSizeUndefined();\r
// el.setWidth("100%");\r
b = new Button("Wide button");\r
b.setWidth("100%");\r
// b.setHeight(200);\r
- // el.expand(b);\r
+ // el.setExpandRatio(b,1);\r
// el.addComponent(b);\r
\r
addButtons(el);\r
\r
/* VERTICAL */\r
\r
- el = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);\r
+ el = new HorizontalLayout();\r
// el.setHeight(400);\r
// el.setWidth("100%");\r
// el.setCaption("Vertical");\r
\r
addButtons(el);\r
// b = new Button("High button");\r
- // el.expand(b);\r
+ // el.setExpandRatio(b,1);\r
// b.setHeight(100);\r
// el.addComponent(b);\r
\r
}\r
\r
private Button getButton(Layout l, int hAlign, int vAlign) {\r
- Button b = new Button(names.get(new Integer(hAlign)) + " - "\r
- + names.get(new Integer(vAlign)));\r
+ Button b = new Button(names.get(new Integer(hAlign)) + " - " + names.get(new Integer(vAlign)));\r
// b.setWidth("100");\r
((AlignmentHandler) l).setComponentAlignment(b, hAlign, vAlign);\r
\r
import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.TextField;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1966_3 extends Application {\r
}\r
\r
private void createUI(GridLayout layout) {\r
- OrderedLayout ol = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);\r
+ VerticalLayout ol = new VerticalLayout();\r
Panel p = new Panel(ol);\r
p.setWidth("300px");\r
p.setHeight("300px");\r
tf.setWidth("100px");\r
\r
ol.addComponent(tf);\r
- ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT,\r
- OrderedLayout.ALIGNMENT_TOP);\r
+ ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT, OrderedLayout.ALIGNMENT_TOP);\r
\r
tf = new TextField("Short caption");\r
tf.setWidth("100px");\r
\r
tf.setComponentError(new UserError("error message"));\r
ol.addComponent(tf);\r
- ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT,\r
- OrderedLayout.ALIGNMENT_TOP);\r
+ ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT, OrderedLayout.ALIGNMENT_TOP);\r
\r
tf = new TextField("Short caption");\r
tf.setComponentError(new UserError("error message"));\r
\r
tf.setComponentError(new UserError("error message"));\r
ol.addComponent(tf);\r
- ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT,\r
- OrderedLayout.ALIGNMENT_TOP);\r
+ ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT, OrderedLayout.ALIGNMENT_TOP);\r
\r
tf = new TextField();\r
tf.setValue("No caption");\r
tf.setWidth("100px");\r
\r
ol.addComponent(tf);\r
- ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT,\r
- OrderedLayout.ALIGNMENT_TOP);\r
+ ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT, OrderedLayout.ALIGNMENT_TOP);\r
\r
layout.addComponent(p);\r
}\r
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.TabSheet;\r
import com.vaadin.ui.Table;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1969 extends com.vaadin.Application {\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
main.getLayout().setSizeFull();\r
TabSheet ts = new TabSheet();\r
ts.setSizeFull();\r
\r
- final Table t = TestForTablesInitialColumnWidthLogicRendering\r
- .getTestTable(7, 2000);\r
+ final Table t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(7, 2000);\r
t.setSizeFull();\r
ts.addTab(t, "Table, scrollins should not flash", null);\r
\r
- final Label testContent = new Label(\r
- "TabSheet by default uses caption, icon, errors etc. from Components. ");\r
+ final Label testContent = new Label("TabSheet by default uses caption, icon, errors etc. from Components. ");\r
\r
testContent.setCaption("Introduction to test");\r
\r
ts.addTab(testContent);\r
\r
- final OrderedLayout actions = new OrderedLayout();\r
+ final VerticalLayout actions = new VerticalLayout();\r
\r
actions.setCaption("Test actions");\r
\r
\r
Button b;\r
\r
- b = new Button(\r
- "change introduction caption (should add * to tab name)",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- testContent.setCaption(testContent.getCaption() + "*");\r
- }\r
- });\r
+ b = new Button("change introduction caption (should add * to tab name)", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ testContent.setCaption(testContent.getCaption() + "*");\r
+ }\r
+ });\r
actions.addComponent(b);\r
\r
- b = new Button("change tab caption (should add * to tab name)",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- actions.setCaption(actions.getCaption() + "*");\r
- }\r
- });\r
+ b = new Button("change tab caption (should add * to tab name)", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ actions.setCaption(actions.getCaption() + "*");\r
+ }\r
+ });\r
\r
actions.addComponent(b);\r
\r
final Window w = new Window("Extra window: " + name);
w.setName(name);
addWindow(w);
- w.addComponent(new Label(
- "This window has been created on fly for name: " + name));
- w.addComponent(new Button("Show open windows",
- new Button.ClickListener() {
+ w.addComponent(new Label("This window has been created on fly for name: " + name));
+ w.addComponent(new Button("Show open windows", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- String openWindows = "";
- for (Iterator<Window> i = getWindows().iterator(); i
- .hasNext();) {
- Window t = i.next();
- openWindows += (openWindows.length() > 0 ? "," : "")
- + t.getName();
- }
- w.showNotification(openWindows);
- }
- }));
+ public void buttonClick(ClickEvent event) {
+ String openWindows = "";
+ for (Iterator<Window> i = getWindows().iterator(); i.hasNext();) {
+ Window t = i.next();
+ openWindows += (openWindows.length() > 0 ? "," : "") + t.getName();
+ }
+ w.showNotification(openWindows);
+ }
+ }));
w.addListener(new Window.CloseListener() {
public void windowClose(CloseEvent e) {
removeWindow(w);
private Window createWindow() {
final Window w = new Window();
- w.addComponent(new Button("Show the name of the application",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- w.showNotification("Name of this window = "
- + w.getName());
- }
- }));
- w.addComponent(new Label("<a href='" + getURL().toExternalForm() + "'>"
- + getURL().toExternalForm() + "</a>", Label.CONTENT_XHTML));
- w.addComponent(new Label(
- "<h2>How to reproduce</h2>Open the above link in another browser"
- + " window and then press the Show-button on this window.",
- Label.CONTENT_XHTML));
+ w.addComponent(new Button("Show the name of the application", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ w.showNotification("Name of this window = " + w.getName());
+ }
+ }));
+ w.addComponent(new Label("<a href='" + getURL().toExternalForm() + "'>" + getURL().toExternalForm() + "</a>", Label.CONTENT_XHTML));
+ w.addComponent(new Label("<h2>How to reproduce</h2>Open the above link in another browser" + " window and then press the Show-button on this window.", Label.CONTENT_XHTML));
return w;
}
import com.vaadin.data.util.IndexedContainer;\r
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Component;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Table;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket1973 extends com.vaadin.Application {\r
public void fill(IndexedContainer container, int size, String prefix) {\r
for (int i = 0; i < size; i++) {\r
Item item = container.addItem(new Integer(i));\r
- OrderedLayout layout = new OrderedLayout();\r
+ VerticalLayout layout = new VerticalLayout();\r
layout.addComponent(new Button(prefix + i));\r
item.getItemProperty("layout").setValue(layout);\r
}\r
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket1973_2 extends Application {
for (int i = 0; i < size; i++) {
int randInt = i;
Item item = container.addItem(new Integer(i));
- OrderedLayout layout = new OrderedLayout();
+ VerticalLayout layout = new VerticalLayout();
layout.setDebugId("lo" + i);
layout.addComponent(new Button("Test " + randInt));
item.getItemProperty("layout").setValue(layout);
layout.addComponent(cl1);\r
WebApplicationContext wc = ((WebApplicationContext) getContext());\r
\r
- layout.addComponent(new Button("Disable/Enable",\r
- new ClickListener() {\r
+ layout.addComponent(new Button("Disable/Enable", new ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- boolean e = cl1.isEnabled();\r
+ public void buttonClick(ClickEvent event) {\r
+ boolean e = cl1.isEnabled();\r
\r
- cl1.setEnabled(!e);\r
- cl2.setEnabled(!e);\r
- }\r
+ cl1.setEnabled(!e);\r
+ cl2.setEnabled(!e);\r
+ }\r
\r
- }));\r
- File f = new File(wc.getBaseDirectory().getAbsoluteFile()\r
- + "/VAADIN/themes/" + getTheme()\r
- + "/layouts/Ticket1975.html");\r
+ }));\r
+ File f = new File(wc.getBaseDirectory().getAbsoluteFile() + "/VAADIN/themes/" + getTheme() + "/layouts/Ticket1975.html");\r
\r
cl2 = new CustomLayout(new FileInputStream(f));\r
layout.addComponent(cl2);\r
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.ExpandLayout;
import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;
gl.addComponent(components.get(3));
}
- private class TitleBar extends ExpandLayout {
+ private class TitleBar extends HorizontalLayout {
private Button max = new Button("Max");
private Button min = new Button("Min");
private GridLayout layout;
public TitleBar(String title, GridLayout layout) {
- super(ExpandLayout.ORIENTATION_HORIZONTAL);
+ super();
this.layout = layout;
addComponent(new Label(title));
addComponent(max);
min.setVisible(true);
max.setVisible(false);
TitleBar.this.layout.removeAllComponents();
- TitleBar.this.layout
- .addComponent(TitleBar.this, 0, 0, 1, 1);
+ TitleBar.this.layout.addComponent(TitleBar.this, 0, 0, 1, 1);
}
});
min.addListener(new ClickListener() {
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.SplitPanel;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
final SplitPanel leftSide = initLeftSide();
setFirstComponent(leftSide);
- final Layout rightSide = new OrderedLayout();
+ final Layout rightSide = new VerticalLayout();
rightSide.setHeight("100%");
setSecondComponent(rightSide);
}
dataSource.addContainerProperty(propId, String.class, null);
dataSource.addContainerProperty(propId2, String.class, null);
final Object itemId = dataSource.addItem();
- dataSource
- .getItem(itemId)
- .getItemProperty(propId)
- .setValue(
- "Very long value that makes a scrollbar appear for sure");
- dataSource
- .getItem(itemId)
- .getItemProperty(propId2)
- .setValue(
- "Very long value that makes a scrollbar appear for sure");
+ dataSource.getItem(itemId).getItemProperty(propId).setValue("Very long value that makes a scrollbar appear for sure");
+ dataSource.getItem(itemId).getItemProperty(propId2).setValue("Very long value that makes a scrollbar appear for sure");
for (int i = 0; i < 150; i++) {
Object id = dataSource.addItem();
- dataSource
- .getItem(id)
- .getItemProperty(propId)
- .setValue(
- (i == 100 ? "Very long value that makes a scrollbar appear for sure"
- : "Short"));
- dataSource.getItem(id).getItemProperty(propId2)
- .setValue("Short");
+ dataSource.getItem(id).getItemProperty(propId).setValue((i == 100 ? "Very long value that makes a scrollbar appear for sure" : "Short"));
+ dataSource.getItem(id).getItemProperty(propId2).setValue("Short");
}
table.setSizeFull();
// Change the column value to a short one --> Should remove
// the scrollbar
if (isLong) {
- dataSource.getItem(itemId).getItemProperty(propId)
- .setValue("Short value");
- dataSource.getItem(itemId).getItemProperty(propId2)
- .setValue("Short value");
+ dataSource.getItem(itemId).getItemProperty(propId).setValue("Short value");
+ dataSource.getItem(itemId).getItemProperty(propId2).setValue("Short value");
isLong = false;
} else {
- dataSource
- .getItem(itemId)
- .getItemProperty(propId)
- .setValue(
- "Very long value that makes a scrollbar appear for sure");
- dataSource
- .getItem(itemId)
- .getItemProperty(propId2)
- .setValue(
- "Very long value that makes a scrollbar appear for sure");
+ dataSource.getItem(itemId).getItemProperty(propId).setValue("Very long value that makes a scrollbar appear for sure");
+ dataSource.getItem(itemId).getItemProperty(propId2).setValue("Very long value that makes a scrollbar appear for sure");
isLong = true;
}
// Works the same way with or without repaint request
}
});
- OrderedLayout ol = new OrderedLayout();
+ VerticalLayout ol = new VerticalLayout();
ol.addComponent(button);
leftSide.setFirstComponent(ol);
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
Table t = new Table("Test table");\r
item = table.addItem("2");\r
item.getItemProperty(PROPERTY_1).setValue("Row 2");\r
\r
- Filterable filterable = (Container.Filterable) table\r
- .getContainerDataSource();\r
+ Filterable filterable = (Container.Filterable) table.getContainerDataSource();\r
filterable.addContainerFilter(PROPERTY_1, "Row", true, false);\r
\r
table.setColumnHeader(PROPERTY_1, "Test (filter: Row)");\r
\r
mainWin.addComponent(table);\r
- mainWin.addComponent(new Button("Add item",\r
- new com.vaadin.ui.Button.ClickListener() {\r
+ mainWin.addComponent(new Button("Add item", new com.vaadin.ui.Button.ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- addItem();\r
- }\r
- }));\r
+ public void buttonClick(ClickEvent event) {\r
+ addItem();\r
+ }\r
+ }));\r
}\r
\r
protected void addItem() {\r
- Filterable filterable = (Container.Filterable) table\r
- .getContainerDataSource();\r
+ Filterable filterable = (Container.Filterable) table.getContainerDataSource();\r
\r
Item i = table.addItem("abc");\r
String res = "";\r
public void validate(Object value) throws InvalidValueException {
if (!isValid(value)) {
- throw new InvalidValueException(value
- + " is not a non-negative number");
+ throw new InvalidValueException(value + " is not a non-negative number");
}
}
});
- CompositeValidator v2 = new CompositeValidator(
- CompositeValidator.MODE_OR, null);
+ CompositeValidator v2 = new CompositeValidator(CompositeValidator.MODE_OR, null);
v2.addValidator(v);
v2.addValidator(new Validator() {
});
tx.addValidator(v2);
- final String[] visibleProps = { "required", "invalidAllowed",
- "readOnly", "readThrough", "invalidCommitted",
- "validationVisible" };
+ final String[] visibleProps = { "required", "invalidAllowed", "readOnly", "readThrough", "invalidCommitted", "validationVisible" };
for (int i = 0; i < visibleProps.length; i++) {
- Button b = new Button(visibleProps[i], new MethodProperty<Boolean>(
- tx, visibleProps[i]));
+ Button b = new Button(visibleProps[i], new MethodProperty<Boolean>(tx, visibleProps[i]));
b.setImmediate(true);
mainWin.addComponent(b);
}
- mainWin.addComponent(new Button("Validate integer",
- new Button.ClickListener() {
- public void buttonClick(
- com.vaadin.ui.Button.ClickEvent event) {
- mainWin.showNotification("The field is "
- + (tx.isValid() ? "" : "not ") + "valid");
- };
- }));
+ mainWin.addComponent(new Button("Validate integer", new Button.ClickListener() {
+ public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
+ mainWin.showNotification("The field is " + (tx.isValid() ? "" : "not ") + "valid");
+ };
+ }));
}
}
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2001 extends Application {
final Window w = new Window(getClass().getName());
setMainWindow(w);
- final OrderedLayout l = new OrderedLayout();
+ final VerticalLayout l = new VerticalLayout();
l.addComponent(new Label("row 1"));
l.addComponent(new Label("row 2"));
w.addComponent(l);
GridLayout layout = new GridLayout(2, 2);\r
layout.setSpacing(true);\r
\r
- TextField f1 = new TextField("Non-immediate/Long text field",\r
- new MethodProperty<Long>(this, "long1"));\r
+ TextField f1 = new TextField("Non-immediate/Long text field", new MethodProperty<Long>(this, "long1"));\r
f1.setImmediate(false);\r
f1.setNullSettingAllowed(true);\r
- TextField f2 = new TextField("Immediate/Long text field",\r
- new MethodProperty<Long>(this, "long2"));\r
+ TextField f2 = new TextField("Immediate/Long text field", new MethodProperty<Long>(this, "long2"));\r
f2.setImmediate(true);\r
f2.setNullSettingAllowed(true);\r
\r
final Window main = new Window("Main window for #2007");
setMainWindow(main);
- main.addComponent(new Button("Open another (non-main) window",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- Window c = new Window("Non-main browser window "
- + (++childs));
- addWindow(c);
- main.open(new ExternalResource(c.getURL()), "_new");
- }
- }));
+ main.addComponent(new Button("Open another (non-main) window", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ Window c = new Window("Non-main browser window " + (++childs));
+ addWindow(c);
+ main.open(new ExternalResource(c.getURL()), "_new");
+ }
+ }));
}
}
import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering;\r
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Button.ClickEvent;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.Table;\r
import com.vaadin.ui.TextField;\r
import com.vaadin.ui.Tree;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2009 extends com.vaadin.Application {\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
- OrderedLayout ol = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ HorizontalLayout ol = new HorizontalLayout();\r
main.setLayout(ol);\r
ol.setSizeFull();\r
\r
t.addItem("Foo");\r
t.addItem("Bar");\r
\r
- final OrderedLayout events = new OrderedLayout();\r
+ final VerticalLayout events = new VerticalLayout();\r
\r
t.addListener(new ItemClickEvent.ItemClickListener() {\r
public void itemClick(ItemClickEvent event) {\r
- events.addComponent(new Label(new Label("Click:"\r
- + (event.isDoubleClick() ? "double" : "single")\r
- + " button:" + event.getButton() + " propertyId:"\r
- + event.getPropertyId() + " itemID:"\r
- + event.getItemId() + " item:" + event.getItem())));\r
+ events.addComponent(new Label(new Label("Click:" + (event.isDoubleClick() ? "double" : "single") + " button:" + event.getButton() + " propertyId:" + event.getPropertyId() + " itemID:" + event.getItemId() + " item:" + event.getItem())));\r
\r
}\r
});\r
Panel p2 = new Panel("Table test (try dbl click also)");\r
p2.setSizeFull();\r
\r
- final OrderedLayout events2 = new OrderedLayout();\r
- Table table = TestForTablesInitialColumnWidthLogicRendering\r
- .getTestTable(5, 100);\r
+ final VerticalLayout events2 = new VerticalLayout();\r
+ Table table = TestForTablesInitialColumnWidthLogicRendering.getTestTable(5, 100);\r
table.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);\r
table.addListener(new ItemClickEvent.ItemClickListener() {\r
public void itemClick(ItemClickEvent event) {\r
- events2.addComponent(new Label("Click:"\r
- + (event.isDoubleClick() ? "double" : "single")\r
- + " button:" + event.getButton() + " propertyId:"\r
- + event.getPropertyId() + " itemID:"\r
- + event.getItemId() + " item:" + event.getItem()));\r
+ events2.addComponent(new Label("Click:" + (event.isDoubleClick() ? "double" : "single") + " button:" + event.getButton() + " propertyId:" + event.getPropertyId() + " itemID:" + event.getItemId() + " item:" + event.getItem()));\r
if (event.isDoubleClick()) {\r
new PropertyEditor(event);\r
}\r
\r
setCaption("Editing " + itemid + " : " + propertyid);\r
\r
- editor.setPropertyDataSource(c.getContainerProperty(itemid,\r
- propertyid));\r
+ editor.setPropertyDataSource(c.getContainerProperty(itemid, propertyid));\r
addComponent(editor);\r
addComponent(done);\r
\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.GridLayout;\r
-import com.vaadin.ui.OrderedLayout;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2014 extends Application {\r
\r
- private OrderedLayout innerLayout1;\r
+ private HorizontalLayout innerLayout1;\r
private Button b1;\r
private Panel panel;\r
\r
setMainWindow(w);\r
// setTheme("tests-ticket");\r
GridLayout layout = new GridLayout(10, 10);\r
- w.setLayout(layout);\r
+ w.setContent(layout);\r
createUI(layout);\r
}\r
\r
private void createUI(GridLayout layout) {\r
createPanel(layout);\r
\r
- layout.addComponent(new Button("Change class name",\r
- new ClickListener() {\r
+ layout.addComponent(new Button("Change class name", new ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- b1.setStyleName(UUID.randomUUID().toString());\r
- }\r
+ public void buttonClick(ClickEvent event) {\r
+ b1.setStyleName(UUID.randomUUID().toString());\r
+ }\r
\r
- }));\r
+ }));\r
\r
}\r
\r
panel = new Panel("panel caption");\r
layout.addComponent(panel);\r
\r
- innerLayout1 = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ innerLayout1 = new HorizontalLayout();\r
innerLayout1.setSpacing(true);\r
panel.addComponent(innerLayout1);\r
\r
\r
import com.vaadin.Application;\r
import com.vaadin.ui.AbstractComponent;\r
+import com.vaadin.ui.AbstractOrderedLayout;\r
import com.vaadin.ui.Button;\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Button.ClickListener;\r
-import com.vaadin.ui.ExpandLayout;\r
import com.vaadin.ui.GridLayout;\r
import com.vaadin.ui.Label;\r
import com.vaadin.ui.Layout;\r
import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.TextField;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2021 extends Application {\r
\r
private TextField tf1, tf2, tf3;\r
\r
- private String contents = "This TextField SHOULD FILL the panel and NOT CAUSE any scrollbars to appear in the Panel. Scrollbars SHOULD appear in the TextField AND the whole scrollbars (includinc arrow down) SHOULD be visible.\n\n"\r
- + ""\r
- + "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent quis justo. Vivamus nec mi eu libero convallis auctor. Mauris et arcu. Nunc luctus justo. Aenean convallis, odio in vehicula scelerisque, est magna condimentum pede, a aliquam elit eros vitae diam. Phasellus porttitor convallis tellus. Nullam elementum, ligula nec viverra malesuada, risus tortor bibendum dui, eget hendrerit sem enim at massa. Nam eu pede sed nulla congue fermentum. Vestibulum malesuada libero non nunc. Proin rutrum. Fusce erat pede, volutpat vitae, aliquam ut, sagittis vel, augue. Fusce dui pede, convallis nec, accumsan tincidunt, consectetuer ac, purus. Nulla facilisi. Ut nisi. Sed orci risus, lacinia eu, sodales molestie, gravida quis, neque. Vestibulum pharetra ornare elit. Nulla porttitor molestie mauris. Morbi fringilla tellus sed risus. Curabitur varius massa."\r
- + "Nulla nisi. Sed blandit, ante vitae sagittis volutpat, arcu mauris vehicula risus, vitae posuere felis lectus sit amet purus. Donec nec magna et leo eleifend scelerisque. Suspendisse condimentum pharetra ligula. Curabitur lorem. Pellentesque a augue sit amet enim fermentum placerat. Phasellus ante risus, molestie at, iaculis at, pellentesque non, tellus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus non urna eget risus tempus imperdiet. Integer est diam, sagittis sit amet, posuere sit amet, bibendum sed, lacus. Aenean adipiscing cursus ipsum. Quisque at elit. Vestibulum vitae nunc. Praesent placerat metus viverra lorem. Cras nec elit congue nisi faucibus feugiat. Nam eget mi. Vestibulum condimentum. Nunc nisl ante, cursus in, dictum ac, lobortis rutrum, mi. Nulla eu nisi. In ultricies vehicula magna."\r
- + "Nunc eros dui, elementum at, ullamcorper eget, varius at, velit. Ut dictum. Cras ullamcorper ante vel tortor. Quisque viverra mauris vulputate quam. Nulla dui. Suspendisse non eros at ipsum faucibus hendrerit. Morbi dignissim pharetra tortor. Etiam malesuada. Mauris lacinia elementum erat. Duis mollis placerat metus. Nunc risus felis, cursus ac, cursus vel, convallis vel, metus. Ut vehicula nibh et nulla. Vivamus id pede. Quisque egestas arcu a ligula. Maecenas vehicula. Quisque sed ligula quis tellus tempus rutrum. Curabitur vel augue sed orci egestas pharetra. Duis pharetra.";\r
+ private String contents = "This TextField SHOULD FILL the panel and NOT CAUSE any scrollbars to appear in the Panel. Scrollbars SHOULD appear in the TextField AND the whole scrollbars (includinc arrow down) SHOULD be visible.\n\n" + "" + "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent quis justo. Vivamus nec mi eu libero convallis auctor. Mauris et arcu. Nunc luctus justo. Aenean convallis, odio in vehicula scelerisque, est magna condimentum pede, a aliquam elit eros vitae diam. Phasellus porttitor convallis tellus. Nullam elementum, ligula nec viverra malesuada, risus tortor bibendum dui, eget hendrerit sem enim at massa. Nam eu pede sed nulla congue fermentum. Vestibulum malesuada libero non nunc. Proin rutrum. Fusce erat pede, volutpat vitae, aliquam ut, sagittis vel, augue. Fusce dui pede, convallis nec, accumsan tincidunt, consectetuer ac, purus. Nulla facilisi. Ut nisi. Sed orci risus, lacinia eu, sodales molestie, gravida quis, neque. Vestibulum pharetra ornare elit. Nulla porttitor molestie mauris. Morbi fringilla tellus sed risus. Curabitur varius massa." + "Nulla nisi. Sed blandit, ante vitae sagittis volutpat, arcu mauris vehicula risus, vitae posuere felis lectus sit amet purus. Donec nec magna et leo eleifend scelerisque. Suspendisse condimentum pharetra ligula. Curabitur lorem. Pellentesque a augue sit amet enim fermentum placerat. Phasellus ante risus, molestie at, iaculis at, pellentesque non, tellus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus non urna eget risus tempus imperdiet. Integer est diam, sagittis sit amet, posuere sit amet, bibendum sed, lacus. Aenean adipiscing cursus ipsum. Quisque at elit. Vestibulum vitae nunc. Praesent placerat metus viverra lorem. Cras nec elit congue nisi faucibus feugiat. Nam eget mi. Vestibulum condimentum. Nunc nisl ante, cursus in, dictum ac, lobortis rutrum, mi. Nulla eu nisi. In ultricies vehicula magna." + "Nunc eros dui, elementum at, ullamcorper eget, varius at, velit. Ut dictum. Cras ullamcorper ante vel tortor. Quisque viverra mauris vulputate quam. Nulla dui. Suspendisse non eros at ipsum faucibus hendrerit. Morbi dignissim pharetra tortor. Etiam malesuada. Mauris lacinia elementum erat. Duis mollis placerat metus. Nunc risus felis, cursus ac, cursus vel, convallis vel, metus. Ut vehicula nibh et nulla. Vivamus id pede. Quisque egestas arcu a ligula. Maecenas vehicula. Quisque sed ligula quis tellus tempus rutrum. Curabitur vel augue sed orci egestas pharetra. Duis pharetra.";\r
\r
private OrderedLayout orderedLayout;\r
\r
@Override\r
public void init() {\r
Window w = new Window(getClass().getSimpleName());\r
- w.setLayout(new GridLayout(2, 2));\r
+ w.setContent(new GridLayout(2, 2));\r
setMainWindow(w);\r
\r
Panel p = new Panel();\r
p.setCaption("ExpandLayout");\r
p.setWidth("500px");\r
p.setHeight("500px");\r
- p.setLayout(new ExpandLayout());\r
- p.getLayout().setSizeFull();\r
+ p.setContent(new VerticalLayout());\r
+ p.getContent().setSizeFull();\r
\r
- w.getLayout().addComponent(p);\r
+ w.getContent().addComponent(p);\r
\r
tf1 = new TextField();\r
tf1.setRows(5);\r
tf1.setSizeFull();\r
tf1.setValue(contents);\r
tf1.setCaption("TextField caption");\r
- p.getLayout().addComponent(tf1);\r
+ p.getContent().addComponent(tf1);\r
\r
/*\r
* \r
p2.setCaption("OrderedLayout");\r
p2.setWidth("500px");\r
p2.setHeight("500px");\r
- p2.setLayout(new OrderedLayout());\r
- p2.getLayout().setSizeFull();\r
+ p2.setContent(new OrderedLayout());\r
+ p2.getContent().setSizeFull();\r
\r
- w.getLayout().addComponent(p2);\r
+ w.getContent().addComponent(p2);\r
\r
tf2 = new TextField();\r
tf2.setRows(5);\r
tf2.setSizeFull();\r
tf2.setValue(contents);\r
tf2.setCaption("TextField caption");\r
- p2.getLayout().addComponent(tf2);\r
+ p2.getContent().addComponent(tf2);\r
\r
/*\r
* \r
p3.setCaption("GridLayout");\r
p3.setWidth(500);\r
p3.setHeight(500);\r
- // p3.setLayout(new GridLayout());\r
- p3.getLayout().setSizeFull();\r
- p3.getLayout().setMargin(false);\r
+ // p3.setContent(new GridLayout());\r
+ p3.getContent().setSizeFull();\r
+ ((Layout) p3.getContent()).setMargin(false);\r
\r
GridLayout gl = new GridLayout();\r
gl.setSizeFull();\r
gl.setMargin(false);\r
- p3.getLayout().addComponent(gl);\r
- w.getLayout().addComponent(p3);\r
+ p3.getContent().addComponent(gl);\r
+ w.getContent().addComponent(p3);\r
\r
tf3 = new TextField();\r
tf3.setRows(5);\r
tf3.setSizeFull();\r
tf3.setValue(contents);\r
tf3.setCaption("TextField caption");\r
- // p3.getLayout().addComponent(tf3);\r
+ // p3.getContent().addComponent(tf3);\r
gl.addComponent(tf3);\r
\r
// Panel pp = new Panel();\r
// pp.setCaption("OrderedLayout");\r
// pp.setWidth("500px");\r
// pp.setHeight("500px");\r
- // pp.getLayout().setSizeFull();\r
- // orderedLayout = new OrderedLayout();\r
- // pp.getLayout().addComponent(orderedLayout);\r
- // w.getLayout().addComponent(pp);\r
+ // pp.getContent().setSizeFull();\r
+ // orderedLayout = new VerticalLayout();\r
+ // pp.getContent().addComponent(orderedLayout);\r
+ // w.getContent().addComponent(pp);\r
// createUI(orderedLayout);\r
}\r
\r
@SuppressWarnings("unused")\r
private void createUI(Layout layout) {\r
Label l = new Label("Label");\r
- Button b = new Button("Enable/disable caption and watch button move",\r
- new ClickListener() {\r
-\r
- public void buttonClick(ClickEvent event) {\r
- System.out.println("Enable/disable caption");\r
- for (AbstractComponent l : new AbstractComponent[] {\r
- tf1, tf2, tf3 }) {\r
- // AbstractComponent l = tf2;\r
- // Layout l = (Layout) event.getButton().getData();\r
- if (l.getCaption() == null) {\r
- l.setCaption("Expand layout caption");\r
- } else {\r
- l.setCaption(null);\r
- }\r
- }\r
+ Button b = new Button("Enable/disable caption and watch button move", new ClickListener() {\r
+\r
+ public void buttonClick(ClickEvent event) {\r
+ System.out.println("Enable/disable caption");\r
+ for (AbstractComponent l : new AbstractComponent[] { tf1, tf2, tf3 }) {\r
+ // AbstractComponent l = tf2;\r
+ // Layout l = (Layout) event.getButton().getData();\r
+ if (l.getCaption() == null) {\r
+ l.setCaption("Expand layout caption");\r
+ } else {\r
+ l.setCaption(null);\r
}\r
+ }\r
+ }\r
\r
- });\r
+ });\r
b.setData(layout);\r
Label l2 = new Label("This should always be visible");\r
\r
layout.addComponent(b);\r
layout.addComponent(l2);\r
\r
- if (layout instanceof ExpandLayout) {\r
- ((ExpandLayout) layout).expand(l);\r
+ if (layout instanceof AbstractOrderedLayout) {\r
+ ((AbstractOrderedLayout) layout).setExpandRatio(l, 1);\r
\r
}\r
}\r
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Window;
-public class Ticket2023 extends com.vaadin.Application implements
- Button.ClickListener {
+public class Ticket2023 extends com.vaadin.Application implements Button.ClickListener {
AbstractComponent c = new Button();
setMainWindow(main);
String[] sizes = { "20", "100", "1", "0", "-1", "", "z" };
- String[] units = { "%", "px", "em", "ex", "in", "cm", "mm", "pt", "pc",
- "", "p", "zyx" };
+ String[] units = { "%", "px", "em", "ex", "in", "cm", "mm", "pt", "pc", "", "p", "zyx" };
GridLayout gl = new GridLayout(units.length, sizes.length);
main.addComponent(gl);
import com.vaadin.Application;\r
import com.vaadin.ui.GridLayout;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.TextField;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2024 extends Application {\r
w.getLayout().setHeight("2000");\r
w.getLayout().addComponent(layout);\r
\r
- layout.addComponent(new Label(\r
- "This should NOT get stuck when scrolling down"));\r
+ layout.addComponent(new Label("This should NOT get stuck when scrolling down"));\r
layout.addComponent(new TextField("This should not get stuck either..."));\r
\r
- OrderedLayout ol = new OrderedLayout();\r
+ VerticalLayout ol = new VerticalLayout();\r
ol.setHeight("1000");\r
ol.setWidth("200");\r
w.getLayout().addComponent(ol);\r
import com.vaadin.terminal.UserError;\r
import com.vaadin.ui.Component;\r
import com.vaadin.ui.GridLayout;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.TextField;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2029 extends Application {\r
p.setWidth(DIM1 + "px");\r
p.setHeight(DIM2 + "px");\r
\r
- OrderedLayout layout = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ HorizontalLayout layout = new HorizontalLayout();\r
p.setLayout(layout);\r
p.getLayout().setSizeFull();\r
\r
tf.setComponentError(new UserError("Error"));\r
}\r
tf.setWidth("100%");\r
- layout.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT,\r
- OrderedLayout.ALIGNMENT_BOTTOM);\r
+ layout.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT, OrderedLayout.ALIGNMENT_BOTTOM);\r
p.addComponent(tf);\r
\r
}\r
tf.setComponentError(new UserError("Error"));\r
}\r
tf.setWidth("100%");\r
- layout.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT,\r
- OrderedLayout.ALIGNMENT_VERTICAL_CENTER);\r
+ layout.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT, OrderedLayout.ALIGNMENT_VERTICAL_CENTER);\r
p.addComponent(tf);\r
\r
}\r
p.setWidth("" + DIM2 + "px");\r
p.setHeight("" + DIM1 + "px");\r
\r
- OrderedLayout layout = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_VERTICAL);\r
+ VerticalLayout layout = new VerticalLayout();\r
p.setLayout(layout);\r
p.getLayout().setSizeFull();\r
\r
tf.setRows(2);\r
tf.setSizeFull();\r
\r
- layout.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT,\r
- OrderedLayout.ALIGNMENT_BOTTOM);\r
+ layout.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT, OrderedLayout.ALIGNMENT_BOTTOM);\r
p.addComponent(tf);\r
\r
}\r
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Label;\r
import com.vaadin.ui.Layout;\r
-import com.vaadin.ui.OrderedLayout;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2037 extends com.vaadin.Application {\r
Window main = new Window();\r
setMainWindow(main);\r
\r
- main.addComponent(new Label(\r
- "Use debug dialog and trac number of registered paintables. It should not grow on subsequant b clicks."));\r
+ main.addComponent(new Label("Use debug dialog and trac number of registered paintables. It should not grow on subsequant b clicks."));\r
\r
- final Layout lo = new OrderedLayout();\r
+ final Layout lo = new VerticalLayout();\r
\r
Button b = new Button("b");\r
\r
final Window w = new Window("Testing for #2038");
setMainWindow(w);
- final TextField tf = new TextField(
- "Test-field, enter someting and click outside the field to activate");
+ final TextField tf = new TextField("Test-field, enter someting and click outside the field to activate");
tf.setRequired(true);
tf.setImmediate(true);
tf.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- w.showNotification("TextField is " + (tf.isValid() ? "" : "in")
- + "valid, with error: " + tf.getErrorMessage(),
- Notification.TYPE_WARNING_MESSAGE);
+ w.showNotification("TextField is " + (tf.isValid() ? "" : "in") + "valid, with error: " + tf.getErrorMessage(), Notification.TYPE_WARNING_MESSAGE);
}
});
w.addComponent(tf);
- final Button b = new Button(
- "Field should use error message. (!) should be shown when invalid.",
- false);
+ final Button b = new Button("Field should use error message. (!) should be shown when invalid.", false);
w.addComponent(b);
b.setImmediate(true);
b.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- tf.setRequiredError(b.booleanValue() ? "Field must not be empty"
- : null);
+ tf.setRequiredError(b.booleanValue() ? "Field must not be empty" : null);
}
});
}
l.setSizeFull();\r
ts.addTab(l, "100% h component", null);\r
\r
- Label testContent = new Label(\r
- "TabSheet by default uses caption, icon, errors etc. from Components. ");\r
+ Label testContent = new Label("TabSheet by default uses caption, icon, errors etc. from Components. ");\r
\r
testContent.setCaption("Introduction to test");\r
\r
l.setSizeFull();\r
ts.addTab(l, "200px h component", null);\r
\r
- testContent = new Label(\r
- "TabSheet by default uses caption, icon, errors etc. from Components. ");\r
+ testContent = new Label("TabSheet by default uses caption, icon, errors etc. from Components. ");\r
\r
testContent.setCaption("Introduction to test");\r
\r
l.setSizeFull();\r
ts.addTab(l, "50% h component", null);\r
\r
- testContent = new Label(\r
- "TabSheet by default uses caption, icon, errors etc. from Components. ");\r
+ testContent = new Label("TabSheet by default uses caption, icon, errors etc. from Components. ");\r
\r
testContent.setCaption("Introduction to test");\r
\r
}\r
\r
private void createUI(GridLayout layout) {\r
- Link l = new Link("Vaadin home (new 200x200 window, no decor, icon)",\r
- new ExternalResource("http://www.vaadin.com"), "_blank", 200,\r
- 200, Link.TARGET_BORDER_NONE);\r
+ Link l = new Link("Vaadin home (new 200x200 window, no decor, icon)", new ExternalResource("http://www.vaadin.com"), "_blank", 200, 200, Link.TARGET_BORDER_NONE);\r
\r
layout.addComponent(l);\r
}\r
import com.vaadin.ui.GridLayout;\r
import com.vaadin.ui.Label;\r
import com.vaadin.ui.Layout;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.SplitPanel;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2048 extends Application {\r
private Panel p;\r
private SplitPanel splitPanel;\r
private GridLayout gridLayout;\r
- private OrderedLayout orderedLayout;\r
+ private VerticalLayout orderedLayout;\r
\r
@Override\r
public void init() {\r
// GridLayout layout = new GridLayout(10, 10);\r
// w.setLayout(layout);\r
// gridLayout = new GridLayout(1, 1);\r
- orderedLayout = new OrderedLayout();\r
+ orderedLayout = new VerticalLayout();\r
\r
getMainWindow().setLayout(orderedLayout);\r
// getMainWindow().setLayout(new GridLayout(1, 1));\r
l.setHeight("400px");\r
p.addComponent(l);\r
\r
- embedded = new Embedded(null, new ThemeResource(\r
- "icons/64/folder-add.png"));\r
+ embedded = new Embedded(null, new ThemeResource("icons/64/folder-add.png"));\r
layout.addComponent(embedded);\r
- Button b = new Button(\r
- "Replace image with new embedded component (flashes)",\r
- new ClickListener() {\r
+ Button b = new Button("Replace image with new embedded component (flashes)", new ClickListener() {\r
\r
- public void buttonClick(ClickEvent event) {\r
- Embedded newEmbedded = new Embedded(null,\r
- new ThemeResource("icons/64/folder-add.png"));\r
- getMainWindow().getLayout().replaceComponent(embedded,\r
- newEmbedded);\r
- embedded = newEmbedded;\r
+ public void buttonClick(ClickEvent event) {\r
+ Embedded newEmbedded = new Embedded(null, new ThemeResource("icons/64/folder-add.png"));\r
+ getMainWindow().getLayout().replaceComponent(embedded, newEmbedded);\r
+ embedded = newEmbedded;\r
\r
- }\r
+ }\r
\r
- });\r
+ });\r
p.addComponent(b);\r
\r
b = new Button("Change image source (is fine)", new ClickListener() {\r
\r
public void buttonClick(ClickEvent event) {\r
String img = "folder-add";\r
- if (((ThemeResource) embedded.getSource()).getResourceId()\r
- .contains("folder-add")) {\r
+ if (((ThemeResource) embedded.getSource()).getResourceId().contains("folder-add")) {\r
img = "folder-delete";\r
}\r
embedded.setSource(new ThemeResource("icons/64/" + img + ".png"));\r
setMainWindow(main);
Button nothing = new Button("Do nothing");
main.addComponent(nothing);
- nothing.setDescription("Even though no action is taked, this window is refreshed to "
- + "draw changes not originating from this window. Such changes include changes "
- + "made by other browser-windows.");
+ nothing.setDescription("Even though no action is taked, this window is refreshed to " + "draw changes not originating from this window. Such changes include changes " + "made by other browser-windows.");
Button add = new Button("Add a window", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
final String name = "Child " + (++childs);
c.addComponent(tf);
tf.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- main.addComponent(new Label(name + " send text:"
- + tf.toString()));
+ main.addComponent(new Label(name + " send text:" + tf.toString()));
}
});
for (int i = 0; i < 3; i++) {
final String caption = "Slow button " + i;
- c.addComponent(new Button(caption,
- new Button.ClickListener() {
- public synchronized void buttonClick(
- ClickEvent event) {
- try {
- this.wait(2000);
- } catch (InterruptedException e) {
- }
- main.addComponent(new Label(caption
- + " pressed"));
- }
- }));
+ c.addComponent(new Button(caption, new Button.ClickListener() {
+ public synchronized void buttonClick(ClickEvent event) {
+ try {
+ this.wait(2000);
+ } catch (InterruptedException e) {
+ }
+ main.addComponent(new Label(caption + " pressed"));
+ }
+ }));
}
}
});
main.addComponent(add);
- add.setDescription("This button opens a new browser window. Closing the browser "
- + "window should do two things: 1) submit all unsubmitted state to server "
- + "(print any changes to textfield to main window) and 2) call window.close()"
- + " on the child window (print closed on the main window)");
+ add.setDescription("This button opens a new browser window. Closing the browser " + "window should do two things: 1) submit all unsubmitted state to server " + "(print any changes to textfield to main window) and 2) call window.close()" + " on the child window (print closed on the main window)");
}
}
import com.vaadin.ui.Button.ClickEvent;\r
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.GridLayout;\r
-import com.vaadin.ui.OrderedLayout;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2060 extends Application {\r
}\r
\r
private void createUI(GridLayout layout) {\r
- OrderedLayout buttonLayout = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ HorizontalLayout buttonLayout = new HorizontalLayout();\r
button1 = new Button("Button which is 50px wide");\r
button1.setWidth("50px");\r
button2 = new Button("Button without width");\r
import com.vaadin.ui.Accordion;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.ExpandLayout;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2061 extends Application {
MyTable table3 = new MyTable(24, "table3");
table3.loadTable(1000);
- MyAccordion accordion = new MyAccordion(new Component[] { table1,
- table2 }, "Test");
+ MyAccordion accordion = new MyAccordion(new Component[] { table1, table2 }, "Test");
Tabs tab = new Tabs(new Component[] { accordion, table3 });
private Table table = new Table();
private String[] columns;
- private ExpandLayout layout = new ExpandLayout();
+ private VerticalLayout layout = new VerticalLayout();
public MyTable(int columnNumber, String id) {
setDebugId(id);
Item rowItem = table.addItem(j);
if (rowItem != null) {
for (int i = 0; i < columns.length; i++) {
- rowItem.getItemProperty(columns[i]).setValue(
- "Value" + j);
+ rowItem.getItemProperty(columns[i]).setValue("Value" + j);
}
}
}
import com.vaadin.ui.Accordion;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.ExpandLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet.SelectedTabChangeListener;
import com.vaadin.ui.Table;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
-public class Ticket2061b extends Application implements
- SelectedTabChangeListener {
+public class Ticket2061b extends Application implements SelectedTabChangeListener {
private Window mainWindow;
private Panel p;
private Table table = new Table();
private String[] columns;
- private ExpandLayout layout = new ExpandLayout();
+ private VerticalLayout layout = new VerticalLayout();
public MyTable(int columnNumber, String id) {
setDebugId(id);
Item rowItem = table.addItem(j);
if (rowItem != null) {
for (int i = 0; i < columns.length; i++) {
- rowItem.getItemProperty(columns[i]).setValue(
- "Value" + j);
+ rowItem.getItemProperty(columns[i]).setValue("Value" + j);
}
}
}
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
-public class Ticket2061c extends Application implements
- SelectedTabChangeListener {
+public class Ticket2061c extends Application implements SelectedTabChangeListener {
private Window mainWindow;
private Panel p;
Item rowItem = table.addItem(j);
if (rowItem != null) {
for (int i = 0; i < columns.length; i++) {
- rowItem.getItemProperty(columns[i]).setValue(
- "Value" + j);
+ rowItem.getItemProperty(columns[i]).setValue("Value" + j);
}
}
}
}\r
\r
private void createUI(GridLayout layout) {\r
- Panel p = new Panel(\r
- "This is a panel with a longer caption than it should have");\r
+ Panel p = new Panel("This is a panel with a longer caption than it should have");\r
p.setWidth("100px");\r
p.getLayout().addComponent(new Label("Contents"));\r
layout.addComponent(p);\r
}
private void updateLabel() {
- label.setValue("width: " + target.getWidth()
- + Sizeable.UNIT_SYMBOLS[target.getWidthUnits()] + ", height: "
- + target.getHeight()
- + Sizeable.UNIT_SYMBOLS[target.getHeightUnits()]);
+ label.setValue("width: " + target.getWidth() + Sizeable.UNIT_SYMBOLS[target.getWidthUnits()] + ", height: " + target.getHeight() + Sizeable.UNIT_SYMBOLS[target.getHeightUnits()]);
}
}
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.GridLayout;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.TabSheet;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2099 extends Application {\r
\r
private Label l1, l2, l3;\r
- private OrderedLayout ol1, ol2, ol3;\r
+ private VerticalLayout ol1, ol2, ol3;\r
private Window popup;\r
\r
@Override\r
private Window createPopup() {\r
Window w = new Window("Popup");\r
TabSheet ts = new TabSheet();\r
- ol1 = new OrderedLayout();\r
- ol2 = new OrderedLayout();\r
- ol3 = new OrderedLayout();\r
+ ol1 = new VerticalLayout();\r
+ ol2 = new VerticalLayout();\r
+ ol3 = new VerticalLayout();\r
l1 = new Label("111");\r
l2 = new Label("222");\r
l3 = new Label("333");\r
Window w = new Window(getClass().getSimpleName());\r
setMainWindow(w);\r
\r
- Button b = new Button(\r
- "Button with a long text which will not fit on 50 pixels");\r
+ Button b = new Button("Button with a long text which will not fit on 50 pixels");\r
b.setWidth("50px");\r
\r
w.getLayout().addComponent(b);\r
import com.vaadin.data.util.HierarchicalContainer;
import com.vaadin.ui.Accordion;
import com.vaadin.ui.Component;
-import com.vaadin.ui.ExpandLayout;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2103 extends Application {
@Override
public void init() {
mainWindow = new Window(getClass().getSimpleName());
- mainWindow.setLayout(new ExpandLayout());
+ mainWindow.setContent(new VerticalLayout());
mainWindow.setSizeFull();
- mainWindow.getLayout().setSizeFull();
+ mainWindow.getContent().setSizeFull();
MyTable table1 = new MyTable(4, "table1");
table1.loadTable(100);
MyTable table2 = new MyTable(4, "table2");
table2.loadTable(100);
- MyAccordion a = new MyAccordion(new Component[] { table1, table2 },
- "FDSF");
+ MyAccordion a = new MyAccordion(new Component[] { table1, table2 }, "FDSF");
mainWindow.addComponent(a);
setMainWindow(mainWindow);
// mainWindow.addComponent(table1);
private Table table = this;
private String[] columns;
- private ExpandLayout layout = new ExpandLayout();
+ private VerticalLayout layout = new VerticalLayout();
public MyTable(int columnNumber, String id) {
setDebugId(id);
Item rowItem = table.addItem(j);
if (rowItem != null) {
for (int i = 0; i < columns.length; i++) {
- rowItem.getItemProperty(columns[i]).setValue(
- "Value" + j);
+ rowItem.getItemProperty(columns[i]).setValue("Value" + j);
}
}
}
import com.vaadin.terminal.ExternalResource;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Table;
import com.vaadin.ui.Tree;
import com.vaadin.ui.Window;
public class Ticket2104 extends Application {
- private static final Label info = new Label(
- "Click event should _always_ come trough. Switching features on/off should immediatly affect the tree (verify w/ debug window)",
- Label.CONTENT_RAW);
+ private static final Label info = new Label("Click event should _always_ come trough. Switching features on/off should immediatly affect the tree (verify w/ debug window)", Label.CONTENT_RAW);
Tree tree = new Tree();
Table table = new Table();
main.addComponent(info);
- OrderedLayout ol = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ HorizontalLayout ol = new HorizontalLayout();
main.addComponent(ol);
- Button b = new Button("immediate", new MethodProperty<Boolean>(tree,
- "immediate"));
+ Button b = new Button("immediate", new MethodProperty<Boolean>(tree, "immediate"));
b.setImmediate(true);
ol.addComponent(b);
- b = new Button("selectable", new MethodProperty<Boolean>(tree,
- "selectable"));
+ b = new Button("selectable", new MethodProperty<Boolean>(tree, "selectable"));
b.setImmediate(true);
ol.addComponent(b);
- b = new Button("nullsel", new MethodProperty<Boolean>(tree,
- "nullSelectionAllowed"));
+ b = new Button("nullsel", new MethodProperty<Boolean>(tree, "nullSelectionAllowed"));
b.setImmediate(true);
ol.addComponent(b);
- b = new Button("multi",
- new MethodProperty<Boolean>(tree, "multiSelect"));
+ b = new Button("multi", new MethodProperty<Boolean>(tree, "multiSelect"));
b.setImmediate(true);
ol.addComponent(b);
b = new Button("icon", new Button.ClickListener() {
tree.setParent("2. Child 1", "Root 2");
tree.addItem("2. Child 2");
tree.setParent("2. Child 2", "Root 2");
- tree.addContainerProperty("icon", ExternalResource.class,
- new ExternalResource(
- "http://www.itmill.com/res/images/itmill_logo.gif"));
+ tree.addContainerProperty("icon", ExternalResource.class, new ExternalResource("http://www.itmill.com/res/images/itmill_logo.gif"));
tree.addListener(new ItemClickListener() {
public void itemClick(ItemClickEvent event) {
- getMainWindow().addComponent(
- new Label(event.toString() + " // " + event.getItemId()
- + "//" + event.getSource()));
+ getMainWindow().addComponent(new Label(event.toString() + " // " + event.getItemId() + "//" + event.getSource()));
}
});
- ol = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ ol = new HorizontalLayout();
main.addComponent(ol);
- b = new Button("immediate", new MethodProperty<Boolean>(table,
- "immediate"));
+ b = new Button("immediate", new MethodProperty<Boolean>(table, "immediate"));
b.setImmediate(true);
ol.addComponent(b);
- b = new Button("selectable", new MethodProperty<Boolean>(table,
- "selectable"));
+ b = new Button("selectable", new MethodProperty<Boolean>(table, "selectable"));
b.setImmediate(true);
ol.addComponent(b);
- b = new Button("nullsel", new MethodProperty<Boolean>(table,
- "nullSelectionAllowed"));
+ b = new Button("nullsel", new MethodProperty<Boolean>(table, "nullSelectionAllowed"));
b.setImmediate(true);
ol.addComponent(b);
- b = new Button("multi", new MethodProperty<Boolean>(table,
- "multiSelect"));
+ b = new Button("multi", new MethodProperty<Boolean>(table, "multiSelect"));
b.setImmediate(true);
ol.addComponent(b);
main.addComponent(table);
}
table.addListener(new ItemClickListener() {
public void itemClick(ItemClickEvent event) {
- getMainWindow().addComponent(
- new Label(event.toString() + " // " + event.getItemId()
- + "//" + event.getSource()));
+ getMainWindow().addComponent(new Label(event.toString() + " // " + event.getItemId() + "//" + event.getSource()));
}
});
@Override
public void init() {
setMainWindow(new Window("#2106"));
- getMainWindow().addComponent(
- new Button("Do nothing", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- getMainWindow().addComponent(
- new Label("Last time did nothing: "
- + new Date()));
- }
- }));
+ getMainWindow().addComponent(new Button("Do nothing", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ getMainWindow().addComponent(new Label("Last time did nothing: " + new Date()));
+ }
+ }));
}
}
final Window w = new Window("Testing for #2107");
setMainWindow(w);
- final TextField tf = new TextField(
- "Required field that validated the input");
+ final TextField tf = new TextField("Required field that validated the input");
tf.setDescription("Enter someting and click outside the field to activate");
tf.setRequired(true);
tf.setImmediate(true);
tf.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- w.showNotification("TextField is " + (tf.isValid() ? "" : "in")
- + "valid, with error: " + tf.getErrorMessage(),
- Notification.TYPE_WARNING_MESSAGE);
+ w.showNotification("TextField is " + (tf.isValid() ? "" : "in") + "valid, with error: " + tf.getErrorMessage(), Notification.TYPE_WARNING_MESSAGE);
}
});
tf.addValidator(new Validator() {
public void validate(Object value) throws InvalidValueException {
if (!isValid(value)) {
- throw new InvalidValueException(
- "Text length must exceed 3 characters");
+ throw new InvalidValueException("Text length must exceed 3 characters");
}
}
});
w.addComponent(tf);
- final Button b = new Button(
- "Field should use error message. (!) should be shown when empty.",
- false);
+ final Button b = new Button("Field should use error message. (!) should be shown when empty.", false);
w.addComponent(b);
b.setImmediate(true);
b.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- tf.setRequiredError(b.booleanValue() ? "Field must not be empty"
- : null);
+ tf.setRequiredError(b.booleanValue() ? "Field must not be empty" : null);
}
});
}
final Window w = new Window("Extra window: " + name);
w.setName(name);
addWindow(w);
- w.addComponent(new Label(
- "This window has been created on fly for name: " + name));
- w.addComponent(new Label("It has also been redirected to " + w.getURL()
- + " to support reloading"));
+ w.addComponent(new Label("This window has been created on fly for name: " + name));
+ w.addComponent(new Label("It has also been redirected to " + w.getURL() + " to support reloading"));
w.addComponent(new Button("button", new ClickListener() {
public void buttonClick(ClickEvent event) {
w.showNotification("Button clicked");
private Window createWindow() {
final Window w = new Window();
- w.addComponent(new Label(
- "Click this link: <a target=\"_blank\" href='"
- + getURL().toExternalForm()
- + "'>"
- + getURL().toExternalForm()
- + "</a> which opens new windows to this uri. They should end up having a separate Window and URL.",
- Label.CONTENT_XHTML));
+ w.addComponent(new Label("Click this link: <a target=\"_blank\" href='" + getURL().toExternalForm() + "'>" + getURL().toExternalForm() + "</a> which opens new windows to this uri. They should end up having a separate Window and URL.", Label.CONTENT_XHTML));
return w;
}
}
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
/**
}
private Layout testLayout() {
- final Layout layout = new OrderedLayout();
- final Label label = new Label(
- "Instructions to reproduce:\n"
- + " - Open this application in two browser windows\n"
- + " - Click the Button in first Window\n"
- + " - Go to the second Window\n"
- + " - Click the arrow in the Select\n"
- + " --> The opened list correctly shows the new value but the old one is shown in the \"input\" part");
+ final Layout layout = new VerticalLayout();
+ final Label label = new Label("Instructions to reproduce:\n" + " - Open this application in two browser windows\n" + " - Click the Button in first Window\n" + " - Go to the second Window\n" + " - Click the arrow in the Select\n" + " --> The opened list correctly shows the new value but the old one is shown in the \"input\" part");
label.setContentMode(Label.CONTENT_PREFORMATTED);
layout.addComponent(label);
select.addItem("2");
select.addItem("3");
- final ObjectProperty<String> valueProperty = new ObjectProperty<String>(
- "1", String.class);
+ final ObjectProperty<String> valueProperty = new ObjectProperty<String>("1", String.class);
select.setPropertyDataSource(valueProperty);
layout.addComponent(select);
MainWindow(String caption) {
super(caption);
- addComponent(new Label(
- "Inspect w/ Firebug: row 5 should have a MYROW -style on the row, and MYCELL on all cells"));
+ addComponent(new Label("Inspect w/ Firebug: row 5 should have a MYROW -style on the row, and MYCELL on all cells"));
Table table = new Table();
table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
table.addContainerProperty("String", String.class, "a string");
table.addContainerProperty("Boolean", Boolean.class, Boolean.TRUE);
table.addGeneratedColumn("Generated", new ColumnGenerator() {
- public Component generateCell(Table source, Object itemId,
- Object columnId) {
+ public Component generateCell(Table source, Object itemId, Object columnId) {
return new Label("Item " + itemId);
}
});
}
});
- Button b = new Button("editmode", new MethodProperty<Boolean>(
- table, "editable"));
+ Button b = new Button("editmode", new MethodProperty<Boolean>(table, "editable"));
b.setImmediate(true);
addComponent(b);
}
}
if (ok) {
- status.setValue(status.getValue() + " "
- + class1.getClass().getSimpleName() + ": OK");
+ status.setValue(status.getValue() + " " + class1.getClass().getSimpleName() + ": OK");
} else {
- status.setValue(status.getValue() + " "
- + class1.getClass().getSimpleName() + ": FAILED");
+ status.setValue(status.getValue() + " " + class1.getClass().getSimpleName() + ": FAILED");
}
}
try {
b.setWriteThrough(true);
b.setReadThrough(true);
- ObjectProperty<String> prop = new ObjectProperty<String>(
- "ABC 123");
+ ObjectProperty<String> prop = new ObjectProperty<String>("ABC 123");
/*
* This should throw an exception or somehow tell that the
* property was invalid (wrong type). See #2223.
}
if (ok) {
- status.setValue(status.getValue() + " "
- + class1.getClass().getSimpleName() + "/DB: OK");
+ status.setValue(status.getValue() + " " + class1.getClass().getSimpleName() + "/DB: OK");
} else {
- status.setValue(status.getValue() + " "
- + class1.getClass().getSimpleName() + "/DB: FAILED");
+ status.setValue(status.getValue() + " " + class1.getClass().getSimpleName() + "/DB: FAILED");
}
}
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2157 extends Application {
}
private void createUI(OrderedLayout layout) {
- OrderedLayout ol;
+ VerticalLayout ol;
Panel p;
ComboBox cb;
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox without width");
// p.setWidth("100px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox without width with caption");
// p.setWidth("100px");
layout.addComponent(p);
//
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 100px wide");
// p.setWidth("100px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 100px wide with caption");
// p.setWidth("100px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 500px wide");
// p.setWidth("500px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 500px wide with caption");
// p.setWidth("500px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 100% wide");
p.setWidth("200px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 100% wide with caption");
p.setWidth("200px");
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2178 extends Application {
}
private void createUI(OrderedLayout layout) {
- OrderedLayout ol;
+ VerticalLayout ol;
Panel p;
ComboBox cb;
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox without width");
// p.setWidth("100px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox without width with caption");
// p.setWidth("100px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 100px wide");
// p.setWidth("100px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 100px wide with caption");
// p.setWidth("100px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 500px wide");
// p.setWidth("500px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 500px wide with caption");
// p.setWidth("500px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 100% wide inside 200px panel");
p.setWidth("200px");
p.addComponent(cb);
layout.addComponent(p);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
p = new Panel(ol);
p.setCaption("Combobox 100% wide inside 200px panel with caption");
p.setWidth("200px");
f.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
- main.showNotification("Test field is "
- + (f.isValid() ? "valid" : "invalid"));
+ main.showNotification("Test field is " + (f.isValid() ? "valid" : "invalid"));
}
});
button.setWidth("100%");
Label label1 = new Label("Lorem ipsum");
Label label2 = new Label("Lorem");
- Label label3 = new Label(
- "Lorema jsdfhak sjdfh kajsdh fkajhd kfjah dkfjah ksfdjh kajsfh kj 1 2 3 4 5 6 7 8 9 10");
+ Label label3 = new Label("Lorema jsdfhak sjdfh kajsdh fkajhd kfjah dkfjah ksfdjh kajsfh kj 1 2 3 4 5 6 7 8 9 10");
label3.setWidth("800px");
tabSheet.addTab(label1, "Tab 1", null);
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Component;
import com.vaadin.ui.OptionGroup;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2181 extends Application implements Button.ClickListener {
@Override
public void init() {
setMainWindow(main);
- OrderedLayout ol;
- ol = new OrderedLayout();
+ VerticalLayout ol;
+ ol = new VerticalLayout();
ol.addComponent(tf1);
main.addComponent(ol);
- ol = new OrderedLayout();
+ ol = new VerticalLayout();
ol.setWidth("150px");
tf2.setWidth("150px");
ol.addComponent(tf2);
tf.setCaption(caption);
} else if (value.equals("Icon")) {
String timestamp = String.valueOf(new Date().getTime());
- tf.setIcon(new ThemeResource(icons.get(random.nextInt(icons
- .size())) + "?" + timestamp));
+ tf.setIcon(new ThemeResource(icons.get(random.nextInt(icons.size())) + "?" + timestamp));
} else if (value.equals("Required")) {
tf.setRequired(true);
} else if (value.equals("Error")) {
package com.vaadin.tests.tickets;
import com.vaadin.Application;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2186 extends Application {
Window main = new Window("Quick test");
setMainWindow(main);
- OrderedLayout base = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ HorizontalLayout base = new HorizontalLayout();
main.setLayout(base);
- OrderedLayout content = new OrderedLayout();
+ VerticalLayout content = new VerticalLayout();
content.addComponent(new Label("Content."));
content.setWidth("500px");
return null;
}
// if (c == OrderedLayout.class) {
- // cc = new OrderedLayout();
+ // cc = new VerticalLayout();
// } else
if (c == Accordion.class) {
// Label l = new Label("Filler");
return createField();
}
- public Field createField(Item item, Object propertyId,
- Component uiContext) {
+ public Field createField(Item item, Object propertyId, Component uiContext) {
return createField();
}
return formTextArea;
}
- public Field createField(Container container, Object itemId,
- Object propertyId, Component uiContext) {
+ public Field createField(Container container, Object itemId, Object propertyId, Component uiContext) {
return createField();
}
t.setHeight("150px");\r
t.addGeneratedColumn("col 3 (green)", new ColumnGenerator() {\r
\r
- public Component generateCell(Table source, Object itemId,\r
- Object columnId) {\r
+ public Component generateCell(Table source, Object itemId, Object columnId) {\r
Item item = source.getItem(itemId);\r
- String col1 = (String) item.getItemProperty("col 1 (red)")\r
- .getValue();\r
+ String col1 = (String) item.getItemProperty("col 1 (red)").getValue();\r
String col2 = (String) item.getItemProperty("col 2").getValue();\r
return new Label(col1 + "-" + col2);\r
}\r
}\r
});\r
\r
- t.addItem(new Object[] { "Col 1-1", "Col 2-1", "Col 4-1" },\r
- new Object());\r
- t.addItem(new Object[] { "Col 1-2", "Col 2-2", "Col 4-2" },\r
- new Object());\r
- t.addItem(new Object[] { "Col 1-3", "Col 2-3", "Col 4-3" },\r
- new Object());\r
+ t.addItem(new Object[] { "Col 1-1", "Col 2-1", "Col 4-1" }, new Object());\r
+ t.addItem(new Object[] { "Col 1-2", "Col 2-2", "Col 4-2" }, new Object());\r
+ t.addItem(new Object[] { "Col 1-3", "Col 2-3", "Col 4-3" }, new Object());\r
\r
t.setColumnReorderingAllowed(true);\r
t.setColumnCollapsingAllowed(true);\r
getMainWindow().addComponent(gl);\r
setTheme("tests-tickets");\r
combo = new ComboBox("Combo caption");\r
- labelLong = new Label(\r
- "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");\r
+ labelLong = new Label("A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");\r
gl.addComponent(combo);\r
gl.addComponent(labelLong);\r
\r
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.ComboBox;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2209OL extends Application {\r
\r
- private OrderedLayout gl;\r
+ private VerticalLayout gl;\r
private ComboBox combo;\r
private Label labelLong;\r
\r
public void init() {\r
setMainWindow(new Window());\r
getMainWindow().getLayout().setWidth("250px");\r
- gl = new OrderedLayout();\r
+ gl = new VerticalLayout();\r
gl.setStyleName("borders");\r
getMainWindow().addComponent(gl);\r
setTheme("tests-tickets");\r
combo = new ComboBox("Combo caption");\r
- labelLong = new Label(\r
- "This should stay on one line or to wrap to multiple lines? At leas it should display all the text?. "\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");\r
+ labelLong = new Label("This should stay on one line or to wrap to multiple lines? At leas it should display all the text?. " + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");\r
gl.addComponent(combo);\r
gl.addComponent(labelLong);\r
\r
import com.vaadin.ui.Button.ClickListener;\r
import com.vaadin.ui.ComboBox;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2209OL2 extends Application {\r
\r
- private OrderedLayout gl;\r
+ private VerticalLayout gl;\r
private ComboBox combo;\r
private Label labelLong;\r
\r
public void init() {\r
setMainWindow(new Window());\r
getMainWindow().getLayout().setWidth("250px");\r
- gl = new OrderedLayout();\r
+ gl = new VerticalLayout();\r
gl.setSizeUndefined();\r
gl.setStyleName("borders");\r
getMainWindow().addComponent(gl);\r
setTheme("tests-tickets");\r
combo = new ComboBox("Combo caption");\r
- labelLong = new Label(\r
- "This should stay on one line or to wrap to multiple lines? At leas it should display all the text?. "\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"\r
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");\r
+ labelLong = new Label("This should stay on one line or to wrap to multiple lines? At leas it should display all the text?. " + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?" + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");\r
gl.addComponent(combo);\r
gl.addComponent(labelLong);\r
\r
\r
import com.vaadin.Application;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2215 extends Application {\r
public void init() {\r
setMainWindow(new Window());\r
\r
- OrderedLayout ol = new OrderedLayout();\r
+ VerticalLayout ol = new VerticalLayout();\r
Panel p = new Panel("Test");\r
p.addComponent(new Label("Panel1"));\r
p.setHeight("500px");\r
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2221 extends Application {
public class Invoice extends CustomComponent {
- Layout main = new OrderedLayout();
+ Layout main = new VerticalLayout();
private TextField tf;
setCompositionRoot(main);
main.setSizeFull();
- Button b = new Button("Switch textfield/panel",
- new ClickListener() {
+ Button b = new Button("Switch textfield/panel", new ClickListener() {
- public void buttonClick(ClickEvent event) {
- Component visible = tf;
+ public void buttonClick(ClickEvent event) {
+ Component visible = tf;
- if (tf.isVisible()) {
- visible = outerPanel;
- }
+ if (tf.isVisible()) {
+ visible = outerPanel;
+ }
- outerPanel.setVisible(false);
- tf.setVisible(false);
+ outerPanel.setVisible(false);
+ tf.setVisible(false);
- visible.setVisible(true);
- }
+ visible.setVisible(true);
+ }
- });
+ });
main.addComponent(b);
tf = new TextField("TextField");
import com.vaadin.Application;
import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2222 extends Application {
}
private void createUI(OrderedLayout layout) {
- OrderedLayout horiz = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
+ HorizontalLayout horiz = new HorizontalLayout();
horiz.setSpacing(true);
horiz.setMargin(true);
horiz.setStyleName("ticket2222");
horiz.addComponent(new Label("Margin-bottom: 30px;"));
horiz.addStyleName("borders");
- OrderedLayout vert = new OrderedLayout(
- OrderedLayout.ORIENTATION_VERTICAL);
+ VerticalLayout vert = new VerticalLayout();
vert.setSizeUndefined();
vert.setSpacing(true);
vert.setMargin(false);
import com.vaadin.ui.Label;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
public class Ticket2227OrderedlayoutInTable extends Application {
Item i = t.addItem(1);
i.getItemProperty("pno").setValue("1");
i.getItemProperty("testi").setValue("12.12.08");
- OrderedLayout ol = new OrderedLayout();
+ VerticalLayout ol = new VerticalLayout();
ol.setWidth("100%");
ol.setHeight(null);
ol.addComponent(new Label("monirivi testi"));
import com.vaadin.ui.Label;\r
import com.vaadin.ui.Layout;\r
import com.vaadin.ui.Layout.SpacingHandler;\r
-import com.vaadin.ui.OrderedLayout;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2232 extends Application {\r
setMainWindow(new Window());\r
setTheme("tests-tickets");\r
\r
- getMainWindow()\r
- .addComponent(\r
- new Label(\r
- "Defining spacing must be possible also with pure CSS"));\r
+ getMainWindow().addComponent(new Label("Defining spacing must be possible also with pure CSS"));\r
\r
Layout gl;\r
- gl = new OrderedLayout();\r
+ gl = new VerticalLayout();\r
gl.setWidth("100%");\r
gl.setHeight("200px");\r
gl.setStyleName("t2232");\r
gl.setStyleName("t2232");\r
fillAndAdd(gl);\r
\r
- gl = new OrderedLayout();\r
+ gl = new VerticalLayout();\r
gl.setWidth("100%");\r
gl.setHeight("200px");\r
((SpacingHandler) gl).setSpacing(true);\r
((SpacingHandler) gl).setSpacing(true);\r
fillAndAdd(gl);\r
\r
- gl = new OrderedLayout();\r
+ gl = new VerticalLayout();\r
gl.setWidth("100%");\r
gl.setHeight("200px");\r
fillAndAdd(gl);\r
gl.addComponent(b);\r
}\r
String caption = gl.getClass().getSimpleName();\r
- caption += " style: " + gl.getStyleName() + ", spacingFromServer:"\r
- + ((SpacingHandler) gl).isSpacingEnabled();\r
+ caption += " style: " + gl.getStyleName() + ", spacingFromServer:" + ((SpacingHandler) gl).isSpacingEnabled();\r
gl.setCaption(caption);\r
getMainWindow().addComponent(gl);\r
}\r
public class Ticket2240 extends Application {
- public static final String txt = "<p>There are two main types of windows: application-level windows, and "
- + "\"sub windows\".</p><p>A sub window is rendered as a \"inline\" popup window"
- + " within the (native) browser window to which it was added. You can create"
- + " a sub window by creating a new Window and adding it to a application-level window, for instance"
- + " your main window. </p><p> In contrast, you create a application-level window by"
- + " creating a new Window and adding it to the Application. Application-level"
- + " windows are not shown by default - you need to open a browser window for"
- + " the url representing the window. You can think of the application-level"
- + " windows as separate views into your application - and a way to create a"
- + " \"native\" browser window.</p><p>Depending on your needs, it's also"
- + " possible to create a new window instance (with it's own internal state)"
- + " for each new (native) browser window, or you can share the same instance"
- + " (and state) between several browser windows (the latter is most useful"
- + " for read-only views).</p><br/><p>This is the end.</p>";
+ public static final String txt = "<p>There are two main types of windows: application-level windows, and " + "\"sub windows\".</p><p>A sub window is rendered as a \"inline\" popup window" + " within the (native) browser window to which it was added. You can create" + " a sub window by creating a new Window and adding it to a application-level window, for instance" + " your main window. </p><p> In contrast, you create a application-level window by" + " creating a new Window and adding it to the Application. Application-level" + " windows are not shown by default - you need to open a browser window for" + " the url representing the window. You can think of the application-level" + " windows as separate views into your application - and a way to create a" + " \"native\" browser window.</p><p>Depending on your needs, it's also" + " possible to create a new window instance (with it's own internal state)" + " for each new (native) browser window, or you can share the same instance" + " (and state) between several browser windows (the latter is most useful" + " for read-only views).</p><br/><p>This is the end.</p>";
@Override
public void init() {
}
private void createUI(OrderedLayout layout) {
- Button b = new Button("Change container datasource",
- new ClickListener() {
+ Button b = new Button("Change container datasource", new ClickListener() {
- public void buttonClick(ClickEvent event) {
- for (int i = 0; i < 5; i++) {
- t.setContainerDataSource(createContainer());
- // prop.setValue("ipsum");
- }
- }
+ public void buttonClick(ClickEvent event) {
+ for (int i = 0; i < 5; i++) {
+ t.setContainerDataSource(createContainer());
+ // prop.setValue("ipsum");
+ }
+ }
- });
+ });
layout.addComponent(b);
IndexedContainer ic = new IndexedContainer();
ic.addContainerProperty("a", String.class, null);
- for (String s : new String[] { "Lorem", "ipsum", "dolor", "sit",
- "amet", "consectetuer" }) {
+ for (String s : new String[] { "Lorem", "ipsum", "dolor", "sit", "amet", "consectetuer" }) {
Item item = ic.addItem(s);
item.getItemProperty("a").setValue(s);
}
public void valueChange(ValueChangeEvent event) {
- System.out.println("Value change from " + tableValue + " to "
- + t.getValue());
+ System.out.println("Value change from " + tableValue + " to " + t.getValue());
tableValue = t.getValue();
}
}
}));
- w.addComponent(new Button("new bigger item",
- new Button.ClickListener() {
+ w.addComponent(new Button("new bigger item", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- form.setItemDataSource(new BeanItem<MyBean>(
- new MyBiggerBean()));
+ public void buttonClick(ClickEvent event) {
+ form.setItemDataSource(new BeanItem<MyBean>(new MyBiggerBean()));
- }
+ }
- }));
- w.addComponent(new Button("new grid layout",
- new Button.ClickListener() {
+ }));
+ w.addComponent(new Button("new grid layout", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- form.setLayout(new GridLayout());
+ public void buttonClick(ClickEvent event) {
+ form.setLayout(new GridLayout());
- }
+ }
- }));
- w.addComponent(new Button("new form layout",
- new Button.ClickListener() {
+ }));
+ w.addComponent(new Button("new form layout", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- form.setLayout(new FormLayout());
+ public void buttonClick(ClickEvent event) {
+ form.setLayout(new FormLayout());
- }
+ }
- }));
+ }));
}
vl.setWidth("500px");
vl.setHeight("500px");
vl.setStyleName("borders");
- label = new Label("<b>Error messages follows:</b><br/>",
- Label.CONTENT_XHTML);
+ label = new Label("<b>Error messages follows:</b><br/>", Label.CONTENT_XHTML);
vl.addComponent(label);
layout.addComponent(vl);
gl.setWidth("500px");
gl.setHeight("500px");
gl.setStyleName("borders");
- label = new Label("<b>Error messages follows:</b><br/>",
- Label.CONTENT_XHTML);
+ label = new Label("<b>Error messages follows:</b><br/>", Label.CONTENT_XHTML);
gl.addComponent(label);
layout.addComponent(gl);
for (String horiz : horizontals) {
// Test "l","r","left","right" etc
int expectedHoriz = expected.get(horiz);
- checkAlignment(layout, horiz, AlignmentHandler.ALIGNMENT_TOP
- | expectedHoriz);
+ checkAlignment(layout, horiz, AlignmentHandler.ALIGNMENT_TOP | expectedHoriz);
for (String vert : shortVerticalAlignments) {
int expectedVert = expected.get(vert);
// Test "lt","rt" etc
if (horiz.length() == 1) {
- checkAlignment(layout, horiz + vert, expectedHoriz
- | expectedVert);
- checkAlignment(layout, vert + horiz, expectedHoriz
- | expectedVert);
+ checkAlignment(layout, horiz + vert, expectedHoriz | expectedVert);
+ checkAlignment(layout, vert + horiz, expectedHoriz | expectedVert);
} else {
boolean ok = false;
try {
- checkAlignment(layout, horiz + vert, expectedHoriz
- | expectedVert);
+ checkAlignment(layout, horiz + vert, expectedHoriz | expectedVert);
} catch (IllegalArgumentException e) {
// OK, "centert","rightb" etc are not valid
ok = true;
}
if (!ok) {
- error("IllegalArgumentException was not thrown for "
- + horiz + vert);
+ error("IllegalArgumentException was not thrown for " + horiz + vert);
}
ok = false;
try {
- checkAlignment(layout, vert + horiz, expectedHoriz
- | expectedVert);
+ checkAlignment(layout, vert + horiz, expectedHoriz | expectedVert);
} catch (IllegalArgumentException e) {
// OK, "centert","rightb" etc are not valid
ok = true;
}
if (!ok) {
- error("IllegalArgumentException was not thrown for "
- + horiz + vert);
+ error("IllegalArgumentException was not thrown for " + horiz + vert);
}
}
// Test "l t","r t" etc
- checkAlignment(layout, horiz + " " + vert, expectedHoriz
- | expectedVert);
- checkAlignment(layout, vert + " " + horiz, expectedHoriz
- | expectedVert);
+ checkAlignment(layout, horiz + " " + vert, expectedHoriz | expectedVert);
+ checkAlignment(layout, vert + " " + horiz, expectedHoriz | expectedVert);
}
for (String vert : longVerticalAlignments) {
int expectedVert = expected.get(vert);
// Test "right t","right b" etc
- checkAlignment(layout, horiz + " " + vert, expectedHoriz
- | expectedVert);
- checkAlignment(layout, vert + " " + horiz, expectedHoriz
- | expectedVert);
+ checkAlignment(layout, horiz + " " + vert, expectedHoriz | expectedVert);
+ checkAlignment(layout, vert + " " + horiz, expectedHoriz | expectedVert);
// Three alignments should throw an exception
boolean ok = false;
try {
- checkAlignment(layout, horiz + " " + vert + " " + horiz,
- expectedHoriz | expectedVert);
+ checkAlignment(layout, horiz + " " + vert + " " + horiz, expectedHoriz | expectedVert);
} catch (IllegalArgumentException e) {
// OK, "centert","rightb" etc are not valid
ok = true;
}
if (!ok) {
- error("IllegalArgumentException was not thrown for "
- + horiz + " " + vert + " " + horiz);
+ error("IllegalArgumentException was not thrown for " + horiz + " " + vert + " " + horiz);
}
}
}
- checkAlignment(layout, "left right", AlignmentHandler.ALIGNMENT_TOP
- | AlignmentHandler.ALIGNMENT_RIGHT);
+ checkAlignment(layout, "left right", AlignmentHandler.ALIGNMENT_TOP | AlignmentHandler.ALIGNMENT_RIGHT);
}
- private void checkAlignment(AlignmentHandler layout,
- String alignmentString, int expected) {
- layout.setComponentAlignment(label, AlignmentInfo.Bits.ALIGNMENT_TOP,
- AlignmentInfo.Bits.ALIGNMENT_LEFT);
+ private void checkAlignment(AlignmentHandler layout, String alignmentString, int expected) {
+ layout.setComponentAlignment(label, AlignmentInfo.Bits.ALIGNMENT_TOP, AlignmentInfo.Bits.ALIGNMENT_LEFT);
if (layout instanceof AbstractOrderedLayout) {
- ((AbstractOrderedLayout) layout).setComponentAlignment(label,
- alignmentString);
+ ((AbstractOrderedLayout) layout).setComponentAlignment(label, alignmentString);
} else {
((GridLayout) layout).setComponentAlignment(label, alignmentString);
}
int actual = layout.getComponentAlignment(label).getBitMask();
if (actual != expected) {
- String error = "Error " + alignmentString
- + " did not produce expected results";
+ String error = "Error " + alignmentString + " did not produce expected results";
error(error);
} else {
- String str = layout.getClass().getSimpleName() + "/"
- + alignmentString + ": OK";
+ String str = layout.getClass().getSimpleName() + "/" + alignmentString + ": OK";
System.out.println(str);
}
layout1 = new FormLayout();
layout1.setSizeUndefined();
layout1.setStyleName("borders");
- Label label = new Label(
- "This should not be wider than this label + reserved error space");
+ Label label = new Label("This should not be wider than this label + reserved error space");
label.setCaption("A caption");
layout1.addComponent(label);
w.addComponent(layout1);
GridLayout gl = new GridLayout(2, 2);
gl.setSizeUndefined();
- gl.addComponent(new Label(
- "Label 1 abc abc abcasdfas dfasd fasdf asdf sadf asdf"));
+ gl.addComponent(new Label("Label 1 abc abc abcasdfas dfasd fasdf asdf sadf asdf"));
gl.addComponent(new Label("Label 2 abc abc abc "));
Label l = new Label("Colspan2, align right");
gl.addComponent(l, 0, 1, 1, 1);
- gl.setComponentAlignment(l, AlignmentHandler.ALIGNMENT_RIGHT,
- AlignmentHandler.ALIGNMENT_TOP);
+ gl.setComponentAlignment(l, AlignmentHandler.ALIGNMENT_RIGHT, AlignmentHandler.ALIGNMENT_TOP);
w.setLayout(gl);
}
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
URL url = getURL();\r
- main.addComponent(new Label(\r
- "Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)."));\r
+ main.addComponent(new Label("Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)."));\r
\r
Label l = new Label();\r
l.setContentMode(Label.CONTENT_XHTML);\r
- l.setValue("This is a label with as slow image. <img src=\"" + url\r
- + "/icon.png\" />");\r
+ l.setValue("This is a label with as slow image. <img src=\"" + url + "/icon.png\" />");\r
main.addComponent(l);\r
\r
l = new Label();\r
l.setContentMode(Label.CONTENT_XHTML);\r
- l.setValue("This is a label with as slow image. <img src=\"" + url\r
- + "/icon.png\" />");\r
+ l.setValue("This is a label with as slow image. <img src=\"" + url + "/icon.png\" />");\r
main.addComponent(l);\r
\r
}\r
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
\r
ExternalResource icon = new ExternalResource("./icon.png");\r
- main.addComponent(new Label(\r
- "Note, run with trailing slash in url to have a working icon. Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)"));\r
+ main.addComponent(new Label("Note, run with trailing slash in url to have a working icon. Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)"));\r
Button b = new Button();\r
main.addComponent(b);\r
b.setIcon(icon);\r
e1.printStackTrace();\r
}\r
\r
- BufferedImage image = new BufferedImage(200, 200,\r
- BufferedImage.TYPE_INT_RGB);\r
+ BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);\r
Graphics drawable = image.getGraphics();\r
drawable.setColor(Color.lightGray);\r
drawable.fillRect(0, 0, 200, 200);\r
ImageIO.write(image, "png", imagebuffer);\r
\r
// Return a stream from the buffer.\r
- ByteArrayInputStream istream = new ByteArrayInputStream(\r
- imagebuffer.toByteArray());\r
+ ByteArrayInputStream istream = new ByteArrayInputStream(imagebuffer.toByteArray());\r
return new DownloadStream(istream, null, null);\r
} catch (IOException e) {\r
return null;\r
layout.addComponent(label1);
try {
- layout.setComponentAlignment(label1,
- AlignmentHandler.ALIGNMENT_LEFT,
- AlignmentHandler.ALIGNMENT_BOTTOM);
+ layout.setComponentAlignment(label1, AlignmentHandler.ALIGNMENT_LEFT, AlignmentHandler.ALIGNMENT_BOTTOM);
result1 = "OK";
} catch (Exception e) {
result1 = "FAILED: " + e.getMessage();
}
try {
- layout.setComponentAlignment(label2,
- AlignmentHandler.ALIGNMENT_LEFT,
- AlignmentHandler.ALIGNMENT_BOTTOM);
+ layout.setComponentAlignment(label2, AlignmentHandler.ALIGNMENT_LEFT, AlignmentHandler.ALIGNMENT_BOTTOM);
result2 = "FAILED, no exception";
} catch (IllegalArgumentException e) {
result2 = "OK";
}
try {
- layout.setComponentAlignment(label3,
- AlignmentHandler.ALIGNMENT_LEFT,
- AlignmentHandler.ALIGNMENT_BOTTOM);
+ layout.setComponentAlignment(label3, AlignmentHandler.ALIGNMENT_LEFT, AlignmentHandler.ALIGNMENT_BOTTOM);
result3 = "FAILED, no exception";
} catch (IllegalArgumentException e) {
result3 = "OK";
result3 = "FAILED: " + e.getMessage();
}
- label1.setValue("Result 1: " + result1 + ", result 2: " + result2
- + ", result 3: " + result3);
+ label1.setValue("Result 1: " + result1 + ", result 2: " + result2 + ", result 3: " + result3);
}
}
\r
@Override\r
public void init() {\r
- final Window main = new Window(getClass().getName().substring(\r
- getClass().getName().lastIndexOf(".") + 1));\r
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));\r
setMainWindow(main);\r
URL url = getURL();\r
- main.addComponent(new Label(\r
- "Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)."));\r
+ main.addComponent(new Label("Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)."));\r
\r
try {\r
- CustomLayout cl = new CustomLayout(\r
- new ByteArrayInputStream(\r
- ("This is an empty CustomLayout with as slow image. <img src=\""\r
- + url.toString() + "/icon.png\" />")\r
- .getBytes()));\r
+ CustomLayout cl = new CustomLayout(new ByteArrayInputStream(("This is an empty CustomLayout with as slow image. <img src=\"" + url.toString() + "/icon.png\" />").getBytes()));\r
main.addComponent(cl);\r
\r
- cl = new CustomLayout(\r
- new ByteArrayInputStream(\r
- ("This is an empty CustomLayout with as slow image. <img src=\""\r
- + url.toString() + "/icon.png\" />")\r
- .getBytes()));\r
+ cl = new CustomLayout(new ByteArrayInputStream(("This is an empty CustomLayout with as slow image. <img src=\"" + url.toString() + "/icon.png\" />").getBytes()));\r
main.addComponent(cl);\r
} catch (IOException e) {\r
// TODO Auto-generated catch block\r
import com.vaadin.Application;\r
import com.vaadin.ui.CustomLayout;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
+import com.vaadin.ui.VerticalLayout;\r
import com.vaadin.ui.Window;\r
\r
public class Ticket2303 extends Application {\r
String customlayout = "<div location=\"test\"></div>";\r
CustomLayout cl = null;\r
try {\r
- cl = new CustomLayout(new ByteArrayInputStream(\r
- customlayout.getBytes()));\r
+ cl = new CustomLayout(new ByteArrayInputStream(customlayout.getBytes()));\r
} catch (IOException e) {\r
// TODO Auto-generated catch block\r
e.printStackTrace();\r
\r
// VerticalLayout ol = new VerticalLayout();\r
// w.setLayout(ol);\r
- OrderedLayout hugeLayout = new OrderedLayout();\r
+ VerticalLayout hugeLayout = new VerticalLayout();\r
hugeLayout.setMargin(true);\r
hugeLayout.setSpacing(true);\r
for (int i = 0; i < 30; i++) {\r
@Override
public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));
setMainWindow(main);
Panel p = new Panel();
main.addComponent(p);
p.setHeight("100px");
- Label l = new Label(
- "a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n");
+ Label l = new Label("a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n");
l.setContentMode(Label.CONTENT_PREFORMATTED);
p.addComponent(l);
- main.addComponent(new Label(
- "This text should be right below the panel, w/o spacing"));
+ main.addComponent(new Label("This text should be right below the panel, w/o spacing"));
}
}
@Override
public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
+ final Window main = new Window(getClass().getName().substring(getClass().getName().lastIndexOf(".") + 1));
setMainWindow(main);
- main.addComponent(new Label("Instructions: change label when panel is "
- + "invisible -> invalid change (with disabled "
- + "flag) is sent to client. Label is grey when panel is shown."));
+ main.addComponent(new Label("Instructions: change label when panel is " + "invisible -> invalid change (with disabled " + "flag) is sent to client. Label is grey when panel is shown."));
final Panel p = new Panel();
p.setStyleName(Panel.STYLE_LIGHT);
Window mainw = new Window();
setMainWindow(mainw);
- mainw.addComponent(new Label(
- "This test has somewhat invalid layouts in it to detect analyzy layout function in debug dialog"));
+ mainw.addComponent(new Label("This test has somewhat invalid layouts in it to detect analyzy layout function in debug dialog"));
HorizontalLayout hl = new HorizontalLayout();
Panel panel = new Panel("p1");
lo.setSizeUndefined();
lo.setWidth("100%");
TextField tf = new TextField();
- tf.setValue("The textfield should fill the window."
- + "\n - Try to resize window\n - Try to push REdo button");
+ tf.setValue("The textfield should fill the window." + "\n - Try to resize window\n - Try to push REdo button");
tf.setRows(10);
tf.setWidth("100%");
lo.addComponent(tf);
- Window subWin = new Window(
- "This window should initially be as wide as the caption", lo);
+ Window subWin = new Window("This window should initially be as wide as the caption", lo);
main.addWindow(subWin);
// subWin.setWidth("500px");
}
}
class TestColumnGenerator implements ColumnGenerator {
- public Component generateCell(Table source, Object rowId,
- Object columnId) {
+ public Component generateCell(Table source, Object rowId, Object columnId) {
return new Button("1");
}
}
Button b = new Button("add", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- gl.addComponent(new Label("asd"), 0, gl.getCursorY(), 2,
- gl.getCursorY());
+ gl.addComponent(new Label("asd"), 0, gl.getCursorY(), 2, gl.getCursorY());
}
setMainWindow(mainWin);
try {
- CustomLayout cl = new CustomLayout(
- new ByteArrayInputStream(
- "<div style=\"width:400px;overflow:hidden;background-color:red;\"><div style=\"border:1em solid blue; height:4em; padding:1em 1.5em;\" location=\"b\"></div></div>"
- .getBytes()));
+ CustomLayout cl = new CustomLayout(new ByteArrayInputStream("<div style=\"width:400px;overflow:hidden;background-color:red;\"><div style=\"border:1em solid blue; height:4em; padding:1em 1.5em;\" location=\"b\"></div></div>".getBytes()));
Button button = new Button("b");
button.setSizeFull();
t.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
- mainWin.addComponent(new Label(
- "Both rows in table should have same data (default values)"));
+ mainWin.addComponent(new Label("Both rows in table should have same data (default values)"));
mainWin.addComponent(t);
// Let's attach that one straight away too
root.addComponent(top);
- label = new Label(
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent porttitor porta lacus. Nulla tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin mollis turpis in mauris faucibus posuere. Nullam rutrum, nisi a fermentum tempus, lacus metus rutrum massa, a condimentum mauris justo a tortor. Mauris aliquet, ante quis ultricies posuere, sapien libero laoreet sem, a accumsan diam metus sed elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur vehicula metus nec turpis dignissim cursus. Suspendisse potenti. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nullam feugiat orci eget risus. Vestibulum at sem. ");
+ label = new Label("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent porttitor porta lacus. Nulla tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin mollis turpis in mauris faucibus posuere. Nullam rutrum, nisi a fermentum tempus, lacus metus rutrum massa, a condimentum mauris justo a tortor. Mauris aliquet, ante quis ultricies posuere, sapien libero laoreet sem, a accumsan diam metus sed elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur vehicula metus nec turpis dignissim cursus. Suspendisse potenti. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nullam feugiat orci eget risus. Vestibulum at sem. ");
label.setWidth("100%");
top.addComponent(label);
split = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
split.setHeight("100%");
- Embedded image = new Embedded("An image", new ExternalResource(
- "http://dev.itmill.com/chrome/site/toolkit-logo.png"));
+ Embedded image = new Embedded("An image", new ExternalResource("http://dev.itmill.com/chrome/site/toolkit-logo.png"));
image.setWidth("100%");
root.addComponent(split);
((VerticalLayout) root.getLayout()).setExpandRatio(split, 1.0f);
l.setHeight("504px");\r
\r
for (int i = 1; i <= 5; i++) {\r
- Button b = new Button("Button " + i\r
- + " should be 100px or 101px high");\r
+ Button b = new Button("Button " + i + " should be 100px or 101px high");\r
b.setHeight("100%");\r
l.addComponent(b);\r
}\r
final String content = "<select/>";
- w.addComponent(new Label("CONTENT_DEFAULT: " + content,
- Label.CONTENT_DEFAULT));
- w.addComponent(new Label("CONTENT_PREFORMATTED: " + content,
- Label.CONTENT_PREFORMATTED));
+ w.addComponent(new Label("CONTENT_DEFAULT: " + content, Label.CONTENT_DEFAULT));
+ w.addComponent(new Label("CONTENT_PREFORMATTED: " + content, Label.CONTENT_PREFORMATTED));
w.addComponent(new Label("CONTENT_RAW: " + content, Label.CONTENT_RAW));
w.addComponent(new Label("CONTENT_TEXT: " + content, Label.CONTENT_TEXT));
w.addComponent(new Label("CONTENT_XML: " + content, Label.CONTENT_XML));
- w.addComponent(new Label("CONTENT_XHTML: " + content,
- Label.CONTENT_XHTML));
+ w.addComponent(new Label("CONTENT_XHTML: " + content, Label.CONTENT_XHTML));
}
Window w = new Window();
setMainWindow(w);
- Label help = new Label(
- "Use CTRL X to fire action, CTRL C to remove it (fails before fix)");
+ Label help = new Label("Use CTRL X to fire action, CTRL C to remove it (fails before fix)");
w.addComponent(help);
w.addActionHandler(new Handler() {
- final ShortcutAction a1 = new ShortcutAction("action", KeyCode.X,
- new int[] { ModifierKey.CTRL });
- final ShortcutAction a2 = new ShortcutAction("action", KeyCode.C,
- new int[] { ModifierKey.CTRL });
+ final ShortcutAction a1 = new ShortcutAction("action", KeyCode.X, new int[] { ModifierKey.CTRL });
+ final ShortcutAction a2 = new ShortcutAction("action", KeyCode.C, new int[] { ModifierKey.CTRL });
Action[] actions = new Action[] { a1, a2 };
}
- private static Alignment[] alignments = new Alignment[] {
- Alignment.TOP_LEFT, Alignment.TOP_CENTER, Alignment.TOP_RIGHT,
- Alignment.MIDDLE_LEFT, Alignment.MIDDLE_CENTER,
- Alignment.MIDDLE_RIGHT, Alignment.BOTTOM_LEFT,
- Alignment.BOTTOM_CENTER, Alignment.BOTTOM_RIGHT };
+ private static Alignment[] alignments = new Alignment[] { Alignment.TOP_LEFT, Alignment.TOP_CENTER, Alignment.TOP_RIGHT, Alignment.MIDDLE_LEFT, Alignment.MIDDLE_CENTER, Alignment.MIDDLE_RIGHT, Alignment.BOTTOM_LEFT, Alignment.BOTTOM_CENTER, Alignment.BOTTOM_RIGHT };
private void populateLayout(Layout layout) {
layout.setSizeFull();
for (int i = 0; i < 9; i++) {
Label l = new Label("M");
Alignment a = alignments[i];
- l.setCaption(a.getHorizontalAlignment() + " "
- + a.getVerticalAlignment() + " " + a.getBitMask());
+ l.setCaption(a.getHorizontalAlignment() + " " + a.getVerticalAlignment() + " " + a.getBitMask());
layout.addComponent(l);
((AlignmentHandler) layout).setComponentAlignment(l, a);
}
setMainWindow(w);
- Table t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3,
- 50);
+ Table t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 50);
t.setPageLength(0);
public void init() {
final Window main = new MainWindow();
setMainWindow(main);
- main.addComponent(new Label(
- "Clicking the link should open a new window that should receive the URI 'msg/hello' and add that a a Label to it's ui. Currently the Label ends up in this (main) window (try reloading). Console intentionally spams during the window finding/uri handling - looks, uhm, interesting."));
+ main.addComponent(new Label("Clicking the link should open a new window that should receive the URI 'msg/hello' and add that a a Label to it's ui. Currently the Label ends up in this (main) window (try reloading). Console intentionally spams during the window finding/uri handling - looks, uhm, interesting."));
}
@Override
public Window getWindow(String name) {
System.err.println("Looking for " + name);
if ("msg".equals(name)) {
- System.err
- .println(" rest uri, returning new MainWindow with message from uri");
+ System.err.println(" rest uri, returning new MainWindow with message from uri");
MainWindow restWindow = new MainWindow();
addWindow(restWindow);
return restWindow;
public MainWindow() {
super("Main window");
- addComponent(new Link("new mainwin", new ExternalResource(
- Ticket2440.this.getURL() + "msg/hello"), "_blank", -1, -1,
- Window.BORDER_DEFAULT));
+ addComponent(new Link("new mainwin", new ExternalResource(Ticket2440.this.getURL() + "msg/hello"), "_blank", -1, -1, Window.BORDER_DEFAULT));
addURIHandler(new URIHandler() {
public DownloadStream handleURI(URL context, String relativeUri) {
- System.err
- .println((getMainWindow() == getWindow() ? "mainwin: "
- : "subwin: ")
- + context + ", " + relativeUri);
+ System.err.println((getMainWindow() == getWindow() ? "mainwin: " : "subwin: ") + context + ", " + relativeUri);
addComponent(new Label(relativeUri));
return null;
}
}\r
\r
@Override\r
- public Field createField(Container container, Object itemId,\r
- Object propertyId, Component uiContext) {\r
+ public Field createField(Container container, Object itemId, Object propertyId, Component uiContext) {\r
\r
/*\r
* trainingType is manyToOne relation, give it a combobox\r
return getSecondaryTypesList(itemId);\r
}\r
\r
- final Field f = super.createField(container, itemId, propertyId,\r
- uiContext);\r
+ final Field f = super.createField(container, itemId, propertyId, uiContext);\r
if (f != null) {\r
if (f instanceof TextField) {\r
TextField tf = (TextField) f;\r
float f = Float.parseFloat((String) value);\r
return true;\r
} catch (Exception e) {\r
- f.getWindow().showNotification(\r
- "Bad number value");\r
+ f.getWindow().showNotification("Bad number value");\r
f.setValue(0);\r
return false;\r
}\r
}\r
\r
- public void validate(Object value)\r
- throws InvalidValueException {\r
+ public void validate(Object value) throws InvalidValueException {\r
// TODO Auto-generated method stub\r
\r
}\r
c.set(Calendar.SECOND, 0);\r
c.set(Calendar.MINUTE, 0);\r
\r
- String[] titles = new String[] { "A short easy one", "intervals",\r
- "very long", "just shaking legs after work",\r
- "long one with Paul", "test run" };\r
+ String[] titles = new String[] { "A short easy one", "intervals", "very long", "just shaking legs after work", "long one with Paul", "test run" };\r
\r
c.add(Calendar.DATE, -1000);\r
\r
\r
for (int i = 0; i < 1000; i++) {\r
r = new Workout();\r
- c.set(Calendar.HOUR_OF_DAY,\r
- 12 + (rnd.nextInt(11) - rnd.nextInt(11)));\r
+ c.set(Calendar.HOUR_OF_DAY, 12 + (rnd.nextInt(11) - rnd.nextInt(11)));\r
r.setDate(c.getTime());\r
r.setTitle(titles[rnd.nextInt(titles.length)]);\r
r.setKilometers(Math.round(rnd.nextFloat() * 30));\r
table.setWidth("200px");\r
mainWindow.addComponent(table);\r
\r
- Button clearButton = new Button("Clear selection",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- clearSelection();\r
- }\r
- });\r
+ Button clearButton = new Button("Clear selection", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ clearSelection();\r
+ }\r
+ });\r
mainWindow.addComponent(clearButton);\r
- Button clearButton2 = new Button("Clear selection 2",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- clearSelection2();\r
- }\r
- });\r
+ Button clearButton2 = new Button("Clear selection 2", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ clearSelection2();\r
+ }\r
+ });\r
mainWindow.addComponent(clearButton2);\r
- Button clearButton3 = new Button("Clear selection 3",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- clearSelection3();\r
- }\r
- });\r
+ Button clearButton3 = new Button("Clear selection 3", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ clearSelection3();\r
+ }\r
+ });\r
mainWindow.addComponent(clearButton3);\r
- Button printButton = new Button("Print selection",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- printSelection();\r
- }\r
- });\r
+ Button printButton = new Button("Print selection", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ printSelection();\r
+ }\r
+ });\r
mainWindow.addComponent(printButton);\r
\r
result = new TextField();\r
reader.addListener(new UriFragmentUtility.FragmentChangedListener() {
public void fragmentChanged(FragmentChangedEvent event) {
- getMainWindow().showNotification(
- "Fragment now: "
- + event.getUriFragmentUtility().getFragment());
+ getMainWindow().showNotification("Fragment now: " + event.getUriFragmentUtility().getFragment());
// try to change to view mapped by fragment string
setView(event.getUriFragmentUtility().getFragment());
}
mainLayout = new VerticalLayout();
mainLayout.setSizeFull();
- final Window mainWin = new Window(
- "Test app for URI fragment management/reading", mainLayout);
+ final Window mainWin = new Window("Test app for URI fragment management/reading", mainLayout);
setMainWindow(mainWin);
// UriFragmentReader is 0px size by default, so it will not render
private void setView(String string) {
Component component = views.get(string);
if (component == null) {
- getMainWindow().showNotification(
- "View called " + string + " not found!");
+ getMainWindow().showNotification("View called " + string + " not found!");
} else if (component != currentView) {
if (currentView != null) {
mainLayout.replaceComponent(currentView, component);
Panel p = new Panel(string);
p.setSizeFull();
((VerticalLayout) p.getLayout()).setSpacing(true);
- p.addComponent(new Label("This is a simple test case for "
- + "UriFragmentReader that can be used for"
- + " adding linking, back/forward button "
- + "and history support for ajax application. "));
+ p.addComponent(new Label("This is a simple test case for " + "UriFragmentReader that can be used for" + " adding linking, back/forward button " + "and history support for ajax application. "));
StringBuffer sb = new StringBuffer();
sb.append("Available views : ");
for (String key : strings) {
sb.append(key);
sb.append(" ");
}
- sb.append("Application will change to them from uri "
- + "fragment or server initiated via textfield below.");
+ sb.append("Application will change to them from uri " + "fragment or server initiated via textfield below.");
p.addComponent(new Label(sb.toString()));
- final TextField tf = new TextField(
- "Type view name (will change to that "
- + "view and change the uri fragment)");
+ final TextField tf = new TextField("Type view name (will change to that " + "view and change the uri fragment)");
p.addComponent(tf);
Button b = new Button("Go!");
p.addComponent(b);
import com.vaadin.ui.Field;\r
import com.vaadin.ui.Form;\r
import com.vaadin.ui.GridLayout;\r
+import com.vaadin.ui.HorizontalLayout;\r
import com.vaadin.ui.Label;\r
-import com.vaadin.ui.OrderedLayout;\r
import com.vaadin.ui.Panel;\r
import com.vaadin.ui.Table;\r
import com.vaadin.ui.TextField;\r
\r
public class Ticket677 extends Application {\r
\r
- private static final Label info = new Label(\r
- "<li> keep debug window open to see variable changes"\r
- + "<li> disable root panel w/ toggle button"\r
- + "<li> toggle one of the subpanels"\r
- + "<li> we attempt to focus the subpanels first textfield"\r
- + "<li> focusing should fail (try tabbing as well) [worked previousy]"\r
- + "<li> no variable changes should be sent from disabled fields [changed sent previously]"\r
- + "<li> try further toggling and tabbing around",\r
- Label.CONTENT_RAW);\r
+ private static final Label info = new Label("<li> keep debug window open to see variable changes" + "<li> disable root panel w/ toggle button" + "<li> toggle one of the subpanels" + "<li> we attempt to focus the subpanels first textfield" + "<li> focusing should fail (try tabbing as well) [worked previousy]" + "<li> no variable changes should be sent from disabled fields [changed sent previously]" + "<li> try further toggling and tabbing around", Label.CONTENT_RAW);\r
\r
Panel root = new Panel("Enabled");\r
Panel one = new Panel("Enabled");\r
\r
main.addComponent(info);\r
\r
- OrderedLayout l = new OrderedLayout(\r
- OrderedLayout.ORIENTATION_HORIZONTAL);\r
+ HorizontalLayout l = new HorizontalLayout();\r
main.addComponent(l);\r
\r
- l.addComponent(new Button("Toggle root panel",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- toggle(root);\r
- }\r
- }));\r
- l.addComponent(new Button("Toggle panel one",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- toggle(one);\r
- }\r
- }));\r
- l.addComponent(new Button("Toggle panel two",\r
- new Button.ClickListener() {\r
- public void buttonClick(ClickEvent event) {\r
- toggle(two);\r
- }\r
- }));\r
+ l.addComponent(new Button("Toggle root panel", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ toggle(root);\r
+ }\r
+ }));\r
+ l.addComponent(new Button("Toggle panel one", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ toggle(one);\r
+ }\r
+ }));\r
+ l.addComponent(new Button("Toggle panel two", new Button.ClickListener() {\r
+ public void buttonClick(ClickEvent event) {\r
+ toggle(two);\r
+ }\r
+ }));\r
l.addComponent(new Button("Toggle form", new Button.ClickListener() {\r
public void buttonClick(ClickEvent event) {\r
toggle(form);\r
form.setFieldFactory(new BaseFieldFactory() {\r
\r
@Override\r
- public Field createField(Item item, Object propertyId,\r
- Component uiContext) {\r
+ public Field createField(Item item, Object propertyId, Component uiContext) {\r
Field f = super.createField(item, propertyId, uiContext);\r
f.setEnabled(!"disabled".equals(propertyId));\r
return f;\r
table.setFieldFactory(new BaseFieldFactory() {\r
\r
@Override\r
- public Field createField(Container container, Object itemId,\r
- Object propertyId, Component uiContext) {\r
- Field f = super.createField(container, itemId, propertyId,\r
- uiContext);\r
+ public Field createField(Container container, Object itemId, Object propertyId, Component uiContext) {\r
+ Field f = super.createField(container, itemId, propertyId, uiContext);\r
Item item = container.getItem(itemId);\r
Property p = item.getItemProperty(propertyId);\r
if ("disabled".equals(p.getValue())) {\r
c.setEnabled(enable);\r
c.setCaption((enable ? "Enabled" : "Disabled"));\r
if (c instanceof ComponentContainer) {\r
- TextField tf = (TextField) ((ComponentContainer) c)\r
- .getComponentIterator().next();\r
+ TextField tf = (TextField) ((ComponentContainer) c).getComponentIterator().next();\r
tf.focus();\r
}\r
}\r
ObjectOutputStream oos = new ObjectOutputStream(buffer);
long t = System.currentTimeMillis();
oos.writeObject(getContext());
- w.showNotification("ApplicationContext serialized ("
- + buffer.size() + "bytes) in "
- + (System.currentTimeMillis() - t) + "ms");
+ w.showNotification("ApplicationContext serialized (" + buffer.size() + "bytes) in " + (System.currentTimeMillis() - t) + "ms");
} catch (IOException e) {
e.printStackTrace();
w.showNotification("ApplicationContext serialization failed - see console for stacktrace");
import com.vaadin.data.util.MethodProperty;
import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.ExpandLayout;
import com.vaadin.ui.Form;
-import com.vaadin.ui.OrderedLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Panel;
import com.vaadin.ui.Window;
// Create form for editing address
final Form f = new Form();
- f.setItemDataSource(new BeanItem<Address>(address, new String[] {
- "name", "street", "zip", "city", "state", "country" }));
+ f.setItemDataSource(new BeanItem<Address>(address, new String[] { "name", "street", "zip", "city", "state", "country" }));
f.setCaption("Office address");
f.setIcon(new ThemeResource("../runo/icons/16/document.png"));
f.setDescription("Jep jpe, this is form description.");
f.setReadThrough(false);
Button commit = new Button("Commit", f, "commit");
Button discard = new Button("Discard", f, "discard");
- ExpandLayout ol = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ HorizontalLayout ol = new HorizontalLayout();
ol.setHeight("3em");
ol.addComponent(commit);
- ol.setComponentAlignment(commit, ExpandLayout.ALIGNMENT_RIGHT,
- ExpandLayout.ALIGNMENT_TOP);
+ ol.setComponentAlignment(commit, Alignment.TOP_RIGHT);
ol.addComponent(discard);
f.setFooter(ol);
// Add some validators for the form
f.getField("zip").addValidator(new IsInteger());
f.getField("zip").setDescription("Jepjep");
- ((AbstractComponent) f.getField("zip")).setIcon(new ThemeResource(
- "../runo/icons/16/folder.png"));
+ ((AbstractComponent) f.getField("zip")).setIcon(new ThemeResource("../runo/icons/16/folder.png"));
f.getField("state").addValidator(new IsValidState());
f.getField("name").setRequired(true);
f.getField("street").setRequired(true);
// Debug form properties
final Panel formProperties = new Panel("Form properties");
- formProperties.setWidth(200);
- final String[] visibleProps = { "required", "invalidAllowed",
- "readOnly", "readThrough", "writeThrough", "invalidCommitted",
- "validationVisible", "immediate" };
+ formProperties.setWidth("200px");
+ final String[] visibleProps = { "required", "invalidAllowed", "readOnly", "readThrough", "writeThrough", "invalidCommitted", "validationVisible", "immediate" };
for (int i = 0; i < visibleProps.length; i++) {
- Button b = new Button(visibleProps[i], new MethodProperty<Boolean>(
- f, visibleProps[i]));
+ Button b = new Button(visibleProps[i], new MethodProperty<Boolean>(f, visibleProps[i]));
b.setImmediate(true);
formProperties.addComponent(b);
}
mainWin.addComponent(formProperties);
// Debug the internal state of the address-object
- mainWin.addComponent(new Button("Show state of the address object",
- new Button.ClickListener() {
+ mainWin.addComponent(new Button("Show state of the address object", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- mainWin.showNotification(address.toString());
- }
- }));
+ public void buttonClick(ClickEvent event) {
+ mainWin.showNotification(address.toString());
+ }
+ }));
}
/** Address pojo. */
@Override
public String toString() {
- return name + "; " + street + "; " + city + " " + zip
- + (state != null ? " " + state : "") + " " + country;
+ return name + "; " + street + "; " + city + " " + zip + (state != null ? " " + state : "") + " " + country;
}
}
public void validate(Object value) throws InvalidValueException {
if (!isValid(value)) {
- throw new InvalidValueException("'" + value
- + "' is not a number");
+ throw new InvalidValueException("'" + value + "' is not a number");
}
}
}
public void validate(Object value) throws InvalidValueException {
if (!isValid(value)) {
- throw new InvalidValueException(
- "State must be either two capital letter abreviation or left empty");
+ throw new InvalidValueException("State must be either two capital letter abreviation or left empty");
}
}
}
}
});
- final String[] visibleProps = { "required", "invalidAllowed",
- "readOnly", "readThrough", "invalidCommitted",
- "validationVisible" };
+ final String[] visibleProps = { "required", "invalidAllowed", "readOnly", "readThrough", "invalidCommitted", "validationVisible" };
for (int i = 0; i < visibleProps.length; i++) {
- Button b = new Button(visibleProps[i], new MethodProperty<Boolean>(
- tx, visibleProps[i]));
+ Button b = new Button(visibleProps[i], new MethodProperty<Boolean>(tx, visibleProps[i]));
b.setImmediate(true);
mainWin.addComponent(b);
}
// tx.setIcon(new ThemeResource("icons/16/folder.png"));
- mainWin.addComponent(new Button("Validate integer",
- new Button.ClickListener() {
- public void buttonClick(
- com.vaadin.ui.Button.ClickEvent event) {
- mainWin.showNotification("The field is "
- + (tx.isValid() ? "" : "not ") + "valid");
- };
- }));
- TextField caption = new TextField("Caption",
- new MethodProperty<String>(tx, "caption"));
+ mainWin.addComponent(new Button("Validate integer", new Button.ClickListener() {
+ public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
+ mainWin.showNotification("The field is " + (tx.isValid() ? "" : "not ") + "valid");
+ };
+ }));
+ TextField caption = new TextField("Caption", new MethodProperty<String>(tx, "caption"));
caption.setImmediate(true);
mainWin.addComponent(caption);
}
final Window mainWin = new Window("Test app for max length feature");
setMainWindow(mainWin);
- final TextField tx = new TextField(
- "Textfield with maxlenght 10, single row");
+ final TextField tx = new TextField("Textfield with maxlenght 10, single row");
tx.setImmediate(true);
tx.setMaxLength(10);
b.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- l.setValue("Length: " + tx.getValue().toString().length()
- + " Content: " + tx.getValue());
+ l.setValue("Length: " + tx.getValue().toString().length() + " Content: " + tx.getValue());
}
});
mainWin.addComponent(tx);
mainWin.addComponent(b);
- final TextField tx2 = new TextField(
- "Textfield with maxlenght 10, multirow ");
+ final TextField tx2 = new TextField("Textfield with maxlenght 10, multirow ");
mainWin.addComponent(tx2);
tx2.setImmediate(true);
tx2.setRows(5);
b2.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- l.setValue("Length: " + tx2.getValue().toString().length()
- + " Content: " + tx2.getValue());
+ l.setValue("Length: " + tx2.getValue().toString().length() + " Content: " + tx2.getValue());
}
});
b = new Button("Check value");
b.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
- l.setValue("Length: " + rta.getValue().toString().length()
- + " Content: " + rta.getValue());
+ l.setValue("Length: " + rta.getValue().toString().length() + " Content: " + rta.getValue());
}
});
import com.vaadin.ui.DateField;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Link;
import com.vaadin.ui.OrderedLayout;
import com.vaadin.ui.Select;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
public class RandomComponents {
switch (randint) {
case 0:
- result = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
+ result = new HorizontalLayout();
((OrderedLayout) result).setCaption("OrderedLayout_horizontal_"
+ caption);
break;
case 1:
- result = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+ result = new VerticalLayout();
((OrderedLayout) result).setCaption("OrderedLayout_vertical_"
+ caption);
break;
result.setCaption("Calendar component " + caption);
break;
case 8:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new ButtonExample());
break;
case 9:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new ClientCachingExample());
break;
case 10:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new ComboBoxExample());
break;
case 11:
- result = new OrderedLayout();
+ result = new VerticalLayout();
// TODO: disabled gwt bug with mixed up iframe's
((OrderedLayout) result).addComponent(new EmbeddedBrowserExample());
break;
case 12:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new JavaScriptAPIExample());
break;
case 13:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new LabelExample());
break;
case 14:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new LayoutExample());
break;
case 15:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new NotificationExample());
break;
case 16:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new RichTextExample());
break;
case 17:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new SelectExample());
break;
case 18:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new ValueInputExample());
break;
case 19:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new WindowingExample());
break;
case 20:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new TreeExample());
break;
case 21:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result).addComponent(new TableExample());
break;
case 22:
- result = new OrderedLayout();
+ result = new VerticalLayout();
((OrderedLayout) result)
.addComponent(new StressComponentsInTable());
break;