Skip to content

Commit

Permalink
move sql explorer to symmetric-ds project
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Jan 31, 2018
1 parent 68ad42e commit bfcb7f2
Show file tree
Hide file tree
Showing 398 changed files with 12,351 additions and 4 deletions.
3 changes: 2 additions & 1 deletion symmetric-assemble/gradle.properties
Expand Up @@ -11,4 +11,5 @@ publishPort=?
publishServer=symmetricds.org
sourceforgeUser=?
sourceforgePassword=?
jetty.version=9.4.7.v20170914
jetty.version=9.4.7.v20170914
vaadinVersion=8.1.6
6 changes: 3 additions & 3 deletions symmetric-assemble/settings.gradle
@@ -1,3 +1,3 @@
includeFlat 'symmetric-util','symmetric-db',
'symmetric-csv','symmetric-jdbc','symmetric-io', 'symmetric-core',
'symmetric-client','symmetric-server','symmetric-wrapper','symmetric-android'
includeFlat 'symmetric-util','symmetric-db','symmetric-csv','symmetric-jdbc',
'symmetric-io', 'symmetric-core','symmetric-client','symmetric-server',
'symmetric-wrapper','symmetric-android','symmetric-sqlexplorer'
18 changes: 18 additions & 0 deletions symmetric-sqlexplorer/.gitignore
@@ -0,0 +1,18 @@
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/.gradle/
/bin/
/build/
/.settings/
/.classpath
/.project
32 changes: 32 additions & 0 deletions symmetric-sqlexplorer/README.md
@@ -0,0 +1,32 @@
#Introduction
This library provides a sql explorer component that can be used in Vaadin applications. This component is used by the Metl and SymmetricDS Pro applications.

# Usage

This library can be found in the JumpMind Maven Repository at http://maven.jumpmind.com/repo.

[DemoUI.java](src/test/java/org/jumpmind/vaadin/ui/sqlexplorer/DemoUI.java) is an example of how to use the Sql Explorer component.

It can be included via gradle or maven. The following is an example of how it can be included using gradle. Including this component will require the vaadin widgetset to be compiled as it includes other addons that require widgetset compilation.
```
repositories {
mavenCentral()
jcenter()
maven { url "http://maven.vaadin.com/vaadin-addons" }
maven { url "http://maven.jumpmind.com/repo" }
}
dependencies {
compile 'org.jumpmind.vaadin:sqlexplorer-vaadin:1.0.11'
}
```

<p align="center">
<img src='src/test/screenshots/screenshot2.png?raw=true' />
</p>

<p align="center">
<img src='src/test/screenshots/screenshot1.png?raw=true' />
</p>


90 changes: 90 additions & 0 deletions symmetric-sqlexplorer/build.gradle
@@ -0,0 +1,90 @@
apply from: symAssembleDir + '/common.gradle'

buildscript {
repositories {
jcenter()
maven { url 'http://repo.spring.io/plugins-release' }
maven { url 'https://plugins.gradle.org/m2/' }
maven { url "http://maven.vaadin.com/vaadin-addons" }
}

dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath 'com.devsoap.plugin:gradle-vaadin-plugin:1.2.2'
classpath 'com.vaadin:vaadin-compatibility-server:8.1.2'
classpath 'com.vaadin:vaadin-compatibility-client-compiled:8.1.2'
}
}

apply plugin: 'com.devsoap.plugin.vaadin'
apply plugin: 'maven'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-eclipse'

configurations { deployerJars }

vaadin.version = vaadinVersion
vaadin.manageDependencies = false
vaadin.manageRepositories = false
vaadin.logToConsole = true
vaadinSourcesJar.enabled=false
vaadinJavadocJar.enabled=false
vaadin.push = true
vaadinCompile.gwtSdkFirstInClasspath=false
artifacts {
archives file("$buildDir/libs/${jar.baseName}-${jar.version}.${jar.extension}")
}

configurations.archives.with {
artifacts.remove artifacts.find { it.archiveTask.is war }
}

dependencies {

deployerJars "org.apache.maven.wagon:wagon-ssh:2.2"

compile project(":symmetric-jdbc")
compile project(":symmetric-io")

compile "commons-lang:commons-lang:$commonsLangVersion"
compile "commons-dbcp:commons-dbcp:$commonsDbcpVersion"
compile "commons-io:commons-io:$commonsIoVersion"

compile "org.springframework:spring-webmvc:$springVersion"

compile group: 'com.vaadin', name: 'vaadin-compatibility-server', version: "$vaadinVersion"
compile group: 'com.vaadin', name: 'vaadin-compatibility-client-compiled', version: "$vaadinVersion"
compile group: 'com.vaadin', name: 'vaadin-compatibility-client', version: "$vaadinVersion"

//compile "com.vaadin:vaadin-server:$vaadinVersion"
compile "com.vaadin:vaadin-push:$vaadinVersion"
compile "com.vaadin:vaadin-themes:$vaadinVersion"
compile "org.vaadin.addons:aceeditor:0.8.15"
compile "com.vaadin:vaadin-context-menu:2.0.0"

compile "org.apache.poi:poi-ooxml:3.17"
// provided ("com.vaadin:vaadin-client-compiler:$vaadinVersion") {
// exclude group:'org.eclipse.jetty'
// }

provided "javax.servlet:javax.servlet-api:$servletVersion"
provided "javax.servlet.jsp:jsp-api:2.2"
provided "javax.websocket:javax.websocket-api:1.1"

testCompile "org.eclipse.jetty:jetty-webapp:$jettyVersion"
testCompile "org.eclipse.jetty:jetty-jmx:$jettyVersion"
testCompile "org.eclipse.jetty:jetty-annotations:$jettyVersion"
testCompile "org.eclipse.jetty.websocket:javax-websocket-server-impl:$jettyVersion"

testCompile "org.slf4j:slf4j-api:$slf4jVersion"
testCompile "org.slf4j:jul-to-slf4j:$slf4jVersion"
testCompile "org.slf4j:slf4j-log4j12:$slf4jVersion"
testCompile "org.slf4j:jcl-over-slf4j:$slf4jVersion"
testCompile "log4j:log4j:$log4jVersion"


}

assemble.dependsOn jar
@@ -0,0 +1,41 @@
package org.jumpmind.vaadin.ui.common;

import java.util.Locale;

import org.apache.commons.lang.StringUtils;

import com.vaadin.v7.data.util.converter.Converter;

public class AbbreviatorConverter implements Converter<String, String> {

private static final long serialVersionUID = 1L;

private int maxWidth;

public AbbreviatorConverter(int maxWidth) {
this.maxWidth = maxWidth;
}

@Override
public String convertToModel(String value, Class<? extends String> targetType, Locale locale)
throws com.vaadin.v7.data.util.converter.Converter.ConversionException {
return value;
}

@Override
public String convertToPresentation(String value, Class<? extends String> targetType, Locale locale)
throws com.vaadin.v7.data.util.converter.Converter.ConversionException {
return StringUtils.abbreviate(value, maxWidth);
}

@Override
public Class<String> getModelType() {
return String.class;
}

@Override
public Class<String> getPresentationType() {
return String.class;
}

}
@@ -0,0 +1,127 @@
/**
* Licensed to JumpMind Inc under one or more contributor
* license agreements. See the NOTICE file distributed
* with this work for additional information regarding
* copyright ownership. JumpMind Inc licenses this file
* to you under the GNU General Public License, version 3.0 (GPLv3)
* (the "License"); you may not use this file except in compliance
* with the License.
*
* You should have received a copy of the GNU General Public License,
* version 3.0 (GPLv3) along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jumpmind.vaadin.ui.common;

import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.Date;
import java.util.Locale;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.vaadin.v7.data.util.converter.Converter;
import com.vaadin.v7.data.util.converter.DefaultConverterFactory;
import com.vaadin.v7.data.util.converter.StringToBigDecimalConverter;
import com.vaadin.v7.data.util.converter.StringToBooleanConverter;
import com.vaadin.v7.data.util.converter.StringToDateConverter;
import com.vaadin.v7.data.util.converter.StringToDoubleConverter;
import com.vaadin.v7.data.util.converter.StringToFloatConverter;
import com.vaadin.v7.data.util.converter.StringToIntegerConverter;
import com.vaadin.v7.data.util.converter.StringToLongConverter;
import com.vaadin.server.DefaultErrorHandler;
import com.vaadin.server.Responsive;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.server.VaadinSession;
import com.vaadin.ui.UI;

abstract public class AbstractSpringUI extends UI {

private static final long serialVersionUID = 1L;

private final Logger log = LoggerFactory.getLogger(getClass());

@Override
protected void init(VaadinRequest request) {
setErrorHandler(new DefaultErrorHandler() {

private static final long serialVersionUID = 1L;

@Override
public void error(com.vaadin.server.ErrorEvent event) {
Throwable ex = event.getThrowable();
CommonUiUtils.notify(ex);
if (ex != null) {
log.error(ex.getMessage(), ex);
} else {
log.error("An unexpected error occurred");
}
}
});

VaadinSession.getCurrent().setConverterFactory(new DefaultConverterFactory() {
private static final long serialVersionUID = 1L;

@Override
protected Converter<Date, ?> createDateConverter(Class<?> sourceType) {
return super.createDateConverter(sourceType);
}

protected Converter<String, ?> createStringConverter(Class<?> sourceType) {
if (Double.class.isAssignableFrom(sourceType)) {
return new StringToDoubleConverter();
} else if (Float.class.isAssignableFrom(sourceType)) {
return new StringToFloatConverter();
} else if (Integer.class.isAssignableFrom(sourceType)) {
return new StringToIntegerConverter() {
private static final long serialVersionUID = 1L;
@Override
protected NumberFormat getFormat(Locale locale) {
NumberFormat format = super.getFormat(locale);
format.setGroupingUsed(false);
return format;
}
};
} else if (Long.class.isAssignableFrom(sourceType)) {
return new StringToLongConverter() {
private static final long serialVersionUID = 1L;
@Override
protected NumberFormat getFormat(Locale locale) {
NumberFormat format = super.getFormat(locale);
format.setGroupingUsed(false);
return format;
}
};
} else if (BigDecimal.class.isAssignableFrom(sourceType)) {
return new StringToBigDecimalConverter();
} else if (Boolean.class.isAssignableFrom(sourceType)) {
return new StringToBooleanConverter();
} else if (Date.class.isAssignableFrom(sourceType)) {
return new StringToDateConverter();
} else {
return null;
}
}


});

Responsive.makeResponsive(this);
}

public WebApplicationContext getWebApplicationContext() {
return WebApplicationContextUtils.getRequiredWebApplicationContext(VaadinServlet
.getCurrent().getServletContext());
}
}

0 comments on commit bfcb7f2

Please sign in to comment.