diff options
author | Artur Signell <artur@vaadin.com> | 2016-08-30 13:16:41 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-08-30 14:09:58 +0000 |
commit | b965c256e86dd14b8baf607f4456da58f6f1d21a (patch) | |
tree | baa94383dba95bbf3628d4aa593bcad30827cbd6 /compatibility-shared/src/main/java | |
parent | b30006bf24791d68fa8c5322564e6224803031e2 (diff) | |
download | vaadin-framework-b965c256e86dd14b8baf607f4456da58f6f1d21a.tar.gz vaadin-framework-b965c256e86dd14b8baf607f4456da58f6f1d21a.zip |
Move and duplicate client side and state to compatibility package
* Calendar
* CheckBox
* CustomField
* Label
* RichTextArea
* TextField
* TextArea
Change-Id: Iba8915195e4d205fb4db9a4df5d96a4a10ab2f96
Diffstat (limited to 'compatibility-shared/src/main/java')
14 files changed, 511 insertions, 2 deletions
diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarClientRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarClientRpc.java new file mode 100644 index 0000000000..20b9a3663a --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarClientRpc.java @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.calendar; + +import com.vaadin.shared.communication.ClientRpc; + +/** + * + * @since 7.1 + * @author Vaadin Ltd. + * + */ +public interface CalendarClientRpc extends ClientRpc { + void scroll(int scrollPosition); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarEventId.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarEventId.java new file mode 100644 index 0000000000..a0de1e52ec --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarEventId.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.calendar; + +import java.io.Serializable; + +/** + * CalendarEventId contains static String identifiers for all Calendar events. + * These are used both in the client and server side code. + * + * @since 7.1 + * @author Vaadin Ltd. + */ +public class CalendarEventId implements Serializable { + + public static final String EVENTMOVE = "eventMove"; + public static final String RANGESELECT = "rangeSelect"; + public static final String FORWARD = "forward"; + public static final String BACKWARD = "backward"; + public static final String DATECLICK = "dateClick"; + public static final String WEEKCLICK = "weekClick"; + public static final String EVENTCLICK = "eventClick"; + public static final String EVENTRESIZE = "eventResize"; + public static final String ACTION = "action"; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarServerRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarServerRpc.java new file mode 100644 index 0000000000..15a3af55ca --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarServerRpc.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.calendar; + +import com.vaadin.shared.annotations.Delayed; +import com.vaadin.shared.communication.ServerRpc; + +/** + * @since 7.1 + * @author Vaadin Ltd. + */ +public interface CalendarServerRpc extends ServerRpc { + void eventMove(int eventIndex, String newDate); + + void rangeSelect(String range); + + void forward(); + + void backward(); + + void dateClick(String date); + + void weekClick(String event); + + void eventClick(int eventIndex); + + void eventResize(int eventIndex, String newStartDate, String newEndDate); + + void actionOnEmptyCell(String actionKey, String startDate, String endDate); + + void actionOnEvent(String actionKey, String startDate, String endDate, + int eventIndex); + + @Delayed(lastOnly = true) + void scroll(int scrollPosition); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarState.java new file mode 100644 index 0000000000..df62f84bbd --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/CalendarState.java @@ -0,0 +1,71 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.calendar; + +import java.util.List; + +import com.vaadin.shared.AbstractComponentState; + +/** + * @since 7.1.0 + * @author Vaadin Ltd. + */ +public class CalendarState extends AbstractComponentState { + + public boolean format24H; + public String[] dayNames; + public String[] monthNames; + public int firstVisibleDayOfWeek = 1; + public int lastVisibleDayOfWeek = 7; + public int firstHourOfDay = 0; + public int lastHourOfDay = 23; + public int firstDayOfWeek; + public int scroll; + public String now; + public List<CalendarState.Day> days; + public List<CalendarState.Event> events; + public List<CalendarState.Action> actions; + public boolean eventCaptionAsHtml; + + public static class Day implements java.io.Serializable { + public String date; + public String localizedDateFormat; + public int dayOfWeek; + public int week; + public int yearOfWeek; + } + + public static class Action implements java.io.Serializable { + + public String caption; + public String iconKey; + public String actionKey; + public String startDate; + public String endDate; + } + + public static class Event implements java.io.Serializable { + public int index; + public String caption; + public String dateFrom; + public String dateTo; + public String timeFrom; + public String timeTo; + public String styleName; + public String description; + public boolean allDay; + } +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/DateConstants.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/DateConstants.java new file mode 100644 index 0000000000..a7c609cc4e --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/calendar/DateConstants.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.calendar; + +import java.io.Serializable; + +/** + * + * @since 7.1 + * + */ +public class DateConstants implements Serializable { + + public static final String ACTION_DATE_FORMAT_PATTERN = "yyyy-MM-dd HH:mm:ss"; + public static final String CLIENT_DATE_FORMAT = "yyyy-MM-dd"; + public static final String CLIENT_TIME_FORMAT = "HH-mm"; + public static final long MINUTEINMILLIS = 60 * 1000; + public static final long HOURINMILLIS = 60 * MINUTEINMILLIS; + public static final long DAYINMILLIS = 24 * HOURINMILLIS; + public static final long WEEKINMILLIS = 7 * DAYINMILLIS; + + public static final int DAYINMINUTES = 24 * 60; + public static final int HOURINMINUTES = 60; + +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/checkbox/CheckBoxServerRpc.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/checkbox/CheckBoxServerRpc.java new file mode 100644 index 0000000000..606bdb3fa3 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/checkbox/CheckBoxServerRpc.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.checkbox; + +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.annotations.Delayed; +import com.vaadin.shared.communication.ServerRpc; + +public interface CheckBoxServerRpc extends ServerRpc { + @Delayed + public void setChecked(boolean checked, + MouseEventDetails mouseEventDetails); +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/checkbox/CheckBoxState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/checkbox/CheckBoxState.java new file mode 100644 index 0000000000..58b52ee97c --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/checkbox/CheckBoxState.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.checkbox; + +import com.vaadin.shared.AbstractFieldState; + +public class CheckBoxState extends AbstractFieldState { + { + primaryStyleName = "v-checkbox"; + } + + public boolean checked = false; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/label/ContentMode.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/label/ContentMode.java new file mode 100644 index 0000000000..e6292b47c5 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/label/ContentMode.java @@ -0,0 +1,57 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.label; + +/** + * Content modes defining how the client should interpret a Label's value. + * + * @since 7.0.0 + */ +public enum ContentMode { + /** + * Content mode, where the label contains only plain text. + */ + TEXT, + + /** + * Content mode, where the label contains preformatted text. In this mode + * newlines are preserved when rendered on the screen. + */ + PREFORMATTED, + + /** + * Content mode, where the label contains HTML. + */ + HTML, + + /** + * Content mode, where the label contains well-formed or well-balanced XML. + * This is handled in the same way as {@link #HTML}. + * + * @deprecated Use {@link #HTML} instead + */ + @Deprecated + XML, + + /** + * Legacy content mode, where the label contains RAW output. This is handled + * in exactly the same way as {@link #HTML}. + * + * @deprecated Use {@link #HTML} instead + */ + @Deprecated + RAW; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/label/LabelState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/label/LabelState.java new file mode 100644 index 0000000000..64cc3b5ee5 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/label/LabelState.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.label; + +import com.vaadin.shared.AbstractComponentState; + +public class LabelState extends AbstractComponentState { + { + primaryStyleName = "v-label"; + } + public ContentMode contentMode = ContentMode.TEXT; + public String text = ""; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/LegacyTextAreaState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/LegacyTextAreaState.java new file mode 100644 index 0000000000..bb851832c3 --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/LegacyTextAreaState.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.textarea; + +import com.vaadin.shared.annotations.DelegateToWidget; +import com.vaadin.shared.annotations.NoLayout; +import com.vaadin.v7.shared.ui.textfield.AbstractTextFieldState; + +@Deprecated +public class LegacyTextAreaState extends AbstractTextFieldState { + { + primaryStyleName = "v-textarea"; + } + + /** + * Number of visible rows in the text area. The default is 5. + */ + @DelegateToWidget + public int rows = 5; + + /** + * Tells if word-wrapping should be used in the text area. + */ + @DelegateToWidget + @NoLayout + public boolean wordwrap = true; + +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/RichTextAreaState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/RichTextAreaState.java new file mode 100644 index 0000000000..9d24c4410b --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/RichTextAreaState.java @@ -0,0 +1,31 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.textarea; + +import com.vaadin.v7.shared.ui.textfield.AbstractTextFieldState; + +/** + * + * Shared state for the RichTextArea component. + * + * @since 7.6 + */ +public class RichTextAreaState extends AbstractTextFieldState { + + { + primaryStyleName = "v-richtextarea"; + } +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/TextAreaState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/TextAreaState.java index 8735136085..aa403032a8 100644 --- a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/TextAreaState.java +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textarea/TextAreaState.java @@ -17,10 +17,10 @@ package com.vaadin.v7.shared.ui.textarea; import com.vaadin.shared.annotations.DelegateToWidget; import com.vaadin.shared.annotations.NoLayout; -import com.vaadin.shared.v7.ui.textfield.LegacyAbstractTextFieldState; +import com.vaadin.v7.shared.ui.textfield.AbstractTextFieldState; @Deprecated -public class TextAreaState extends LegacyAbstractTextFieldState { +public class TextAreaState extends AbstractTextFieldState { { primaryStyleName = "v-textarea"; } diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textfield/AbstractTextFieldState.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textfield/AbstractTextFieldState.java new file mode 100644 index 0000000000..c25694ff2e --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textfield/AbstractTextFieldState.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.textfield; + +import com.vaadin.shared.AbstractFieldState; +import com.vaadin.shared.annotations.NoLayout; + +@Deprecated +public class AbstractTextFieldState extends AbstractFieldState { + { + primaryStyleName = "v-textfield"; + } + + /** + * Maximum character count in text field. + */ + @NoLayout + public int maxLength = -1; + + /** + * Number of visible columns in the TextField. + */ + public int columns = 0; + + /** + * The prompt to display in an empty field. Null when disabled. + */ + @NoLayout + public String inputPrompt = null; + + /** + * The text in the field + */ + @NoLayout + public String text = null; +} diff --git a/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textfield/LegacyTextFieldConstants.java b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textfield/LegacyTextFieldConstants.java new file mode 100644 index 0000000000..f2f91ea87b --- /dev/null +++ b/compatibility-shared/src/main/java/com/vaadin/v7/shared/ui/textfield/LegacyTextFieldConstants.java @@ -0,0 +1,29 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.v7.shared.ui.textfield; + +import java.io.Serializable; + +@Deprecated +public class LegacyTextFieldConstants implements Serializable { + public static final String VAR_CUR_TEXT = "curText"; + public static final String ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS = "nvc"; + public static final String ATTR_TEXTCHANGE_TIMEOUT = "iet"; + public static final String VAR_CURSOR = "c"; + public static final String ATTR_TEXTCHANGE_EVENTMODE = "iem"; + public static final String TEXTCHANGE_MODE_EAGER = "EAGER"; + +} |