Skip to content

Commit

Permalink
Initial take at QI-core migration to jPOS-EE
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Aug 21, 2016
1 parent 23e2a18 commit bf52f2a
Show file tree
Hide file tree
Showing 65 changed files with 6,609 additions and 27 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ subprojects {
mavenCentral()
maven { url 'http://jpos.org/maven' }
maven { url 'http://download.oracle.com/maven' }
maven { url 'http://maven.vaadin.com/vaadin-addons' }
mavenLocal()
}

Expand Down
1 change: 1 addition & 0 deletions libraries.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ext {
jsonSchemaVersion = '2.2.6'
jacksonVersion = '2.7.4'
groovyVersion = '2.4.6'
vaadinVersion = '7.6.8'

libraries = [
//jUnit (Tests)
Expand Down
3 changes: 3 additions & 0 deletions modules/qi-core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src/main/resources/org/jpos/AppWidgetset.gwt.xml
src/main/webapp/VAADIN

63 changes: 63 additions & 0 deletions modules/qi-core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
plugins {
id "fi.jasoft.plugin.vaadin" version "0.11.1"
}
vaadin {
version=vaadinVersion
addon.title='QI'
manageDependencies = false
}
vaadinCompile.gwtSdkFirstInClasspath=false

apply plugin: 'maven-publish'

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
url 'file:///opt/local/maven'
}
}
}

install {
doFirst {
Configuration archivesConfig = project.getConfigurations().getByName('archives')
archivesConfig.artifacts.removeAll {
it.extension.equals('war')
}
}
}

dependencies {
compile project(':modules:core')
compile project(':modules:visitor')
compile project(':modules:syslog')
compile project(':modules:sysconfig')
compile project(':modules:jetty')
compile "com.vaadin:vaadin-server:${vaadinVersion}"
compile "com.vaadin:vaadin-push:${vaadinVersion}"
compile 'org.vaadin.addons:d3Gauge:1.0.1'
compile 'org.vaadin.addons:dcharts-widget:1.7.0'
compile 'org.vaadin.addons:vaadin-sliderpanel:1.3.0'

providedCompile "com.vaadin:vaadin-client:${vaadin.version}"
providedCompile "com.vaadin:vaadin-themes:${vaadin.version}"
providedCompile "com.vaadin:vaadin-client-compiler:${vaadin.version}"

// providedCompile 'com.vaadin.external.slf4j:vaadin-slf4j-jdk14:1.6.1'
// compile 'org.slf4j:jcl-over-slf4j:1.7.7'
compile 'org.slf4j:jul-to-slf4j:1.7.7'
}

jar {
from 'src/main/webapp'
exclude '**/gwt-unitCache/*'
exclude '**/gwt-unitCache'
}
jar.dependsOn("vaadinCompile")
install.dependsOn("publishToMavenLocal")
uploadArchives.dependsOn("publishMavenJavaPublicationToMavenRepository")
104 changes: 104 additions & 0 deletions modules/qi-core/src/main/java/org/jpos/client/ui/XLabelConnector.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* jPOS Project [http://jpos.org]
* Copyright (C) 2000-2016 Alejandro P. Revilla
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package org.jpos.client.ui;

/*
* This code is based on Vaadin's Label that has the following copyright notice
*
* Copyright 2000-2014 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.PreElement;
import com.vaadin.client.Profiler;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.VLabel;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.Connect.LoadStyle;
import com.vaadin.shared.ui.label.LabelState;
import org.jpos.server.ui.XLabel;

@Connect(value = XLabel.class, loadStyle = LoadStyle.EAGER)
public class XLabelConnector extends AbstractComponentConnector {

@Override
public LabelState getState() {
return (LabelState) super.getState();
}

@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
boolean sinkOnloads = false;
Profiler.enter("LabelConnector.onStateChanged update content");
switch (getState().contentMode) {
case PREFORMATTED:
Document doc = Document.get();
Element e = getWidget().getElement();
PreElement preElement = doc.createPreElement();
preElement.setInnerText(getState().text);
// DO NOT clear existing content
// getWidget().setHTML("");
// add preformatted text to dom
e.appendChild(preElement);
// e.appendChild(doc.createHRElement());
break;
case TEXT:
getWidget().setText(getState().text);
break;
case HTML:
case RAW:
sinkOnloads = true;
case XML:
getWidget().setHTML(getState().text);
break;
default:
getWidget().setText("");
break;

}
Profiler.leave("LabelConnector.onStateChanged update content");

if (sinkOnloads) {
Profiler.enter("LabelConnector.onStateChanged sinkOnloads");
WidgetUtil.sinkOnloadForImages(getWidget().getElement());
Profiler.leave("LabelConnector.onStateChanged sinkOnloads");
}
}

@Override
public VLabel getWidget() {
return (VLabel) super.getWidget();
}
}
72 changes: 72 additions & 0 deletions modules/qi-core/src/main/java/org/jpos/qi/ConfirmDialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* jPOS Project [http://jpos.org]
* Copyright (C) 2000-2016 Alejandro P. Revilla
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package org.jpos.qi;

import com.vaadin.shared.ui.MarginInfo;
import com.vaadin.ui.*;
import org.jpos.ee.BLException;

public class ConfirmDialog extends Window implements Button.ClickListener {
Callback callback;
Button yes = new Button("Yes", this);
Button no = new Button("No", this);

public ConfirmDialog(String caption, String question, Callback callback) {
super(caption);
setWidth("350px");
setModal(true);
setResizable(false);

VerticalLayout content = new VerticalLayout();
content.setMargin(true);
content.setSpacing(true);
setContent(content);

this.callback = callback;

if (question != null) {
content.addComponent(new Label(question));
}
HorizontalLayout hl = new HorizontalLayout();
hl.setMargin(new MarginInfo(true, false, false, false));
hl.setSpacing(true);
hl.setWidth("100%");
hl.addComponent(yes);
hl.setComponentAlignment(yes, Alignment.MIDDLE_CENTER);
hl.addComponent(no);
hl.setComponentAlignment(no, Alignment.MIDDLE_CENTER);
content.addComponent(hl);
}

@Override
public void buttonClick(Button.ClickEvent event) {
if (getParent() != null)
close();
try {
callback.onDialogResult(event.getSource() == yes);
} catch (BLException e) {
QI.getQI().getLog().error(e);
}

}

public interface Callback{
void onDialogResult(boolean resultIsYes) throws BLException;
}
}
Loading

0 comments on commit bf52f2a

Please sign in to comment.