├── README.md ├── gwt-sandbox └── src │ └── main │ ├── resources │ ├── org │ │ └── kaaproject │ │ │ └── avro │ │ │ └── ui │ │ │ └── sandbox │ │ │ └── client │ │ │ ├── i18n │ │ │ ├── AvroUiSandboxMessages.properties │ │ │ └── AvroUiSandboxConstants.properties │ │ │ ├── AvroUiSandboxTheme.css │ │ │ └── KaaTheme.css │ └── avro-ui-sandbox-logback.xml │ ├── java │ └── org │ │ └── kaaproject │ │ └── avro │ │ └── ui │ │ └── sandbox │ │ ├── services │ │ ├── cache │ │ │ └── JsonCacheService.java │ │ ├── JsonCacheServiceImpl.java │ │ └── util │ │ │ └── Utils.java │ │ ├── client │ │ ├── mvp │ │ │ ├── view │ │ │ │ ├── HeaderView.java │ │ │ │ ├── MainView.java │ │ │ │ ├── FormConstructorView.java │ │ │ │ ├── header │ │ │ │ │ ├── HeaderViewImpl.ui.xml │ │ │ │ │ └── HeaderViewImpl.java │ │ │ │ └── main │ │ │ │ │ └── MainViewImpl.ui.xml │ │ │ ├── place │ │ │ │ ├── AvroUiSandboxPlaceHistoryMapper.java │ │ │ │ └── MainPlace.java │ │ │ ├── ClientFactory.java │ │ │ ├── activity │ │ │ │ ├── HeaderActivityMapper.java │ │ │ │ ├── AvroUiSandboxActivityMapper.java │ │ │ │ └── HeaderActivity.java │ │ │ └── ClientFactoryImpl.java │ │ ├── layout │ │ │ ├── SimpleWidgetPanel.java │ │ │ ├── AppLayout.ui.xml │ │ │ └── AppLayout.java │ │ ├── AvroUiSandboxResources.java │ │ ├── servlet │ │ │ └── ServletHelper.java │ │ ├── util │ │ │ └── Utils.java │ │ └── AvroUiSandbox.java │ │ ├── shared │ │ └── services │ │ │ ├── AvroUiSandboxServiceException.java │ │ │ └── AvroUiSandboxService.java │ │ └── AvroUiSandbox.gwt.xml │ └── webapp │ ├── AvroUiSandbox.html │ └── WEB-INF │ ├── applicationContext.xml │ └── web.xml ├── gwt-client └── src │ └── main │ ├── java │ └── org │ │ └── kaaproject │ │ └── avro │ │ └── ui │ │ └── gwt │ │ └── client │ │ ├── images │ │ ├── circles.png │ │ ├── close.png │ │ ├── remove.png │ │ ├── vborder.png │ │ ├── zoom_out.png │ │ ├── circles_ie6.png │ │ ├── resizeHandle.png │ │ ├── vborder_ie6.png │ │ ├── busyIndicator.gif │ │ ├── arrowBottomImage.png │ │ └── arrowRightImage.png │ │ ├── widget │ │ ├── grid │ │ │ ├── AvroUiPagerSmall.css │ │ │ ├── AvroUiDataGridSmall.css │ │ │ ├── event │ │ │ │ ├── RowActionEventHandler.java │ │ │ │ ├── HasRowActionEventHandlers.java │ │ │ │ └── RowActionEvent.java │ │ │ ├── AvroUiPagerResourcesSmall.java │ │ │ ├── AvroUiGridResourcesSmall.java │ │ │ ├── AvroUiGridResources.java │ │ │ ├── cell │ │ │ │ ├── LinkCell.java │ │ │ │ └── UneditableCheckboxCell.java │ │ │ ├── FiltrableStringColumn.java │ │ │ ├── ColumnFilterEvent.java │ │ │ ├── StringFilterHeader.java │ │ │ └── AvroUiDataGrid.css │ │ ├── ShowableWidget.java │ │ ├── nav │ │ │ ├── NavigationAction.java │ │ │ ├── Divider.java │ │ │ ├── NavigationActionListener.java │ │ │ ├── NavigationContainer.java │ │ │ ├── NavLink.java │ │ │ ├── ListItem.java │ │ │ ├── UnorderedList.java │ │ │ ├── NavWidget.java │ │ │ └── NavigationPanel.java │ │ ├── choosen │ │ │ ├── AvroChoosenResources.java │ │ │ └── avroChozen.css │ │ ├── LongBox.java │ │ ├── FloatBox.java │ │ ├── DoubleBox.java │ │ ├── IntegerBox.java │ │ ├── FormEnumListBox.java │ │ ├── FieldWidgetPanel.ui.xml │ │ ├── AlertPanel.java │ │ ├── dialog │ │ │ └── ConfirmDialog.java │ │ └── ExtendedValueListBox.java │ │ ├── input │ │ ├── InputEventHandler.java │ │ ├── HasInputEventHandlers.java │ │ └── InputEvent.java │ │ ├── util │ │ ├── BusyAsyncCallback.java │ │ └── Utils.java │ │ └── AvroUiResources.java │ └── resources │ └── org │ └── kaaproject │ └── avro │ └── ui │ └── gwt │ └── client │ ├── i18n │ ├── AvroUiConstants.properties │ └── AvroUiMessages.properties │ └── AvroUIClient.gwt.xml ├── suppressions.xml ├── .gitignore ├── converter ├── src │ ├── test │ │ ├── resources │ │ │ ├── type-ctl-references.avsc │ │ │ ├── type-references2.avsc │ │ │ ├── type-references.avsc │ │ │ ├── array.avsc │ │ │ ├── union.avsc │ │ │ ├── override-schema.avsc │ │ │ └── single-fields.avsc │ │ └── java │ │ │ └── org │ │ │ └── kaaproject │ │ │ └── avro │ │ │ └── ui │ │ │ └── converter │ │ │ ├── TestCtlSource.java │ │ │ └── TestAvroSchemas.java │ └── main │ │ └── java │ │ └── org │ │ └── kaaproject │ │ └── avro │ │ └── ui │ │ └── converter │ │ ├── CtlSource.java │ │ └── ConverterConstants.java └── pom.xml ├── shared └── src │ └── main │ ├── resources │ └── org │ │ └── kaaproject │ │ └── avro │ │ └── ui │ │ └── shared │ │ └── AvroUIShared.gwt.xml │ └── java │ └── org │ └── kaaproject │ └── avro │ └── ui │ └── shared │ ├── Version.template │ ├── FieldType.java │ ├── FqnField.java │ ├── FqnVersion.java │ ├── SizedField.java │ ├── FormEnum.java │ ├── DependenciesField.java │ ├── FqnKey.java │ ├── AlertField.java │ ├── VersionField.java │ ├── BooleanField.java │ ├── LongField.java │ ├── FloatField.java │ ├── IntegerField.java │ ├── DoubleField.java │ └── FqnReferenceField.java └── checkstyle.xml /README.md: -------------------------------------------------------------------------------- 1 | Avro UI forms generator 2 | ============================ 3 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/resources/org/kaaproject/avro/ui/sandbox/client/i18n/AvroUiSandboxMessages.properties: -------------------------------------------------------------------------------- 1 | 2 | footerMessage = Powered by Avro UI {0} -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/circles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/circles.png -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/close.png -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/remove.png -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/vborder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/vborder.png -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/zoom_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/zoom_out.png -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/circles_ie6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/circles_ie6.png -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/resizeHandle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/resizeHandle.png -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/vborder_ie6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/vborder_ie6.png -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/busyIndicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/busyIndicator.gif -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/arrowBottomImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/arrowBottomImage.png -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/arrowRightImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaaproject/avro-ui/HEAD/gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/images/arrowRightImage.png -------------------------------------------------------------------------------- /suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | output/** 2 | *.class 3 | *.iml 4 | */.idea/** 5 | .idea/** 6 | .idea 7 | *.log 8 | *.log.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] 9 | */.classpath 10 | .classpath 11 | */.project 12 | .project 13 | .cache/** 14 | target/ 15 | .gwt/ 16 | .settings/ 17 | /bin 18 | bin/ 19 | **/dependency-reduced-pom.xml 20 | shared/src/main/java/org/kaaproject/avro/ui/shared/Version.java -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/AvroUiPagerSmall.css: -------------------------------------------------------------------------------- 1 | @external .gwt-HTML; 2 | 3 | .pageDetails, .pageDetails .gwt-HTML { 4 | padding: 4px 8px; 5 | text-align: center; 6 | font-size: 12px; 7 | } 8 | 9 | .button { 10 | padding: 4px; 11 | cursor: pointer; 12 | cursor: hand; 13 | } 14 | 15 | .disabledButton { 16 | cursor: default; 17 | } 18 | -------------------------------------------------------------------------------- /converter/src/test/resources/type-ctl-references.avsc: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "record", 3 | "name" : "test", 4 | "namespace" : "ctl.test", 5 | "fields" : [ { 6 | "name" : "f1", 7 | "type" : [ "org.kaaproject.ctl.TypeA", "null" ] 8 | }, { 9 | "name" : "f2", 10 | "type" : [ "org.kaaproject.ctl.TypeB", "null" ] 11 | } ], 12 | "version" : 1, 13 | "dependencies" : [ { 14 | "fqn" : "org.kaaproject.ctl.TypeA", 15 | "version" : 5 16 | }, { 17 | "fqn" : "org.kaaproject.ctl.TypeB", 18 | "version" : 5 19 | } ] 20 | } -------------------------------------------------------------------------------- /gwt-client/src/main/resources/org/kaaproject/avro/ui/gwt/client/i18n/AvroUiConstants.properties: -------------------------------------------------------------------------------- 1 | 2 | add = Add 3 | 4 | appendStrategy = add items 5 | 6 | back = Back 7 | 8 | busyPopupText = Processing request... 9 | 10 | close = Close 11 | 12 | create = Create 13 | 14 | dataGridEmpty = There is no data to display 15 | 16 | delete = Delete 17 | 18 | empty = Empty 19 | 20 | fqn = FQN 21 | 22 | invalidFqn = Invalid FQN 23 | 24 | no = No 25 | 26 | open = Open 27 | 28 | remove = Remove 29 | 30 | replaceStrategy = replace items 31 | 32 | version = Version 33 | 34 | yes = Yes 35 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/AvroUiDataGridSmall.css: -------------------------------------------------------------------------------- 1 | @def selection-color #336699; 2 | @def selectionBorderWidth 2px; 3 | 4 | .dataGridHeader { 5 | font-family: Arial; 6 | border-bottom: 1px solid #DDDDDD; 7 | font-size: 12px; 8 | padding: 3px 8px; 9 | text-align: left; 10 | text-shadow: none; 11 | color: #666666; 12 | overflow: hidden; 13 | white-space: nowrap; 14 | 15 | } 16 | 17 | .dataGridCell { 18 | padding: 2px 8px; 19 | overflow: hidden; 20 | height: 26px; 21 | font-size: 12px; 22 | vertical-align: inherit !important; 23 | word-break: break-all; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /converter/src/test/resources/type-references2.avsc: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "record", 3 | "name" : "TypeA", 4 | "namespace" : "org.kaaproject.avro.ui.test", 5 | "fields" : [ { 6 | "name" : "testReference3", 7 | "type" : [ { 8 | "type" : "record", 9 | "name" : "TypeC", 10 | "fields" : [ { 11 | "name" : "testReference2", 12 | "type" : [ { 13 | "type" : "record", 14 | "name" : "TypeB", 15 | "fields" : [ { 16 | "name" : "testRecord2", 17 | "type" : [ "TypeC", "null" ] 18 | } ] 19 | }, "null" ] 20 | } ] 21 | }, "null" ] 22 | } ] 23 | } -------------------------------------------------------------------------------- /gwt-client/src/main/resources/org/kaaproject/avro/ui/gwt/client/i18n/AvroUiMessages.properties: -------------------------------------------------------------------------------- 1 | 2 | addNewEntry = Add new {0} 3 | 4 | charactersLength = {0} of {1} max characters 5 | 6 | deleteNestedEntryQuestion = Are you sure you want to delete nested {0} which is value of field ''{1}''? 7 | 8 | deleteNestedEntryTitle = Delete nested entry 9 | 10 | deleteSelectedEntryQuestion = Are you sure you want to delete selected entry? 11 | 12 | deleteSelectedEntryTitle = Delete entry 13 | 14 | detailsMayCloseMessage = You have unsaved changes for ''{0}''. If you navigate away from this form without first saving, all changes will be lost. 15 | 16 | nestedEntry = Nested {0} 17 | 18 | pagerText = Page {0} of {1} 19 | -------------------------------------------------------------------------------- /converter/src/test/resources/type-references.avsc: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "record", 3 | "name" : "TypeA", 4 | "namespace" : "org.kaaproject.avro.ui.test", 5 | "fields" : [ { 6 | "name" : "testRecord1", 7 | "type" : [ { 8 | "type" : "record", 9 | "name" : "TypeB", 10 | "fields" : [ { 11 | "name" : "testRecord2", 12 | "type" : [ { 13 | "type" : "record", 14 | "name" : "TypeC", 15 | "fields" : [ { 16 | "name" : "testReference2", 17 | "type" : [ "TypeB", "null" ] 18 | } ] 19 | }, "null" ] 20 | } ] 21 | }, "null" ] 22 | }, { 23 | "name" : "testReference1", 24 | "type" : [ "TypeB", "null" ] 25 | }, { 26 | "name" : "testReference3", 27 | "type" : [ "TypeC", "null" ] 28 | } ] 29 | } -------------------------------------------------------------------------------- /converter/src/test/resources/array.avsc: -------------------------------------------------------------------------------- 1 | { 2 | "namespace": "org.kaaproject.avro.ui.test", 3 | "type": "record", 4 | "name": "TestArray", 5 | "fields": 6 | [ 7 | { 8 | "name": "testArrayElements", 9 | "displayName": "Test Array Elements", 10 | "minRowCount": 1, 11 | "type": { 12 | "type": "array", 13 | "items": { 14 | "namespace": "org.kaaproject.avro.ui.test", 15 | "type": "record", 16 | "name": "TestArrayRecord", 17 | "fields": [ 18 | {"name": "test", "displayName": "Test field", "maxLength": 1000, "by_default": "", "type": {"type":"string","avro.java.string":"String"}} 19 | ] 20 | } 21 | } 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /shared/src/main/resources/org/kaaproject/avro/ui/shared/AvroUIShared.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/ShowableWidget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget; 18 | 19 | public interface ShowableWidget { 20 | 21 | public void onShown(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/nav/NavigationAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.nav; 18 | 19 | public enum NavigationAction { 20 | 21 | ADD, 22 | EDIT, 23 | VIEW 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/services/cache/JsonCacheService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.services.cache; 18 | 19 | public interface JsonCacheService { 20 | 21 | String putJson(String json); 22 | 23 | String getJson(String jsonKey); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/input/InputEventHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.input; 18 | 19 | import com.google.gwt.event.shared.EventHandler; 20 | 21 | public interface InputEventHandler extends EventHandler { 22 | void onInputChanged(InputEvent event); 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /converter/src/main/java/org/kaaproject/avro/ui/converter/CtlSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.converter; 18 | 19 | import java.util.List; 20 | import java.util.Map; 21 | 22 | import org.kaaproject.avro.ui.shared.Fqn; 23 | 24 | public interface CtlSource { 25 | 26 | Map> getCtlTypes(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/view/HeaderView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp.view; 18 | 19 | import com.google.gwt.user.client.ui.Button; 20 | import com.google.gwt.user.client.ui.IsWidget; 21 | 22 | public interface HeaderView extends IsWidget { 23 | Button getResetButton(); 24 | } 25 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/event/RowActionEventHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid.event; 18 | 19 | import com.google.gwt.event.shared.EventHandler; 20 | 21 | public interface RowActionEventHandler extends EventHandler { 22 | void onRowAction(RowActionEvent event); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/nav/Divider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.nav; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.util.Utils; 20 | 21 | public class Divider extends ListItem { 22 | 23 | public Divider() { 24 | setStyleName(Utils.avroUiStyle.divider()); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/nav/NavigationActionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.nav; 18 | 19 | import org.kaaproject.avro.ui.shared.FormField; 20 | 21 | public interface NavigationActionListener { 22 | 23 | void onAdded(FormField field); 24 | 25 | void onChanged(FormField field); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/input/HasInputEventHandlers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.input; 18 | 19 | import com.google.gwt.event.shared.HandlerRegistration; 20 | import com.google.gwt.event.shared.HasHandlers; 21 | 22 | public interface HasInputEventHandlers extends HasHandlers { 23 | 24 | HandlerRegistration addInputHandler(InputEventHandler handler); 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/place/AvroUiSandboxPlaceHistoryMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp.place; 18 | 19 | import com.google.gwt.place.shared.PlaceHistoryMapper; 20 | import com.google.gwt.place.shared.WithTokenizers; 21 | 22 | @WithTokenizers({MainPlace.Tokenizer.class}) 23 | public interface AvroUiSandboxPlaceHistoryMapper extends PlaceHistoryMapper 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/resources/org/kaaproject/avro/ui/sandbox/client/AvroUiSandboxTheme.css: -------------------------------------------------------------------------------- 1 | @external .gwt-Label, .gwt-HTML; 2 | 3 | .b-app-header-title { 4 | font-family: Arial; 5 | font-size: 34px; 6 | font-weight: bold; 7 | color: #666666; 8 | padding-left: 30px; 9 | } 10 | 11 | .b-app-content-title { 12 | font-family: Arial; 13 | font-size: 18px; 14 | font-weight: bold; 15 | color: #666666; 16 | padding-left: 30px; 17 | } 18 | 19 | .b-app-content-details-table { 20 | padding-left: 35px; 21 | padding-top: 5px; 22 | } 23 | 24 | .b-app-content-details-table td{ 25 | vertical-align: top; 26 | } 27 | 28 | .b-app-content-details-table .gwt-Label, 29 | .b-app-content-details-table .gwt-HTML { 30 | font-family: Arial; 31 | font-size: 14px; 32 | color: #000000; 33 | font-weight: bold; 34 | } 35 | 36 | .b-app-content-details-table .b-app-content-title { 37 | color: #999999; 38 | font-family: Arial; 39 | font-size: 18px; 40 | font-weight: bold; 41 | padding-left: 0px; 42 | } 43 | 44 | .b-app-footer { 45 | font-family: Arial; 46 | font-size: 12px; 47 | color: #666666; 48 | } 49 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/event/HasRowActionEventHandlers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid.event; 18 | 19 | import com.google.gwt.event.shared.HandlerRegistration; 20 | import com.google.gwt.event.shared.HasHandlers; 21 | 22 | public interface HasRowActionEventHandlers extends HasHandlers { 23 | 24 | HandlerRegistration addRowActionHandler(RowActionEventHandler handler); 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/resources/org/kaaproject/avro/ui/sandbox/client/i18n/AvroUiSandboxConstants.properties: -------------------------------------------------------------------------------- 1 | 2 | avroUiSandboxHeaderTitle = Avro UI form 3 | 4 | avroUiView = Avro UI view 5 | 6 | cancel = Cancel 7 | 8 | close = Close 9 | 10 | display_string = Display string 11 | 12 | form = Form 13 | 14 | general_error = Unexpected service error occurred: 15 | 16 | generateRecordForm = Generate record form 17 | 18 | generatedJson = Generated JSON 19 | 20 | jsonToUpload = JSON to upload 21 | 22 | jsonView = JSON view 23 | 24 | mainConsole = Main console 25 | 26 | no = No 27 | 28 | ok = Ok 29 | 30 | read_only = Read only 31 | 32 | recordConstructor = Record constructor 33 | 34 | reset = Reset 35 | 36 | schemaConstructor = Schema constructor 37 | 38 | saveFile = Save file 39 | 40 | showJson = Show JSON 41 | 42 | upload = Upload 43 | 44 | uploadEmptyFileError = Chose not empty file with you schema 45 | 46 | uploadFromFile = Upload from file 47 | 48 | loadJson = Load JSON 49 | 50 | view_display_string = View display string 51 | 52 | yes = Yes 53 | 54 | unableToGenerateJsonIncompleteRecordForm = JSON could not be generated due to the incomplete data form 55 | -------------------------------------------------------------------------------- /converter/src/test/resources/union.avsc: -------------------------------------------------------------------------------- 1 | { 2 | "namespace": "org.kaaproject.avro.ui.test", 3 | "type": "record", 4 | "name": "TestUnion", 5 | "fields": 6 | [ 7 | {"name": "unionField", 8 | "displayName": "Union Field", 9 | "type": 10 | [ 11 | { 12 | "type": "record", 13 | "namespace": "org.kaaproject.avro.ui.test", 14 | "name": "FirstRecord", 15 | "displayName": "First Record", 16 | "fields": [ 17 | {"name": "test", "displayName": "Test field", "maxLength": 1000, "by_default": "", "type": {"type":"string","avro.java.string":"String"}} 18 | ] 19 | }, 20 | { 21 | "type": "record", 22 | "namespace": "org.kaaproject.avro.ui.test", 23 | "name": "SecondRecord", 24 | "displayName": "Second Record", 25 | "fields": [ 26 | {"name": "test", "displayName": "Test field", "maxLength": 1000, "by_default": "", "type": {"type":"string","avro.java.string":"String"}} 27 | ] 28 | } 29 | ] 30 | } 31 | ] 32 | } -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/nav/NavigationContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.nav; 18 | 19 | import org.kaaproject.avro.ui.shared.FormField; 20 | 21 | public interface NavigationContainer { 22 | 23 | void goBack(); 24 | 25 | void gotoIndex(int index); 26 | 27 | void showField(FormField field, NavigationActionListener listener); 28 | 29 | void addNewField(FormField field, NavigationActionListener listener); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/AvroUiPagerResourcesSmall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid; 18 | 19 | import com.google.gwt.user.cellview.client.SimplePager; 20 | 21 | public interface AvroUiPagerResourcesSmall extends SimplePager.Resources { 22 | 23 | @Override 24 | @Source("AvroUiPagerSmall.css") 25 | AvroUiPagerSmallStyle simplePagerStyle(); 26 | 27 | public interface AvroUiPagerSmallStyle extends SimplePager.Style {} 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /gwt-client/src/main/resources/org/kaaproject/avro/ui/gwt/client/AvroUIClient.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/view/MainView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp.view; 18 | 19 | import com.google.gwt.user.client.ui.IsWidget; 20 | 21 | public interface MainView extends IsWidget { 22 | 23 | void clearMessages(); 24 | 25 | void setErrorMessage(String message); 26 | 27 | void setInfoMessage(String message); 28 | 29 | FormConstructorView getSchemaConstructorView(); 30 | 31 | FormConstructorView getRecordConstructorView(); 32 | 33 | void reset(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/choosen/AvroChoosenResources.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.choosen; 18 | 19 | import com.watopi.chosen.client.resources.ChozenCss; 20 | import com.watopi.chosen.client.resources.Resources; 21 | 22 | public interface AvroChoosenResources extends Resources { 23 | 24 | @Override 25 | @Source({ "com/watopi/chosen/client/resources/chozen.css", 26 | "avroChozen.css" }) 27 | AvroChoosenCss css(); 28 | 29 | } 30 | 31 | interface AvroChoosenCss extends ChozenCss {} 32 | -------------------------------------------------------------------------------- /converter/src/test/resources/override-schema.avsc: -------------------------------------------------------------------------------- 1 | { 2 | "type" : "record", 3 | "name" : "DefaultSchema", 4 | "namespace" : "org.kaa.config", 5 | "fields" : [ { 6 | "name" : "Properties", 7 | "type" : [ { 8 | "type" : "array", 9 | "items" : { 10 | "type" : "record", 11 | "name" : "Property", 12 | "namespace" : "config.system", 13 | "fields" : [ { 14 | "name" : "name", 15 | "type" : [ "string", { 16 | "type" : "enum", 17 | "name" : "unchangedT", 18 | "namespace" : "org.kaaproject.configuration", 19 | "symbols" : [ "unchanged" ] 20 | } ] 21 | }, { 22 | "name" : "value", 23 | "type" : [ "string", "org.kaaproject.configuration.unchangedT" ] 24 | }, { 25 | "name" : "__uuid", 26 | "type" : [ { 27 | "type" : "fixed", 28 | "name" : "uuidT", 29 | "namespace" : "org.kaaproject.configuration", 30 | "size" : 16 31 | }, "null" ] 32 | } ] 33 | } 34 | }, "org.kaaproject.configuration.unchangedT" ] 35 | }, { 36 | "name" : "__uuid", 37 | "type" : [ "org.kaaproject.configuration.uuidT", "null" ] 38 | } ] 39 | } -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/AvroUiGridResourcesSmall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid; 18 | 19 | import com.google.gwt.user.cellview.client.DataGrid; 20 | 21 | public interface AvroUiGridResourcesSmall extends AvroUiGridResources { 22 | 23 | @Override 24 | @Source({ DataGrid.Style.DEFAULT_CSS, 25 | "AvroUiDataGrid.css", 26 | "AvroUiDataGridSmall.css"}) 27 | AvroUiGridSmallStyle dataGridStyle(); 28 | 29 | public interface AvroUiGridSmallStyle extends AvroUiGridResources.AvroUiGridStyle {} 30 | } 31 | 32 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/ClientFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp; 18 | 19 | import org.kaaproject.avro.ui.sandbox.client.mvp.view.HeaderView; 20 | import org.kaaproject.avro.ui.sandbox.client.mvp.view.MainView; 21 | 22 | import com.google.gwt.place.shared.PlaceController; 23 | import com.google.web.bindery.event.shared.EventBus; 24 | 25 | public interface ClientFactory { 26 | EventBus getEventBus(); 27 | PlaceController getPlaceController(); 28 | 29 | HeaderView getHeaderView(); 30 | 31 | MainView getMainView(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/AvroUiGridResources.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid; 18 | 19 | import com.google.gwt.user.cellview.client.DataGrid; 20 | 21 | public interface AvroUiGridResources extends DataGrid.Resources { 22 | 23 | @Override 24 | @Source({ DataGrid.Style.DEFAULT_CSS, 25 | "AvroUiDataGrid.css" }) 26 | AvroUiGridStyle dataGridStyle(); 27 | 28 | public interface AvroUiGridStyle extends DataGrid.Style { 29 | 30 | String dataGridColumnInvisible(); 31 | 32 | } 33 | } 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/LongBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources.AvroUiStyle; 20 | 21 | import com.google.gwt.dom.client.Document; 22 | 23 | public class LongBox extends NumberBox { 24 | public LongBox(AvroUiStyle style, String prompt, String numberFormatPattern) { 25 | super(style, Document.get().createTextInputElement(), prompt, new NumberRenderer( 26 | numberFormatPattern, false), new LongParser(numberFormatPattern)); 27 | setDecimal(false); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/FloatBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources.AvroUiStyle; 20 | 21 | import com.google.gwt.dom.client.Document; 22 | 23 | public class FloatBox extends NumberBox { 24 | public FloatBox(AvroUiStyle style, String prompt, String numberFormatPattern) { 25 | super(style, Document.get().createTextInputElement(), prompt, new NumberRenderer( 26 | numberFormatPattern, true), new FloatParser(numberFormatPattern)); 27 | setDecimal(true); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/DoubleBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources.AvroUiStyle; 20 | 21 | import com.google.gwt.dom.client.Document; 22 | 23 | public class DoubleBox extends NumberBox { 24 | public DoubleBox(AvroUiStyle style, String prompt, String numberFormatPattern) { 25 | super(style, Document.get().createTextInputElement(), prompt, new NumberRenderer( 26 | numberFormatPattern, true), new DoubleParser(numberFormatPattern)); 27 | setDecimal(true); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/IntegerBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources.AvroUiStyle; 20 | 21 | import com.google.gwt.dom.client.Document; 22 | 23 | public class IntegerBox extends NumberBox { 24 | public IntegerBox(AvroUiStyle style, String prompt, String numberFormatPattern) { 25 | super(style, Document.get().createTextInputElement(), prompt, new NumberRenderer( 26 | numberFormatPattern, false), new IntegerParser(numberFormatPattern)); 27 | setDecimal(false); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/Version.template: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | /* 20 | * This code is automatically generated. In order to change content of this class edit Version.template file 21 | */ 22 | 23 | /** 24 | * The Class Version provides access to useful project version information. 25 | * This information is populated during pre-compilation phase. 26 | */ 27 | public final class Version { 28 | 29 | /** The Constant PROJECT_VERSION. */ 30 | public static final String PROJECT_VERSION = "@projectVersion@"; 31 | 32 | /** 33 | * Instantiates a new version. 34 | */ 35 | private Version(){ 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/place/MainPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.kaaproject.avro.ui.sandbox.client.mvp.place; 17 | 18 | import com.google.gwt.place.shared.Place; 19 | import com.google.gwt.place.shared.PlaceTokenizer; 20 | import com.google.gwt.place.shared.Prefix; 21 | 22 | public class MainPlace extends Place { 23 | 24 | @Prefix(value = "main") 25 | public static class Tokenizer implements PlaceTokenizer { 26 | 27 | @Override 28 | public MainPlace getPlace(String token) { 29 | return new MainPlace(); 30 | } 31 | 32 | @Override 33 | public String getToken(MainPlace place) { 34 | return ""; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/shared/services/AvroUiSandboxServiceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.shared.services; 18 | 19 | public class AvroUiSandboxServiceException extends Exception { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public AvroUiSandboxServiceException() { 24 | super(); 25 | } 26 | public AvroUiSandboxServiceException(String message) { 27 | super(message); 28 | } 29 | 30 | public AvroUiSandboxServiceException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | 34 | public AvroUiSandboxServiceException(Throwable cause) { 35 | super(cause); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /converter/src/test/resources/single-fields.avsc: -------------------------------------------------------------------------------- 1 | { 2 | "namespace": "org.kaaproject.avro.ui.test", 3 | "type": "record", 4 | "name": "Test", 5 | "fields": [ 6 | {"name": "testString", "displayName": "Test string field", "maxLength": 1000, "by_default": "default string", "type": {"type":"string","avro.java.string":"String"}}, 7 | {"name": "testPasswordString", "displayName": "Test password string field", "maxLength": 1000, "by_default": "default password", "inputType": "password", "type": {"type":"string","avro.java.string":"String"}}, 8 | {"name": "testInteger", "displayName": "Test integer field", "by_default": 20, "type": "int"}, 9 | {"name": "testLong", "displayName": "Test long field", "by_default": 30, "type": "long"}, 10 | {"name": "testBoolean", "displayName": "Test boolean field", "by_default": true, "type": "boolean"}, 11 | {"name": "testEnum", "displayName": "Test enum field", "by_default": "VALUE_TWO", "displayNames" : ["Value One", "Value Two", "Value Three"], 12 | "type": { 13 | "namespace": "org.kaaproject.avro.ui.test", 14 | "type": "enum", 15 | "name": "TestEnum", 16 | "symbols" : ["VALUE_ONE", "VALUE_TWO", "VALUE_THREE"] 17 | } 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/nav/NavLink.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.nav; 18 | 19 | import com.google.gwt.user.client.ui.HasText; 20 | 21 | public class NavLink extends NavWidget implements HasText { 22 | 23 | public NavLink() { 24 | super(); 25 | } 26 | 27 | public NavLink(String text) { 28 | super(); 29 | setText(text); 30 | } 31 | 32 | public NavLink(String text, String href) { 33 | super(); 34 | setText(text); 35 | setHref(href); 36 | } 37 | 38 | public NavLink(String text, String href, String target) { 39 | super(); 40 | setText(text); 41 | setHref(href); 42 | setTarget(target); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/activity/HeaderActivityMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp.activity; 18 | 19 | import org.kaaproject.avro.ui.sandbox.client.mvp.ClientFactory; 20 | 21 | import com.google.gwt.activity.shared.Activity; 22 | import com.google.gwt.activity.shared.ActivityMapper; 23 | import com.google.gwt.place.shared.Place; 24 | 25 | public class HeaderActivityMapper implements ActivityMapper { 26 | 27 | private final HeaderActivity headerActivity; 28 | 29 | public HeaderActivityMapper(ClientFactory clientFactory) { 30 | super(); 31 | this.headerActivity = new HeaderActivity(clientFactory); 32 | } 33 | 34 | @Override 35 | public Activity getActivity(Place place) { 36 | return headerActivity; 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/input/InputEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.input; 18 | 19 | import com.google.gwt.event.shared.GwtEvent; 20 | import com.google.gwt.user.client.ui.Widget; 21 | 22 | public class InputEvent extends GwtEvent{ 23 | public static Type TYPE = new Type(); 24 | 25 | private final Widget source; 26 | 27 | public InputEvent(Widget source) { 28 | this.source = source; 29 | } 30 | 31 | public Widget getSource() { 32 | return source; 33 | } 34 | 35 | @Override 36 | public Type getAssociatedType() { 37 | return TYPE; 38 | } 39 | 40 | @Override 41 | protected void dispatch(InputEventHandler handler) { 42 | handler.onInputChanged(this); 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/util/BusyAsyncCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.util; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.widget.BusyPopup; 20 | 21 | import com.google.gwt.user.client.rpc.AsyncCallback; 22 | 23 | public abstract class BusyAsyncCallback implements AsyncCallback { 24 | 25 | public BusyAsyncCallback() { 26 | BusyPopup.showPopup(); 27 | } 28 | 29 | @Override 30 | public void onFailure(Throwable caught) { 31 | BusyPopup.hidePopup(); 32 | onFailureImpl(caught); 33 | } 34 | 35 | @Override 36 | public void onSuccess(T result) { 37 | BusyPopup.hidePopup(); 38 | onSuccessImpl(result); 39 | } 40 | 41 | public abstract void onFailureImpl(Throwable caught); 42 | 43 | public abstract void onSuccessImpl(T result); 44 | } 45 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/nav/ListItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.nav; 18 | 19 | import com.google.gwt.user.client.DOM; 20 | import com.google.gwt.user.client.ui.ComplexPanel; 21 | import com.google.gwt.user.client.ui.HasWidgets; 22 | import com.google.gwt.user.client.ui.Widget; 23 | 24 | public class ListItem extends ComplexPanel implements HasWidgets { 25 | 26 | @SuppressWarnings("deprecation") 27 | public ListItem() { 28 | setElement(DOM.createElement("li")); 29 | } 30 | 31 | @SuppressWarnings("deprecation") 32 | @Override 33 | public void add(Widget w) { 34 | add(w, getElement()); 35 | } 36 | 37 | public ListItem(Widget... widgets) { 38 | this(); 39 | for (Widget w : widgets) { 40 | add(w); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/nav/UnorderedList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.nav; 18 | 19 | import com.google.gwt.user.client.DOM; 20 | import com.google.gwt.user.client.ui.ComplexPanel; 21 | import com.google.gwt.user.client.ui.HasWidgets; 22 | import com.google.gwt.user.client.ui.Widget; 23 | 24 | public class UnorderedList extends ComplexPanel implements HasWidgets { 25 | 26 | @SuppressWarnings("deprecation") 27 | public UnorderedList() { 28 | setElement(DOM.createElement("ul")); 29 | } 30 | 31 | @SuppressWarnings("deprecation") 32 | @Override 33 | public void add(Widget w) { 34 | add(w, getElement()); 35 | } 36 | 37 | public UnorderedList(ListItem... widgets) { 38 | this(); 39 | for (ListItem li : widgets) { 40 | add(li); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/services/JsonCacheServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.services; 18 | 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | import org.apache.commons.lang3.RandomStringUtils; 23 | import org.kaaproject.avro.ui.sandbox.services.cache.JsonCacheService; 24 | import org.springframework.stereotype.Service; 25 | 26 | @Service("jsonCacheService") 27 | public class JsonCacheServiceImpl implements JsonCacheService { 28 | 29 | private Map uploadedJsonMap = new HashMap<>(); 30 | 31 | @Override 32 | public String putJson(String json) { 33 | String jsonKey = RandomStringUtils.randomAlphanumeric(10); 34 | uploadedJsonMap.put(jsonKey, json); 35 | return jsonKey; 36 | } 37 | 38 | @Override 39 | public String getJson(String jsonKey) { 40 | return uploadedJsonMap.remove(jsonKey); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/view/FormConstructorView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp.view; 18 | 19 | import com.google.gwt.user.client.ui.Button; 20 | import com.google.gwt.user.client.ui.FormPanel; 21 | import org.kaaproject.avro.ui.shared.RecordField; 22 | 23 | import com.google.gwt.event.dom.client.HasClickHandlers; 24 | import com.google.gwt.user.client.ui.HasValue; 25 | import com.google.gwt.user.client.ui.IsWidget; 26 | 27 | public interface FormConstructorView extends IsWidget, HasValue { 28 | 29 | HasValue getFormJson(); 30 | 31 | void setFormJson(String json); 32 | 33 | Button getGenerateRecordButton(); 34 | 35 | Button getDownloadJsonButton(); 36 | 37 | HasClickHandlers getShowJsonButton(); 38 | 39 | FormPanel getUploadFileForm(); 40 | 41 | HasClickHandlers getUploadJSONButton(); 42 | 43 | void fireChanged(); 44 | 45 | void reset(); 46 | } 47 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/layout/SimpleWidgetPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.layout; 18 | 19 | import com.google.gwt.user.client.ui.AcceptsOneWidget; 20 | import com.google.gwt.user.client.ui.IsWidget; 21 | import com.google.gwt.user.client.ui.LayoutPanel; 22 | import com.google.gwt.user.client.ui.Widget; 23 | 24 | public class SimpleWidgetPanel extends LayoutPanel implements AcceptsOneWidget { 25 | 26 | private Widget widget; 27 | 28 | @Override 29 | public void setWidget(IsWidget w) { 30 | setOneWidget(asWidgetOrNull(w)); 31 | } 32 | 33 | private void setOneWidget(Widget w) { 34 | // validate 35 | if (w == widget) { 36 | return; 37 | } 38 | 39 | // remove the old widget 40 | if (widget != null) { 41 | super.remove(widget); 42 | } 43 | 44 | // logical attach 45 | widget = w; 46 | 47 | if (w != null) { 48 | super.add(w); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /gwt-sandbox/src/main/webapp/AvroUiSandbox.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Avro Ui Sandbox Web Console 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/FormEnumListBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget; 18 | 19 | import java.io.IOException; 20 | 21 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources.AvroUiStyle; 22 | import org.kaaproject.avro.ui.shared.FormEnum; 23 | 24 | import com.google.gwt.text.shared.Renderer; 25 | 26 | public class FormEnumListBox extends ExtendedValueListBox { 27 | 28 | public FormEnumListBox(AvroUiStyle style, String promptText) { 29 | super(new FormEnumRenderer(), style, promptText); 30 | } 31 | 32 | static class FormEnumRenderer implements Renderer { 33 | 34 | @Override 35 | public String render(FormEnum object) { 36 | return object != null ? object.getDisplayValue() : ""; 37 | } 38 | 39 | @Override 40 | public void render(FormEnum object, Appendable appendable) 41 | throws IOException { 42 | appendable.append(render(object)); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/cell/LinkCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid.cell; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.util.Utils; 20 | 21 | import com.google.gwt.cell.client.ClickableTextCell; 22 | import com.google.gwt.safehtml.shared.SafeHtml; 23 | import com.google.gwt.safehtml.shared.SafeHtmlBuilder; 24 | 25 | 26 | public class LinkCell extends ClickableTextCell { 27 | 28 | String style; 29 | public LinkCell() 30 | { 31 | super(); 32 | style = Utils.avroUiStyle.linkCell(); 33 | } 34 | 35 | 36 | @Override 37 | protected void render(Context context, SafeHtml value, SafeHtmlBuilder sb) { 38 | if (value != null) { 39 | sb.appendHtmlConstant("
"); 40 | sb.append(value); 41 | sb.appendHtmlConstant("
"); 42 | } 43 | } 44 | 45 | public void addStyleName(String style) 46 | { 47 | this.style = style; 48 | } 49 | 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/AvroUiSandboxResources.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client; 18 | 19 | import com.google.gwt.resources.client.ClientBundle; 20 | import com.google.gwt.resources.client.CssResource; 21 | import com.google.gwt.resources.client.CssResource.NotStrict; 22 | import com.google.gwt.resources.client.ImageResource; 23 | import com.google.gwt.resources.client.ImageResource.ImageOptions; 24 | 25 | public interface AvroUiSandboxResources extends ClientBundle { 26 | 27 | public interface KaaTheme extends CssResource { 28 | 29 | String DEFAULT_CSS = "KaaTheme.css"; 30 | 31 | } 32 | 33 | public interface AvroUiSandboxStyle extends AvroUiSandboxTheme { 34 | 35 | String DEFAULT_CSS = "AvroUiSandboxTheme.css"; 36 | 37 | } 38 | 39 | @NotStrict 40 | @Source(KaaTheme.DEFAULT_CSS) 41 | KaaTheme kaaTheme(); 42 | 43 | @NotStrict 44 | @Source(AvroUiSandboxStyle.DEFAULT_CSS) 45 | AvroUiSandboxStyle avroUiSandboxStyle(); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/FiltrableStringColumn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid; 18 | 19 | import com.google.gwt.cell.client.Cell; 20 | import com.google.gwt.user.cellview.client.Column; 21 | 22 | public abstract class FiltrableStringColumn extends Column { 23 | 24 | private String filterString = ""; 25 | 26 | public FiltrableStringColumn(Cell cell) { 27 | super(cell); 28 | } 29 | 30 | public String getFilterString() { 31 | return filterString; 32 | } 33 | 34 | public void setFilterString(String filterString) { 35 | this.filterString = filterString; 36 | } 37 | 38 | public boolean isFilterEmpty() { 39 | return filterString == null || filterString.isEmpty(); 40 | } 41 | 42 | public boolean matched(T object) { 43 | if (!isFilterEmpty()) { 44 | String value = getValue(object); 45 | return value != null ? value.toLowerCase().contains(filterString.toLowerCase()) : false; 46 | } else { 47 | return true; 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/activity/AvroUiSandboxActivityMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp.activity; 18 | 19 | import org.kaaproject.avro.ui.sandbox.client.mvp.ClientFactory; 20 | import org.kaaproject.avro.ui.sandbox.client.mvp.place.MainPlace; 21 | 22 | import com.google.gwt.activity.shared.Activity; 23 | import com.google.gwt.activity.shared.ActivityMapper; 24 | import com.google.gwt.place.shared.Place; 25 | 26 | public class AvroUiSandboxActivityMapper implements ActivityMapper { 27 | 28 | private final ClientFactory clientFactory; 29 | 30 | public AvroUiSandboxActivityMapper(ClientFactory clientFactory) { 31 | super(); 32 | this.clientFactory = clientFactory; 33 | } 34 | 35 | @Override 36 | public Activity getActivity(Place place) { 37 | 38 | if (place != null) { 39 | Class clazz = place.getClass(); 40 | 41 | if (clazz == MainPlace.class) { 42 | return new MainActivity((MainPlace)place, clientFactory); 43 | } 44 | 45 | } 46 | 47 | return null; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /converter/src/test/java/org/kaaproject/avro/ui/converter/TestCtlSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.converter; 18 | 19 | import java.util.Arrays; 20 | import java.util.HashMap; 21 | import java.util.List; 22 | import java.util.Map; 23 | 24 | import org.kaaproject.avro.ui.shared.Fqn; 25 | 26 | public class TestCtlSource implements CtlSource { 27 | 28 | private Map> ctlTypes = new HashMap<>(); 29 | { 30 | ctlTypes.put(new Fqn("org.kaaproject.ctl.TypeA"), Arrays.asList(1,2,3,4,5)); 31 | ctlTypes.put(new Fqn("org.kaaproject.ctl.TypeB"), Arrays.asList(1,5)); 32 | ctlTypes.put(new Fqn("org.kaaproject.ctl.TypeC"), Arrays.asList(1,2,3,4,5)); 33 | ctlTypes.put(new Fqn("org.kaaproject.ctl.TypeD"), Arrays.asList(1,2,3,4,10,20)); 34 | ctlTypes.put(new Fqn("org.kaaproject.ctl.TypeE"), Arrays.asList(2,3,4,50)); 35 | ctlTypes.put(new Fqn("org.kaaproject.ctl.TypeF"), Arrays.asList(1,20,30,40,50)); 36 | ctlTypes.put(new Fqn("org.kaaproject.ctl.TypeG"), Arrays.asList(1,22,35,47,51)); 37 | } 38 | 39 | @Override 40 | public Map> getCtlTypes() { 41 | return ctlTypes; 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/view/header/HeaderViewImpl.ui.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/services/util/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 20142-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.services.util; 18 | 19 | import org.kaaproject.avro.ui.sandbox.shared.services.AvroUiSandboxServiceException; 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | public class Utils { 24 | 25 | /** The Constant logger. */ 26 | private static final Logger logger = LoggerFactory.getLogger(Utils.class); 27 | 28 | public static AvroUiSandboxServiceException handleException(Exception exception) { 29 | return handleException(exception, true); 30 | } 31 | 32 | public static AvroUiSandboxServiceException handleException(Exception exception, boolean logException) { 33 | if (logException) { 34 | logger.error("Unexpected exception catched!", exception); 35 | } 36 | if (exception instanceof AvroUiSandboxServiceException) { 37 | return (AvroUiSandboxServiceException)exception; 38 | } 39 | else { 40 | AvroUiSandboxServiceException sandboxServiceException = 41 | new AvroUiSandboxServiceException(exception.getMessage()); 42 | return sandboxServiceException; 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/shared/services/AvroUiSandboxService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.shared.services; 18 | 19 | import org.kaaproject.avro.ui.shared.RecordField; 20 | 21 | import com.google.gwt.user.client.rpc.RemoteService; 22 | import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; 23 | 24 | @RemoteServiceRelativePath("springGwtServices/avroUiSandboxService") 25 | public interface AvroUiSandboxService extends RemoteService { 26 | 27 | public RecordField generateFormFromSchema(String avroSchema) throws AvroUiSandboxServiceException; 28 | 29 | public String getJsonStringFromRecord(RecordField field) throws AvroUiSandboxServiceException; 30 | 31 | public RecordField generateFormDataFromJson(String avroSchema, String json) throws AvroUiSandboxServiceException; 32 | 33 | public RecordField getEmptySchemaForm() throws AvroUiSandboxServiceException; 34 | 35 | public RecordField generateSchemaFormFromSchema(String avroSchema) throws AvroUiSandboxServiceException; 36 | 37 | public String getJsonStringFromSchemaForm(RecordField field) throws AvroUiSandboxServiceException; 38 | 39 | public String uploadJsonToFile(String json) throws AvroUiSandboxServiceException; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/FieldType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | public enum FieldType { 20 | 21 | RECORD("Record", true), 22 | STRING("String"), 23 | INT("Integer"), 24 | LONG("Long"), 25 | FLOAT("Float"), 26 | DOUBLE("Double"), 27 | BOOLEAN("Boolean"), 28 | BYTES("Bytes"), 29 | ENUM("Enumeration"), 30 | ARRAY("Array", true), 31 | UNION("Union", true), 32 | FIXED("Fixed"), 33 | TYPE_REFERENCE("FqnReference"), 34 | ALERT("Alert"), 35 | VERSION("Version"), 36 | DEPENDENCIES("Dependencies", true); 37 | 38 | private boolean isComplex; 39 | private String name; 40 | private String displayName; 41 | 42 | FieldType(String displayName) { 43 | this(displayName, false); 44 | } 45 | 46 | FieldType(String displayName, boolean isComplex) { 47 | this.displayName = displayName; 48 | this.isComplex = isComplex; 49 | this.name = this.name().toLowerCase(); 50 | } 51 | 52 | public boolean isComplex() { 53 | return isComplex; 54 | } 55 | 56 | public String getName() { 57 | return name; 58 | } 59 | 60 | public String getDisplayName() { 61 | return displayName; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/event/RowActionEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid.event; 18 | 19 | import com.google.gwt.event.shared.GwtEvent; 20 | 21 | public class RowActionEvent extends GwtEvent>{ 22 | 23 | public static final int CLICK = 1; 24 | public static final int DELETE = 2; 25 | public static final int MAX_ACTION = DELETE; 26 | 27 | private static Type> TYPE; 28 | 29 | private final K clickedId; 30 | private final int action; 31 | 32 | public RowActionEvent(K clickedId, int action) { 33 | this.clickedId = clickedId; 34 | this.action = action; 35 | } 36 | 37 | public K getClickedId() { 38 | return clickedId; 39 | } 40 | 41 | public int getAction() { 42 | return action; 43 | } 44 | 45 | public static Type> getType() { 46 | if (TYPE == null) { 47 | TYPE = new Type>(); 48 | } 49 | return TYPE; 50 | } 51 | 52 | @SuppressWarnings({ "unchecked", "rawtypes" }) 53 | @Override 54 | public Type> getAssociatedType() { 55 | return (Type) TYPE; 56 | } 57 | 58 | @Override 59 | protected void dispatch(RowActionEventHandler handler) { 60 | handler.onRowAction(this); 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/choosen/avroChozen.css: -------------------------------------------------------------------------------- 1 | 2 | .chzn-container { 3 | font-size: 12px; 4 | position: relative; 5 | display: inline-block; 6 | zoom: 1; 7 | white-space: pre; 8 | /* *display: inline;*/ 9 | } 10 | 11 | .chzn-container-multi .chzn-choices { 12 | padding : 2px; 13 | line-height : 18px; 14 | background-color : #fff; 15 | border : 1px solid #ccc; 16 | -webkit-border-radius : 3px; 17 | -moz-border-radius : 3px; 18 | border-radius : 3px; 19 | -webkit-box-shadow : inset 0 1px 1px rgba(0, 0, 0, 0.075); 20 | -moz-box-shadow : inset 0 1px 1px rgba(0, 0, 0, 0.075); 21 | box-shadow : inset 0 1px 1px rgba(0, 0, 0, 0.075); 22 | -webkit-transition : border linear 0.2s, box-shadow linear 0.2s; 23 | -moz-transition : border linear 0.2s, box-shadow linear 0.2s; 24 | -ms-transition : border linear 0.2s, box-shadow linear 0.2s; 25 | -o-transition : border linear 0.2s, box-shadow linear 0.2s; 26 | transition : border linear 0.2s, box-shadow linear 0.2s; 27 | } 28 | 29 | .chzn-container-active .chzn-choices { 30 | border-color: rgba(82, 168, 236, 0.8); 31 | outline: 0; 32 | outline: thin dotted \9; 33 | /* IE6-9 */ 34 | 35 | -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); 36 | -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); 37 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); 38 | 39 | } 40 | 41 | .chzn-container-multi .chzn-choices .search-field input { 42 | width: 100%; 43 | color: #666; 44 | background: transparent !important; 45 | border: 0 !important; 46 | font-family: sans-serif; 47 | font-size: 100%; 48 | height: 15px; 49 | padding: 5px; 50 | margin: 1px 0; 51 | outline: 0; 52 | -webkit-box-shadow: none; 53 | -moz-box-shadow : none; 54 | -o-box-shadow : none; 55 | box-shadow : none; 56 | } 57 | 58 | .chzn-container-multi .chzn-choices .search-field .default input { 59 | width: 100%; 60 | } 61 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/resources/avro-ui-sandbox-logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | %d{ISO8601} [%thread] %-5level %logger{36} - %msg%n 21 | 22 | 23 | 24 | 25 | ${server_log_dir}/avro-ui-sandbox.log 26 | 27 | logFile.%d{yyyy-MM-dd}.log 28 | 30 29 | 30 | 31 | %d{ISO8601} [%thread] %-5level %logger{36} - %msg%n 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/ClientFactoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp; 18 | 19 | import org.kaaproject.avro.ui.sandbox.client.mvp.view.HeaderView; 20 | import org.kaaproject.avro.ui.sandbox.client.mvp.view.MainView; 21 | import org.kaaproject.avro.ui.sandbox.client.mvp.view.header.HeaderViewImpl; 22 | import org.kaaproject.avro.ui.sandbox.client.mvp.view.main.MainViewImpl; 23 | 24 | import com.google.gwt.place.shared.PlaceController; 25 | import com.google.web.bindery.event.shared.EventBus; 26 | import com.google.web.bindery.event.shared.SimpleEventBus; 27 | 28 | public class ClientFactoryImpl implements ClientFactory { 29 | 30 | private final EventBus eventBus = new SimpleEventBus(); 31 | private final PlaceController placeController = new PlaceController(eventBus); 32 | 33 | private final HeaderView headerView = new HeaderViewImpl(); 34 | 35 | private final MainView mainView = new MainViewImpl(); 36 | 37 | 38 | @Override 39 | public EventBus getEventBus() { 40 | return eventBus; 41 | } 42 | 43 | @Override 44 | public PlaceController getPlaceController() { 45 | return placeController; 46 | } 47 | 48 | @Override 49 | public HeaderView getHeaderView() { 50 | return headerView; 51 | } 52 | 53 | @Override 54 | public MainView getMainView() { 55 | return mainView; 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/util/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.util; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources; 20 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources.AvroUiStyle; 21 | import org.kaaproject.avro.ui.gwt.client.i18n.AvroUiConstants; 22 | import org.kaaproject.avro.ui.gwt.client.i18n.AvroUiMessages; 23 | 24 | import com.google.gwt.core.client.GWT; 25 | 26 | public class Utils { 27 | 28 | public static final AvroUiResources resources = GWT 29 | .create(AvroUiResources.class); 30 | 31 | public static final AvroUiMessages messages = GWT.create( 32 | AvroUiMessages.class); 33 | 34 | public static final AvroUiConstants constants = GWT.create( 35 | AvroUiConstants.class); 36 | 37 | public static final AvroUiStyle avroUiStyle = resources.avroUiStyle(); 38 | 39 | public static boolean isNotBlank(String string) { 40 | return string != null && string.length() > 0; 41 | } 42 | 43 | public static boolean isNotBlank(CharSequence cs) { 44 | return cs != null && cs.length() > 0; 45 | } 46 | 47 | public static boolean isBlank(String string) { 48 | return string == null || string.length() == 0; 49 | } 50 | 51 | public static boolean isBlank(CharSequence cs) { 52 | return cs == null || cs.length() == 0; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/FieldWidgetPanel.ui.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/activity/HeaderActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp.activity; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import org.kaaproject.avro.ui.sandbox.client.mvp.ClientFactory; 23 | import org.kaaproject.avro.ui.sandbox.client.mvp.view.HeaderView; 24 | 25 | import com.google.gwt.activity.shared.AbstractActivity; 26 | import com.google.gwt.event.shared.EventBus; 27 | import com.google.gwt.event.shared.HandlerRegistration; 28 | import com.google.gwt.user.client.ui.AcceptsOneWidget; 29 | 30 | public class HeaderActivity extends AbstractActivity { 31 | 32 | private final HeaderView headerView; 33 | 34 | protected List registrations = new ArrayList(); 35 | 36 | public HeaderActivity(ClientFactory clientFactory) { 37 | this.headerView = clientFactory.getHeaderView(); 38 | } 39 | 40 | @Override 41 | public void start(AcceptsOneWidget containerWidget, EventBus eventBus) { 42 | bind(headerView, eventBus); 43 | containerWidget.setWidget(headerView.asWidget()); 44 | } 45 | 46 | @Override 47 | public void onStop() { 48 | for (HandlerRegistration registration : registrations) { 49 | registration.removeHandler(); 50 | } 51 | registrations.clear(); 52 | } 53 | 54 | private void bind(final HeaderView headerView, final EventBus eventBus) { 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/layout/AppLayout.ui.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/ColumnFilterEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid; 18 | 19 | import com.google.gwt.event.shared.EventHandler; 20 | import com.google.gwt.event.shared.GwtEvent; 21 | import com.google.gwt.event.shared.HandlerRegistration; 22 | import com.google.gwt.event.shared.HasHandlers; 23 | 24 | public class ColumnFilterEvent extends GwtEvent { 25 | 26 | public static interface Handler extends EventHandler { 27 | 28 | void onColumnFilter(ColumnFilterEvent event); 29 | 30 | } 31 | 32 | public static interface HasColumnFilterEventHandlers extends HasHandlers { 33 | 34 | HandlerRegistration addColumnFilterEventHandler(ColumnFilterEvent.Handler handler); 35 | 36 | } 37 | 38 | private static Type TYPE; 39 | 40 | public static ColumnFilterEvent fire(HasColumnFilterEventHandlers source) { 41 | ColumnFilterEvent event = new ColumnFilterEvent(); 42 | if (TYPE != null) { 43 | source.fireEvent(event); 44 | } 45 | return event; 46 | } 47 | 48 | public static Type getType() { 49 | if (TYPE == null) { 50 | TYPE = new Type(); 51 | } 52 | return TYPE; 53 | } 54 | 55 | protected ColumnFilterEvent() { 56 | } 57 | 58 | @Override 59 | public Type getAssociatedType() { 60 | return TYPE; 61 | } 62 | 63 | @Override 64 | protected void dispatch(Handler handler) { 65 | handler.onColumnFilter(this); 66 | } 67 | } -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/cell/UneditableCheckboxCell.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid.cell; 18 | 19 | import com.google.gwt.cell.client.AbstractEditableCell; 20 | import com.google.gwt.dom.client.Element; 21 | import com.google.gwt.safehtml.shared.SafeHtml; 22 | import com.google.gwt.safehtml.shared.SafeHtmlBuilder; 23 | import com.google.gwt.safehtml.shared.SafeHtmlUtils; 24 | 25 | public class UneditableCheckboxCell extends AbstractEditableCell { 26 | 27 | private static final SafeHtml INPUT_CHECKED_DISABLED = SafeHtmlUtils 28 | .fromSafeConstant(""); 29 | 30 | private static final SafeHtml INPUT_UNCHECKED_DISABLED = SafeHtmlUtils.fromSafeConstant(""); 31 | 32 | 33 | @Override 34 | public void render(Context context, Boolean value, SafeHtmlBuilder sb) { 35 | // Get the view data. 36 | Object key = context.getKey(); 37 | Boolean viewData = getViewData(key); 38 | if (viewData != null && viewData.equals(value)) { 39 | clearViewData(key); 40 | viewData = null; 41 | } 42 | 43 | if (value != null && ((viewData != null) ? viewData : value)) { 44 | sb.append(INPUT_CHECKED_DISABLED); 45 | } else { 46 | sb.append(INPUT_UNCHECKED_DISABLED); 47 | } 48 | } 49 | 50 | @Override 51 | public boolean isEditing(Context context, Element parent, Boolean value) { 52 | return false; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/view/header/HeaderViewImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.mvp.view.header; 18 | 19 | import com.google.gwt.dom.client.Style; 20 | import com.google.gwt.user.client.ui.Button; 21 | import org.kaaproject.avro.ui.sandbox.client.AvroUiSandboxResources.AvroUiSandboxStyle; 22 | import org.kaaproject.avro.ui.sandbox.client.mvp.view.HeaderView; 23 | import org.kaaproject.avro.ui.sandbox.client.util.Utils; 24 | 25 | import com.google.gwt.core.client.GWT; 26 | import com.google.gwt.uibinder.client.UiBinder; 27 | import com.google.gwt.uibinder.client.UiField; 28 | import com.google.gwt.user.client.ui.Composite; 29 | import com.google.gwt.user.client.ui.HTMLPanel; 30 | import com.google.gwt.user.client.ui.Widget; 31 | 32 | public class HeaderViewImpl extends Composite implements HeaderView { 33 | 34 | interface HeaderViewImplUiBinder extends UiBinder { } 35 | private static HeaderViewImplUiBinder uiBinder = GWT.create(HeaderViewImplUiBinder.class); 36 | 37 | @UiField public Button resetButton; 38 | @UiField public HTMLPanel headerTitlePanel; 39 | @UiField(provided=true) final AvroUiSandboxStyle avroUiSandboxStyle; 40 | 41 | public HeaderViewImpl() { 42 | avroUiSandboxStyle = Utils.avroUiSandboxStyle; 43 | initWidget(uiBinder.createAndBindUi(this)); 44 | headerTitlePanel.getElement().setInnerHTML(Utils.constants.avroUiSandboxHeaderTitle()); 45 | resetButton.setText(Utils.constants.reset()); 46 | resetButton.getElement().getStyle().setMarginRight(30, Style.Unit.PX); 47 | } 48 | 49 | @Override 50 | public Button getResetButton() { 51 | return resetButton; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/AlertPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget; 18 | 19 | import static org.kaaproject.avro.ui.gwt.client.util.Utils.avroUiStyle; 20 | 21 | import com.google.gwt.dom.client.DivElement; 22 | import com.google.gwt.dom.client.Document; 23 | import com.google.gwt.dom.client.Style.Unit; 24 | import com.google.gwt.user.client.ui.InlineLabel; 25 | import com.google.gwt.user.client.ui.Label; 26 | 27 | public class AlertPanel extends Label { 28 | 29 | private DivElement textNode; 30 | 31 | public enum Type { 32 | INFO(avroUiStyle.info(), avroUiStyle.iconInfo()), 33 | HINT(avroUiStyle.hint(), avroUiStyle.iconHint()), 34 | WARNING(avroUiStyle.warning(), avroUiStyle.iconWarning()), 35 | ERROR(avroUiStyle.error(), avroUiStyle.iconError()), 36 | SUCCESS(avroUiStyle.success(), avroUiStyle.iconSuccess()); 37 | 38 | String labelStyleName; 39 | 40 | String iconStyleName; 41 | 42 | Type(String _labelStyleName, String _iconStyleName) { 43 | labelStyleName = _labelStyleName; 44 | iconStyleName = _iconStyleName; 45 | } 46 | } 47 | 48 | public AlertPanel(Type type) { 49 | setStylePrimaryName(avroUiStyle.uiMessage()); 50 | addStyleName(type.labelStyleName); 51 | 52 | InlineLabel icon = new InlineLabel(); 53 | icon.setStylePrimaryName(avroUiStyle.uiIcon()); 54 | icon.addStyleName(type.iconStyleName); 55 | 56 | getElement().appendChild(icon.getElement()); 57 | textNode = Document.get().createDivElement(); 58 | textNode.getStyle().setWidth(100, Unit.PCT); 59 | getElement().appendChild(textNode); 60 | } 61 | 62 | public void setMessage(String message) { 63 | textNode.setInnerHTML(message); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/webapp/WEB-INF/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/layout/AppLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.layout; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources.AvroUiStyle; 20 | import org.kaaproject.avro.ui.sandbox.client.AvroUiSandboxResources.AvroUiSandboxStyle; 21 | import org.kaaproject.avro.ui.sandbox.client.util.Utils; 22 | import org.kaaproject.avro.ui.shared.Version; 23 | 24 | import com.google.gwt.core.client.GWT; 25 | import com.google.gwt.uibinder.client.UiBinder; 26 | import com.google.gwt.uibinder.client.UiField; 27 | import com.google.gwt.user.client.ui.Composite; 28 | import com.google.gwt.user.client.ui.HTMLPanel; 29 | import com.google.gwt.user.client.ui.SimplePanel; 30 | import com.google.gwt.user.client.ui.Widget; 31 | 32 | public class AppLayout extends Composite { 33 | interface AppLayoutUiBinder extends UiBinder { } 34 | private static AppLayoutUiBinder uiBinder = GWT.create(AppLayoutUiBinder.class); 35 | 36 | @UiField SimplePanel appHeader; 37 | @UiField SimpleWidgetPanel appContent; 38 | @UiField(provided=true) final AvroUiSandboxStyle avroUiSandboxStyle; 39 | @UiField(provided=true) final AvroUiStyle avroUiStyle; 40 | @UiField HTMLPanel footerPanel; 41 | 42 | public AppLayout() { 43 | avroUiSandboxStyle = Utils.avroUiSandboxStyle; 44 | avroUiStyle = Utils.avroUiStyle; 45 | initWidget(uiBinder.createAndBindUi(this)); 46 | footerPanel.getElement().setInnerHTML(Utils.messages.footerMessage(Version.PROJECT_VERSION)); 47 | } 48 | 49 | public SimplePanel getAppHeaderHolder() { 50 | return this.appHeader; 51 | } 52 | 53 | public SimpleWidgetPanel getAppContentHolder() { 54 | return this.appContent; 55 | } 56 | 57 | } 58 | 59 | 60 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/servlet/ServletHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2016 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.servlet; 18 | 19 | import java.util.List; 20 | import java.util.Map.Entry; 21 | 22 | import com.google.gwt.core.client.GWT; 23 | import com.google.gwt.user.client.Window; 24 | 25 | public class ServletHelper { 26 | 27 | private static final String UPLOAD_SERVLET_PATH = "servlet/fileUploadServlet"; 28 | 29 | private static final String JSON_KEY = "jsonKey"; 30 | private static final String FILE_NAME = "fileName"; 31 | 32 | private static final String JSON_SCHEMA_FILE = "schema.json"; 33 | private static final String JSON_RECORD_FILE = "record.json"; 34 | 35 | public static void downloadJsonSchema(String key) { 36 | String getUrl = composeURL(UPLOAD_SERVLET_PATH, JSON_KEY+"="+key, FILE_NAME+"="+JSON_SCHEMA_FILE); 37 | String url = GWT.getModuleBaseURL() + getUrl; 38 | Window.open( url, "_self", "enabled"); 39 | } 40 | 41 | public static void downloadJsonRecord(String key) { 42 | String getUrl = composeURL(UPLOAD_SERVLET_PATH, JSON_KEY+"="+key, FILE_NAME+"="+JSON_RECORD_FILE); 43 | String url = GWT.getModuleBaseURL() + getUrl; 44 | Window.open( url, "_self", "enabled"); 45 | } 46 | 47 | private static String composeURL(String servletPath, String... params) { 48 | String ret = servletPath; 49 | ret = ret.replaceAll("[\\?&]+$", ""); 50 | String sep = ret.contains("?") ? "&" : "?"; 51 | for (String par : params) { 52 | ret += sep + par; 53 | sep = "&"; 54 | } 55 | for (Entry> e : Window.Location.getParameterMap().entrySet()) { 56 | ret += sep + e.getKey() + "=" + e.getValue().get(0); 57 | } 58 | ret += sep + "random=" + Math.random(); 59 | return ret; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /converter/pom.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | 4.0.0 20 | 21 | org.kaaproject 22 | 0.2.1 23 | avro-ui 24 | 25 | org.kaaproject.avro-ui 26 | converter 27 | jar 28 | 29 | Avro UI Data Converter 30 | http://kaaproject.org 31 | 32 | 33 | UTF-8 34 | ${basedir}/.. 35 | 36 | 37 | 38 | 39 | org.apache.avro 40 | avro 41 | 42 | 43 | org.kaaproject.avro-ui 44 | shared 45 | 46 | 47 | junit 48 | junit 49 | test 50 | 51 | 52 | 53 | 54 | 55 | 56 | org.apache.maven.plugins 57 | maven-jar-plugin 58 | 2.2 59 | 60 | 61 | 62 | test-jar 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/FqnField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | public abstract class FqnField extends FormField { 20 | 21 | private static final long serialVersionUID = 7473310438849667183L; 22 | 23 | protected Fqn fqn; 24 | 25 | public FqnField() { 26 | super(); 27 | } 28 | 29 | public FqnField(FormContext context, 30 | String fieldName, 31 | String displayName, 32 | String schema, 33 | boolean optional) { 34 | super(context, fieldName, displayName, schema, optional); 35 | } 36 | 37 | public Fqn getFqn() { 38 | return fqn; 39 | } 40 | 41 | public void setFqn(Fqn fqn) { 42 | this.fqn = fqn; 43 | } 44 | 45 | @Override 46 | public String getTypeFullname() { 47 | return fqn.getFqnString(); 48 | } 49 | 50 | @Override 51 | protected void copyFields(FormField cloned, boolean deepCopy) { 52 | super.copyFields(cloned, deepCopy); 53 | FqnField clonedFqnField = (FqnField)cloned; 54 | clonedFqnField.fqn = fqn; 55 | } 56 | 57 | @Override 58 | public int hashCode() { 59 | final int prime = 31; 60 | int result = super.hashCode(); 61 | result = prime * result 62 | + ((fqn == null) ? 0 : fqn.hashCode()); 63 | return result; 64 | } 65 | 66 | @Override 67 | public boolean equals(Object obj) { 68 | if (this == obj) 69 | return true; 70 | if (!super.equals(obj)) 71 | return false; 72 | if (getClass() != obj.getClass()) 73 | return false; 74 | FqnField other = (FqnField) obj; 75 | if (fqn == null) { 76 | if (other.fqn != null) 77 | return false; 78 | } else if (!fqn.equals(other.fqn)) 79 | return false; 80 | return true; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/dialog/ConfirmDialog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.dialog; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.util.Utils; 20 | import org.kaaproject.avro.ui.gwt.client.widget.AlertPanel; 21 | 22 | import com.google.gwt.event.dom.client.ClickEvent; 23 | import com.google.gwt.event.dom.client.ClickHandler; 24 | import com.google.gwt.user.client.ui.Button; 25 | import com.google.gwt.user.client.ui.VerticalPanel; 26 | 27 | public class ConfirmDialog extends AvroUiDialog { 28 | 29 | private Button noButton; 30 | private Button yesButton; 31 | 32 | private ConfirmListener listener; 33 | 34 | public ConfirmDialog(ConfirmListener listener, String title, String question) { 35 | super(false, true); 36 | setTitle(title); 37 | this.listener = listener; 38 | 39 | VerticalPanel dialogContents = new VerticalPanel(); 40 | dialogContents.setSpacing(4); 41 | setWidget(dialogContents); 42 | 43 | AlertPanel questionLabel = new AlertPanel(AlertPanel.Type.WARNING); 44 | questionLabel.setMessage(question); 45 | dialogContents.add(questionLabel); 46 | 47 | noButton = new Button(Utils.constants.no(), new ClickHandler() { 48 | @Override 49 | public void onClick(ClickEvent event) { 50 | hide(); 51 | ConfirmDialog.this.listener.onNo(); 52 | } 53 | }); 54 | 55 | yesButton = new Button(Utils.constants.yes(), new ClickHandler() { 56 | @Override 57 | public void onClick(ClickEvent event) { 58 | hide(); 59 | ConfirmDialog.this.listener.onYes(); 60 | } 61 | }); 62 | 63 | addButton(yesButton); 64 | addButton(noButton); 65 | 66 | } 67 | 68 | public interface ConfirmListener { 69 | 70 | public void onNo(); 71 | 72 | public void onYes(); 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/StringFilterHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.grid; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.widget.grid.ColumnFilterEvent.HasColumnFilterEventHandlers; 20 | import org.kaaproject.avro.ui.gwt.client.widget.grid.cell.FilterTextInputCell; 21 | 22 | import com.google.gwt.cell.client.ValueUpdater; 23 | import com.google.gwt.dom.client.BrowserEvents; 24 | import com.google.gwt.dom.client.Style.Unit; 25 | import com.google.gwt.user.cellview.client.Header; 26 | 27 | public class StringFilterHeader extends Header implements ValueUpdater { 28 | 29 | private FiltrableStringColumn column; 30 | private HasColumnFilterEventHandlers source; 31 | private Integer key; 32 | 33 | public StringFilterHeader(HasColumnFilterEventHandlers source, FiltrableStringColumn column, Integer key) { 34 | super(new FilterTextInputCell(100, Unit.PCT)); 35 | setUpdater(this); 36 | this.source = source; 37 | this.column = column; 38 | this.key = key; 39 | } 40 | 41 | public void update(String value) { 42 | String prev = getValue(); 43 | if (prev == null && value != null || 44 | prev != null && value == null || 45 | prev != null && value != null && !prev.equals(value)) { 46 | column.setFilterString(value); 47 | ColumnFilterEvent.fire(source); 48 | } 49 | } 50 | 51 | @Override 52 | public String getValue() { 53 | return column.getFilterString(); 54 | } 55 | 56 | @Override 57 | public Object getKey() { 58 | return key; 59 | } 60 | 61 | public static boolean isFilterFocusEvent(String eventType) { 62 | return BrowserEvents.CHANGE.equals(eventType) || 63 | BrowserEvents.KEYUP.equals(eventType) || 64 | BrowserEvents.KEYDOWN.equals(eventType) || 65 | FilterTextInputCell.PASTE.equals(eventType); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /converter/src/test/java/org/kaaproject/avro/ui/converter/TestAvroSchemas.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.kaaproject.avro.ui.converter; 17 | 18 | import java.io.ByteArrayOutputStream; 19 | import java.io.IOException; 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | import org.apache.avro.Schema; 24 | import org.apache.commons.compress.utils.IOUtils; 25 | 26 | public class TestAvroSchemas { 27 | 28 | public static final String SINGLE_FIELDS = "single-fields.avsc"; 29 | public static final String ARRAY = "array.avsc"; 30 | public static final String UNION = "union.avsc"; 31 | public static final String OVERRIDE_SCHEMA = "override-schema.avsc"; 32 | public static final String TYPE_REFERENCES_SCHEMA = "type-references.avsc"; 33 | public static final String TYPE_REFERENCES2_SCHEMA = "type-references2.avsc"; 34 | public static final String TYPE_CTL_REFERENCES = "type-ctl-references.avsc"; 35 | 36 | private static final Map schemasMap = new HashMap<>(); 37 | private static final Map schemaJsonsMap = new HashMap<>(); 38 | 39 | public static Schema getSchema(String resourceName) throws IOException { 40 | Schema schema = schemasMap.get(resourceName); 41 | if (schema == null) { 42 | schema = new Schema.Parser().parse(Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName)); 43 | schemasMap.put(resourceName, schema); 44 | } 45 | return schema; 46 | } 47 | 48 | public static String getSchemaJson(String resourceName) throws IOException { 49 | String schema = schemaJsonsMap.get(resourceName); 50 | if (schema == null) { 51 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 52 | IOUtils.copy(Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName), baos); 53 | schema = new String(baos.toByteArray()); 54 | schemaJsonsMap.put(resourceName, schema); 55 | } 56 | return schema; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/AvroUiResources.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client; 18 | 19 | import com.google.gwt.resources.client.ClientBundle; 20 | import com.google.gwt.resources.client.CssResource.NotStrict; 21 | import com.google.gwt.resources.client.ImageResource; 22 | import com.google.gwt.resources.client.ImageResource.ImageOptions; 23 | 24 | public interface AvroUiResources extends ClientBundle { 25 | 26 | public interface AvroUiStyle extends AvroUiTheme { 27 | 28 | String DEFAULT_CSS = "AvroUiTheme.css"; 29 | 30 | } 31 | 32 | @NotStrict 33 | @Source(AvroUiStyle.DEFAULT_CSS) 34 | AvroUiStyle avroUiStyle(); 35 | 36 | @ImageOptions(width = 0, height = 0) 37 | @Source("images/circles.png") 38 | ImageResource circles(); 39 | 40 | @ImageOptions(width = 0, height = 0) 41 | @Source("images/circles_ie6.png") 42 | ImageResource circles_ie6(); 43 | 44 | @ImageOptions(width = 0, height = 0) 45 | @Source("images/vborder.png") 46 | ImageResource vborder(); 47 | 48 | @ImageOptions(width = 0, height = 0) 49 | @Source("images/vborder_ie6.png") 50 | ImageResource vborder_ie6(); 51 | 52 | @Source("images/arrowBottomImage.png") 53 | ImageResource arrowBottomImage(); 54 | 55 | @Source("images/arrowRightImage.png") 56 | ImageResource arrowRightImage(); 57 | 58 | @ImageOptions(width = 14, height = 14) 59 | @Source("images/remove.png") 60 | ImageResource remove(); 61 | 62 | @ImageOptions(width = 14, height = 14) 63 | @Source("images/close.png") 64 | ImageResource close(); 65 | 66 | @ImageOptions(width = 16, height = 16) 67 | @Source("images/zoom_out.png") 68 | ImageResource zoomOut(); 69 | 70 | @ImageOptions(width = 14, height = 14) 71 | @Source("images/resizeHandle.png") 72 | ImageResource resizeHandle(); 73 | 74 | @ImageOptions(width = 48, height = 48) 75 | @Source("images/busyIndicator.gif") 76 | ImageResource busyIndicator(); 77 | 78 | } 79 | 80 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/FqnVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | public class FqnVersion extends Fqn { 20 | 21 | private static final long serialVersionUID = 5169512001216622502L; 22 | 23 | private int version; 24 | 25 | public FqnVersion() { 26 | super(); 27 | } 28 | 29 | public FqnVersion(Fqn fqn, int version) { 30 | super(fqn); 31 | this.version = version; 32 | } 33 | 34 | public FqnVersion(String fqnString, int version) { 35 | super(fqnString); 36 | this.version = version; 37 | } 38 | 39 | public FqnVersion(String namespace, String name, int version) { 40 | super(namespace, name); 41 | this.version = version; 42 | } 43 | 44 | public Fqn getFqn() { 45 | return new Fqn(this.namespace, this.name); 46 | } 47 | 48 | public int getVersion() { 49 | return version; 50 | } 51 | 52 | public void setVersion(int version) { 53 | this.version = version; 54 | } 55 | 56 | @Override 57 | public int hashCode() { 58 | final int prime = 31; 59 | int result = super.hashCode(); 60 | result = prime * result + version; 61 | return result; 62 | } 63 | 64 | @Override 65 | public boolean equals(Object obj) { 66 | if (this == obj) 67 | return true; 68 | if (!super.equals(obj)) 69 | return false; 70 | if (getClass() != obj.getClass()) 71 | return false; 72 | FqnVersion other = (FqnVersion) obj; 73 | if (version != other.version) 74 | return false; 75 | return true; 76 | } 77 | 78 | @Override 79 | public String toString() { 80 | StringBuilder builder = new StringBuilder(); 81 | builder.append("FqnVersion [version="); 82 | builder.append(version); 83 | builder.append(", toString()="); 84 | builder.append(super.toString()); 85 | builder.append("]"); 86 | return builder.toString(); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/SizedField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | 20 | public abstract class SizedField extends FormField { 21 | 22 | private static final long serialVersionUID = 6539576598668221454L; 23 | 24 | public static final int DEFAULT_MAX_LENGTH = -1; 25 | 26 | private Integer maxLength; 27 | 28 | public SizedField() { 29 | super(); 30 | } 31 | 32 | public SizedField(FormContext context, 33 | String fieldName, 34 | String displayName, 35 | String schema, 36 | boolean optional) { 37 | super(context, fieldName, displayName, schema, optional); 38 | } 39 | 40 | public int getMaxLength() { 41 | if (maxLength != null) { 42 | return maxLength.intValue(); 43 | } 44 | else { 45 | return DEFAULT_MAX_LENGTH; 46 | } 47 | } 48 | 49 | public void setMaxLength(int maxLength) { 50 | this.maxLength = Integer.valueOf(maxLength); 51 | } 52 | 53 | @Override 54 | protected void copyFields(FormField cloned, boolean deepCopy) { 55 | super.copyFields(cloned, deepCopy); 56 | SizedField clonedSizedField = (SizedField)cloned; 57 | clonedSizedField.maxLength = maxLength; 58 | } 59 | 60 | @Override 61 | public int hashCode() { 62 | final int prime = 31; 63 | int result = super.hashCode(); 64 | result = prime * result 65 | + ((maxLength == null) ? 0 : maxLength.hashCode()); 66 | return result; 67 | } 68 | 69 | @Override 70 | public boolean equals(Object obj) { 71 | if (this == obj) 72 | return true; 73 | if (!super.equals(obj)) 74 | return false; 75 | if (getClass() != obj.getClass()) 76 | return false; 77 | SizedField other = (SizedField) obj; 78 | if (maxLength == null) { 79 | if (other.maxLength != null) 80 | return false; 81 | } else if (!maxLength.equals(other.maxLength)) 82 | return false; 83 | return true; 84 | } 85 | 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/FormEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | import java.io.Serializable; 20 | 21 | public class FormEnum implements Serializable { 22 | 23 | private static final long serialVersionUID = 816172078410943534L; 24 | 25 | private String enumSymbol; 26 | private String displayValue; 27 | 28 | public FormEnum() { 29 | super(); 30 | } 31 | 32 | public FormEnum(String enumSymbol, String displayValue) { 33 | this.enumSymbol = enumSymbol; 34 | this.displayValue = displayValue; 35 | } 36 | 37 | public String getEnumSymbol() { 38 | return enumSymbol; 39 | } 40 | 41 | public void setEnumSymbol(String enumSymbol) { 42 | this.enumSymbol = enumSymbol; 43 | } 44 | 45 | public String getDisplayValue() { 46 | return displayValue; 47 | } 48 | 49 | public void setDisplayValue(String displayValue) { 50 | this.displayValue = displayValue; 51 | } 52 | 53 | @Override 54 | public int hashCode() { 55 | final int prime = 31; 56 | int result = 1; 57 | result = prime * result 58 | + ((displayValue == null) ? 0 : displayValue.hashCode()); 59 | result = prime * result 60 | + ((enumSymbol == null) ? 0 : enumSymbol.hashCode()); 61 | return result; 62 | } 63 | 64 | @Override 65 | public boolean equals(Object obj) { 66 | if (this == obj) 67 | return true; 68 | if (obj == null) 69 | return false; 70 | if (getClass() != obj.getClass()) 71 | return false; 72 | FormEnum other = (FormEnum) obj; 73 | if (displayValue == null) { 74 | if (other.displayValue != null) 75 | return false; 76 | } else if (!displayValue.equals(other.displayValue)) 77 | return false; 78 | if (enumSymbol == null) { 79 | if (other.enumSymbol != null) 80 | return false; 81 | } else if (!enumSymbol.equals(other.enumSymbol)) 82 | return false; 83 | return true; 84 | } 85 | 86 | @Override 87 | public String toString() { 88 | return enumSymbol; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/grid/AvroUiDataGrid.css: -------------------------------------------------------------------------------- 1 | @def selection-color #336699; 2 | @def selectionBorderWidth 2px; 3 | 4 | .dataGridCell input[type="text"] { 5 | height: 26px; 6 | width: 100%; 7 | } 8 | 9 | .dataGridWidget { 10 | 11 | } 12 | 13 | .dataGridFirstColumn { 14 | 15 | } 16 | 17 | .dataGridLastColumn { 18 | 19 | } 20 | 21 | .dataGridFooter { 22 | border-top: 1px solid #6f7277; 23 | padding: 3px 15px; 24 | text-align: left; 25 | color: #4b4a4a; 26 | text-shadow: #ddf 1px 1px 0; 27 | overflow: hidden; 28 | white-space: nowrap; 29 | } 30 | 31 | .dataGridHeader { 32 | font-family: Arial; 33 | border-bottom: 1px solid #DDDDDD; 34 | font-size: 14px; 35 | padding: 3px 15px; 36 | text-align: left; 37 | text-shadow: none; 38 | color: #666666; 39 | overflow: hidden; 40 | white-space: nowrap; 41 | 42 | } 43 | 44 | .dataGridCell { 45 | padding: 2px 15px; 46 | overflow: hidden; 47 | height: 40px; 48 | } 49 | 50 | .dataGridFirstColumnFooter { 51 | 52 | } 53 | 54 | .dataGridFirstColumnHeader { 55 | 56 | } 57 | 58 | .dataGridLastColumnFooter { 59 | 60 | } 61 | 62 | .dataGridLastColumnHeader { 63 | 64 | } 65 | 66 | .dataGridSortableHeader { 67 | cursor: pointer; 68 | cursor: hand; 69 | } 70 | 71 | .dataGridSortableHeader:hover { 72 | color: #6c6b6b; 73 | } 74 | 75 | .dataGridSortedHeaderAscending { 76 | 77 | } 78 | 79 | .dataGridSortedHeaderDescending { 80 | 81 | } 82 | 83 | .dataGridEvenRowCell { 84 | /* border: selectionBorderWidth solid #ffffff;*/ 85 | border: inherit; 86 | } 87 | 88 | .dataGridOddRow, .dataGridEvenRow { 89 | background-color: rgba(0, 0, 0, 0); 90 | border-bottom: 1px solid #DDDDDD; 91 | } 92 | 93 | .dataGridOddRowCell { 94 | /* border: selectionBorderWidth solid #f3f7fb; */ 95 | border: inherit; 96 | } 97 | 98 | .dataGridHoveredRow { 99 | background: #E2F2F4; 100 | } 101 | 102 | .dataGridHoveredRowCell { 103 | /* border: selectionBorderWidth solid #eee;*/ 104 | border: inherit; 105 | /* background: #B5D8F5;*/ 106 | } 107 | 108 | .dataGridKeyboardSelectedRow { 109 | /* background: #ffc;*/ 110 | background: #B5D8F5; 111 | } 112 | 113 | .dataGridKeyboardSelectedRowCell { 114 | /* border: selectionBorderWidth solid #ffc;*/ 115 | border: inherit; 116 | } 117 | 118 | .dataGridSelectedRow { 119 | /* background: selection-color;*/ 120 | color: white; 121 | height: auto; 122 | overflow: auto; 123 | background: #B5D8F5; 124 | } 125 | 126 | .dataGridSelectedRowCell { 127 | /* border: selectionBorderWidth solid selection-color;*/ 128 | border: inherit; 129 | background: #B5D8F5; 130 | } 131 | 132 | /** 133 | * The keyboard selected cell is visible over selection. 134 | */ 135 | .dataGridKeyboardSelectedCell { 136 | /* border: selectionBorderWidth solid #d7dde8;*/ 137 | border: inherit; 138 | background: #B5D8F5; 139 | } 140 | 141 | .dataGridColumnInvisible { 142 | display: none; 143 | } 144 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 24 | logbackExposeWebAppRoot 25 | false 26 | 27 | 28 | 29 | contextConfigLocation 30 | /WEB-INF/applicationContext.xml 31 | 32 | 33 | 34 | logbackConfigLocation 35 | classpath:avro-ui-sandbox-logback.xml 36 | 37 | 38 | 39 | ch.qos.logback.ext.spring.web.LogbackConfigListener 40 | 41 | 42 | 43 | 44 | org.springframework.web.context.ContextLoaderListener 45 | 46 | 47 | 48 | 49 | springGwtRemoteServiceServlet 50 | org.spring4gwt.server.SpringGwtRemoteServiceServlet 51 | 52 | 53 | 54 | springGwtRemoteServiceServlet 55 | /avroUiSandbox/springGwtServices/* 56 | 57 | 58 | 59 | fileUploadServlet 60 | org.kaaproject.avro.ui.sandbox.services.FileUploadServlet 61 | 62 | 63 | 64 | fileUploadServlet 65 | /avroUiSandbox/servlet/fileUploadServlet 66 | 67 | 68 | 69 | 70 | AvroUiSandbox.html 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/DependenciesField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | import java.util.List; 20 | 21 | public class DependenciesField extends FormField { 22 | 23 | private static final long serialVersionUID = 863727275754175198L; 24 | 25 | public DependenciesField() { 26 | super(); 27 | } 28 | 29 | public DependenciesField(FormContext context, 30 | String fieldName, 31 | String displayName, 32 | String schema, 33 | boolean optional) { 34 | super(context, fieldName, displayName, schema, optional); 35 | } 36 | 37 | public List getValue() { 38 | if (isRootChild()) { 39 | return context.getCtlDependenciesList(); 40 | } else { 41 | return null; 42 | } 43 | } 44 | 45 | public void setValue(List fqnVersions) { 46 | if (isRootChild()) { 47 | context.setCtlDependenciesList(fqnVersions); 48 | } 49 | } 50 | 51 | @Override 52 | public String getDisplayString() { 53 | return super.getDisplayString(); 54 | } 55 | 56 | @Override 57 | public FieldType getFieldType() { 58 | return FieldType.DEPENDENCIES; 59 | } 60 | 61 | @Override 62 | public boolean isNull() { 63 | return getValue() == null; 64 | } 65 | 66 | @Override 67 | protected FormField createInstance() { 68 | return new DependenciesField(); 69 | } 70 | 71 | @Override 72 | protected void copyFields(FormField cloned, boolean deepCopy) { 73 | super.copyFields(cloned, deepCopy); 74 | } 75 | 76 | @Override 77 | protected boolean valid() { 78 | return getValue() != null; 79 | } 80 | 81 | @Override 82 | public boolean equals(Object obj) { 83 | if (this == obj) 84 | return true; 85 | if (!super.equals(obj)) 86 | return false; 87 | if (getClass() != obj.getClass()) 88 | return false; 89 | DependenciesField other = (DependenciesField) obj; 90 | if (getValue() == null) { 91 | if (other.getValue() != null) 92 | return false; 93 | } else if (!getValue().equals(other.getValue())) 94 | return false; 95 | return true; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/AvroUiSandbox.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/FqnKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | import java.io.Serializable; 20 | 21 | public class FqnKey implements Serializable { 22 | 23 | private static final long serialVersionUID = -2705987324288726672L; 24 | 25 | private Integer id; 26 | private Fqn fqn; 27 | private boolean isLocalFqn; 28 | 29 | public FqnKey() { 30 | } 31 | 32 | public FqnKey(Integer id) { 33 | super(); 34 | this.isLocalFqn = true; 35 | this.id = id; 36 | } 37 | 38 | public FqnKey(Fqn fqn) { 39 | super(); 40 | this.isLocalFqn = false; 41 | this.fqn = fqn; 42 | } 43 | 44 | public boolean isLocalFqn() { 45 | return isLocalFqn; 46 | } 47 | 48 | public Integer getId() { 49 | return id; 50 | } 51 | 52 | public Fqn getFqn() { 53 | return fqn; 54 | } 55 | 56 | @Override 57 | public int hashCode() { 58 | final int prime = 31; 59 | int result = 1; 60 | result = prime * result + ((fqn == null) ? 0 : fqn.hashCode()); 61 | result = prime * result + ((id == null) ? 0 : id.hashCode()); 62 | result = prime * result + (isLocalFqn ? 1231 : 1237); 63 | return result; 64 | } 65 | 66 | @Override 67 | public boolean equals(Object obj) { 68 | if (this == obj) 69 | return true; 70 | if (obj == null) 71 | return false; 72 | if (getClass() != obj.getClass()) 73 | return false; 74 | FqnKey other = (FqnKey) obj; 75 | if (fqn == null) { 76 | if (other.fqn != null) 77 | return false; 78 | } else if (!fqn.equals(other.fqn)) 79 | return false; 80 | if (id == null) { 81 | if (other.id != null) 82 | return false; 83 | } else if (!id.equals(other.id)) 84 | return false; 85 | if (isLocalFqn != other.isLocalFqn) 86 | return false; 87 | return true; 88 | } 89 | 90 | @Override 91 | public String toString() { 92 | StringBuilder builder = new StringBuilder(); 93 | builder.append("FqnKey [isLocalFqn="); 94 | builder.append(isLocalFqn); 95 | builder.append(", id="); 96 | builder.append(id); 97 | builder.append("]"); 98 | return builder.toString(); 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/mvp/view/main/MainViewImpl.ui.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/util/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client.util; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources; 20 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources.AvroUiStyle; 21 | import org.kaaproject.avro.ui.sandbox.client.AvroUiSandboxResources; 22 | import org.kaaproject.avro.ui.sandbox.client.AvroUiSandboxResources.AvroUiSandboxStyle; 23 | import org.kaaproject.avro.ui.sandbox.client.AvroUiSandboxResources.KaaTheme; 24 | import org.kaaproject.avro.ui.sandbox.client.i18n.AvroUiSandboxConstants; 25 | import org.kaaproject.avro.ui.sandbox.client.i18n.AvroUiSandboxMessages; 26 | import org.kaaproject.avro.ui.sandbox.shared.services.AvroUiSandboxServiceException; 27 | 28 | import com.google.gwt.core.client.GWT; 29 | 30 | public class Utils { 31 | 32 | public static final AvroUiSandboxResources resources = GWT.create( 33 | AvroUiSandboxResources.class); 34 | 35 | public static final AvroUiSandboxConstants constants = GWT.create( 36 | AvroUiSandboxConstants.class); 37 | 38 | public static final AvroUiSandboxMessages messages = GWT.create( 39 | AvroUiSandboxMessages.class); 40 | 41 | public static final AvroUiResources avroUiResources = 42 | GWT.create(AvroUiResources.class); 43 | 44 | public static final KaaTheme kaaTheme = 45 | resources.kaaTheme(); 46 | 47 | public static final AvroUiSandboxStyle avroUiSandboxStyle = 48 | resources.avroUiSandboxStyle(); 49 | 50 | public static final AvroUiStyle avroUiStyle = 51 | avroUiResources.avroUiStyle(); 52 | 53 | public static void injectSandboxStyles() { 54 | kaaTheme.ensureInjected(); 55 | avroUiSandboxStyle.ensureInjected(); 56 | avroUiStyle.ensureInjected(); 57 | } 58 | 59 | public static String getErrorMessage(Throwable throwable) { 60 | if (throwable instanceof AvroUiSandboxServiceException) { 61 | AvroUiSandboxServiceException sandboxException = (AvroUiSandboxServiceException)throwable; 62 | String message = constants.general_error(); 63 | message += sandboxException.getMessage(); 64 | return message; 65 | } else { 66 | return throwable.getMessage(); 67 | } 68 | } 69 | 70 | public static boolean isNotBlank(String string) { 71 | return string != null && string.length() > 0; 72 | } 73 | 74 | public static boolean isBlank(String string) { 75 | return string == null || string.length() == 0; 76 | } 77 | 78 | 79 | } 80 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/nav/NavWidget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.nav; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.util.Utils; 20 | 21 | import com.google.gwt.event.dom.client.ClickEvent; 22 | import com.google.gwt.event.dom.client.ClickHandler; 23 | import com.google.gwt.event.dom.client.HasClickHandlers; 24 | import com.google.gwt.event.shared.HandlerRegistration; 25 | import com.google.gwt.uibinder.client.UiChild; 26 | import com.google.gwt.user.client.ui.Anchor; 27 | import com.google.gwt.user.client.ui.Widget; 28 | 29 | public class NavWidget extends ListItem implements HasClickHandlers { 30 | 31 | public static final String EMPTY_HREF = "javascript:;"; 32 | 33 | private final Anchor anchor = new Anchor(); 34 | 35 | public NavWidget() { 36 | super.add(anchor); 37 | setEmptyHref(); 38 | } 39 | 40 | public NavWidget(Widget w) { 41 | this(); 42 | add(w); 43 | } 44 | 45 | public void setEmptyHref() { 46 | setHref(EMPTY_HREF); 47 | } 48 | 49 | public void setHref(String href) { 50 | anchor.setHref(href); 51 | } 52 | 53 | public void setText(String text) { 54 | anchor.setText(text); 55 | } 56 | 57 | public String getText() { 58 | return anchor.getText(); 59 | } 60 | 61 | public void setActive(boolean active) { 62 | if (active) 63 | addStyleName(Utils.avroUiStyle.active()); 64 | else 65 | removeStyleName(Utils.avroUiStyle.active()); 66 | } 67 | 68 | public boolean isActive() { 69 | return this.getStyleName().contains(Utils.avroUiStyle.active()); 70 | } 71 | 72 | public void setDisabled(boolean disabled) { 73 | anchor.setEnabled(!disabled); 74 | } 75 | 76 | public boolean isDisabled() { 77 | return !anchor.isEnabled(); 78 | } 79 | 80 | public Anchor getAnchor() { 81 | return anchor; 82 | } 83 | 84 | 85 | public HandlerRegistration addClickHandler(ClickHandler handler) { 86 | return anchor.addDomHandler(handler, ClickEvent.getType()); 87 | } 88 | 89 | @UiChild(tagname = "widget") 90 | public void addWidget(Widget w) { 91 | super.add(w); 92 | } 93 | 94 | public void setTarget(String target) { 95 | anchor.setTarget(target); 96 | } 97 | 98 | public String getTarget() { 99 | return anchor.getTarget(); 100 | } 101 | 102 | public void setName(String name) { 103 | anchor.setName(name); 104 | } 105 | 106 | public String getName() { 107 | return anchor.getName(); 108 | } 109 | 110 | } -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/AlertField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | public class AlertField extends FormField { 20 | 21 | private static final long serialVersionUID = -5439254303335483343L; 22 | private String value; 23 | 24 | public AlertField() { 25 | super(); 26 | } 27 | 28 | public AlertField(FormContext context, 29 | String fieldName, 30 | String displayName, 31 | String schema, 32 | boolean optional) { 33 | super(context, fieldName, displayName, schema, optional); 34 | } 35 | 36 | public String getValue() { 37 | return value; 38 | } 39 | 40 | public void setValue(String value) { 41 | if ((this.value == null && value != null) || 42 | (this.value != null && !this.value.equals(value))) { 43 | this.value = value; 44 | fireValueChanged(this.value); 45 | } 46 | fireChanged(); 47 | } 48 | 49 | @Override 50 | public String getDisplayString() { 51 | return super.getDisplayString() + ": \"" + valueToDisplayString(value) + "\""; 52 | } 53 | 54 | @Override 55 | public FieldType getFieldType() { 56 | return FieldType.ALERT; 57 | } 58 | 59 | @Override 60 | public boolean isNull() { 61 | return value == null; 62 | } 63 | 64 | @Override 65 | protected FormField createInstance() { 66 | return new AlertField(); 67 | } 68 | 69 | @Override 70 | protected void copyFields(FormField cloned, boolean deepCopy) { 71 | super.copyFields(cloned, deepCopy); 72 | AlertField clonedStringField = (AlertField)cloned; 73 | clonedStringField.value = value; 74 | } 75 | 76 | @Override 77 | protected boolean valid() { 78 | return !strIsEmpty(value); 79 | } 80 | 81 | @Override 82 | public int hashCode() { 83 | final int prime = 31; 84 | int result = super.hashCode(); 85 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 86 | return result; 87 | } 88 | 89 | @Override 90 | public boolean equals(Object obj) { 91 | if (this == obj) 92 | return true; 93 | if (!super.equals(obj)) 94 | return false; 95 | if (getClass() != obj.getClass()) 96 | return false; 97 | AlertField other = (AlertField) obj; 98 | if (value == null) { 99 | if (other.value != null) 100 | return false; 101 | } else if (!value.equals(other.value)) 102 | return false; 103 | return true; 104 | } 105 | 106 | 107 | 108 | } 109 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/VersionField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | public class VersionField extends FormField { 20 | 21 | private static final long serialVersionUID = 863727275754175198L; 22 | 23 | private Integer value; 24 | 25 | public VersionField() { 26 | super(); 27 | } 28 | 29 | public VersionField(FormContext context, 30 | String fieldName, 31 | String displayName, 32 | String schema, 33 | boolean optional) { 34 | super(context, fieldName, displayName, schema, optional); 35 | } 36 | 37 | public Integer getValue() { 38 | return value; 39 | } 40 | 41 | public void setValue(Integer value) { 42 | if ((this.value == null && value != null) || 43 | (this.value != null && !this.value.equals(value))) { 44 | this.value = value; 45 | fireValueChanged(this.value); 46 | } 47 | fireChanged(); 48 | } 49 | 50 | @Override 51 | public String getDisplayString() { 52 | return super.getDisplayString() + ": " + valueToDisplayString(value); 53 | } 54 | 55 | @Override 56 | public FieldType getFieldType() { 57 | return FieldType.VERSION; 58 | } 59 | 60 | @Override 61 | public boolean isNull() { 62 | return value == null; 63 | } 64 | 65 | @Override 66 | protected FormField createInstance() { 67 | return new VersionField(); 68 | } 69 | 70 | @Override 71 | protected void copyFields(FormField cloned, boolean deepCopy) { 72 | super.copyFields(cloned, deepCopy); 73 | VersionField clonedIntegerField = (VersionField)cloned; 74 | clonedIntegerField.value = value; 75 | } 76 | 77 | @Override 78 | protected boolean valid() { 79 | return value != null; 80 | } 81 | 82 | @Override 83 | public int hashCode() { 84 | final int prime = 31; 85 | int result = super.hashCode(); 86 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 87 | return result; 88 | } 89 | 90 | @Override 91 | public boolean equals(Object obj) { 92 | if (this == obj) 93 | return true; 94 | if (!super.equals(obj)) 95 | return false; 96 | if (getClass() != obj.getClass()) 97 | return false; 98 | VersionField other = (VersionField) obj; 99 | if (value == null) { 100 | if (other.value != null) 101 | return false; 102 | } else if (!value.equals(other.value)) 103 | return false; 104 | return true; 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/BooleanField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | 20 | public class BooleanField extends FormField { 21 | 22 | private static final long serialVersionUID = -7841564200726288319L; 23 | 24 | private Boolean defaultValue; 25 | 26 | private Boolean value; 27 | 28 | public BooleanField() { 29 | super(); 30 | } 31 | 32 | public BooleanField(FormContext context, 33 | String fieldName, 34 | String displayName, 35 | String schema, 36 | boolean optional) { 37 | super(context, fieldName, displayName, schema, optional); 38 | } 39 | 40 | public Boolean getDefaultValue() { 41 | return defaultValue; 42 | } 43 | 44 | public void setDefaultValue(Boolean defaultValue) { 45 | this.defaultValue = defaultValue; 46 | } 47 | 48 | public Boolean getValue() { 49 | return value; 50 | } 51 | 52 | public void setValue(Boolean value) { 53 | this.value = value; 54 | fireChanged(); 55 | } 56 | 57 | @Override 58 | public String getDisplayString() { 59 | return super.getDisplayString() + ": " + valueToDisplayString(value); 60 | } 61 | 62 | @Override 63 | public FieldType getFieldType() { 64 | return FieldType.BOOLEAN; 65 | } 66 | 67 | @Override 68 | public boolean isNull() { 69 | return false; 70 | } 71 | 72 | @Override 73 | protected FormField createInstance() { 74 | return new BooleanField(); 75 | } 76 | 77 | @Override 78 | protected void copyFields(FormField cloned, boolean deepCopy) { 79 | super.copyFields(cloned, deepCopy); 80 | BooleanField clonedBoolenField = (BooleanField)cloned; 81 | clonedBoolenField.defaultValue = defaultValue; 82 | clonedBoolenField.value = value; 83 | } 84 | 85 | @Override 86 | protected boolean valid() { 87 | return true; 88 | } 89 | 90 | @Override 91 | public int hashCode() { 92 | final int prime = 31; 93 | int result = super.hashCode(); 94 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 95 | return result; 96 | } 97 | 98 | @Override 99 | public boolean equals(Object obj) { 100 | if (this == obj) { 101 | return true; 102 | } 103 | if (!super.equals(obj)) { 104 | return false; 105 | } 106 | if (getClass() != obj.getClass()) { 107 | return false; 108 | } 109 | BooleanField other = (BooleanField) obj; 110 | if (value == null) { 111 | if (other.value != null) { 112 | return false; 113 | } 114 | } else if (!value.equals(other.value)) { 115 | return false; 116 | } 117 | return true; 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /gwt-sandbox/src/main/java/org/kaaproject/avro/ui/sandbox/client/AvroUiSandbox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.sandbox.client; 18 | 19 | import org.kaaproject.avro.ui.sandbox.client.layout.AppLayout; 20 | import org.kaaproject.avro.ui.sandbox.client.mvp.ClientFactory; 21 | import org.kaaproject.avro.ui.sandbox.client.mvp.activity.AvroUiSandboxActivityMapper; 22 | import org.kaaproject.avro.ui.sandbox.client.mvp.activity.HeaderActivityMapper; 23 | import org.kaaproject.avro.ui.sandbox.client.mvp.place.AvroUiSandboxPlaceHistoryMapper; 24 | import org.kaaproject.avro.ui.sandbox.client.mvp.place.MainPlace; 25 | import org.kaaproject.avro.ui.sandbox.client.util.Utils; 26 | import org.kaaproject.avro.ui.sandbox.shared.services.AvroUiSandboxServiceAsync; 27 | 28 | import com.google.gwt.activity.shared.ActivityManager; 29 | import com.google.gwt.activity.shared.ActivityMapper; 30 | import com.google.gwt.core.client.EntryPoint; 31 | import com.google.gwt.core.client.GWT; 32 | import com.google.gwt.place.shared.Place; 33 | import com.google.gwt.place.shared.PlaceController; 34 | import com.google.gwt.place.shared.PlaceHistoryHandler; 35 | import com.google.gwt.place.shared.PlaceHistoryMapper; 36 | import com.google.gwt.user.client.ui.RootLayoutPanel; 37 | import com.google.web.bindery.event.shared.EventBus; 38 | 39 | public class AvroUiSandbox implements EntryPoint { 40 | 41 | private static AvroUiSandboxServiceAsync avroUiSandboxService = AvroUiSandboxServiceAsync.Util.getInstance(); 42 | 43 | private AppLayout appWidget = new AppLayout(); 44 | 45 | @Override 46 | public void onModuleLoad() { 47 | init(); 48 | } 49 | 50 | public static AvroUiSandboxServiceAsync getAvroUiSandboxService() { 51 | return avroUiSandboxService; 52 | } 53 | 54 | private void init() { 55 | Utils.injectSandboxStyles(); 56 | 57 | ClientFactory clientFactory = GWT.create(ClientFactory.class); 58 | EventBus eventBus = clientFactory.getEventBus(); 59 | 60 | PlaceController placeController = clientFactory.getPlaceController(); 61 | 62 | ActivityMapper headerActivityMapper = new HeaderActivityMapper(clientFactory); 63 | ActivityManager headerActivityManager = new ActivityManager(headerActivityMapper, eventBus); 64 | headerActivityManager.setDisplay(appWidget.getAppHeaderHolder()); 65 | 66 | ActivityMapper appActivityMapper = new AvroUiSandboxActivityMapper(clientFactory); 67 | ActivityManager appActivityManager = new ActivityManager(appActivityMapper, eventBus); 68 | appActivityManager.setDisplay(appWidget.getAppContentHolder()); 69 | 70 | PlaceHistoryMapper historyMapper = GWT.create(AvroUiSandboxPlaceHistoryMapper.class); 71 | 72 | PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper); 73 | 74 | Place place = new MainPlace(); 75 | 76 | historyHandler.register(placeController, eventBus, place); 77 | 78 | RootLayoutPanel.get().add(appWidget); 79 | 80 | // Goes to the place represented on URL else default place 81 | historyHandler.handleCurrentHistory(); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/LongField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | 20 | public class LongField extends FormField { 21 | 22 | private static final long serialVersionUID = -5046250549233854347L; 23 | 24 | private Long defaultValue; 25 | 26 | private Long value; 27 | 28 | public LongField() { 29 | super(); 30 | } 31 | 32 | public LongField(FormContext context, 33 | String fieldName, 34 | String displayName, 35 | String schema, 36 | boolean optional) { 37 | super(context, fieldName, displayName, schema, optional); 38 | } 39 | 40 | public Long getDefaultValue() { 41 | return defaultValue; 42 | } 43 | 44 | public void setDefaultValue(Long defaultValue) { 45 | this.defaultValue = defaultValue; 46 | } 47 | 48 | public Long getValue() { 49 | return value; 50 | } 51 | 52 | public void setValue(Long value) { 53 | this.value = value; 54 | fireChanged(); 55 | } 56 | 57 | @Override 58 | public String getDisplayString() { 59 | return super.getDisplayString() + ": " + valueToDisplayString(value); 60 | } 61 | 62 | @Override 63 | public FieldType getFieldType() { 64 | return FieldType.LONG; 65 | } 66 | 67 | @Override 68 | public boolean isNull() { 69 | return value == null; 70 | } 71 | 72 | @Override 73 | protected FormField createInstance() { 74 | return new LongField(); 75 | } 76 | 77 | @Override 78 | protected void copyFields(FormField cloned, boolean deepCopy) { 79 | super.copyFields(cloned, deepCopy); 80 | LongField clonedLongField = (LongField)cloned; 81 | clonedLongField.defaultValue = defaultValue; 82 | clonedLongField.value = value; 83 | } 84 | 85 | @Override 86 | protected boolean valid() { 87 | return value != null; 88 | } 89 | 90 | @Override 91 | public int hashCode() { 92 | final int prime = 31; 93 | int result = super.hashCode(); 94 | result = prime * result 95 | + ((defaultValue == null) ? 0 : defaultValue.hashCode()); 96 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 97 | return result; 98 | } 99 | 100 | @Override 101 | public boolean equals(Object obj) { 102 | if (this == obj) 103 | return true; 104 | if (!super.equals(obj)) 105 | return false; 106 | if (getClass() != obj.getClass()) 107 | return false; 108 | LongField other = (LongField) obj; 109 | if (defaultValue == null) { 110 | if (other.defaultValue != null) 111 | return false; 112 | } else if (!defaultValue.equals(other.defaultValue)) 113 | return false; 114 | if (value == null) { 115 | if (other.value != null) 116 | return false; 117 | } else if (!value.equals(other.value)) 118 | return false; 119 | return true; 120 | } 121 | 122 | 123 | 124 | } 125 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/FloatField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | 20 | public class FloatField extends FormField { 21 | 22 | private static final long serialVersionUID = -5046250549233854347L; 23 | 24 | private Float defaultValue; 25 | 26 | private Float value; 27 | 28 | public FloatField() { 29 | super(); 30 | } 31 | 32 | public FloatField(FormContext context, 33 | String fieldName, 34 | String displayName, 35 | String schema, 36 | boolean optional) { 37 | super(context, fieldName, displayName, schema, optional); 38 | } 39 | 40 | public Float getDefaultValue() { 41 | return defaultValue; 42 | } 43 | 44 | public void setDefaultValue(Float defaultValue) { 45 | this.defaultValue = defaultValue; 46 | } 47 | 48 | public Float getValue() { 49 | return value; 50 | } 51 | 52 | public void setValue(Float value) { 53 | this.value = value; 54 | fireChanged(); 55 | } 56 | 57 | @Override 58 | public String getDisplayString() { 59 | return super.getDisplayString() + ": " + valueToDisplayString(value); 60 | } 61 | 62 | @Override 63 | public FieldType getFieldType() { 64 | return FieldType.FLOAT; 65 | } 66 | 67 | @Override 68 | public boolean isNull() { 69 | return value == null; 70 | } 71 | 72 | @Override 73 | protected FormField createInstance() { 74 | return new FloatField(); 75 | } 76 | 77 | @Override 78 | protected void copyFields(FormField cloned, boolean deepCopy) { 79 | super.copyFields(cloned, deepCopy); 80 | FloatField clonedFloatField = (FloatField)cloned; 81 | clonedFloatField.defaultValue = defaultValue; 82 | clonedFloatField.value = value; 83 | } 84 | 85 | @Override 86 | protected boolean valid() { 87 | return value != null; 88 | } 89 | 90 | @Override 91 | public int hashCode() { 92 | final int prime = 31; 93 | int result = super.hashCode(); 94 | result = prime * result 95 | + ((defaultValue == null) ? 0 : defaultValue.hashCode()); 96 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 97 | return result; 98 | } 99 | 100 | @Override 101 | public boolean equals(Object obj) { 102 | if (this == obj) 103 | return true; 104 | if (!super.equals(obj)) 105 | return false; 106 | if (getClass() != obj.getClass()) 107 | return false; 108 | FloatField other = (FloatField) obj; 109 | if (defaultValue == null) { 110 | if (other.defaultValue != null) 111 | return false; 112 | } else if (!defaultValue.equals(other.defaultValue)) 113 | return false; 114 | if (value == null) { 115 | if (other.value != null) 116 | return false; 117 | } else if (!value.equals(other.value)) 118 | return false; 119 | return true; 120 | } 121 | 122 | 123 | 124 | } 125 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/IntegerField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | public class IntegerField extends FormField { 20 | 21 | private static final long serialVersionUID = -5046250549233854347L; 22 | 23 | private Integer defaultValue; 24 | 25 | private Integer value; 26 | 27 | public IntegerField() { 28 | super(); 29 | } 30 | 31 | public IntegerField(FormContext context, 32 | String fieldName, 33 | String displayName, 34 | String schema, 35 | boolean optional) { 36 | super(context, fieldName, displayName, schema, optional); 37 | } 38 | 39 | public Integer getDefaultValue() { 40 | return defaultValue; 41 | } 42 | 43 | public void setDefaultValue(Integer defaultValue) { 44 | this.defaultValue = defaultValue; 45 | } 46 | 47 | public Integer getValue() { 48 | return value; 49 | } 50 | 51 | public void setValue(Integer value) { 52 | this.value = value; 53 | fireChanged(); 54 | } 55 | 56 | @Override 57 | public String getDisplayString() { 58 | return super.getDisplayString() + ": " + valueToDisplayString(value); 59 | } 60 | 61 | @Override 62 | public FieldType getFieldType() { 63 | return FieldType.INT; 64 | } 65 | 66 | @Override 67 | public boolean isNull() { 68 | return value == null; 69 | } 70 | 71 | @Override 72 | protected FormField createInstance() { 73 | return new IntegerField(); 74 | } 75 | 76 | @Override 77 | protected void copyFields(FormField cloned, boolean deepCopy) { 78 | super.copyFields(cloned, deepCopy); 79 | IntegerField clonedIntegerField = (IntegerField)cloned; 80 | clonedIntegerField.defaultValue = defaultValue; 81 | clonedIntegerField.value = value; 82 | } 83 | 84 | @Override 85 | protected boolean valid() { 86 | return value != null; 87 | } 88 | 89 | @Override 90 | public int hashCode() { 91 | final int prime = 31; 92 | int result = super.hashCode(); 93 | result = prime * result 94 | + ((defaultValue == null) ? 0 : defaultValue.hashCode()); 95 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 96 | return result; 97 | } 98 | 99 | @Override 100 | public boolean equals(Object obj) { 101 | if (this == obj) 102 | return true; 103 | if (!super.equals(obj)) 104 | return false; 105 | if (getClass() != obj.getClass()) 106 | return false; 107 | IntegerField other = (IntegerField) obj; 108 | if (defaultValue == null) { 109 | if (other.defaultValue != null) 110 | return false; 111 | } else if (!defaultValue.equals(other.defaultValue)) 112 | return false; 113 | if (value == null) { 114 | if (other.value != null) 115 | return false; 116 | } else if (!value.equals(other.value)) 117 | return false; 118 | return true; 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/DoubleField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | 20 | public class DoubleField extends FormField { 21 | 22 | private static final long serialVersionUID = -5046250549233854347L; 23 | 24 | private Double defaultValue; 25 | 26 | private Double value; 27 | 28 | public DoubleField() { 29 | super(); 30 | } 31 | 32 | public DoubleField(FormContext context, 33 | String fieldName, 34 | String displayName, 35 | String schema, 36 | boolean optional) { 37 | super(context, fieldName, displayName, schema, optional); 38 | } 39 | 40 | public Double getDefaultValue() { 41 | return defaultValue; 42 | } 43 | 44 | public void setDefaultValue(Double defaultValue) { 45 | this.defaultValue = defaultValue; 46 | } 47 | 48 | public Double getValue() { 49 | return value; 50 | } 51 | 52 | public void setValue(Double value) { 53 | this.value = value; 54 | fireChanged(); 55 | } 56 | 57 | @Override 58 | public String getDisplayString() { 59 | return super.getDisplayString() + ": " + valueToDisplayString(value); 60 | } 61 | 62 | @Override 63 | public FieldType getFieldType() { 64 | return FieldType.DOUBLE; 65 | } 66 | 67 | @Override 68 | public boolean isNull() { 69 | return value == null; 70 | } 71 | 72 | @Override 73 | protected FormField createInstance() { 74 | return new DoubleField(); 75 | } 76 | 77 | @Override 78 | protected void copyFields(FormField cloned, boolean deepCopy) { 79 | super.copyFields(cloned, deepCopy); 80 | DoubleField clonedDoubleField = (DoubleField)cloned; 81 | clonedDoubleField.defaultValue = defaultValue; 82 | clonedDoubleField.value = value; 83 | } 84 | 85 | @Override 86 | protected boolean valid() { 87 | return value != null; 88 | } 89 | 90 | @Override 91 | public int hashCode() { 92 | final int prime = 31; 93 | int result = super.hashCode(); 94 | result = prime * result 95 | + ((defaultValue == null) ? 0 : defaultValue.hashCode()); 96 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 97 | return result; 98 | } 99 | 100 | @Override 101 | public boolean equals(Object obj) { 102 | if (this == obj) 103 | return true; 104 | if (!super.equals(obj)) 105 | return false; 106 | if (getClass() != obj.getClass()) 107 | return false; 108 | DoubleField other = (DoubleField) obj; 109 | if (defaultValue == null) { 110 | if (other.defaultValue != null) 111 | return false; 112 | } else if (!defaultValue.equals(other.defaultValue)) 113 | return false; 114 | if (value == null) { 115 | if (other.value != null) 116 | return false; 117 | } else if (!value.equals(other.value)) 118 | return false; 119 | return true; 120 | } 121 | 122 | 123 | 124 | } 125 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/nav/NavigationPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget.nav; 18 | 19 | import org.kaaproject.avro.ui.gwt.client.util.Utils; 20 | 21 | import com.google.gwt.dom.client.Element; 22 | import com.google.gwt.dom.client.Style.Display; 23 | import com.google.gwt.user.client.DOM; 24 | import com.google.gwt.user.client.Event; 25 | import com.google.gwt.user.client.ui.FlowPanel; 26 | import com.google.gwt.user.client.ui.Widget; 27 | 28 | public class NavigationPanel extends FlowPanel { 29 | 30 | private Breadcrumbs breadcrumbs; 31 | private Element zoomElement; 32 | 33 | private ZoomListener zoomListener; 34 | 35 | public NavigationPanel() { 36 | super(); 37 | setWidth("100%"); 38 | breadcrumbs = new Breadcrumbs(); 39 | add(breadcrumbs); 40 | DOM.sinkEvents(this.getElement(), Event.ONMOUSEUP); 41 | zoomElement = DOM.createDiv(); 42 | zoomElement.addClassName(Utils.avroUiStyle.zoomActionPanel()); 43 | Element zoomIcon = DOM.createDiv(); 44 | zoomIcon.addClassName(Utils.avroUiStyle.zoomAction()); 45 | zoomElement.appendChild(zoomIcon); 46 | this.getElement().appendChild(zoomElement); 47 | } 48 | 49 | public void enableZoom(boolean enableZoom) { 50 | if (enableZoom) { 51 | zoomElement.getStyle().clearDisplay(); 52 | } else { 53 | zoomElement.getStyle().setDisplay(Display.NONE); 54 | } 55 | } 56 | 57 | public void setZoomListener(ZoomListener zoomListener) { 58 | this.zoomListener = zoomListener; 59 | } 60 | 61 | public void clearNavElements() { 62 | breadcrumbs.clear(); 63 | } 64 | 65 | public void addNavElement(Widget navElement) { 66 | breadcrumbs.add(navElement); 67 | } 68 | 69 | public void removeNavElement(Widget navElement) { 70 | breadcrumbs.remove(navElement); 71 | } 72 | 73 | @Override 74 | public void onBrowserEvent(Event event) { 75 | final int eventType = DOM.eventGetType(event); 76 | if (Event.ONMOUSEUP == eventType && isZoomElement(event)) { 77 | if (zoomListener != null) { 78 | zoomListener.onZoom(); 79 | } 80 | } else { 81 | super.onBrowserEvent(event); 82 | } 83 | } 84 | 85 | protected boolean isZoomElement(Event event) { 86 | if (zoomElement != null) { 87 | int cursorY = event.getClientY(); 88 | int initialY = zoomElement.getAbsoluteTop(); 89 | int height = zoomElement.getOffsetHeight(); 90 | int cursorX = event.getClientX(); 91 | int initialX = zoomElement.getAbsoluteLeft(); 92 | int width = zoomElement.getOffsetWidth(); 93 | 94 | if (cursorY >= initialY && cursorY <= (initialY + height) && 95 | cursorX >= initialX && cursorX <= (initialX + width)) { 96 | return true; 97 | } else { 98 | return false; 99 | } 100 | } else { 101 | return false; 102 | } 103 | } 104 | 105 | public static interface ZoomListener { 106 | 107 | void onZoom(); 108 | 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /shared/src/main/java/org/kaaproject/avro/ui/shared/FqnReferenceField.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.shared; 18 | 19 | public class FqnReferenceField extends FormField { 20 | 21 | private static final long serialVersionUID = 5129865434220898861L; 22 | 23 | private FqnKey value; 24 | 25 | public FqnReferenceField() { 26 | super(); 27 | } 28 | 29 | public FqnReferenceField(FormContext context, 30 | String fieldName, 31 | String displayName, 32 | String schema, 33 | boolean optional) { 34 | super(context, fieldName, displayName, schema, optional); 35 | } 36 | 37 | public FqnKey getValue() { 38 | return value; 39 | } 40 | 41 | public void setValue(FqnKey value) { 42 | boolean valueChanged = (this.value == null && value != null) || 43 | (this.value != null && value != null && this.value.getId() != value.getId()); 44 | this.value = value; 45 | if (valueChanged) { 46 | fireValueChanged(this.value); 47 | context.orderSchemaTypes(); 48 | } 49 | fireChanged(); 50 | } 51 | 52 | public Fqn getFqnValue() { 53 | if (value != null) { 54 | return context.getDeclaredTypes().get(value); 55 | } 56 | return null; 57 | } 58 | 59 | public void setFqnValue(Fqn fqnValue) { 60 | FqnKey fqnKey = null; 61 | if (fqnValue != null) { 62 | fqnKey = context.fqnToFqnKey(fqnValue); 63 | } 64 | setValue(fqnKey); 65 | } 66 | 67 | @Override 68 | public String getDisplayString() { 69 | return super.getDisplayString() + ": " + valueToDisplayString(value); 70 | } 71 | 72 | @Override 73 | public FieldType getFieldType() { 74 | return FieldType.TYPE_REFERENCE; 75 | } 76 | 77 | @Override 78 | public boolean isNull() { 79 | return value == null; 80 | } 81 | 82 | @Override 83 | protected FormField createInstance() { 84 | return new FqnReferenceField(); 85 | } 86 | 87 | @Override 88 | protected void copyFields(FormField cloned, boolean deepCopy) { 89 | super.copyFields(cloned, deepCopy); 90 | FqnReferenceField clonedLongField = (FqnReferenceField)cloned; 91 | clonedLongField.value = value; 92 | } 93 | 94 | @Override 95 | protected boolean valid() { 96 | if (value != null && !context.containsDeclaredType(value)) { 97 | setValue(null); 98 | } 99 | return value != null; 100 | } 101 | 102 | @Override 103 | public int hashCode() { 104 | final int prime = 31; 105 | int result = super.hashCode(); 106 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 107 | return result; 108 | } 109 | 110 | @Override 111 | public boolean equals(Object obj) { 112 | if (this == obj) 113 | return true; 114 | if (!super.equals(obj)) 115 | return false; 116 | if (getClass() != obj.getClass()) 117 | return false; 118 | FqnReferenceField other = (FqnReferenceField) obj; 119 | if (value == null) { 120 | if (other.value != null) 121 | return false; 122 | } else if (!value.equals(other.value)) 123 | return false; 124 | return true; 125 | } 126 | 127 | } 128 | -------------------------------------------------------------------------------- /gwt-client/src/main/java/org/kaaproject/avro/ui/gwt/client/widget/ExtendedValueListBox.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2015 CyberVision, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.kaaproject.avro.ui.gwt.client.widget; 18 | 19 | import java.util.Collection; 20 | 21 | import org.kaaproject.avro.ui.gwt.client.AvroUiResources.AvroUiStyle; 22 | import org.kaaproject.avro.ui.gwt.client.util.Utils; 23 | 24 | import com.google.gwt.dom.client.NodeList; 25 | import com.google.gwt.dom.client.OptionElement; 26 | import com.google.gwt.dom.client.SelectElement; 27 | import com.google.gwt.text.shared.Renderer; 28 | import com.google.gwt.user.client.ui.ValueListBox; 29 | import com.google.gwt.view.client.ProvidesKey; 30 | import com.google.gwt.view.client.SimpleKeyProvider; 31 | 32 | public class ExtendedValueListBox extends ValueListBox { 33 | 34 | private AvroUiStyle style; 35 | private String promptText; 36 | 37 | public ExtendedValueListBox(Renderer renderer, AvroUiStyle style, String promptText) { 38 | this(renderer, new SimpleKeyProvider(), style, promptText); 39 | } 40 | 41 | public ExtendedValueListBox(Renderer renderer, 42 | ProvidesKey keyProvider, AvroUiStyle style, String promptText) { 43 | super(renderer, keyProvider); 44 | 45 | this.style = style; 46 | this.promptText = promptText; 47 | } 48 | 49 | @Override 50 | public void setValue(T value, boolean fireEvents) { 51 | super.setValue(value, fireEvents); 52 | updateOptionsStyle(); 53 | } 54 | 55 | @Override 56 | public void setAcceptableValues(Collection newValues) { 57 | super.setAcceptableValues(newValues); 58 | updateOptionsStyle(); 59 | } 60 | 61 | private void updateOptionsStyle() { 62 | if (Utils.isNotBlank(promptText)) { 63 | SelectElement select = getSelectElement(); 64 | int index = select.getSelectedIndex(); 65 | if (index > -1) { 66 | OptionElement selectedOption = getOptionElement(index); 67 | if (Utils.isBlank(selectedOption.getValue())) { 68 | selectedOption.setClassName(style.prompt()); 69 | selectedOption.setText(promptText); 70 | addStyleName(style.prompt()); 71 | NodeList options = getSelectElement().getOptions(); 72 | for (int i=0;i options = getSelectElement().getOptions(); 80 | for (int i=0;i