if (newWidth.endsWith("%") != lastKnownWidth.endsWith("%")) {
ComponentContainerConnector parent = getParent();
if (parent instanceof ManagedLayout) {
- getLayoutManager().setNeedsHorizontalLayout((ManagedLayout) parent);
+ getLayoutManager().setNeedsHorizontalLayout(
+ (ManagedLayout) parent);
}
}
if (newHeight.endsWith("%") != lastKnownHeight.endsWith("%")) {
ComponentContainerConnector parent = getParent();
if (parent instanceof ManagedLayout) {
- getLayoutManager().setNeedsVerticalLayout((ManagedLayout) parent);
+ getLayoutManager().setNeedsVerticalLayout(
+ (ManagedLayout) parent);
}
}
*/
package com.vaadin.terminal.gwt.client.ui;
-
public abstract class AbstractLayoutConnector extends
AbstractComponentContainerConnector {
*/
package com.vaadin.terminal.gwt.client.ui.customlayout;
-
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Widget;
*/
package com.vaadin.terminal.gwt.client.ui.orderedlayout;
-
public class VHorizontalLayout extends VMeasuringOrderedLayout {
public static final String CLASSNAME = "v-horizontallayout";
*/
package com.vaadin.terminal.gwt.client.ui.orderedlayout;
-
public class VVerticalLayout extends VMeasuringOrderedLayout {
public static final String CLASSNAME = "v-verticallayout";
package com.vaadin.terminal.gwt.client.ui.splitpanel;
-
public class VSplitPanelHorizontal extends VAbstractSplitPanel {
public VSplitPanelHorizontal() {
package com.vaadin.terminal.gwt.client.ui.splitpanel;
-
public class VSplitPanelVertical extends VAbstractSplitPanel {
public VSplitPanelVertical() {
getLayoutManager().setNeedsMeasure(TableConnector.this);
getLayoutManager().setNeedsMeasure(
TableConnector.this.getParent());
- getLayoutManager()
- .setNeedsVerticalLayout(TableConnector.this);
+ getLayoutManager().setNeedsVerticalLayout(
+ TableConnector.this);
getLayoutManager().layoutNow();
}
});
private Collection<Class<? extends ComponentConnector>> deferredPaintables = new HashSet<Class<? extends ComponentConnector>>();
@Override
- protected LoadStyle getLoadStyle(Class<? extends ComponentConnector> connector) {
+ protected LoadStyle getLoadStyle(
+ Class<? extends ComponentConnector> connector) {
if (eagerPaintables == null) {
init();
}
*
*/
public class EagerWidgetMapGenerator extends WidgetMapGenerator {
-
-
- @Override
- protected LoadStyle getLoadStyle(Class<? extends ComponentConnector> connector) {
- return LoadStyle.EAGER;
+
+ @Override
+ protected LoadStyle getLoadStyle(
+ Class<? extends ComponentConnector> connector) {
+ return LoadStyle.EAGER;
}
}
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.ui.Connect.LoadStyle;
-
/**
* WidgetMap generator that builds a widgetset that optimizes the transferred
* data. Widgets are loaded only when used if the widgetset is built with this
*/
public class LazyWidgetMapGenerator extends WidgetMapGenerator {
@Override
- protected LoadStyle getLoadStyle(Class<? extends ComponentConnector> connector) {
+ protected LoadStyle getLoadStyle(
+ Class<? extends ComponentConnector> connector) {
return LoadStyle.LAZY;
}
+ requestedType.getName().replaceAll("[$.]", "_");
JClassType initializableInterface = typeOracle
- .findType(InitializableServerRpc.class
- .getCanonicalName());
+ .findType(InitializableServerRpc.class.getCanonicalName());
ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(
requestedType.getPackage().getName(), generatedClassName);
package com.vaadin.ui;
-
/**
* FormLayout is used by {@link Form} to layout fields. It may also be used
* separately without {@link Form}.
*/
package com.vaadin.ui;
-
/**
* Horizontal layout
*
*/
package com.vaadin.ui;
-
/**
* A horizontal split panel contains two components and lays them horizontally.
* The first component is on the left side.
*/
package com.vaadin.ui;
-
@SuppressWarnings("serial")
public class NativeButton extends Button {
*/
package com.vaadin.ui;
-
/**
* A vertical split panel contains two components and lays them vertically. The
* first component is above the second component.
import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool;
public class DataGenerator {
-
- @Test
- public void testDummy(){
- // Added dummy test so JUnit will not complain about "No runnable methods".
- }
+
+ @Test
+ public void testDummy() {
+ // Added dummy test so JUnit will not complain about
+ // "No runnable methods".
+ }
public static void addPeopleToDatabase(JDBCConnectionPool connectionPool)
throws SQLException {
public class FreeformQueryUtil {
- @Test
- public void testDummy(){
- // Added dummy test so JUnit will not complain about "No runnable methods".
- }
-
+ @Test
+ public void testDummy() {
+ // Added dummy test so JUnit will not complain about
+ // "No runnable methods".
+ }
+
public static StatementHelper getQueryWithFilters(List<Filter> filters,
int offset, int limit) {
StatementHelper sh = new StatementHelper();
query.append(") AS rownum, * FROM \"PEOPLE\"");
if (!filters.isEmpty()) {
- query.append(QueryBuilder.getWhereStringForFilters(
- filters, sh));
+ query.append(QueryBuilder.getWhereStringForFilters(filters, sh));
}
query.append(") AS a WHERE a.rownum BETWEEN ").append(offset)
.append(" AND ").append(Integer.toString(offset + limit));
query.append("SELECT * FROM (SELECT x.*, ROWNUM AS "
+ "\"rownum\" FROM (SELECT * FROM \"PEOPLE\"");
if (!filters.isEmpty()) {
- query.append(QueryBuilder.getWhereStringForFilters(
- filters, sh));
+ query.append(QueryBuilder.getWhereStringForFilters(filters, sh));
}
query.append(") x) WHERE \"rownum\" BETWEEN ? AND ?");
sh.addParameterValue(offset);
} else {
StringBuilder query = new StringBuilder("SELECT * FROM people");
if (!filters.isEmpty()) {
- query.append(QueryBuilder.getWhereStringForFilters(
- filters, sh));
+ query.append(QueryBuilder.getWhereStringForFilters(filters, sh));
}
if (limit != 0 || offset != 0) {
query.append(" LIMIT ? OFFSET ?");
@Test
public void escapeSQL_severalQuotes_returnsEscapedString() {
Assert.assertEquals("asdf''ghjk''qwerty",
- SQLUtil.escapeSQL("asdf'ghjk'qwerty"));
+ SQLUtil.escapeSQL("asdf'ghjk'qwerty"));
}
@Test
@Test
public void escapeSQL_multipleDoubleQuotes_returnsEscapedString() {
Assert.assertEquals("asdf\\\"foo\\\"bar",
- SQLUtil.escapeSQL("asdf\"foo\"bar"));
+ SQLUtil.escapeSQL("asdf\"foo\"bar"));
}
@Test
public void escapeSQL_backslashes_returnsEscapedString() {
- Assert.assertEquals("foo\\\\nbar\\\\r", SQLUtil.escapeSQL("foo\\nbar\\r"));
+ Assert.assertEquals("foo\\\\nbar\\\\r",
+ SQLUtil.escapeSQL("foo\\nbar\\r"));
}
@Test
*/
public class MockInitialContextFactory implements InitialContextFactory {
private static Context mockCtx = null;
-
+
@Test
- public void testDummy(){
- // Added dummy test so JUnit will not complain about "No runnable methods".
- }
+ public void testDummy() {
+ // Added dummy test so JUnit will not complain about
+ // "No runnable methods".
+ }
public static void setMockContext(Context ctx) {
mockCtx = ctx;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.tests.server.component.AbstractListenerMethodsTest;
-public class TestAbstractBeanContainerListeners extends AbstractListenerMethodsTest {
+public class TestAbstractBeanContainerListeners extends
+ AbstractListenerMethodsTest {
public void testPropertySetChangeListenerAddGetRemove() throws Exception {
testListenerAddGetRemove(BeanItemContainer.class,
PropertySetChangeEvent.class, PropertySetChangeListener.class,
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.tests.server.component.AbstractListenerMethodsTest;
-public class TestAbstractInMemoryContainerListeners extends AbstractListenerMethodsTest {
+public class TestAbstractInMemoryContainerListeners extends
+ AbstractListenerMethodsTest {
public void testItemSetChangeListenerAddGetRemove() throws Exception {
testListenerAddGetRemove(IndexedContainer.class,
ItemSetChangeEvent.class, ItemSetChangeListener.class);
return getExpectedClass().newInstance();
}
};
+
@SuppressWarnings("rawtypes")
private Class expectedClass;
private Class getExpectedClass() {
return expectedClass;
}
-
+
/**
* The object passed to format should be same as property's type.
- * @throws IllegalAccessException
- * @throws InstantiationException
+ *
+ * @throws IllegalAccessException
+ * @throws InstantiationException
*/
@Test
@SuppressWarnings({ "rawtypes" })
- public void testCorrectTypeForFormat() throws InstantiationException, IllegalAccessException {
- Class[] testedTypes = new Class[] {Integer.class, Boolean.class, Double.class, String.class, Date.class};
- Object[] testValues = new Object[] {new Integer(3), Boolean.FALSE, new Double(3.3), "bar", new Date()};
-
+ public void testCorrectTypeForFormat() throws InstantiationException,
+ IllegalAccessException {
+ Class[] testedTypes = new Class[] { Integer.class, Boolean.class,
+ Double.class, String.class, Date.class };
+ Object[] testValues = new Object[] { new Integer(3), Boolean.FALSE,
+ new Double(3.3), "bar", new Date() };
+
int i = 0;
for (Class class1 : testedTypes) {
expectedClass = class1;
-
+
TestFormatter formatter = new TestFormatter();
-
+
// Should just return null, without formatting
Object value = formatter.getValue();
-
+
// test with property which value is null
- formatter.setPropertyDataSource(new ObjectProperty(null, expectedClass));
+ formatter.setPropertyDataSource(new ObjectProperty(null,
+ expectedClass));
formatter.getValue(); // calls format
-
+
// test with a value
- formatter.setPropertyDataSource(new ObjectProperty(testValues[i++], expectedClass));
+ formatter.setPropertyDataSource(new ObjectProperty(testValues[i++],
+ expectedClass));
formatter.getValue(); // calls format
}
-
}
}
System.out.println("package " + packageName + ";");
System.out.println("import "
- + AbstractListenerMethodsTest.class.getName() + ";");
+ + AbstractListenerMethodsTest.class.getName()
+ + ";");
System.out.println("import " + c.getName() + ";");
- System.out.println("public class " + c.getSimpleName()
+ System.out.println("public class "
+ + c.getSimpleName()
+ "Listeners extends "
- + AbstractListenerMethodsTest.class.getSimpleName() + " {");
+ + AbstractListenerMethodsTest.class
+ .getSimpleName() + " {");
}
String listenerClassName = m.getParameterTypes()[0]
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.VerticalLayout;
-public class TestAbstractComponentContainerListeners extends AbstractListenerMethodsTest {
+public class TestAbstractComponentContainerListeners extends
+ AbstractListenerMethodsTest {
public void testComponentDetachListenerAddGetRemove() throws Exception {
testListenerAddGetRemove(HorizontalLayout.class,
ComponentDetachEvent.class, ComponentDetachListener.class);
import com.vaadin.tests.server.component.AbstractListenerMethodsTest;
import com.vaadin.ui.VerticalLayout;
-public class TestAbstractOrderedLayoutListeners extends AbstractListenerMethodsTest {
+public class TestAbstractOrderedLayoutListeners extends
+ AbstractListenerMethodsTest {
public void testLayoutClickListenerAddGetRemove() throws Exception {
testListenerAddGetRemove(VerticalLayout.class, LayoutClickEvent.class,
LayoutClickListener.class);
import com.vaadin.ui.AbstractSplitPanel.SplitterClickListener;
import com.vaadin.ui.HorizontalSplitPanel;
-public class TestAbstractSplitPanelListeners extends AbstractListenerMethodsTest {
+public class TestAbstractSplitPanelListeners extends
+ AbstractListenerMethodsTest {
public void testSplitterClickListenerAddGetRemove() throws Exception {
testListenerAddGetRemove(HorizontalSplitPanel.class,
SplitterClickEvent.class, SplitterClickListener.class);
}
public void testItemClickListenerAddGetRemove() throws Exception {
- testListenerAddGetRemove(Table.class, ItemClickEvent.class, ItemClickListener.class);
+ testListenerAddGetRemove(Table.class, ItemClickEvent.class,
+ ItemClickListener.class);
}
public void testFooterClickListenerAddGetRemove() throws Exception {
assertEquals(tab2, tabSheet.getTab(1));
assertEquals(tab3, tabSheet.getTab(2));
}
-
+
}
*/
private void assertAttached(TestContainer win) {
TestContent testContent = win.getTestContent();
-
+
assertTrue("window attach not called", win.attachCalled());
assertTrue("window content attach not called",
testContent.contentAttachCalled);
});
main.addComponent(b);
- b = new Button("remove randomly one component", new Button.ClickListener() { public void buttonClick(ClickEvent event) { removeRandomComponent();}});
+ b = new Button("remove randomly one component",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ removeRandomComponent();
+ }
+ });
main.addComponent(b);
}
}));
}
- private void testOrderedLayout(){
+ private void testOrderedLayout() {
content.removeAllComponents();
-
+
final VerticalLayout v = new VerticalLayout();
v.setWidth("300px");
v.setHeight("300px");
package com.vaadin.tests.components.combobox;
+
import java.util.Arrays;
import com.vaadin.data.Property.ValueChangeEvent;
@Override
protected void setup() {
-
final Form form = new Form();
form.setItemDataSource(new BeanItem<MySecondBean>(new MySecondBean()));
addComponent(form);
addComponent(new Button("Change data source",
new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
+ public void buttonClick(ClickEvent event) {
form.setItemDataSource(new BeanItem<MyBean>(
new MyBean()));
- }
+ }
}));
}
@Override
protected void setup() {
- final Form form = new Form();
- form.setDescription("Some description");
+ final Form form = new Form();
+ form.setDescription("Some description");
form.addField("AAAA", new TextField());
- addComponent(form);
-
+ addComponent(form);
+
addComponent(new Button("Toggle description",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
}
}
}));
-
}
@Override
public Object parse(String formattedValue)
throws Exception {
- String str = formattedValue
- .replaceAll("[^0-9.]", "");
+ String str = formattedValue.replaceAll("[^0-9.]",
+ "");
if (formattedValue.toLowerCase().contains("months")) {
return Double.parseDouble(str) / 12;
}
public String format(Object value) {
Double dValue = (Double) value;
if (dValue < 1) {
- return ((int)(dValue * 12)) + " months";
+ return ((int) (dValue * 12)) + " months";
}
return dValue + " years";
}
}
});
form2.setItemDataSource(createItem());
-
+
addComponent(form2);
addComponent(new Button("B"));
}
@Override
public void init() {
- LegacyWindow mainWindow = new LegacyWindow(
- "MenuBar in SplitPanel", new HorizontalSplitPanel());
+ LegacyWindow mainWindow = new LegacyWindow("MenuBar in SplitPanel",
+ new HorizontalSplitPanel());
VerticalLayout left = new VerticalLayout();
mainWindow.addComponent(left);
left.setSizeFull();
}
};
-
@Override
protected Class<TwinColSelect> getTestClass() {
return TwinColSelect.class;
import com.vaadin.ui.Window;
public class LongMultiselect extends TestBase {
-
+
private enum ItemProperty {
- COLUMN1,
- COLUMN2
+ COLUMN1, COLUMN2
}
-
+
@Override
protected void setup() {
- VerticalLayout layout = generateLayout();
- addComponent(layout);
- layout.setSizeFull();
+ VerticalLayout layout = generateLayout();
+ addComponent(layout);
+ layout.setSizeFull();
}
- private VerticalLayout generateLayout() {
- VerticalLayout layout = new VerticalLayout();
+ private VerticalLayout generateLayout() {
+ VerticalLayout layout = new VerticalLayout();
- final Table table = new Table("Ticket #8264 table");
+ final Table table = new Table("Ticket #8264 table");
layout.addComponent(table);
table.setWidth("200px");
table.setHeight("170px");
// Create example data
table.addContainerProperty(ItemProperty.COLUMN1, String.class, null);
table.addContainerProperty(ItemProperty.COLUMN2, String.class, null);
- for (int i=1;i<100;i++) {
- table.addItem(new String[]{"Item " + i, null}, i);
+ for (int i = 1; i < 100; i++) {
+ table.addItem(new String[] { "Item " + i, null }, i);
}
- //Add action button
+ // Add action button
layout.addComponent(new Button("Do It", new Button.ClickListener() {
public void buttonClick(Button.ClickEvent event) {
// Set ItemProperty.COLUMN2 for all selected values of table
- Collection selectedIds = (Collection)table.getValue();
+ Collection selectedIds = (Collection) table.getValue();
for (final Object itemId : selectedIds) {
- final Property p = table.getItem(itemId).getItemProperty(ItemProperty.COLUMN2);
+ final Property p = table.getItem(itemId).getItemProperty(
+ ItemProperty.COLUMN2);
if (p.getValue() instanceof String) {
p.setValue(null);
} else {
}
}
}));
-
+
return layout;
- }
+ }
- @Override
- protected String getDescription() {
- return "Multiselecting 94 rows (from \"item 5\" to \"item 98\") and modifying second column of each row selected (press Do It). This should work (update the 2nd column) and not cause JS exception.";
- }
+ @Override
+ protected String getDescription() {
+ return "Multiselecting 94 rows (from \"item 5\" to \"item 98\") and modifying second column of each row selected (press Do It). This should work (update the 2nd column) and not cause JS exception.";
+ }
- @Override
- protected Integer getTicketNumber() {
- return 8264;
- }
+ @Override
+ protected Integer getTicketNumber() {
+ return 8264;
+ }
}
}
public String getTableHeight() {
- return "" + (int) table.getHeight() + table.getHeightUnits().getSymbol();
+ return "" + (int) table.getHeight()
+ + table.getHeightUnits().getSymbol();
}
public void setTableHeight(String height) {
@Override
protected void setup() {
final TabSheet tabs = new TabSheet();
-
+
// Add some tabs
tabs.addTab(new Label("Content 1"), "Tab 1", null);
tabs.addTab(new Label("Content 2"), "Tab 2", null);
tabs.addTab(new Label("Content 3"), "Tab 3", null);
-
+
addComponent(tabs);
-
- Button addTab = new Button("Add tab at index 2", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
+
+ Button addTab = new Button("Add tab at index 2",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
tabs.addTab(new Label("Content " + tabCounter),
"Added Tab " + tabCounter, null, 2);
tabCounter++;
Tab tab = tabs.getTab(2);
tab.setCaption(new StringBuffer(tab.getCaption())
.reverse().toString());
- }
- });
+ }
+ });
addComponent(setCaption);
Button move = new Button("Move selected tab to index 2",
}
});
addComponent(move);
-
- Button getIndex = new Button("Get selected tab index", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
+
+ Button getIndex = new Button("Get selected tab index",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
getMainWindow().showNotification(
"Index: "
+ tabs.getTabPosition(tabs.getTab(tabs
.getSelectedTab())));
-
- }
- });
+
+ }
+ });
addComponent(getIndex);
}
package com.vaadin.tests.components.tabsheet;
+
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
public class TextChangeListenerChangingNonTextProperties extends TestBase {
int index = 0;
- String[] styles = {"red","green","blue","cyan", "magenta"};
-
+ String[] styles = { "red", "green", "blue", "cyan", "magenta" };
+
private String getNextStyle() {
- return styles[++index%styles.length];
+ return styles[++index % styles.length];
}
-
+
@Override
protected void setup() {
final TextField tf2 = new TextField("Updates width") {
tf2.setStyleName(getNextStyle());
}
- }) ;
+ });
tf2.setImmediate(true);
addComponent(tf2);
protected Integer getTicketNumber() {
return Integer.valueOf(6588);
}
-
}
}
});
addComponent(field);
-
+
Button detachBtn = new Button("detach field",
new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
+ public void buttonClick(ClickEvent event) {
removeComponent(field);
getLayout().addComponentAsFirst(
new Label("Field detached!"));
- }
- });
+ }
+ });
addComponent(detachBtn);
}
@Override
protected void setup() {
-
+
final TextField tf1 = new TextField();
-
+
final ObjectProperty<String> op = new ObjectProperty<String>("FOO");
-
+
tf1.setPropertyDataSource(op);
addComponent(tf1);
- Button b = new Button("Set BAR to underlaying property (should propagate to UI)");
+ Button b = new Button(
+ "Set BAR to underlaying property (should propagate to UI)");
b.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
op.setValue("BAR");
}
});
- addComponent(b );
-
+ addComponent(b);
+
}
@Override
table.setCaption("tab 2");
table.setWidth("100%");
table.setHeight("100%");
-
+
final TabSheet tabsheet = new TabSheet();
tabsheet.addComponent(tabButton);
tabsheet.addComponent(table);
tabsheet.addListener(new TabSheet.SelectedTabChangeListener() {
- public void selectedTabChange(
- TabSheet.SelectedTabChangeEvent event) {
+ public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
if (tabsheet.getSelectedTab() == tabButton) {
tabsheet.setSizeUndefined();
subwindow.getContent().setSizeUndefined();
import com.vaadin.data.util.converter.StringToDoubleConverter;
-public class StringToDoubleConverterWithThreeFractionDigits extends StringToDoubleConverter {
+public class StringToDoubleConverterWithThreeFractionDigits extends
+ StringToDoubleConverter {
@Override
protected NumberFormat getFormat(Locale locale) {
protected void setup() {
TestUtils.injectCSS(getMainWindow(), GREENBOXES + HIDEDRAGSOURCE);
-
+
VerticalLayout l = new VerticalLayout();
l.setWidth("400px");
l.setHeight("100px");
DragAndDropWrapper pane = new DragAndDropWrapper(cssLayout);
pane.setSizeFull();
l.addComponent(pane);
-
+
addComponent(l);
-
+
for (int i = 0; i < 4; i++) {
cssLayout.addComponent(new WrappedLabel("Block"));
}
-
+
}
-
+
static int count;
- private CssLayout cssLayout = new CssLayout() {};
+ private CssLayout cssLayout = new CssLayout() {
+ };
class WrappedLabel extends DragAndDropWrapper {
return true;
}
- public void onProgress(
- StreamingProgressEvent event) {
+ public void onProgress(StreamingProgressEvent event) {
System.err.println("Progress"
+ event.getBytesReceived());
}