repo_name
stringlengths 7
104
| file_path
stringlengths 13
198
| context
stringlengths 67
7.15k
| import_statement
stringlengths 16
4.43k
| code
stringlengths 40
6.98k
| prompt
stringlengths 227
8.27k
| next_line
stringlengths 8
795
|
|---|---|---|---|---|---|---|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test03.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
|
import xiaofei.library.shelly.function.Function1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test03 {
@Test
public void f() {
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test03.java
import xiaofei.library.shelly.function.Function1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test03 {
@Test
public void f() {
|
Shelly.<Integer>createDomino(1)
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test03.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
|
import xiaofei.library.shelly.function.Function1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test03 {
@Test
public void f() {
Shelly.<Integer>createDomino(1)
.backgroundQueue()
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test03.java
import xiaofei.library.shelly.function.Function1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test03 {
@Test
public void f() {
Shelly.<Integer>createDomino(1)
.backgroundQueue()
|
.perform(new Action1<Integer>() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test03.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
|
import xiaofei.library.shelly.function.Function1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test03 {
@Test
public void f() {
Shelly.<Integer>createDomino(1)
.backgroundQueue()
.perform(new Action1<Integer>() {
@Override
public void call(Integer input) {
System.out.println("cached thread1 : " + Thread.currentThread().getName() + " " + input);
}
})
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test03.java
import xiaofei.library.shelly.function.Function1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test03 {
@Test
public void f() {
Shelly.<Integer>createDomino(1)
.backgroundQueue()
.perform(new Action1<Integer>() {
@Override
public void call(Integer input) {
System.out.println("cached thread1 : " + Thread.currentThread().getName() + " " + input);
}
})
|
.map(new Function1<Integer, String>() {
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
|
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/6/27.
*/
public class RetrofitDomino<T, R> extends Domino<T, Triple<Boolean, Response<R>, Throwable>> {
public RetrofitDomino(Object label, Tile<T, Triple<Boolean, Response<R>, Throwable>> tile) {
super(label, tile);
}
private RetrofitDomino(Domino<T, Triple<Boolean, Response<R>, Throwable>> domino) {
//can use getPlayer(), but not here!
this(domino.getLabel(), domino.getPlayer());
}
@Override
public RetrofitDomino<T, R> uiThread() {
return new RetrofitDomino<T, R>(super.uiThread());
}
@Override
public RetrofitDomino<T, R> background() {
return new RetrofitDomino<T, R>(super.background());
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/6/27.
*/
public class RetrofitDomino<T, R> extends Domino<T, Triple<Boolean, Response<R>, Throwable>> {
public RetrofitDomino(Object label, Tile<T, Triple<Boolean, Response<R>, Throwable>> tile) {
super(label, tile);
}
private RetrofitDomino(Domino<T, Triple<Boolean, Response<R>, Throwable>> domino) {
//can use getPlayer(), but not here!
this(domino.getLabel(), domino.getPlayer());
}
@Override
public RetrofitDomino<T, R> uiThread() {
return new RetrofitDomino<T, R>(super.uiThread());
}
@Override
public RetrofitDomino<T, R> background() {
return new RetrofitDomino<T, R>(super.background());
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
|
perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
|
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/6/27.
*/
public class RetrofitDomino<T, R> extends Domino<T, Triple<Boolean, Response<R>, Throwable>> {
public RetrofitDomino(Object label, Tile<T, Triple<Boolean, Response<R>, Throwable>> tile) {
super(label, tile);
}
private RetrofitDomino(Domino<T, Triple<Boolean, Response<R>, Throwable>> domino) {
//can use getPlayer(), but not here!
this(domino.getLabel(), domino.getPlayer());
}
@Override
public RetrofitDomino<T, R> uiThread() {
return new RetrofitDomino<T, R>(super.uiThread());
}
@Override
public RetrofitDomino<T, R> background() {
return new RetrofitDomino<T, R>(super.background());
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/6/27.
*/
public class RetrofitDomino<T, R> extends Domino<T, Triple<Boolean, Response<R>, Throwable>> {
public RetrofitDomino(Object label, Tile<T, Triple<Boolean, Response<R>, Throwable>> tile) {
super(label, tile);
}
private RetrofitDomino(Domino<T, Triple<Boolean, Response<R>, Throwable>> domino) {
//can use getPlayer(), but not here!
this(domino.getLabel(), domino.getPlayer());
}
@Override
public RetrofitDomino<T, R> uiThread() {
return new RetrofitDomino<T, R>(super.uiThread());
}
@Override
public RetrofitDomino<T, R> background() {
return new RetrofitDomino<T, R>(super.background());
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
|
.reduce(new Function1<List<Triple<Boolean, Response<R>, Throwable>>, List<Throwable>>() {
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
|
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
|
@Override
public RetrofitDomino<T, R> uiThread() {
return new RetrofitDomino<T, R>(super.uiThread());
}
@Override
public RetrofitDomino<T, R> background() {
return new RetrofitDomino<T, R>(super.background());
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
.reduce(new Function1<List<Triple<Boolean, Response<R>, Throwable>>, List<Throwable>>() {
@Override
public List<Throwable> call(List<Triple<Boolean, Response<R>, Throwable>> input) {
List<Throwable> result= new ArrayList<Throwable>();
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
result.add(triple.third);
}
}
return result;
}
})
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
@Override
public RetrofitDomino<T, R> uiThread() {
return new RetrofitDomino<T, R>(super.uiThread());
}
@Override
public RetrofitDomino<T, R> background() {
return new RetrofitDomino<T, R>(super.background());
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
.reduce(new Function1<List<Triple<Boolean, Response<R>, Throwable>>, List<Throwable>>() {
@Override
public List<Throwable> call(List<Triple<Boolean, Response<R>, Throwable>> input) {
List<Throwable> result= new ArrayList<Throwable>();
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
result.add(triple.third);
}
}
return result;
}
})
|
.flatMap(new ListIdentityOperator<Throwable>())
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
|
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
|
@Override
public RetrofitDomino<T, R> background() {
return new RetrofitDomino<T, R>(super.background());
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
.reduce(new Function1<List<Triple<Boolean, Response<R>, Throwable>>, List<Throwable>>() {
@Override
public List<Throwable> call(List<Triple<Boolean, Response<R>, Throwable>> input) {
List<Throwable> result= new ArrayList<Throwable>();
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
result.add(triple.third);
}
}
return result;
}
})
.flatMap(new ListIdentityOperator<Throwable>())
.perform(domino)
));
}
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
@Override
public RetrofitDomino<T, R> background() {
return new RetrofitDomino<T, R>(super.background());
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
.reduce(new Function1<List<Triple<Boolean, Response<R>, Throwable>>, List<Throwable>>() {
@Override
public List<Throwable> call(List<Triple<Boolean, Response<R>, Throwable>> input) {
List<Throwable> result= new ArrayList<Throwable>();
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
result.add(triple.third);
}
}
return result;
}
})
.flatMap(new ListIdentityOperator<Throwable>())
.perform(domino)
));
}
|
public <S> RetrofitDomino<T, R> onFailure(final Class<? extends S> target, final TargetAction0<? super S> targetAction0) {
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
|
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
|
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
.reduce(new Function1<List<Triple<Boolean, Response<R>, Throwable>>, List<Throwable>>() {
@Override
public List<Throwable> call(List<Triple<Boolean, Response<R>, Throwable>> input) {
List<Throwable> result= new ArrayList<Throwable>();
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
result.add(triple.third);
}
}
return result;
}
})
.flatMap(new ListIdentityOperator<Throwable>())
.perform(domino)
));
}
public <S> RetrofitDomino<T, R> onFailure(final Class<? extends S> target, final TargetAction0<? super S> targetAction0) {
return new RetrofitDomino<T, R>(
reduce(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>())
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
}
@Override
public RetrofitDomino<T, R> backgroundQueue() {
return new RetrofitDomino<T, R>(super.backgroundQueue());
}
public RetrofitDomino<T, R> onFailure(final Domino<? super Throwable, ?> domino) {
return new RetrofitDomino<T, R>(
perform(Shelly.<Triple<Boolean, Response<R>, Throwable>>createAnonymousDomino()
.reduce(new Function1<List<Triple<Boolean, Response<R>, Throwable>>, List<Throwable>>() {
@Override
public List<Throwable> call(List<Triple<Boolean, Response<R>, Throwable>> input) {
List<Throwable> result= new ArrayList<Throwable>();
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
result.add(triple.third);
}
}
return result;
}
})
.flatMap(new ListIdentityOperator<Throwable>())
.perform(domino)
));
}
public <S> RetrofitDomino<T, R> onFailure(final Class<? extends S> target, final TargetAction0<? super S> targetAction0) {
return new RetrofitDomino<T, R>(
reduce(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>())
|
.perform(target, new TargetAction1<S, List<Triple<Boolean, Response<R>, Throwable>>>() {
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
|
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
|
return new RetrofitDomino<T, R>(
reduce(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>())
.perform(target, new TargetAction1<S, List<Triple<Boolean, Response<R>, Throwable>>>() {
@Override
public void call(S s, List<Triple<Boolean, Response<R>, Throwable>> input) {
boolean failure = false;
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
failure = true;
break;
}
}
if (failure) {
targetAction0.call(s);
}
}
}).flatMap(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>()));
}
public <S> RetrofitDomino<T, R> onFailure(final Class<? extends S> target, final TargetAction1<? super S, ? super Throwable> targetAction1) {
return new RetrofitDomino<T, R>(perform(target, new TargetAction1<S, Triple<Boolean, Response<R>, Throwable>>() {
@Override
public void call(S s, Triple<Boolean, Response<R>, Throwable> input) {
if (!input.first) {
targetAction1.call(s, input.third);
}
}
}));
}
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
return new RetrofitDomino<T, R>(
reduce(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>())
.perform(target, new TargetAction1<S, List<Triple<Boolean, Response<R>, Throwable>>>() {
@Override
public void call(S s, List<Triple<Boolean, Response<R>, Throwable>> input) {
boolean failure = false;
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
failure = true;
break;
}
}
if (failure) {
targetAction0.call(s);
}
}
}).flatMap(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>()));
}
public <S> RetrofitDomino<T, R> onFailure(final Class<? extends S> target, final TargetAction1<? super S, ? super Throwable> targetAction1) {
return new RetrofitDomino<T, R>(perform(target, new TargetAction1<S, Triple<Boolean, Response<R>, Throwable>>() {
@Override
public void call(S s, Triple<Boolean, Response<R>, Throwable> input) {
if (!input.first) {
targetAction1.call(s, input.third);
}
}
}));
}
|
public RetrofitDomino<T, R> onFailure(final Action0 action0) {
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
|
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
|
@Override
public void call(S s, List<Triple<Boolean, Response<R>, Throwable>> input) {
boolean failure = false;
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
failure = true;
break;
}
}
if (failure) {
targetAction0.call(s);
}
}
}).flatMap(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>()));
}
public <S> RetrofitDomino<T, R> onFailure(final Class<? extends S> target, final TargetAction1<? super S, ? super Throwable> targetAction1) {
return new RetrofitDomino<T, R>(perform(target, new TargetAction1<S, Triple<Boolean, Response<R>, Throwable>>() {
@Override
public void call(S s, Triple<Boolean, Response<R>, Throwable> input) {
if (!input.first) {
targetAction1.call(s, input.third);
}
}
}));
}
public RetrofitDomino<T, R> onFailure(final Action0 action0) {
return new RetrofitDomino<T, R>(
reduce(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>())
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction0.java
// public interface TargetAction0<T> extends Action {
// void call(T t);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/operator/ListIdentityOperator.java
// public class ListIdentityOperator<T> extends IdentityOperator<List<T>> {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Tile.java
// public interface Tile<T, R> extends Function1<List<T>, Player<R>> {
//
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/domino/RetrofitDomino.java
import xiaofei.library.shelly.util.Tile;
import java.util.ArrayList;
import java.util.List;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.TargetAction0;
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.operator.ListIdentityOperator;
import xiaofei.library.shelly.tuple.Triple;
@Override
public void call(S s, List<Triple<Boolean, Response<R>, Throwable>> input) {
boolean failure = false;
for (Triple<Boolean, Response<R>, Throwable> triple : input) {
if (!triple.first) {
failure = true;
break;
}
}
if (failure) {
targetAction0.call(s);
}
}
}).flatMap(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>()));
}
public <S> RetrofitDomino<T, R> onFailure(final Class<? extends S> target, final TargetAction1<? super S, ? super Throwable> targetAction1) {
return new RetrofitDomino<T, R>(perform(target, new TargetAction1<S, Triple<Boolean, Response<R>, Throwable>>() {
@Override
public void call(S s, Triple<Boolean, Response<R>, Throwable> input) {
if (!input.first) {
targetAction1.call(s, input.third);
}
}
}));
}
public RetrofitDomino<T, R> onFailure(final Action0 action0) {
return new RetrofitDomino<T, R>(
reduce(new ListIdentityOperator<Triple<Boolean, Response<R>, Throwable>>())
|
.perform(new Action1<List<Triple<Boolean, Response<R>, Throwable>>>() {
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/runnable/ScheduledRunnable.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Player.java
// public class Player<T> {
//
// private final AugmentedListCanary<PlayerInputs> mInputs;
//
// private final DoubleKeyMap mStash;
//
// private Scheduler mScheduler;
//
// public Player(List<T> input) {
// mInputs = new AugmentedListCanary<PlayerInputs>();
// mInputs.add(new PlayerInputs((List<Object>) input, 0));
// mStash = new DoubleKeyMap();
// mScheduler = new DefaultScheduler();
// }
//
// public void setScheduler(Scheduler scheduler) {
// mScheduler = scheduler;
// }
//
// public Scheduler getScheduler() {
// return mScheduler;
// }
//
// public void prepare(Function function) {
// if (function instanceof StashFunction) {
// ((StashFunction) function).setStash(mStash);
// }
// }
//
// protected Runnable getRunnable(final Tile<T, ?> tile) {
// return new Runnable() {
// private int mIndex = mInputs.size() - 1;
// @Override
// public void run() {
// tile.call((CopyOnWriteArrayList<T>) mInputs.get(mIndex).getInputs());
// }
// };
// }
//
// //This method is not thread-safe! But we always call this in a single thread.
// public final <R> Player<R> playRunnable(List<? extends Runnable> runnables) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// int size = mInputs.size();
// for (Runnable runnable : runnables) {
// mScheduler.call(new ScheduledRunnable<T>(this, runnable, size));
// }
// }
// return (Player<R>) this;
// }
// }
//
// public final <R> Player<R> playFunction(List<? extends Function1<CopyOnWriteArrayList<T>, CopyOnWriteArrayList<R>>> functions) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// int index = mInputs.add(new PlayerInputs(functions.size())) - 1;
// for (Function1<CopyOnWriteArrayList<T>, CopyOnWriteArrayList<R>> function : functions) {
// mScheduler.call(new ScheduledRunnable<T>(this, new BlockingRunnable<T, R>(this, function, index), index));
// }
// }
// return (Player<R>) this;
// }
// }
//
// //This method is not thread-safe! But we always call this in a single thread.
// public final void play(Tile<T, ?> tile) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// playRunnable(Collections.singletonList(getRunnable(tile)));
// }
// }
// }
//
// public void appendAt(int index, final CopyOnWriteArrayList<Object> object) {
// mInputs.action(index, new Action<PlayerInputs>() {
// @Override
// public void call(PlayerInputs o) {
// o.getInputs().addAll(object);
// o.getFinishedNumber().getAndIncrement();
// }
// });
// }
//
// public final CopyOnWriteArrayList<Object> waitForFinishing() {
// int index = mInputs.size() - 1;
// return mInputs.get(index, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// }).getInputs();
// }
//
// public CopyOnWriteArrayList<Object> getInput(int index) {
// return mInputs.get(index).getInputs();
// }
//
// public AugmentedListCanary<PlayerInputs> getInputs() {
// return mInputs;
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/PlayerInputs.java
// public class PlayerInputs {
//
// private final CopyOnWriteArrayList<Object> mInputs;
//
// private final int mFunctionNumber;
//
// private final AtomicInteger mFinishedNumber;
//
// public PlayerInputs(List<Object> list, int functionNumber) {
// if (list instanceof CopyOnWriteArrayList<?>) {
// mInputs = (CopyOnWriteArrayList<Object>) list;
// } else {
// mInputs = new CopyOnWriteArrayList<Object>(list);
// }
// mFunctionNumber = functionNumber;
// mFinishedNumber = new AtomicInteger();
// }
//
// public PlayerInputs(int functionNumber) {
// mInputs = new CopyOnWriteArrayList<Object>();
// mFunctionNumber = functionNumber;
// mFinishedNumber = new AtomicInteger();
// }
//
// public AtomicInteger getFinishedNumber() {
// return mFinishedNumber;
// }
//
// public int getFunctionNumber() {
// return mFunctionNumber;
// }
//
// public CopyOnWriteArrayList<Object> getInputs() {
// return mInputs;
// }
// }
|
import xiaofei.library.concurrentutils.util.Condition;
import xiaofei.library.shelly.util.Player;
import xiaofei.library.shelly.util.PlayerInputs;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.runnable;
/**
* Created by Xiaofei on 16/6/23.
*/
public class ScheduledRunnable<R> implements Runnable {
private Player<R> mPlayer;
private Runnable mRunnable;
private int mWaiting;
public ScheduledRunnable(Player<R> player, Runnable runnable, int waiting) {
mPlayer = player;
mRunnable = runnable;
mWaiting = waiting;
}
public Runnable getRunnable() {
return mRunnable;
}
public void waitForInput() {
int waitingIndex = mWaiting - 1;
|
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Player.java
// public class Player<T> {
//
// private final AugmentedListCanary<PlayerInputs> mInputs;
//
// private final DoubleKeyMap mStash;
//
// private Scheduler mScheduler;
//
// public Player(List<T> input) {
// mInputs = new AugmentedListCanary<PlayerInputs>();
// mInputs.add(new PlayerInputs((List<Object>) input, 0));
// mStash = new DoubleKeyMap();
// mScheduler = new DefaultScheduler();
// }
//
// public void setScheduler(Scheduler scheduler) {
// mScheduler = scheduler;
// }
//
// public Scheduler getScheduler() {
// return mScheduler;
// }
//
// public void prepare(Function function) {
// if (function instanceof StashFunction) {
// ((StashFunction) function).setStash(mStash);
// }
// }
//
// protected Runnable getRunnable(final Tile<T, ?> tile) {
// return new Runnable() {
// private int mIndex = mInputs.size() - 1;
// @Override
// public void run() {
// tile.call((CopyOnWriteArrayList<T>) mInputs.get(mIndex).getInputs());
// }
// };
// }
//
// //This method is not thread-safe! But we always call this in a single thread.
// public final <R> Player<R> playRunnable(List<? extends Runnable> runnables) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// int size = mInputs.size();
// for (Runnable runnable : runnables) {
// mScheduler.call(new ScheduledRunnable<T>(this, runnable, size));
// }
// }
// return (Player<R>) this;
// }
// }
//
// public final <R> Player<R> playFunction(List<? extends Function1<CopyOnWriteArrayList<T>, CopyOnWriteArrayList<R>>> functions) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// int index = mInputs.add(new PlayerInputs(functions.size())) - 1;
// for (Function1<CopyOnWriteArrayList<T>, CopyOnWriteArrayList<R>> function : functions) {
// mScheduler.call(new ScheduledRunnable<T>(this, new BlockingRunnable<T, R>(this, function, index), index));
// }
// }
// return (Player<R>) this;
// }
// }
//
// //This method is not thread-safe! But we always call this in a single thread.
// public final void play(Tile<T, ?> tile) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// playRunnable(Collections.singletonList(getRunnable(tile)));
// }
// }
// }
//
// public void appendAt(int index, final CopyOnWriteArrayList<Object> object) {
// mInputs.action(index, new Action<PlayerInputs>() {
// @Override
// public void call(PlayerInputs o) {
// o.getInputs().addAll(object);
// o.getFinishedNumber().getAndIncrement();
// }
// });
// }
//
// public final CopyOnWriteArrayList<Object> waitForFinishing() {
// int index = mInputs.size() - 1;
// return mInputs.get(index, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// }).getInputs();
// }
//
// public CopyOnWriteArrayList<Object> getInput(int index) {
// return mInputs.get(index).getInputs();
// }
//
// public AugmentedListCanary<PlayerInputs> getInputs() {
// return mInputs;
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/PlayerInputs.java
// public class PlayerInputs {
//
// private final CopyOnWriteArrayList<Object> mInputs;
//
// private final int mFunctionNumber;
//
// private final AtomicInteger mFinishedNumber;
//
// public PlayerInputs(List<Object> list, int functionNumber) {
// if (list instanceof CopyOnWriteArrayList<?>) {
// mInputs = (CopyOnWriteArrayList<Object>) list;
// } else {
// mInputs = new CopyOnWriteArrayList<Object>(list);
// }
// mFunctionNumber = functionNumber;
// mFinishedNumber = new AtomicInteger();
// }
//
// public PlayerInputs(int functionNumber) {
// mInputs = new CopyOnWriteArrayList<Object>();
// mFunctionNumber = functionNumber;
// mFinishedNumber = new AtomicInteger();
// }
//
// public AtomicInteger getFinishedNumber() {
// return mFinishedNumber;
// }
//
// public int getFunctionNumber() {
// return mFunctionNumber;
// }
//
// public CopyOnWriteArrayList<Object> getInputs() {
// return mInputs;
// }
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/runnable/ScheduledRunnable.java
import xiaofei.library.concurrentutils.util.Condition;
import xiaofei.library.shelly.util.Player;
import xiaofei.library.shelly.util.PlayerInputs;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.runnable;
/**
* Created by Xiaofei on 16/6/23.
*/
public class ScheduledRunnable<R> implements Runnable {
private Player<R> mPlayer;
private Runnable mRunnable;
private int mWaiting;
public ScheduledRunnable(Player<R> player, Runnable runnable, int waiting) {
mPlayer = player;
mRunnable = runnable;
mWaiting = waiting;
}
public Runnable getRunnable() {
return mRunnable;
}
public void waitForInput() {
int waitingIndex = mWaiting - 1;
|
mPlayer.getInputs().wait(waitingIndex, new Condition<PlayerInputs>() {
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/runnable/BlockingRunnable.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Player.java
// public class Player<T> {
//
// private final AugmentedListCanary<PlayerInputs> mInputs;
//
// private final DoubleKeyMap mStash;
//
// private Scheduler mScheduler;
//
// public Player(List<T> input) {
// mInputs = new AugmentedListCanary<PlayerInputs>();
// mInputs.add(new PlayerInputs((List<Object>) input, 0));
// mStash = new DoubleKeyMap();
// mScheduler = new DefaultScheduler();
// }
//
// public void setScheduler(Scheduler scheduler) {
// mScheduler = scheduler;
// }
//
// public Scheduler getScheduler() {
// return mScheduler;
// }
//
// public void prepare(Function function) {
// if (function instanceof StashFunction) {
// ((StashFunction) function).setStash(mStash);
// }
// }
//
// protected Runnable getRunnable(final Tile<T, ?> tile) {
// return new Runnable() {
// private int mIndex = mInputs.size() - 1;
// @Override
// public void run() {
// tile.call((CopyOnWriteArrayList<T>) mInputs.get(mIndex).getInputs());
// }
// };
// }
//
// //This method is not thread-safe! But we always call this in a single thread.
// public final <R> Player<R> playRunnable(List<? extends Runnable> runnables) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// int size = mInputs.size();
// for (Runnable runnable : runnables) {
// mScheduler.call(new ScheduledRunnable<T>(this, runnable, size));
// }
// }
// return (Player<R>) this;
// }
// }
//
// public final <R> Player<R> playFunction(List<? extends Function1<CopyOnWriteArrayList<T>, CopyOnWriteArrayList<R>>> functions) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// int index = mInputs.add(new PlayerInputs(functions.size())) - 1;
// for (Function1<CopyOnWriteArrayList<T>, CopyOnWriteArrayList<R>> function : functions) {
// mScheduler.call(new ScheduledRunnable<T>(this, new BlockingRunnable<T, R>(this, function, index), index));
// }
// }
// return (Player<R>) this;
// }
// }
//
// //This method is not thread-safe! But we always call this in a single thread.
// public final void play(Tile<T, ?> tile) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// playRunnable(Collections.singletonList(getRunnable(tile)));
// }
// }
// }
//
// public void appendAt(int index, final CopyOnWriteArrayList<Object> object) {
// mInputs.action(index, new Action<PlayerInputs>() {
// @Override
// public void call(PlayerInputs o) {
// o.getInputs().addAll(object);
// o.getFinishedNumber().getAndIncrement();
// }
// });
// }
//
// public final CopyOnWriteArrayList<Object> waitForFinishing() {
// int index = mInputs.size() - 1;
// return mInputs.get(index, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// }).getInputs();
// }
//
// public CopyOnWriteArrayList<Object> getInput(int index) {
// return mInputs.get(index).getInputs();
// }
//
// public AugmentedListCanary<PlayerInputs> getInputs() {
// return mInputs;
// }
//
// }
|
import java.util.concurrent.CopyOnWriteArrayList;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.util.Player;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.runnable;
/**
* Created by Xiaofei on 16/6/23.
*/
public class BlockingRunnable<T, R> implements Runnable {
private Player<T> mPlayer;
private int mIndex;
|
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Player.java
// public class Player<T> {
//
// private final AugmentedListCanary<PlayerInputs> mInputs;
//
// private final DoubleKeyMap mStash;
//
// private Scheduler mScheduler;
//
// public Player(List<T> input) {
// mInputs = new AugmentedListCanary<PlayerInputs>();
// mInputs.add(new PlayerInputs((List<Object>) input, 0));
// mStash = new DoubleKeyMap();
// mScheduler = new DefaultScheduler();
// }
//
// public void setScheduler(Scheduler scheduler) {
// mScheduler = scheduler;
// }
//
// public Scheduler getScheduler() {
// return mScheduler;
// }
//
// public void prepare(Function function) {
// if (function instanceof StashFunction) {
// ((StashFunction) function).setStash(mStash);
// }
// }
//
// protected Runnable getRunnable(final Tile<T, ?> tile) {
// return new Runnable() {
// private int mIndex = mInputs.size() - 1;
// @Override
// public void run() {
// tile.call((CopyOnWriteArrayList<T>) mInputs.get(mIndex).getInputs());
// }
// };
// }
//
// //This method is not thread-safe! But we always call this in a single thread.
// public final <R> Player<R> playRunnable(List<? extends Runnable> runnables) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// int size = mInputs.size();
// for (Runnable runnable : runnables) {
// mScheduler.call(new ScheduledRunnable<T>(this, runnable, size));
// }
// }
// return (Player<R>) this;
// }
// }
//
// public final <R> Player<R> playFunction(List<? extends Function1<CopyOnWriteArrayList<T>, CopyOnWriteArrayList<R>>> functions) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// int index = mInputs.add(new PlayerInputs(functions.size())) - 1;
// for (Function1<CopyOnWriteArrayList<T>, CopyOnWriteArrayList<R>> function : functions) {
// mScheduler.call(new ScheduledRunnable<T>(this, new BlockingRunnable<T, R>(this, function, index), index));
// }
// }
// return (Player<R>) this;
// }
// }
//
// //This method is not thread-safe! But we always call this in a single thread.
// public final void play(Tile<T, ?> tile) {
// synchronized (this) {
// if (mScheduler.isRunning()) {
// playRunnable(Collections.singletonList(getRunnable(tile)));
// }
// }
// }
//
// public void appendAt(int index, final CopyOnWriteArrayList<Object> object) {
// mInputs.action(index, new Action<PlayerInputs>() {
// @Override
// public void call(PlayerInputs o) {
// o.getInputs().addAll(object);
// o.getFinishedNumber().getAndIncrement();
// }
// });
// }
//
// public final CopyOnWriteArrayList<Object> waitForFinishing() {
// int index = mInputs.size() - 1;
// return mInputs.get(index, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// }).getInputs();
// }
//
// public CopyOnWriteArrayList<Object> getInput(int index) {
// return mInputs.get(index).getInputs();
// }
//
// public AugmentedListCanary<PlayerInputs> getInputs() {
// return mInputs;
// }
//
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/runnable/BlockingRunnable.java
import java.util.concurrent.CopyOnWriteArrayList;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.util.Player;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.runnable;
/**
* Created by Xiaofei on 16/6/23.
*/
public class BlockingRunnable<T, R> implements Runnable {
private Player<T> mPlayer;
private int mIndex;
|
private Function1<CopyOnWriteArrayList<T>, CopyOnWriteArrayList<R>> mFunction;
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
|
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/6/22.
*/
public class Test07 {
private static class A {
private int x;
A(int x) {
this.x = x;
}
void f(String a) {
System.out.println("A: " + a + " x = " + x);
}
int getX() {
return x;
}
}
private static class B extends A {
B(int x) {
super(x);
}
}
@Test
public void testRegister() {
A a1 = new A(1), a2 = new B(2);
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/6/22.
*/
public class Test07 {
private static class A {
private int x;
A(int x) {
this.x = x;
}
void f(String a) {
System.out.println("A: " + a + " x = " + x);
}
int getX() {
return x;
}
}
private static class B extends A {
B(int x) {
super(x);
}
}
@Test
public void testRegister() {
A a1 = new A(1), a2 = new B(2);
|
Shelly.register(a1);
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
|
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/6/22.
*/
public class Test07 {
private static class A {
private int x;
A(int x) {
this.x = x;
}
void f(String a) {
System.out.println("A: " + a + " x = " + x);
}
int getX() {
return x;
}
}
private static class B extends A {
B(int x) {
super(x);
}
}
@Test
public void testRegister() {
A a1 = new A(1), a2 = new B(2);
Shelly.register(a1);
Shelly.register(a1);
Shelly.register(a2);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.<String>createDomino(1)
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/6/22.
*/
public class Test07 {
private static class A {
private int x;
A(int x) {
this.x = x;
}
void f(String a) {
System.out.println("A: " + a + " x = " + x);
}
int getX() {
return x;
}
}
private static class B extends A {
B(int x) {
super(x);
}
}
@Test
public void testRegister() {
A a1 = new A(1), a2 = new B(2);
Shelly.register(a1);
Shelly.register(a1);
Shelly.register(a2);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.<String>createDomino(1)
|
.perform(A.class, new TargetAction1<A, String>() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
|
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
|
Shelly.register(a1);
Shelly.register(a1);
Shelly.register(a2);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.<String>createDomino(1)
.perform(A.class, new TargetAction1<A, String>() {
@Override
public void call(A a, String input) {
a.f(input);
}
})
.commit();
Shelly.playDomino(1, "F");
Shelly.unregister(a1);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.playDomino(1, "G");
Shelly.unregister(a1);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.playDomino(1, "G");
}
@Test
public void testMap() {
A a1 = new A(1), a2 = new B(2);
Shelly.register(a1);
Shelly.register(a2);
Shelly.<A>createDomino(2)
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
Shelly.register(a1);
Shelly.register(a1);
Shelly.register(a2);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.<String>createDomino(1)
.perform(A.class, new TargetAction1<A, String>() {
@Override
public void call(A a, String input) {
a.f(input);
}
})
.commit();
Shelly.playDomino(1, "F");
Shelly.unregister(a1);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.playDomino(1, "G");
Shelly.unregister(a1);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.playDomino(1, "G");
}
@Test
public void testMap() {
A a1 = new A(1), a2 = new B(2);
Shelly.register(a1);
Shelly.register(a2);
Shelly.<A>createDomino(2)
|
.perform(new Action1<A>() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
|
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
|
.perform(A.class, new TargetAction1<A, String>() {
@Override
public void call(A a, String input) {
a.f(input);
}
})
.commit();
Shelly.playDomino(1, "F");
Shelly.unregister(a1);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.playDomino(1, "G");
Shelly.unregister(a1);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.playDomino(1, "G");
}
@Test
public void testMap() {
A a1 = new A(1), a2 = new B(2);
Shelly.register(a1);
Shelly.register(a2);
Shelly.<A>createDomino(2)
.perform(new Action1<A>() {
@Override
public void call(A input) {
System.out.println("1: " + input.getX());
}
})
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
.perform(A.class, new TargetAction1<A, String>() {
@Override
public void call(A a, String input) {
a.f(input);
}
})
.commit();
Shelly.playDomino(1, "F");
Shelly.unregister(a1);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.playDomino(1, "G");
Shelly.unregister(a1);
System.out.println(Shelly.isRegistered(a1));
System.out.println(Shelly.isRegistered(a2));
Shelly.playDomino(1, "G");
}
@Test
public void testMap() {
A a1 = new A(1), a2 = new B(2);
Shelly.register(a1);
Shelly.register(a2);
Shelly.<A>createDomino(2)
.perform(new Action1<A>() {
@Override
public void call(A input) {
System.out.println("1: " + input.getX());
}
})
|
.map(A.class, new Function2<A, A, String>() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
|
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
|
.commit();
Shelly.<String>createDomino(4)
.backgroundQueue()
.perform(new Action1<String>() {
@Override
public void call(String input) {
System.out.println("5: " + Thread.currentThread().getName() + " " + input);
}
})
.perform(new Action1<String>() {
@Override
public void call(String input) {
System.out.println("6: " + Thread.currentThread().getName() + " " + input);
}
})
.commit();
Shelly.playDomino(3, "A");
Shelly.playDomino(4, "B");
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Test
public void testBugOfHandler() {
Shelly.<String>createDomino(5)
.merge(new Domino[]{Shelly.<String>createAnonymousDomino()
.background()
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function2.java
// public interface Function2<T, R, S> extends Function {
// S call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test07.java
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
import xiaofei.library.shelly.function.Function2;
import xiaofei.library.shelly.function.TargetAction1;
.commit();
Shelly.<String>createDomino(4)
.backgroundQueue()
.perform(new Action1<String>() {
@Override
public void call(String input) {
System.out.println("5: " + Thread.currentThread().getName() + " " + input);
}
})
.perform(new Action1<String>() {
@Override
public void call(String input) {
System.out.println("6: " + Thread.currentThread().getName() + " " + input);
}
})
.commit();
Shelly.playDomino(3, "A");
Shelly.playDomino(4, "B");
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Test
public void testBugOfHandler() {
Shelly.<String>createDomino(5)
.merge(new Domino[]{Shelly.<String>createAnonymousDomino()
.background()
|
.map(new Function1<String, Integer>() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test08.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction0.java
// public abstract class StashAction0 extends StashAction implements Action0 {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction1.java
// public abstract class StashAction1<T> extends StashAction implements Action1<T> {
// }
|
import xiaofei.library.shelly.function.stashfunction.StashAction1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.stashfunction.StashAction0;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/7/19.
*/
public class Test08 {
@Test
public void testMap() {
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction0.java
// public abstract class StashAction0 extends StashAction implements Action0 {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction1.java
// public abstract class StashAction1<T> extends StashAction implements Action1<T> {
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test08.java
import xiaofei.library.shelly.function.stashfunction.StashAction1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.stashfunction.StashAction0;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/7/19.
*/
public class Test08 {
@Test
public void testMap() {
|
Shelly.<String>createDomino(1)
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test08.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction0.java
// public abstract class StashAction0 extends StashAction implements Action0 {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction1.java
// public abstract class StashAction1<T> extends StashAction implements Action1<T> {
// }
|
import xiaofei.library.shelly.function.stashfunction.StashAction1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.stashfunction.StashAction0;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/7/19.
*/
public class Test08 {
@Test
public void testMap() {
Shelly.<String>createDomino(1)
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction0.java
// public abstract class StashAction0 extends StashAction implements Action0 {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction1.java
// public abstract class StashAction1<T> extends StashAction implements Action1<T> {
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test08.java
import xiaofei.library.shelly.function.stashfunction.StashAction1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.stashfunction.StashAction0;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/7/19.
*/
public class Test08 {
@Test
public void testMap() {
Shelly.<String>createDomino(1)
|
.perform(new StashAction0() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test08.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction0.java
// public abstract class StashAction0 extends StashAction implements Action0 {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction1.java
// public abstract class StashAction1<T> extends StashAction implements Action1<T> {
// }
|
import xiaofei.library.shelly.function.stashfunction.StashAction1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.stashfunction.StashAction0;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/7/19.
*/
public class Test08 {
@Test
public void testMap() {
Shelly.<String>createDomino(1)
.perform(new StashAction0() {
@Override
public void call() {
stash(1, 2);
}
})
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction0.java
// public abstract class StashAction0 extends StashAction implements Action0 {
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/stashfunction/StashAction1.java
// public abstract class StashAction1<T> extends StashAction implements Action1<T> {
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test08.java
import xiaofei.library.shelly.function.stashfunction.StashAction1;
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.stashfunction.StashAction0;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/7/19.
*/
public class Test08 {
@Test
public void testMap() {
Shelly.<String>createDomino(1)
.perform(new StashAction0() {
@Override
public void call() {
stash(1, 2);
}
})
|
.perform(new StashAction1<String>() {
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/scheduler/UiThreadScheduler.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/runnable/ScheduledRunnable.java
// public class ScheduledRunnable<R> implements Runnable {
//
// private Player<R> mPlayer;
//
// private Runnable mRunnable;
//
// private int mWaiting;
//
// public ScheduledRunnable(Player<R> player, Runnable runnable, int waiting) {
// mPlayer = player;
// mRunnable = runnable;
// mWaiting = waiting;
// }
//
// public Runnable getRunnable() {
// return mRunnable;
// }
//
// public void waitForInput() {
// int waitingIndex = mWaiting - 1;
// mPlayer.getInputs().wait(waitingIndex, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// });
// }
//
// public boolean inputSet() {
// return mPlayer.getInputs().satisfy(mWaiting - 1, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// });
// }
//
// @Override
// public void run() {
// waitForInput();
// mRunnable.run();
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Config.java
// public class Config {
// public static final boolean DEBUG = false;
// }
|
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import xiaofei.library.shelly.runnable.ScheduledRunnable;
import xiaofei.library.shelly.util.Config;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.scheduler;
/**
* Created by Xiaofei on 16/5/31.
*/
public class UiThreadScheduler extends Scheduler {
private static Handler sHandler = new Handler(Looper.getMainLooper());
//下面这个改变比较重要!!!
private ExecutorService mExecutor = Executors.newSingleThreadExecutor();
private void scheduleInternal(Runnable runnable) {
boolean isMainThread = Looper.getMainLooper() == Looper.myLooper();
if (isMainThread) {
|
// Path: shelly/src/main/java/xiaofei/library/shelly/runnable/ScheduledRunnable.java
// public class ScheduledRunnable<R> implements Runnable {
//
// private Player<R> mPlayer;
//
// private Runnable mRunnable;
//
// private int mWaiting;
//
// public ScheduledRunnable(Player<R> player, Runnable runnable, int waiting) {
// mPlayer = player;
// mRunnable = runnable;
// mWaiting = waiting;
// }
//
// public Runnable getRunnable() {
// return mRunnable;
// }
//
// public void waitForInput() {
// int waitingIndex = mWaiting - 1;
// mPlayer.getInputs().wait(waitingIndex, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// });
// }
//
// public boolean inputSet() {
// return mPlayer.getInputs().satisfy(mWaiting - 1, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// });
// }
//
// @Override
// public void run() {
// waitForInput();
// mRunnable.run();
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Config.java
// public class Config {
// public static final boolean DEBUG = false;
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/scheduler/UiThreadScheduler.java
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import xiaofei.library.shelly.runnable.ScheduledRunnable;
import xiaofei.library.shelly.util.Config;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.scheduler;
/**
* Created by Xiaofei on 16/5/31.
*/
public class UiThreadScheduler extends Scheduler {
private static Handler sHandler = new Handler(Looper.getMainLooper());
//下面这个改变比较重要!!!
private ExecutorService mExecutor = Executors.newSingleThreadExecutor();
private void scheduleInternal(Runnable runnable) {
boolean isMainThread = Looper.getMainLooper() == Looper.myLooper();
if (isMainThread) {
|
if (Config.DEBUG) {
|
Xiaofei-it/Shelly
|
shelly/src/main/java/xiaofei/library/shelly/scheduler/UiThreadScheduler.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/runnable/ScheduledRunnable.java
// public class ScheduledRunnable<R> implements Runnable {
//
// private Player<R> mPlayer;
//
// private Runnable mRunnable;
//
// private int mWaiting;
//
// public ScheduledRunnable(Player<R> player, Runnable runnable, int waiting) {
// mPlayer = player;
// mRunnable = runnable;
// mWaiting = waiting;
// }
//
// public Runnable getRunnable() {
// return mRunnable;
// }
//
// public void waitForInput() {
// int waitingIndex = mWaiting - 1;
// mPlayer.getInputs().wait(waitingIndex, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// });
// }
//
// public boolean inputSet() {
// return mPlayer.getInputs().satisfy(mWaiting - 1, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// });
// }
//
// @Override
// public void run() {
// waitForInput();
// mRunnable.run();
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Config.java
// public class Config {
// public static final boolean DEBUG = false;
// }
|
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import xiaofei.library.shelly.runnable.ScheduledRunnable;
import xiaofei.library.shelly.util.Config;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.scheduler;
/**
* Created by Xiaofei on 16/5/31.
*/
public class UiThreadScheduler extends Scheduler {
private static Handler sHandler = new Handler(Looper.getMainLooper());
//下面这个改变比较重要!!!
private ExecutorService mExecutor = Executors.newSingleThreadExecutor();
private void scheduleInternal(Runnable runnable) {
boolean isMainThread = Looper.getMainLooper() == Looper.myLooper();
if (isMainThread) {
if (Config.DEBUG) {
System.out.println("post ui0 " + Thread.currentThread().getName());
}
runnable.run();
} else {
if (Config.DEBUG) {
System.out.println("post ui1 " + Thread.currentThread().getName());
}
sHandler.post(runnable);
}
}
@Override
public void call(Runnable runnable) {
|
// Path: shelly/src/main/java/xiaofei/library/shelly/runnable/ScheduledRunnable.java
// public class ScheduledRunnable<R> implements Runnable {
//
// private Player<R> mPlayer;
//
// private Runnable mRunnable;
//
// private int mWaiting;
//
// public ScheduledRunnable(Player<R> player, Runnable runnable, int waiting) {
// mPlayer = player;
// mRunnable = runnable;
// mWaiting = waiting;
// }
//
// public Runnable getRunnable() {
// return mRunnable;
// }
//
// public void waitForInput() {
// int waitingIndex = mWaiting - 1;
// mPlayer.getInputs().wait(waitingIndex, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// });
// }
//
// public boolean inputSet() {
// return mPlayer.getInputs().satisfy(mWaiting - 1, new Condition<PlayerInputs>() {
// @Override
// public boolean satisfy(PlayerInputs o) {
// return o.getFinishedNumber().get() == o.getFunctionNumber();
// }
// });
// }
//
// @Override
// public void run() {
// waitForInput();
// mRunnable.run();
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/util/Config.java
// public class Config {
// public static final boolean DEBUG = false;
// }
// Path: shelly/src/main/java/xiaofei/library/shelly/scheduler/UiThreadScheduler.java
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import xiaofei.library.shelly.runnable.ScheduledRunnable;
import xiaofei.library.shelly.util.Config;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.scheduler;
/**
* Created by Xiaofei on 16/5/31.
*/
public class UiThreadScheduler extends Scheduler {
private static Handler sHandler = new Handler(Looper.getMainLooper());
//下面这个改变比较重要!!!
private ExecutorService mExecutor = Executors.newSingleThreadExecutor();
private void scheduleInternal(Runnable runnable) {
boolean isMainThread = Looper.getMainLooper() == Looper.myLooper();
if (isMainThread) {
if (Config.DEBUG) {
System.out.println("post ui0 " + Thread.currentThread().getName());
}
runnable.run();
} else {
if (Config.DEBUG) {
System.out.println("post ui1 " + Thread.currentThread().getName());
}
sHandler.post(runnable);
}
}
@Override
public void call(Runnable runnable) {
|
if (runnable instanceof ScheduledRunnable) {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test02.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
|
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test02 {
@Test
public void f() {
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test02.java
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test02 {
@Test
public void f() {
|
Shelly.<Integer>createDomino(1)
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test02.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
|
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test02 {
@Test
public void f() {
Shelly.<Integer>createDomino(1)
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test02.java
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test02 {
@Test
public void f() {
Shelly.<Integer>createDomino(1)
|
.perform(new Action0() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test02.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
|
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test02 {
@Test
public void f() {
Shelly.<Integer>createDomino(1)
.perform(new Action0() {
@Override
public void call() {
System.out.println("directly then");
}
})
.commit();
Shelly.playDomino(1, 2);
Shelly.<Integer>createDomino(2)
.perform(new Action0() {
@Override
public void call() {
System.out.println("double perform 1");
}
})
.perform(new Action0() {
@Override
public void call() {
System.out.println("double perform 2");
}
})
.commit();
Shelly.playDomino(2, 2);
Shelly.<Integer>createDomino(3)
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test02.java
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.domino;
/**
* Created by Xiaofei on 16/5/30.
*/
public class Test02 {
@Test
public void f() {
Shelly.<Integer>createDomino(1)
.perform(new Action0() {
@Override
public void call() {
System.out.println("directly then");
}
})
.commit();
Shelly.playDomino(1, 2);
Shelly.<Integer>createDomino(2)
.perform(new Action0() {
@Override
public void call() {
System.out.println("double perform 1");
}
})
.perform(new Action0() {
@Override
public void call() {
System.out.println("double perform 2");
}
})
.commit();
Shelly.playDomino(2, 2);
Shelly.<Integer>createDomino(3)
|
.perform(new Action1<Integer>() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/domino/Test02.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
|
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
|
public void call() {
System.out.println("directly then");
}
})
.commit();
Shelly.playDomino(1, 2);
Shelly.<Integer>createDomino(2)
.perform(new Action0() {
@Override
public void call() {
System.out.println("double perform 1");
}
})
.perform(new Action0() {
@Override
public void call() {
System.out.println("double perform 2");
}
})
.commit();
Shelly.playDomino(2, 2);
Shelly.<Integer>createDomino(3)
.perform(new Action1<Integer>() {
@Override
public void call(Integer input) {
System.out.println("action1 " + input);
}
})
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action0.java
// public interface Action0 extends Action {
// void call();
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Function1.java
// public interface Function1<T, R> extends Function {
// R call(T input);
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/domino/Test02.java
import org.junit.Test;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action0;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Function1;
public void call() {
System.out.println("directly then");
}
})
.commit();
Shelly.playDomino(1, 2);
Shelly.<Integer>createDomino(2)
.perform(new Action0() {
@Override
public void call() {
System.out.println("double perform 1");
}
})
.perform(new Action0() {
@Override
public void call() {
System.out.println("double perform 2");
}
})
.commit();
Shelly.playDomino(2, 2);
Shelly.<Integer>createDomino(3)
.perform(new Action1<Integer>() {
@Override
public void call(Integer input) {
System.out.println("action1 " + input);
}
})
|
.map(new Function1<Integer, String>() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
|
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.demo;
/**
* Created by Xiaofei on 16/8/10.
*/
class HomeActivity extends Activity {
void signUp(String s1, String s2) {}
}
interface UserNetwork {
Call<String> signUp(String s1, String s2);
}
public class UserService {
public static final Object SIGN_UP = new Object();
public static final Object SIGN_IN = new Object();
public static final Object SIGN_OUT = new Object();
public static void init() {
final UserNetwork userNetwork = null;
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.demo;
/**
* Created by Xiaofei on 16/8/10.
*/
class HomeActivity extends Activity {
void signUp(String s1, String s2) {}
}
interface UserNetwork {
Call<String> signUp(String s1, String s2);
}
public class UserService {
public static final Object SIGN_UP = new Object();
public static final Object SIGN_IN = new Object();
public static final Object SIGN_OUT = new Object();
public static void init() {
final UserNetwork userNetwork = null;
|
Shelly.<Pair<String, String>>createDomino(SIGN_UP)
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
|
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.demo;
/**
* Created by Xiaofei on 16/8/10.
*/
class HomeActivity extends Activity {
void signUp(String s1, String s2) {}
}
interface UserNetwork {
Call<String> signUp(String s1, String s2);
}
public class UserService {
public static final Object SIGN_UP = new Object();
public static final Object SIGN_IN = new Object();
public static final Object SIGN_OUT = new Object();
public static void init() {
final UserNetwork userNetwork = null;
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.demo;
/**
* Created by Xiaofei on 16/8/10.
*/
class HomeActivity extends Activity {
void signUp(String s1, String s2) {}
}
interface UserNetwork {
Call<String> signUp(String s1, String s2);
}
public class UserService {
public static final Object SIGN_UP = new Object();
public static final Object SIGN_IN = new Object();
public static final Object SIGN_OUT = new Object();
public static void init() {
final UserNetwork userNetwork = null;
|
Shelly.<Pair<String, String>>createDomino(SIGN_UP)
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
|
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.demo;
/**
* Created by Xiaofei on 16/8/10.
*/
class HomeActivity extends Activity {
void signUp(String s1, String s2) {}
}
interface UserNetwork {
Call<String> signUp(String s1, String s2);
}
public class UserService {
public static final Object SIGN_UP = new Object();
public static final Object SIGN_IN = new Object();
public static final Object SIGN_OUT = new Object();
public static void init() {
final UserNetwork userNetwork = null;
Shelly.<Pair<String, String>>createDomino(SIGN_UP)
.background()
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.demo;
/**
* Created by Xiaofei on 16/8/10.
*/
class HomeActivity extends Activity {
void signUp(String s1, String s2) {}
}
interface UserNetwork {
Call<String> signUp(String s1, String s2);
}
public class UserService {
public static final Object SIGN_UP = new Object();
public static final Object SIGN_IN = new Object();
public static final Object SIGN_OUT = new Object();
public static void init() {
final UserNetwork userNetwork = null;
Shelly.<Pair<String, String>>createDomino(SIGN_UP)
.background()
|
.beginRetrofitTaskKeepingInput(new RetrofitTask<Pair<String,String>, String>() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
|
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
|
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.demo;
/**
* Created by Xiaofei on 16/8/10.
*/
class HomeActivity extends Activity {
void signUp(String s1, String s2) {}
}
interface UserNetwork {
Call<String> signUp(String s1, String s2);
}
public class UserService {
public static final Object SIGN_UP = new Object();
public static final Object SIGN_IN = new Object();
public static final Object SIGN_OUT = new Object();
public static void init() {
final UserNetwork userNetwork = null;
Shelly.<Pair<String, String>>createDomino(SIGN_UP)
.background()
.beginRetrofitTaskKeepingInput(new RetrofitTask<Pair<String,String>, String>() {
@Override
protected Call<String> getCall(Pair<String, String> input) {
return userNetwork.signUp(input.first, input.second);
}
})
.background()
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
/**
*
* Copyright 2016 Xiaofei
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package xiaofei.library.shelly.demo;
/**
* Created by Xiaofei on 16/8/10.
*/
class HomeActivity extends Activity {
void signUp(String s1, String s2) {}
}
interface UserNetwork {
Call<String> signUp(String s1, String s2);
}
public class UserService {
public static final Object SIGN_UP = new Object();
public static final Object SIGN_IN = new Object();
public static final Object SIGN_OUT = new Object();
public static void init() {
final UserNetwork userNetwork = null;
Shelly.<Pair<String, String>>createDomino(SIGN_UP)
.background()
.beginRetrofitTaskKeepingInput(new RetrofitTask<Pair<String,String>, String>() {
@Override
protected Call<String> getCall(Pair<String, String> input) {
return userNetwork.signUp(input.first, input.second);
}
})
.background()
|
.onSuccessResult(new Action2<Pair<String, String>, String>() {
|
Xiaofei-it/Shelly
|
shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
|
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
|
@Override
protected Call<String> getCall(Pair<String, String> input) {
return userNetwork.signUp(input.first, input.second);
}
})
.background()
.onSuccessResult(new Action2<Pair<String, String>, String>() {
@Override
public void call(Pair<String, String> input1, String token) {
// Store the token.
}
})
.uiThread()
.onSuccessResult(HomeActivity.class, new TargetAction2<HomeActivity, Pair<String, String>, String>() {
@Override
public void call(HomeActivity homeActivity, Pair<String, String> input1, String token) {
homeActivity.signUp(input1.first, token);
}
})
.onResponseFailure(HomeActivity.class, new TargetAction2<HomeActivity, Pair<String, String>, Response<String>>() {
@Override
public void call(HomeActivity homeActivity, Pair<String, String> input1, Response<String> input2) {
try {
Toast.makeText(homeActivity, input2.errorBody().string(), Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}
}
})
.background()
|
// Path: shelly/src/main/java/xiaofei/library/shelly/Shelly.java
// public class Shelly {
//
// private static final TargetCenter TARGET_CENTER = TargetCenter.getInstance();
//
// private static final DominoCenter DOMINO_CENTER = DominoCenter.getInstance();
//
// public static void register(Object object) {
// TARGET_CENTER.register(object);
// }
//
// public static boolean isRegistered(Object object) {
// return TARGET_CENTER.isRegistered(object);
// }
//
// public static void unregister(Object object) {
// TARGET_CENTER.unregister(object);
// }
//
// public static <T> Domino<T, T> createDomino(Object label) {
// return new Domino<T, T>(label);
// }
//
// public static <T> Domino<T, T> createAnonymousDomino() {
// return createDomino(null);
// }
//
// @SafeVarargs
// public static <T> void playDomino(Object label, T... input) {
// CopyOnWriteArrayList<T> newInput = new CopyOnWriteArrayList<T>();
// if (input == null) {
// newInput.add(null);
// } else if (input.length > 0) {
// newInput.addAll(Arrays.asList(input));
// }
// playDominoInternal(label, newInput);
// }
//
// public static void playDomino(Object label) {
// playDominoInternal(label, new CopyOnWriteArrayList<Object>());
// }
//
// private static <T> void playDominoInternal(Object label, CopyOnWriteArrayList<T> input) {
// DOMINO_CENTER.play(label, input);
// }
//
// public static <T, R> Domino<T, R> getDominoByLabel(Object label) {
// return DOMINO_CENTER.getDomino(label);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action1.java
// public interface Action1<T> extends Action {
// void call(T input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/Action2.java
// public interface Action2<T, R> extends Action {
// void call(T input1, R input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction1.java
// public interface TargetAction1<T, R> extends Action {
// void call(T t, R input);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/function/TargetAction2.java
// public interface TargetAction2<T, R, S> extends Action {
// void call(T t, R input1, S input2);
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/task/RetrofitTask.java
// public abstract class RetrofitTask<T, R> extends AbstractRetrofitTask<T, R> {
// @Override
// protected void call(Call<R> call) {
// call.enqueue(getCallback());
// }
//
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Pair.java
// public class Pair<T1, T2> {
// public final T1 first;
// public final T2 second;
//
// @Deprecated
// public Pair(T1 first, T2 second) {
// this.first = first;
// this.second = second;
// }
//
// public static <T1, T2> Pair<T1, T2> create(T1 first, T2 second) {
// return new Pair<T1, T2>(first, second);
// }
// }
//
// Path: shelly/src/main/java/xiaofei/library/shelly/tuple/Triple.java
// public class Triple<T1, T2, T3> {
// public final T1 first;
// public final T2 second;
// public final T3 third;
//
// @Deprecated
// public Triple(T1 first, T2 second, T3 third) {
// this.first = first;
// this.second = second;
// this.third = third;
// }
//
// public static <T1, T2, T3> Triple<T1, T2, T3> create(T1 first, T2 second, T3 third) {
// return new Triple<T1, T2, T3>(first, second, third);
// }
// }
// Path: shelly/src/test/java/xiaofei/library/shelly/demo/UserService.java
import xiaofei.library.shelly.function.TargetAction1;
import xiaofei.library.shelly.function.TargetAction2;
import xiaofei.library.shelly.task.RetrofitTask;
import xiaofei.library.shelly.tuple.Pair;
import xiaofei.library.shelly.tuple.Triple;
import android.app.Activity;
import android.util.Log;
import android.widget.Toast;
import java.io.IOException;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Response;
import xiaofei.library.shelly.Shelly;
import xiaofei.library.shelly.function.Action1;
import xiaofei.library.shelly.function.Action2;
@Override
protected Call<String> getCall(Pair<String, String> input) {
return userNetwork.signUp(input.first, input.second);
}
})
.background()
.onSuccessResult(new Action2<Pair<String, String>, String>() {
@Override
public void call(Pair<String, String> input1, String token) {
// Store the token.
}
})
.uiThread()
.onSuccessResult(HomeActivity.class, new TargetAction2<HomeActivity, Pair<String, String>, String>() {
@Override
public void call(HomeActivity homeActivity, Pair<String, String> input1, String token) {
homeActivity.signUp(input1.first, token);
}
})
.onResponseFailure(HomeActivity.class, new TargetAction2<HomeActivity, Pair<String, String>, Response<String>>() {
@Override
public void call(HomeActivity homeActivity, Pair<String, String> input1, Response<String> input2) {
try {
Toast.makeText(homeActivity, input2.errorBody().string(), Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}
}
})
.background()
|
.onFailure(new Action1<Throwable>() {
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/misc/ProjectModel.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
|
import com.dooapp.xstreamfx.*;
import com.rvantwisk.cnctools.data.*;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.sun.javafx.collections.ObservableListWrapper;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.io.xml.XppDomDriver;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.util.ArrayList;
|
xStream.registerConverter(new StringPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new BooleanPropertyConverter(xStream.getMapper()));
// xStream.registerConverter(new ObjectPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new DoublePropertyConverter(xStream.getMapper()));
xStream.registerConverter(new LongPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new IntegerPropertyConverter(xStream.getMapper()));
// xStream.registerConverter(new ObservableListConverter(xStream.getMapper()));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, List.class), ObservableListWrapper.class));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, List.class), ObservableList.class));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, Map.class), ObservableMap.class));
xStream.omitField(ObservableListWrapper.class, "listenerHelper");
// FXConverters.configure(xstream);
// JavaFX aliases
xStream.alias("IntProp", SimpleIntegerProperty.class);
xStream.alias("StrProp", SimpleStringProperty.class);
xStream.alias("DblProp", SimpleDoubleProperty.class);
xStream.alias("Boolprop", SimpleBooleanProperty.class);
xStream.alias("ObjProp", SimpleObjectProperty.class);
xStream.alias("LongProp", SimpleLongProperty.class);
xStream.alias("OListWrapper", ObservableListWrapper.class);
// Program properties aliases
xStream.alias("Task", TaskRunnable.class);
xStream.alias("Project", Project.class);
xStream.alias("StockToolParameter", StockToolParameter.class);
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/ProjectModel.java
import com.dooapp.xstreamfx.*;
import com.rvantwisk.cnctools.data.*;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.sun.javafx.collections.ObservableListWrapper;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.io.xml.XppDomDriver;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.util.ArrayList;
xStream.registerConverter(new StringPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new BooleanPropertyConverter(xStream.getMapper()));
// xStream.registerConverter(new ObjectPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new DoublePropertyConverter(xStream.getMapper()));
xStream.registerConverter(new LongPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new IntegerPropertyConverter(xStream.getMapper()));
// xStream.registerConverter(new ObservableListConverter(xStream.getMapper()));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, List.class), ObservableListWrapper.class));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, List.class), ObservableList.class));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, Map.class), ObservableMap.class));
xStream.omitField(ObservableListWrapper.class, "listenerHelper");
// FXConverters.configure(xstream);
// JavaFX aliases
xStream.alias("IntProp", SimpleIntegerProperty.class);
xStream.alias("StrProp", SimpleStringProperty.class);
xStream.alias("DblProp", SimpleDoubleProperty.class);
xStream.alias("Boolprop", SimpleBooleanProperty.class);
xStream.alias("ObjProp", SimpleObjectProperty.class);
xStream.alias("LongProp", SimpleLongProperty.class);
xStream.alias("OListWrapper", ObservableListWrapper.class);
// Program properties aliases
xStream.alias("Task", TaskRunnable.class);
xStream.alias("Project", Project.class);
xStream.alias("StockToolParameter", StockToolParameter.class);
|
xStream.alias("EndMill", EndMill.class);
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/misc/ProjectModel.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
|
import com.dooapp.xstreamfx.*;
import com.rvantwisk.cnctools.data.*;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.sun.javafx.collections.ObservableListWrapper;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.io.xml.XppDomDriver;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.util.ArrayList;
|
xStream.registerConverter(new BooleanPropertyConverter(xStream.getMapper()));
// xStream.registerConverter(new ObjectPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new DoublePropertyConverter(xStream.getMapper()));
xStream.registerConverter(new LongPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new IntegerPropertyConverter(xStream.getMapper()));
// xStream.registerConverter(new ObservableListConverter(xStream.getMapper()));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, List.class), ObservableListWrapper.class));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, List.class), ObservableList.class));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, Map.class), ObservableMap.class));
xStream.omitField(ObservableListWrapper.class, "listenerHelper");
// FXConverters.configure(xstream);
// JavaFX aliases
xStream.alias("IntProp", SimpleIntegerProperty.class);
xStream.alias("StrProp", SimpleStringProperty.class);
xStream.alias("DblProp", SimpleDoubleProperty.class);
xStream.alias("Boolprop", SimpleBooleanProperty.class);
xStream.alias("ObjProp", SimpleObjectProperty.class);
xStream.alias("LongProp", SimpleLongProperty.class);
xStream.alias("OListWrapper", ObservableListWrapper.class);
// Program properties aliases
xStream.alias("Task", TaskRunnable.class);
xStream.alias("Project", Project.class);
xStream.alias("StockToolParameter", StockToolParameter.class);
xStream.alias("EndMill", EndMill.class);
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/ProjectModel.java
import com.dooapp.xstreamfx.*;
import com.rvantwisk.cnctools.data.*;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.sun.javafx.collections.ObservableListWrapper;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.io.xml.XppDomDriver;
import javafx.beans.property.*;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.util.ArrayList;
xStream.registerConverter(new BooleanPropertyConverter(xStream.getMapper()));
// xStream.registerConverter(new ObjectPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new DoublePropertyConverter(xStream.getMapper()));
xStream.registerConverter(new LongPropertyConverter(xStream.getMapper()));
xStream.registerConverter(new IntegerPropertyConverter(xStream.getMapper()));
// xStream.registerConverter(new ObservableListConverter(xStream.getMapper()));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, List.class), ObservableListWrapper.class));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, List.class), ObservableList.class));
// xStream.registerConverter(new ConverterWrapper(lookupTypeConverter(xStream, Map.class), ObservableMap.class));
xStream.omitField(ObservableListWrapper.class, "listenerHelper");
// FXConverters.configure(xstream);
// JavaFX aliases
xStream.alias("IntProp", SimpleIntegerProperty.class);
xStream.alias("StrProp", SimpleStringProperty.class);
xStream.alias("DblProp", SimpleDoubleProperty.class);
xStream.alias("Boolprop", SimpleBooleanProperty.class);
xStream.alias("ObjProp", SimpleObjectProperty.class);
xStream.alias("LongProp", SimpleLongProperty.class);
xStream.alias("OListWrapper", ObservableListWrapper.class);
// Program properties aliases
xStream.alias("Task", TaskRunnable.class);
xStream.alias("Project", Project.class);
xStream.alias("StockToolParameter", StockToolParameter.class);
xStream.alias("EndMill", EndMill.class);
|
xStream.alias("BallMill", BallMill.class);
|
rvt/cnctools
|
gcodeparser/src/main/java/com/rvantwisk/gcodeparser/MachineStatusHelper.java
|
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/ActivePlane.java
// public enum ActivePlane implements ModalGroups {
// G17(GCodeGroups.ActivePlane),
// G18(GCodeGroups.ActivePlane),
// G19(GCodeGroups.ActivePlane);
//
// final GCodeGroups group;
//
// ActivePlane(GCodeGroups group) {
// this.group = group;
// }
//
// public boolean isInGroup(final GCodeGroups group) {
// return this.group == group;
// }
//
// }
|
import com.rvantwisk.gcodeparser.gcodes.ActivePlane;
import com.rvantwisk.gcodeparser.gcodes.MotionMode;
import com.rvantwisk.gcodeparser.gcodes.Units;
import java.util.Set;
|
public double getOY() {
return machineStatus.getMachineOffsets().get(MachineStatus.Axis.Y).doubleValue();
}
public double getOZ() {
return machineStatus.getMachineOffsets().get(MachineStatus.Axis.Z).doubleValue();
}
public MotionMode getMotionMode() {
return getModalValue(MotionMode.class);
}
public Units getActiveUnit() {
return getModalValue(Units.class);
}
public double getFeedrate() {
return machineStatus.getModalVars().get("F").doubleValue();
}
private <T extends Enum<T>> T getModalValue(Class<T> enumClass) {
Set<String> stat = machineStatus.getModals();
for (T value : enumClass.getEnumConstants()) {
if (stat.contains(value.toString())) {
return value;
}
}
return null;
}
|
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/ActivePlane.java
// public enum ActivePlane implements ModalGroups {
// G17(GCodeGroups.ActivePlane),
// G18(GCodeGroups.ActivePlane),
// G19(GCodeGroups.ActivePlane);
//
// final GCodeGroups group;
//
// ActivePlane(GCodeGroups group) {
// this.group = group;
// }
//
// public boolean isInGroup(final GCodeGroups group) {
// return this.group == group;
// }
//
// }
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/MachineStatusHelper.java
import com.rvantwisk.gcodeparser.gcodes.ActivePlane;
import com.rvantwisk.gcodeparser.gcodes.MotionMode;
import com.rvantwisk.gcodeparser.gcodes.Units;
import java.util.Set;
public double getOY() {
return machineStatus.getMachineOffsets().get(MachineStatus.Axis.Y).doubleValue();
}
public double getOZ() {
return machineStatus.getMachineOffsets().get(MachineStatus.Axis.Z).doubleValue();
}
public MotionMode getMotionMode() {
return getModalValue(MotionMode.class);
}
public Units getActiveUnit() {
return getModalValue(Units.class);
}
public double getFeedrate() {
return machineStatus.getModalVars().get("F").doubleValue();
}
private <T extends Enum<T>> T getModalValue(Class<T> enumClass) {
Set<String> stat = machineStatus.getModals();
for (T value : enumClass.getEnumConstants()) {
if (stat.contains(value.toString())) {
return value;
}
}
return null;
}
|
public ActivePlane getActivePlane() {
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/operations/interfaces/MillTaskController.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/interfaces/TaskModel.java
// public interface TaskModel extends Copyable<TaskModel> {
//
// void generateGCode(final ToolDBManager toolDBManager, final CncToolsGCodegenerator gCodeGenerator, final String taskId);
// }
|
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.interfaces.TaskModel;
|
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.operations.interfaces;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/11/13
* Time: 2:08 PM
* To change this template use File | Settings | File Templates.
*/
public interface MillTaskController {
public abstract void setModel(final TaskModel model);
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/interfaces/TaskModel.java
// public interface TaskModel extends Copyable<TaskModel> {
//
// void generateGCode(final ToolDBManager toolDBManager, final CncToolsGCodegenerator gCodeGenerator, final String taskId);
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/operations/interfaces/MillTaskController.java
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.interfaces.TaskModel;
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.operations.interfaces;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/11/13
* Time: 2:08 PM
* To change this template use File | Settings | File Templates.
*/
public interface MillTaskController {
public abstract void setModel(final TaskModel model);
|
public abstract void setProject(final Project project);
|
rvt/cnctools
|
gcodeparser/src/main/java/com/rvantwisk/gcodeparser/MachineStatus.java
|
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/GCodeGroups.java
// public enum GCodeGroups {
//
// ActivePlane,
// AxisOffset,
// CollantMode,
// CoordinateSystemMode,
// CutterLengthCompMode,
// CutterRadiusCompMode,
// DistanceMode,
// FeedRateMode,
// MotionsModes,
// PathControleMode,
// PredefinedPosition,
// ReferenceLocation,
// RetrackMode,
// SFOverrideMode,
// SpindleMode,
// StopModes,
// Units;
//
//
//
// }
//
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/ModalGrouping.java
// public final class ModalGrouping {
//
// public static final Map<GCodeGroups, Set<String>> groupToModals;
// public static final Map<String, GCodeGroups> modalToGroup;
//
// static {
// HashMap<GCodeGroups, Set<String>> gGroups = new HashMap<>();
// HashMap<String, GCodeGroups> mGroups = new HashMap<>();
//
// // Add all model sets
// gGroups.put(GCodeGroups.ActivePlane, toStringSet(ActivePlane.class.getEnumConstants()));
// gGroups.put(GCodeGroups.AxisOffset, toStringSet(AxisOffset.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CollantMode, toStringSet(CollantMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CoordinateSystemMode, toStringSet(CoordinateSystemMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CutterLengthCompMode, toStringSet(CutterLengthCompMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CutterRadiusCompMode, toStringSet(CutterRadiusCompMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.DistanceMode, toStringSet(DistanceMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.FeedRateMode, toStringSet(FeedRateMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.MotionsModes, toStringSet(MotionMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.PathControleMode, toStringSet(PathControleMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.PredefinedPosition, toStringSet(PredefinedPosition.class.getEnumConstants()));
// gGroups.put(GCodeGroups.ReferenceLocation, toStringSet(ReferenceLocation.class.getEnumConstants()));
// gGroups.put(GCodeGroups.RetrackMode, toStringSet(RetrackMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.SFOverrideMode, toStringSet(SFOverrideMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.SpindleMode, toStringSet(SpindleMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.StopModes, toStringSet(StopModes.class.getEnumConstants()));
// gGroups.put(GCodeGroups.Units, toStringSet(Units.class.getEnumConstants()));
//
// // Create a modal to group map
// for (Map.Entry<GCodeGroups, Set<String>> group : gGroups.entrySet()) {
// for (String modals : group.getValue()) {
// mGroups.put(modals, group.getKey());
// }
// }
//
// //
// groupToModals = Collections.unmodifiableMap(gGroups);
// modalToGroup = Collections.unmodifiableMap(mGroups);
// }
//
// /**
// * Return the group belonging to a modal word
// * @param word
// * @return
// */
// static public GCodeGroups whatGroup(final String word) {
// return modalToGroup.get(word);
// }
//
// private static <T> Set<String> toStringSet(T[] enumClass) {
// final Set<String> stringSet = new HashSet<>();
// for (T code : enumClass) {
// stringSet.add(code.toString());
// }
// return stringSet;
// }
//
// }
|
import com.rvantwisk.gcodeparser.gcodes.GCodeGroups;
import com.rvantwisk.gcodeparser.gcodes.ModalGrouping;
import java.util.*;
|
ParsedWord word = block.get(axis.toString());
machineOffsets.put(axis, word.value);
}
}
}
private void setAxis(final Map<String, ParsedWord> block) {
for (Axis axis : Axis.values()) {
if (block.containsKey(axis.toString())) {
ParsedWord word = block.get(axis.toString());
// Handle absolute cordinate position (G0 and G1 only)
if (modals.contains("G53")) {
machineCoordinates.put(axis, word.value);
} else {
// Handle relative distance mode
if (modals.contains("G90")) {
machineCoordinates.put(axis, machineOffsets.get(axis) + word.value);
} else {
machineCoordinates.put(axis, machineCoordinates.get(axis) + word.value);
}
}
}
}
}
private void setModals(final Map<String, ParsedWord> block) {
for (ParsedWord word : block.values()) {
if (word.word.equals("G") || word.word.equals("M")) {
// Find the modal group and remove all modals if found
|
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/GCodeGroups.java
// public enum GCodeGroups {
//
// ActivePlane,
// AxisOffset,
// CollantMode,
// CoordinateSystemMode,
// CutterLengthCompMode,
// CutterRadiusCompMode,
// DistanceMode,
// FeedRateMode,
// MotionsModes,
// PathControleMode,
// PredefinedPosition,
// ReferenceLocation,
// RetrackMode,
// SFOverrideMode,
// SpindleMode,
// StopModes,
// Units;
//
//
//
// }
//
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/ModalGrouping.java
// public final class ModalGrouping {
//
// public static final Map<GCodeGroups, Set<String>> groupToModals;
// public static final Map<String, GCodeGroups> modalToGroup;
//
// static {
// HashMap<GCodeGroups, Set<String>> gGroups = new HashMap<>();
// HashMap<String, GCodeGroups> mGroups = new HashMap<>();
//
// // Add all model sets
// gGroups.put(GCodeGroups.ActivePlane, toStringSet(ActivePlane.class.getEnumConstants()));
// gGroups.put(GCodeGroups.AxisOffset, toStringSet(AxisOffset.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CollantMode, toStringSet(CollantMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CoordinateSystemMode, toStringSet(CoordinateSystemMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CutterLengthCompMode, toStringSet(CutterLengthCompMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CutterRadiusCompMode, toStringSet(CutterRadiusCompMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.DistanceMode, toStringSet(DistanceMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.FeedRateMode, toStringSet(FeedRateMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.MotionsModes, toStringSet(MotionMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.PathControleMode, toStringSet(PathControleMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.PredefinedPosition, toStringSet(PredefinedPosition.class.getEnumConstants()));
// gGroups.put(GCodeGroups.ReferenceLocation, toStringSet(ReferenceLocation.class.getEnumConstants()));
// gGroups.put(GCodeGroups.RetrackMode, toStringSet(RetrackMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.SFOverrideMode, toStringSet(SFOverrideMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.SpindleMode, toStringSet(SpindleMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.StopModes, toStringSet(StopModes.class.getEnumConstants()));
// gGroups.put(GCodeGroups.Units, toStringSet(Units.class.getEnumConstants()));
//
// // Create a modal to group map
// for (Map.Entry<GCodeGroups, Set<String>> group : gGroups.entrySet()) {
// for (String modals : group.getValue()) {
// mGroups.put(modals, group.getKey());
// }
// }
//
// //
// groupToModals = Collections.unmodifiableMap(gGroups);
// modalToGroup = Collections.unmodifiableMap(mGroups);
// }
//
// /**
// * Return the group belonging to a modal word
// * @param word
// * @return
// */
// static public GCodeGroups whatGroup(final String word) {
// return modalToGroup.get(word);
// }
//
// private static <T> Set<String> toStringSet(T[] enumClass) {
// final Set<String> stringSet = new HashSet<>();
// for (T code : enumClass) {
// stringSet.add(code.toString());
// }
// return stringSet;
// }
//
// }
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/MachineStatus.java
import com.rvantwisk.gcodeparser.gcodes.GCodeGroups;
import com.rvantwisk.gcodeparser.gcodes.ModalGrouping;
import java.util.*;
ParsedWord word = block.get(axis.toString());
machineOffsets.put(axis, word.value);
}
}
}
private void setAxis(final Map<String, ParsedWord> block) {
for (Axis axis : Axis.values()) {
if (block.containsKey(axis.toString())) {
ParsedWord word = block.get(axis.toString());
// Handle absolute cordinate position (G0 and G1 only)
if (modals.contains("G53")) {
machineCoordinates.put(axis, word.value);
} else {
// Handle relative distance mode
if (modals.contains("G90")) {
machineCoordinates.put(axis, machineOffsets.get(axis) + word.value);
} else {
machineCoordinates.put(axis, machineCoordinates.get(axis) + word.value);
}
}
}
}
}
private void setModals(final Map<String, ParsedWord> block) {
for (ParsedWord word : block.values()) {
if (word.word.equals("G") || word.word.equals("M")) {
// Find the modal group and remove all modals if found
|
GCodeGroups thisGroup = ModalGrouping.whatGroup(word.parsed);
|
rvt/cnctools
|
gcodeparser/src/main/java/com/rvantwisk/gcodeparser/MachineStatus.java
|
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/GCodeGroups.java
// public enum GCodeGroups {
//
// ActivePlane,
// AxisOffset,
// CollantMode,
// CoordinateSystemMode,
// CutterLengthCompMode,
// CutterRadiusCompMode,
// DistanceMode,
// FeedRateMode,
// MotionsModes,
// PathControleMode,
// PredefinedPosition,
// ReferenceLocation,
// RetrackMode,
// SFOverrideMode,
// SpindleMode,
// StopModes,
// Units;
//
//
//
// }
//
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/ModalGrouping.java
// public final class ModalGrouping {
//
// public static final Map<GCodeGroups, Set<String>> groupToModals;
// public static final Map<String, GCodeGroups> modalToGroup;
//
// static {
// HashMap<GCodeGroups, Set<String>> gGroups = new HashMap<>();
// HashMap<String, GCodeGroups> mGroups = new HashMap<>();
//
// // Add all model sets
// gGroups.put(GCodeGroups.ActivePlane, toStringSet(ActivePlane.class.getEnumConstants()));
// gGroups.put(GCodeGroups.AxisOffset, toStringSet(AxisOffset.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CollantMode, toStringSet(CollantMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CoordinateSystemMode, toStringSet(CoordinateSystemMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CutterLengthCompMode, toStringSet(CutterLengthCompMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CutterRadiusCompMode, toStringSet(CutterRadiusCompMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.DistanceMode, toStringSet(DistanceMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.FeedRateMode, toStringSet(FeedRateMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.MotionsModes, toStringSet(MotionMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.PathControleMode, toStringSet(PathControleMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.PredefinedPosition, toStringSet(PredefinedPosition.class.getEnumConstants()));
// gGroups.put(GCodeGroups.ReferenceLocation, toStringSet(ReferenceLocation.class.getEnumConstants()));
// gGroups.put(GCodeGroups.RetrackMode, toStringSet(RetrackMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.SFOverrideMode, toStringSet(SFOverrideMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.SpindleMode, toStringSet(SpindleMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.StopModes, toStringSet(StopModes.class.getEnumConstants()));
// gGroups.put(GCodeGroups.Units, toStringSet(Units.class.getEnumConstants()));
//
// // Create a modal to group map
// for (Map.Entry<GCodeGroups, Set<String>> group : gGroups.entrySet()) {
// for (String modals : group.getValue()) {
// mGroups.put(modals, group.getKey());
// }
// }
//
// //
// groupToModals = Collections.unmodifiableMap(gGroups);
// modalToGroup = Collections.unmodifiableMap(mGroups);
// }
//
// /**
// * Return the group belonging to a modal word
// * @param word
// * @return
// */
// static public GCodeGroups whatGroup(final String word) {
// return modalToGroup.get(word);
// }
//
// private static <T> Set<String> toStringSet(T[] enumClass) {
// final Set<String> stringSet = new HashSet<>();
// for (T code : enumClass) {
// stringSet.add(code.toString());
// }
// return stringSet;
// }
//
// }
|
import com.rvantwisk.gcodeparser.gcodes.GCodeGroups;
import com.rvantwisk.gcodeparser.gcodes.ModalGrouping;
import java.util.*;
|
ParsedWord word = block.get(axis.toString());
machineOffsets.put(axis, word.value);
}
}
}
private void setAxis(final Map<String, ParsedWord> block) {
for (Axis axis : Axis.values()) {
if (block.containsKey(axis.toString())) {
ParsedWord word = block.get(axis.toString());
// Handle absolute cordinate position (G0 and G1 only)
if (modals.contains("G53")) {
machineCoordinates.put(axis, word.value);
} else {
// Handle relative distance mode
if (modals.contains("G90")) {
machineCoordinates.put(axis, machineOffsets.get(axis) + word.value);
} else {
machineCoordinates.put(axis, machineCoordinates.get(axis) + word.value);
}
}
}
}
}
private void setModals(final Map<String, ParsedWord> block) {
for (ParsedWord word : block.values()) {
if (word.word.equals("G") || word.word.equals("M")) {
// Find the modal group and remove all modals if found
|
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/GCodeGroups.java
// public enum GCodeGroups {
//
// ActivePlane,
// AxisOffset,
// CollantMode,
// CoordinateSystemMode,
// CutterLengthCompMode,
// CutterRadiusCompMode,
// DistanceMode,
// FeedRateMode,
// MotionsModes,
// PathControleMode,
// PredefinedPosition,
// ReferenceLocation,
// RetrackMode,
// SFOverrideMode,
// SpindleMode,
// StopModes,
// Units;
//
//
//
// }
//
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/gcodes/ModalGrouping.java
// public final class ModalGrouping {
//
// public static final Map<GCodeGroups, Set<String>> groupToModals;
// public static final Map<String, GCodeGroups> modalToGroup;
//
// static {
// HashMap<GCodeGroups, Set<String>> gGroups = new HashMap<>();
// HashMap<String, GCodeGroups> mGroups = new HashMap<>();
//
// // Add all model sets
// gGroups.put(GCodeGroups.ActivePlane, toStringSet(ActivePlane.class.getEnumConstants()));
// gGroups.put(GCodeGroups.AxisOffset, toStringSet(AxisOffset.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CollantMode, toStringSet(CollantMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CoordinateSystemMode, toStringSet(CoordinateSystemMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CutterLengthCompMode, toStringSet(CutterLengthCompMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.CutterRadiusCompMode, toStringSet(CutterRadiusCompMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.DistanceMode, toStringSet(DistanceMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.FeedRateMode, toStringSet(FeedRateMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.MotionsModes, toStringSet(MotionMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.PathControleMode, toStringSet(PathControleMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.PredefinedPosition, toStringSet(PredefinedPosition.class.getEnumConstants()));
// gGroups.put(GCodeGroups.ReferenceLocation, toStringSet(ReferenceLocation.class.getEnumConstants()));
// gGroups.put(GCodeGroups.RetrackMode, toStringSet(RetrackMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.SFOverrideMode, toStringSet(SFOverrideMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.SpindleMode, toStringSet(SpindleMode.class.getEnumConstants()));
// gGroups.put(GCodeGroups.StopModes, toStringSet(StopModes.class.getEnumConstants()));
// gGroups.put(GCodeGroups.Units, toStringSet(Units.class.getEnumConstants()));
//
// // Create a modal to group map
// for (Map.Entry<GCodeGroups, Set<String>> group : gGroups.entrySet()) {
// for (String modals : group.getValue()) {
// mGroups.put(modals, group.getKey());
// }
// }
//
// //
// groupToModals = Collections.unmodifiableMap(gGroups);
// modalToGroup = Collections.unmodifiableMap(mGroups);
// }
//
// /**
// * Return the group belonging to a modal word
// * @param word
// * @return
// */
// static public GCodeGroups whatGroup(final String word) {
// return modalToGroup.get(word);
// }
//
// private static <T> Set<String> toStringSet(T[] enumClass) {
// final Set<String> stringSet = new HashSet<>();
// for (T code : enumClass) {
// stringSet.add(code.toString());
// }
// return stringSet;
// }
//
// }
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/MachineStatus.java
import com.rvantwisk.gcodeparser.gcodes.GCodeGroups;
import com.rvantwisk.gcodeparser.gcodes.ModalGrouping;
import java.util.*;
ParsedWord word = block.get(axis.toString());
machineOffsets.put(axis, word.value);
}
}
}
private void setAxis(final Map<String, ParsedWord> block) {
for (Axis axis : Axis.values()) {
if (block.containsKey(axis.toString())) {
ParsedWord word = block.get(axis.toString());
// Handle absolute cordinate position (G0 and G1 only)
if (modals.contains("G53")) {
machineCoordinates.put(axis, word.value);
} else {
// Handle relative distance mode
if (modals.contains("G90")) {
machineCoordinates.put(axis, machineOffsets.get(axis) + word.value);
} else {
machineCoordinates.put(axis, machineCoordinates.get(axis) + word.value);
}
}
}
}
}
private void setModals(final Map<String, ParsedWord> block) {
for (ParsedWord word : block.values()) {
if (word.word.equals("G") || word.word.equals("M")) {
// Find the modal group and remove all modals if found
|
GCodeGroups thisGroup = ModalGrouping.whatGroup(word.parsed);
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/controllers/TaskEditController.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/interfaces/TaskModel.java
// public interface TaskModel extends Copyable<TaskModel> {
//
// void generateGCode(final ToolDBManager toolDBManager, final CncToolsGCodegenerator gCodeGenerator, final String taskId);
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/operations/interfaces/MillTaskController.java
// public interface MillTaskController {
// public abstract void setModel(final TaskModel model);
// public abstract void setProject(final Project project);
// public abstract TaskModel getModel();
// public abstract <T extends TaskModel> T createNewModel();
// public abstract void destroy();
// }
|
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.data.interfaces.TaskModel;
import com.rvantwisk.cnctools.misc.AbstractController;
import com.rvantwisk.cnctools.operations.interfaces.MillTaskController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.util.Callback;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
|
/*
* Copyright (c) 2014, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controllers;
/**
* Created by rvt on 1/2/14.
*/
public class TaskEditController extends AbstractController {
enum ViewAs {
CLOSE,
CANCELSAVE
}
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/interfaces/TaskModel.java
// public interface TaskModel extends Copyable<TaskModel> {
//
// void generateGCode(final ToolDBManager toolDBManager, final CncToolsGCodegenerator gCodeGenerator, final String taskId);
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/operations/interfaces/MillTaskController.java
// public interface MillTaskController {
// public abstract void setModel(final TaskModel model);
// public abstract void setProject(final Project project);
// public abstract TaskModel getModel();
// public abstract <T extends TaskModel> T createNewModel();
// public abstract void destroy();
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/controllers/TaskEditController.java
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.data.interfaces.TaskModel;
import com.rvantwisk.cnctools.misc.AbstractController;
import com.rvantwisk.cnctools.operations.interfaces.MillTaskController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.util.Callback;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
/*
* Copyright (c) 2014, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controllers;
/**
* Created by rvt on 1/2/14.
*/
public class TaskEditController extends AbstractController {
enum ViewAs {
CLOSE,
CANCELSAVE
}
|
private MillTaskController tasksController;
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/controllers/TaskEditController.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/interfaces/TaskModel.java
// public interface TaskModel extends Copyable<TaskModel> {
//
// void generateGCode(final ToolDBManager toolDBManager, final CncToolsGCodegenerator gCodeGenerator, final String taskId);
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/operations/interfaces/MillTaskController.java
// public interface MillTaskController {
// public abstract void setModel(final TaskModel model);
// public abstract void setProject(final Project project);
// public abstract TaskModel getModel();
// public abstract <T extends TaskModel> T createNewModel();
// public abstract void destroy();
// }
|
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.data.interfaces.TaskModel;
import com.rvantwisk.cnctools.misc.AbstractController;
import com.rvantwisk.cnctools.operations.interfaces.MillTaskController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.util.Callback;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
|
@FXML
void onCancel(ActionEvent event) {
tasksController.destroy();
setReturned(Result.CANCEL);
getDialog().close();
}
@FXML
void onClose(ActionEvent event) {
tasksController.destroy();
setReturned(Result.CLOSE);
getDialog().close();
}
@FXML
void onSave(ActionEvent event) {
tasksController.destroy();
setReturned(Result.SAVE);
getDialog().close();
}
@FXML
void initialize() {
assert btnCancel != null : "fx:id=\"btnCancel\" was not injected: check your FXML file 'TaskEdit.fxml'.";
assert btnSave != null : "fx:id=\"btnSave\" was not injected: check your FXML file 'TaskEdit.fxml'.";
assert lbHeader != null : "fx:id=\"lbHeader\" was not injected: check your FXML file 'TaskEdit.fxml'.";
setViewAs(ViewAs.CANCELSAVE);
}
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/interfaces/TaskModel.java
// public interface TaskModel extends Copyable<TaskModel> {
//
// void generateGCode(final ToolDBManager toolDBManager, final CncToolsGCodegenerator gCodeGenerator, final String taskId);
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/operations/interfaces/MillTaskController.java
// public interface MillTaskController {
// public abstract void setModel(final TaskModel model);
// public abstract void setProject(final Project project);
// public abstract TaskModel getModel();
// public abstract <T extends TaskModel> T createNewModel();
// public abstract void destroy();
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/controllers/TaskEditController.java
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.data.interfaces.TaskModel;
import com.rvantwisk.cnctools.misc.AbstractController;
import com.rvantwisk.cnctools.operations.interfaces.MillTaskController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.util.Callback;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
@FXML
void onCancel(ActionEvent event) {
tasksController.destroy();
setReturned(Result.CANCEL);
getDialog().close();
}
@FXML
void onClose(ActionEvent event) {
tasksController.destroy();
setReturned(Result.CLOSE);
getDialog().close();
}
@FXML
void onSave(ActionEvent event) {
tasksController.destroy();
setReturned(Result.SAVE);
getDialog().close();
}
@FXML
void initialize() {
assert btnCancel != null : "fx:id=\"btnCancel\" was not injected: check your FXML file 'TaskEdit.fxml'.";
assert btnSave != null : "fx:id=\"btnSave\" was not injected: check your FXML file 'TaskEdit.fxml'.";
assert lbHeader != null : "fx:id=\"lbHeader\" was not injected: check your FXML file 'TaskEdit.fxml'.";
setViewAs(ViewAs.CANCELSAVE);
}
|
public void setTask(final Project project, final TaskRunnable taskRunnable) {
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/controllers/TaskEditController.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/interfaces/TaskModel.java
// public interface TaskModel extends Copyable<TaskModel> {
//
// void generateGCode(final ToolDBManager toolDBManager, final CncToolsGCodegenerator gCodeGenerator, final String taskId);
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/operations/interfaces/MillTaskController.java
// public interface MillTaskController {
// public abstract void setModel(final TaskModel model);
// public abstract void setProject(final Project project);
// public abstract TaskModel getModel();
// public abstract <T extends TaskModel> T createNewModel();
// public abstract void destroy();
// }
|
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.data.interfaces.TaskModel;
import com.rvantwisk.cnctools.misc.AbstractController;
import com.rvantwisk.cnctools.operations.interfaces.MillTaskController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.util.Callback;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
|
@FXML
void onClose(ActionEvent event) {
tasksController.destroy();
setReturned(Result.CLOSE);
getDialog().close();
}
@FXML
void onSave(ActionEvent event) {
tasksController.destroy();
setReturned(Result.SAVE);
getDialog().close();
}
@FXML
void initialize() {
assert btnCancel != null : "fx:id=\"btnCancel\" was not injected: check your FXML file 'TaskEdit.fxml'.";
assert btnSave != null : "fx:id=\"btnSave\" was not injected: check your FXML file 'TaskEdit.fxml'.";
assert lbHeader != null : "fx:id=\"lbHeader\" was not injected: check your FXML file 'TaskEdit.fxml'.";
setViewAs(ViewAs.CANCELSAVE);
}
public void setTask(final Project project, final TaskRunnable taskRunnable) {
currentTaskRunnable = taskRunnable;
tasksController = (MillTaskController) applicationContext.getBean(taskRunnable.getClassName());
// Ensure we supply a non-null model to the operation
if (taskRunnable.getMilltaskModel()==null) {
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/interfaces/TaskModel.java
// public interface TaskModel extends Copyable<TaskModel> {
//
// void generateGCode(final ToolDBManager toolDBManager, final CncToolsGCodegenerator gCodeGenerator, final String taskId);
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/operations/interfaces/MillTaskController.java
// public interface MillTaskController {
// public abstract void setModel(final TaskModel model);
// public abstract void setProject(final Project project);
// public abstract TaskModel getModel();
// public abstract <T extends TaskModel> T createNewModel();
// public abstract void destroy();
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/controllers/TaskEditController.java
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.data.interfaces.TaskModel;
import com.rvantwisk.cnctools.misc.AbstractController;
import com.rvantwisk.cnctools.operations.interfaces.MillTaskController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.util.Callback;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ResourceBundle;
@FXML
void onClose(ActionEvent event) {
tasksController.destroy();
setReturned(Result.CLOSE);
getDialog().close();
}
@FXML
void onSave(ActionEvent event) {
tasksController.destroy();
setReturned(Result.SAVE);
getDialog().close();
}
@FXML
void initialize() {
assert btnCancel != null : "fx:id=\"btnCancel\" was not injected: check your FXML file 'TaskEdit.fxml'.";
assert btnSave != null : "fx:id=\"btnSave\" was not injected: check your FXML file 'TaskEdit.fxml'.";
assert lbHeader != null : "fx:id=\"lbHeader\" was not injected: check your FXML file 'TaskEdit.fxml'.";
setViewAs(ViewAs.CANCELSAVE);
}
public void setTask(final Project project, final TaskRunnable taskRunnable) {
currentTaskRunnable = taskRunnable;
tasksController = (MillTaskController) applicationContext.getBean(taskRunnable.getClassName());
// Ensure we supply a non-null model to the operation
if (taskRunnable.getMilltaskModel()==null) {
|
TaskModel m = tasksController.createNewModel();
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/controllers/AddMillTaskController.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/AbstractTask.java
// public abstract class AbstractTask {
//
// private StringProperty name = new SimpleStringProperty();
// private StringProperty description = new SimpleStringProperty();
// private StringProperty className = new SimpleStringProperty();
// private StringProperty fxmlFileName = new SimpleStringProperty();
//
//
// public AbstractTask() {
// }
//
// public AbstractTask(String name, String description, String className, String fxmlFileName) {
// this.name.set(name);
// this.description.set(description);
// this.className.set(className);
// this.fxmlFileName.set(fxmlFileName);
// }
//
// public String getName() {
// return name.get();
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public String getClassName() {
// return className.get();
// }
//
// public String getFxmlFileName() {
// return fxmlFileName.get();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
|
import com.rvantwisk.cnctools.data.AbstractTask;
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.misc.AbstractController;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javax.annotation.Resource;
import java.util.List;
|
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controllers;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/6/13
* Time: 9:51 PM
* To change this template use File | Settings | File Templates.
*/
public class AddMillTaskController extends AbstractController {
@Resource(name = "applicapableMillTasks")
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/AbstractTask.java
// public abstract class AbstractTask {
//
// private StringProperty name = new SimpleStringProperty();
// private StringProperty description = new SimpleStringProperty();
// private StringProperty className = new SimpleStringProperty();
// private StringProperty fxmlFileName = new SimpleStringProperty();
//
//
// public AbstractTask() {
// }
//
// public AbstractTask(String name, String description, String className, String fxmlFileName) {
// this.name.set(name);
// this.description.set(description);
// this.className.set(className);
// this.fxmlFileName.set(fxmlFileName);
// }
//
// public String getName() {
// return name.get();
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public String getClassName() {
// return className.get();
// }
//
// public String getFxmlFileName() {
// return fxmlFileName.get();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/controllers/AddMillTaskController.java
import com.rvantwisk.cnctools.data.AbstractTask;
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.misc.AbstractController;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javax.annotation.Resource;
import java.util.List;
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controllers;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/6/13
* Time: 9:51 PM
* To change this template use File | Settings | File Templates.
*/
public class AddMillTaskController extends AbstractController {
@Resource(name = "applicapableMillTasks")
|
private List<AbstractTask> applicapableMillTasks;
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/controllers/AddMillTaskController.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/AbstractTask.java
// public abstract class AbstractTask {
//
// private StringProperty name = new SimpleStringProperty();
// private StringProperty description = new SimpleStringProperty();
// private StringProperty className = new SimpleStringProperty();
// private StringProperty fxmlFileName = new SimpleStringProperty();
//
//
// public AbstractTask() {
// }
//
// public AbstractTask(String name, String description, String className, String fxmlFileName) {
// this.name.set(name);
// this.description.set(description);
// this.className.set(className);
// this.fxmlFileName.set(fxmlFileName);
// }
//
// public String getName() {
// return name.get();
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public String getClassName() {
// return className.get();
// }
//
// public String getFxmlFileName() {
// return fxmlFileName.get();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
|
import com.rvantwisk.cnctools.data.AbstractTask;
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.misc.AbstractController;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javax.annotation.Resource;
import java.util.List;
|
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controllers;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/6/13
* Time: 9:51 PM
* To change this template use File | Settings | File Templates.
*/
public class AddMillTaskController extends AbstractController {
@Resource(name = "applicapableMillTasks")
private List<AbstractTask> applicapableMillTasks;
@FXML TableView tbl_assignedMillTasks;
@FXML TextField tv_taskName;
@FXML Button bt_add;
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/AbstractTask.java
// public abstract class AbstractTask {
//
// private StringProperty name = new SimpleStringProperty();
// private StringProperty description = new SimpleStringProperty();
// private StringProperty className = new SimpleStringProperty();
// private StringProperty fxmlFileName = new SimpleStringProperty();
//
//
// public AbstractTask() {
// }
//
// public AbstractTask(String name, String description, String className, String fxmlFileName) {
// this.name.set(name);
// this.description.set(description);
// this.className.set(className);
// this.fxmlFileName.set(fxmlFileName);
// }
//
// public String getName() {
// return name.get();
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public String getClassName() {
// return className.get();
// }
//
// public String getFxmlFileName() {
// return fxmlFileName.get();
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/Project.java
// public class Project {
//
// private final StringProperty name = new SimpleStringProperty();
// private final StringProperty description = new SimpleStringProperty();
// private final ObservableList<TaskRunnable> milltasks = FXCollections.observableArrayList();
// private ObjectProperty<CNCToolsPostProcessConfig> postProcessor = new SimpleObjectProperty<>();
//
// public Project() {
// }
//
// public Project(String projectName, String description) {
// this.name.set(projectName);
// this.description.set(description);
// }
//
// public Object readResolve() {
// if (postProcessor == null) {
// postProcessor = new SimpleObjectProperty<>();
// postProcessorProperty().set(Factory.newPostProcessor());
// }
// return this;
// }
//
// public String toString() {
// return "Project{" +
// "name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", has Operations='" + milltasks.size() + '\'' +
// '}';
// }
//
// public ObservableList<TaskRunnable> millTasksProperty() {
// return milltasks;
// }
//
// public StringProperty nameProperty() {
// return name;
// }
//
// public StringProperty descriptionProperty() {
// return description;
// }
//
// public String getName() {
// return name.get();
// }
//
// public void setName(String name) {
// this.name.set(name);
// }
//
// public String getDescription() {
// return description.get();
// }
//
// public void setDescription(String description) {
// this.description.set(description);
// }
//
// public CNCToolsPostProcessConfig getPostProcessor() {
// return postProcessor.get();
// }
//
// public void setPostProcessor(CNCToolsPostProcessConfig postProcessor) {
// this.postProcessor.set(postProcessor);
// }
//
// public ObjectProperty<CNCToolsPostProcessConfig> postProcessorProperty() {
// return postProcessor;
// }
//
// public GCodeCollection getGCode(ToolDBManager toolDBManager) {
// final CncToolsGCodegenerator gCodeGenerator = Factory.getProcessorDialect(postProcessor.get());
//
// gCodeGenerator.startProgram();
// for (TaskRunnable t : milltasks) {
// t.generateGCode(toolDBManager, gCodeGenerator);
// }
// gCodeGenerator.endProgram();
//
// return gCodeGenerator.getGCode();
// }
//
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/controllers/AddMillTaskController.java
import com.rvantwisk.cnctools.data.AbstractTask;
import com.rvantwisk.cnctools.data.Project;
import com.rvantwisk.cnctools.data.TaskRunnable;
import com.rvantwisk.cnctools.misc.AbstractController;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javax.annotation.Resource;
import java.util.List;
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controllers;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/6/13
* Time: 9:51 PM
* To change this template use File | Settings | File Templates.
*/
public class AddMillTaskController extends AbstractController {
@Resource(name = "applicapableMillTasks")
private List<AbstractTask> applicapableMillTasks;
@FXML TableView tbl_assignedMillTasks;
@FXML TextField tv_taskName;
@FXML Button bt_add;
|
private Project currentProject;
|
rvt/cnctools
|
gcodeparser/src/main/java/com/rvantwisk/gcodeparser/MachineController.java
|
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/exceptions/SimException.java
// public class SimException extends Exception {
// public SimException(String message) {
// super(message);
// }
//
// public SimException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SimException(Throwable cause) {
// super(cause);
// }
//
// public SimException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
// }
|
import com.rvantwisk.gcodeparser.exceptions.SimException;
import java.util.Map;
|
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.gcodeparser;
public interface MachineController {
void startBlock(GCodeParser parser, MachineStatus machineStatus, Map<String, ParsedWord> block);
|
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/exceptions/SimException.java
// public class SimException extends Exception {
// public SimException(String message) {
// super(message);
// }
//
// public SimException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SimException(Throwable cause) {
// super(cause);
// }
//
// public SimException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
// super(message, cause, enableSuppression, writableStackTrace);
// }
// }
// Path: gcodeparser/src/main/java/com/rvantwisk/gcodeparser/MachineController.java
import com.rvantwisk.gcodeparser.exceptions.SimException;
import java.util.Map;
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.gcodeparser;
public interface MachineController {
void startBlock(GCodeParser parser, MachineStatus machineStatus, Map<String, ParsedWord> block);
|
void endBlock(GCodeParser parser, MachineStatus machineStatus, Map<String, ParsedWord> block) throws SimException;
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/controls/ToolParametersControl.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/InputMaskChecker.java
// public class InputMaskChecker implements ChangeListener<String> {
//
// public static final String NOTEMPTY = "^.+$";
// public static final String NUMERIC = "^[0-9]*$";
// public static final String TEXTONLY = "^\\w*$";
// public static final String PASSWORD = "^[\\w\\+\\!\\?\\-\\$\\&\\%£]+$";
// public static final String DATASOURCE = "^([a-zA-Z]+:){3}@([a-zA-Z0-9]+:)+[a-zA-Z0-9]+$";
// public static final String TCPPORT = "^(6553[0-5]|655[0-2]\\d|65[0-4]\\d\\d|6[0-4]\\d{3}|[1-5]\\d{4}|[2-9]\\d{3}|1[1-9]\\d{2}|10[3-9]\\d|102[4-9])$";
//
// private static final String STYLE = "-fx-effect: dropshadow(gaussian, red, 4, 0.0, 0, 0);";
//
// public final BooleanProperty erroneous = new SimpleBooleanProperty(false);
//
// private final String mask;
// private final int max_lenght;
// private final TextField control;
//
//
// public InputMaskChecker(String mask, TextField control) {
// this.mask = mask;
// this.max_lenght = 0;
// this.control = control;
// }
//
// public InputMaskChecker(String mask, int max_lenght, TextField control) {
// this.mask = mask;
// this.max_lenght = max_lenght;
// this.control = control;
// }
//
//
// @Override
// public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
// erroneous.setValue(!newValue.matches(mask) || ((max_lenght > 0) ? newValue.length() > max_lenght : false) || newValue.length() == 0);
// control.setStyle( erroneous.get() ? STYLE : "-fx-effect: null;");
// }
// }
|
import com.rvantwisk.cnctools.data.ToolParameter;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.rvantwisk.cnctools.misc.InputMaskChecker;
import javafx.beans.binding.BooleanBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
|
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controls;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/10/13
* Time: 7:44 AM
* To change this template use File | Settings | File Templates.
*/
public class ToolParametersControl extends AnchorPane {
ObservableList tools = FXCollections.observableArrayList(
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/InputMaskChecker.java
// public class InputMaskChecker implements ChangeListener<String> {
//
// public static final String NOTEMPTY = "^.+$";
// public static final String NUMERIC = "^[0-9]*$";
// public static final String TEXTONLY = "^\\w*$";
// public static final String PASSWORD = "^[\\w\\+\\!\\?\\-\\$\\&\\%£]+$";
// public static final String DATASOURCE = "^([a-zA-Z]+:){3}@([a-zA-Z0-9]+:)+[a-zA-Z0-9]+$";
// public static final String TCPPORT = "^(6553[0-5]|655[0-2]\\d|65[0-4]\\d\\d|6[0-4]\\d{3}|[1-5]\\d{4}|[2-9]\\d{3}|1[1-9]\\d{2}|10[3-9]\\d|102[4-9])$";
//
// private static final String STYLE = "-fx-effect: dropshadow(gaussian, red, 4, 0.0, 0, 0);";
//
// public final BooleanProperty erroneous = new SimpleBooleanProperty(false);
//
// private final String mask;
// private final int max_lenght;
// private final TextField control;
//
//
// public InputMaskChecker(String mask, TextField control) {
// this.mask = mask;
// this.max_lenght = 0;
// this.control = control;
// }
//
// public InputMaskChecker(String mask, int max_lenght, TextField control) {
// this.mask = mask;
// this.max_lenght = max_lenght;
// this.control = control;
// }
//
//
// @Override
// public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
// erroneous.setValue(!newValue.matches(mask) || ((max_lenght > 0) ? newValue.length() > max_lenght : false) || newValue.length() == 0);
// control.setStyle( erroneous.get() ? STYLE : "-fx-effect: null;");
// }
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/controls/ToolParametersControl.java
import com.rvantwisk.cnctools.data.ToolParameter;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.rvantwisk.cnctools.misc.InputMaskChecker;
import javafx.beans.binding.BooleanBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controls;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/10/13
* Time: 7:44 AM
* To change this template use File | Settings | File Templates.
*/
public class ToolParametersControl extends AnchorPane {
ObservableList tools = FXCollections.observableArrayList(
|
"EndMill", "BallMill"
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/controls/ToolParametersControl.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/InputMaskChecker.java
// public class InputMaskChecker implements ChangeListener<String> {
//
// public static final String NOTEMPTY = "^.+$";
// public static final String NUMERIC = "^[0-9]*$";
// public static final String TEXTONLY = "^\\w*$";
// public static final String PASSWORD = "^[\\w\\+\\!\\?\\-\\$\\&\\%£]+$";
// public static final String DATASOURCE = "^([a-zA-Z]+:){3}@([a-zA-Z0-9]+:)+[a-zA-Z0-9]+$";
// public static final String TCPPORT = "^(6553[0-5]|655[0-2]\\d|65[0-4]\\d\\d|6[0-4]\\d{3}|[1-5]\\d{4}|[2-9]\\d{3}|1[1-9]\\d{2}|10[3-9]\\d|102[4-9])$";
//
// private static final String STYLE = "-fx-effect: dropshadow(gaussian, red, 4, 0.0, 0, 0);";
//
// public final BooleanProperty erroneous = new SimpleBooleanProperty(false);
//
// private final String mask;
// private final int max_lenght;
// private final TextField control;
//
//
// public InputMaskChecker(String mask, TextField control) {
// this.mask = mask;
// this.max_lenght = 0;
// this.control = control;
// }
//
// public InputMaskChecker(String mask, int max_lenght, TextField control) {
// this.mask = mask;
// this.max_lenght = max_lenght;
// this.control = control;
// }
//
//
// @Override
// public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
// erroneous.setValue(!newValue.matches(mask) || ((max_lenght > 0) ? newValue.length() > max_lenght : false) || newValue.length() == 0);
// control.setStyle( erroneous.get() ? STYLE : "-fx-effect: null;");
// }
// }
|
import com.rvantwisk.cnctools.data.ToolParameter;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.rvantwisk.cnctools.misc.InputMaskChecker;
import javafx.beans.binding.BooleanBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
|
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controls;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/10/13
* Time: 7:44 AM
* To change this template use File | Settings | File Templates.
*/
public class ToolParametersControl extends AnchorPane {
ObservableList tools = FXCollections.observableArrayList(
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/InputMaskChecker.java
// public class InputMaskChecker implements ChangeListener<String> {
//
// public static final String NOTEMPTY = "^.+$";
// public static final String NUMERIC = "^[0-9]*$";
// public static final String TEXTONLY = "^\\w*$";
// public static final String PASSWORD = "^[\\w\\+\\!\\?\\-\\$\\&\\%£]+$";
// public static final String DATASOURCE = "^([a-zA-Z]+:){3}@([a-zA-Z0-9]+:)+[a-zA-Z0-9]+$";
// public static final String TCPPORT = "^(6553[0-5]|655[0-2]\\d|65[0-4]\\d\\d|6[0-4]\\d{3}|[1-5]\\d{4}|[2-9]\\d{3}|1[1-9]\\d{2}|10[3-9]\\d|102[4-9])$";
//
// private static final String STYLE = "-fx-effect: dropshadow(gaussian, red, 4, 0.0, 0, 0);";
//
// public final BooleanProperty erroneous = new SimpleBooleanProperty(false);
//
// private final String mask;
// private final int max_lenght;
// private final TextField control;
//
//
// public InputMaskChecker(String mask, TextField control) {
// this.mask = mask;
// this.max_lenght = 0;
// this.control = control;
// }
//
// public InputMaskChecker(String mask, int max_lenght, TextField control) {
// this.mask = mask;
// this.max_lenght = max_lenght;
// this.control = control;
// }
//
//
// @Override
// public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
// erroneous.setValue(!newValue.matches(mask) || ((max_lenght > 0) ? newValue.length() > max_lenght : false) || newValue.length() == 0);
// control.setStyle( erroneous.get() ? STYLE : "-fx-effect: null;");
// }
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/controls/ToolParametersControl.java
import com.rvantwisk.cnctools.data.ToolParameter;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.rvantwisk.cnctools.misc.InputMaskChecker;
import javafx.beans.binding.BooleanBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools.controls;
/**
* Created with IntelliJ IDEA.
* User: rvt
* Date: 10/10/13
* Time: 7:44 AM
* To change this template use File | Settings | File Templates.
*/
public class ToolParametersControl extends AnchorPane {
ObservableList tools = FXCollections.observableArrayList(
|
"EndMill", "BallMill"
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/controls/ToolParametersControl.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/InputMaskChecker.java
// public class InputMaskChecker implements ChangeListener<String> {
//
// public static final String NOTEMPTY = "^.+$";
// public static final String NUMERIC = "^[0-9]*$";
// public static final String TEXTONLY = "^\\w*$";
// public static final String PASSWORD = "^[\\w\\+\\!\\?\\-\\$\\&\\%£]+$";
// public static final String DATASOURCE = "^([a-zA-Z]+:){3}@([a-zA-Z0-9]+:)+[a-zA-Z0-9]+$";
// public static final String TCPPORT = "^(6553[0-5]|655[0-2]\\d|65[0-4]\\d\\d|6[0-4]\\d{3}|[1-5]\\d{4}|[2-9]\\d{3}|1[1-9]\\d{2}|10[3-9]\\d|102[4-9])$";
//
// private static final String STYLE = "-fx-effect: dropshadow(gaussian, red, 4, 0.0, 0, 0);";
//
// public final BooleanProperty erroneous = new SimpleBooleanProperty(false);
//
// private final String mask;
// private final int max_lenght;
// private final TextField control;
//
//
// public InputMaskChecker(String mask, TextField control) {
// this.mask = mask;
// this.max_lenght = 0;
// this.control = control;
// }
//
// public InputMaskChecker(String mask, int max_lenght, TextField control) {
// this.mask = mask;
// this.max_lenght = max_lenght;
// this.control = control;
// }
//
//
// @Override
// public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
// erroneous.setValue(!newValue.matches(mask) || ((max_lenght > 0) ? newValue.length() > max_lenght : false) || newValue.length() == 0);
// control.setStyle( erroneous.get() ? STYLE : "-fx-effect: null;");
// }
// }
|
import com.rvantwisk.cnctools.data.ToolParameter;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.rvantwisk.cnctools.misc.InputMaskChecker;
import javafx.beans.binding.BooleanBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
|
@FXML
private RadioButton iSPindleCW;
@FXML
private RadioButton iSPindleCCW;
@FXML
private ChoiceBox<String> ddNumFlutes;
@FXML
private ChoiceBox cbToolType;
private ToolParameter tool;
public ToolParametersControl() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ToolParameters.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
@FXML
void initialize() {
assert iDiameter != null : "fx:id=\"iDiameter\" was not injected: check your FXML file 'ToolParameters.fxml'.";
assert iName != null : "fx:id=\"iName\" was not injected: check your FXML file 'ToolParameters.fxml'.";
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/BallMill.java
// public class BallMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public BallMill() {
// }
//
// public BallMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
//
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/data/tools/EndMill.java
// public class EndMill extends Toolbase {
//
// private final DimensionProperty diameter = new DimensionProperty();
//
// public EndMill() {
// }
//
// public EndMill(DimensionProperty diameter) {
// this.diameter.set(diameter);
// }
//
// public DimensionProperty diameterProperty() {
// return diameter;
// }
// }
//
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/InputMaskChecker.java
// public class InputMaskChecker implements ChangeListener<String> {
//
// public static final String NOTEMPTY = "^.+$";
// public static final String NUMERIC = "^[0-9]*$";
// public static final String TEXTONLY = "^\\w*$";
// public static final String PASSWORD = "^[\\w\\+\\!\\?\\-\\$\\&\\%£]+$";
// public static final String DATASOURCE = "^([a-zA-Z]+:){3}@([a-zA-Z0-9]+:)+[a-zA-Z0-9]+$";
// public static final String TCPPORT = "^(6553[0-5]|655[0-2]\\d|65[0-4]\\d\\d|6[0-4]\\d{3}|[1-5]\\d{4}|[2-9]\\d{3}|1[1-9]\\d{2}|10[3-9]\\d|102[4-9])$";
//
// private static final String STYLE = "-fx-effect: dropshadow(gaussian, red, 4, 0.0, 0, 0);";
//
// public final BooleanProperty erroneous = new SimpleBooleanProperty(false);
//
// private final String mask;
// private final int max_lenght;
// private final TextField control;
//
//
// public InputMaskChecker(String mask, TextField control) {
// this.mask = mask;
// this.max_lenght = 0;
// this.control = control;
// }
//
// public InputMaskChecker(String mask, int max_lenght, TextField control) {
// this.mask = mask;
// this.max_lenght = max_lenght;
// this.control = control;
// }
//
//
// @Override
// public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
// erroneous.setValue(!newValue.matches(mask) || ((max_lenght > 0) ? newValue.length() > max_lenght : false) || newValue.length() == 0);
// control.setStyle( erroneous.get() ? STYLE : "-fx-effect: null;");
// }
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/controls/ToolParametersControl.java
import com.rvantwisk.cnctools.data.ToolParameter;
import com.rvantwisk.cnctools.data.tools.BallMill;
import com.rvantwisk.cnctools.data.tools.EndMill;
import com.rvantwisk.cnctools.misc.InputMaskChecker;
import javafx.beans.binding.BooleanBinding;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
@FXML
private RadioButton iSPindleCW;
@FXML
private RadioButton iSPindleCCW;
@FXML
private ChoiceBox<String> ddNumFlutes;
@FXML
private ChoiceBox cbToolType;
private ToolParameter tool;
public ToolParametersControl() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ToolParameters.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
}
@FXML
void initialize() {
assert iDiameter != null : "fx:id=\"iDiameter\" was not injected: check your FXML file 'ToolParameters.fxml'.";
assert iName != null : "fx:id=\"iName\" was not injected: check your FXML file 'ToolParameters.fxml'.";
|
final InputMaskChecker listener1 = new InputMaskChecker(InputMaskChecker.NOTEMPTY, iName);
|
rvt/cnctools
|
cnctools/src/main/java/com/rvantwisk/cnctools/Main.java
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/FXMLDialog.java
// public class FXMLDialog extends Stage {
//
// private final FXMLLoader loader;
//
// public FXMLDialog(final AbstractController controller, final URL fxml, final Window owner) {
// this(controller, fxml, owner, StageStyle.DECORATED);
// }
//
// public FXMLDialog(final AbstractController controller, final URL fxml, final Window owner, final StageStyle style) {
// super(style);
// initModality(Modality.APPLICATION_MODAL);
// initOwner(owner);
// try {
// loader = new FXMLLoader(fxml);
// loader.setControllerFactory(new Callback<Class<?>, Object>() {
// @Override
// public Object call(Class<?> aClass) {
// return controller;
// }
// });
// controller.setDialog(this);
// Scene s = new Scene((Parent) loader.load());
// setScene(s);
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// }
//
// /**
// * Return the controller associated with this dialog
// *
// * @param <T> controlled that extends from AbstractController
// * @return
// */
// public <T extends AbstractController> T getController() {
// return (T) loader.getController();
// }
// }
|
import com.rvantwisk.cnctools.misc.FXMLDialog;
import javafx.application.Application;
import javafx.stage.Stage;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools;
public class Main extends Application {
private static Stage stage;
@Override
public void start(Stage stage) throws Exception{
ApplicationContext context = new AnnotationConfigApplicationContext("com.rvantwisk.cnctools");
ScreensConfiguration screens = context.getBean(ScreensConfiguration.class);
screens.setPrimaryStage(stage);
this.stage = stage;
screens.setContext(context);
|
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/misc/FXMLDialog.java
// public class FXMLDialog extends Stage {
//
// private final FXMLLoader loader;
//
// public FXMLDialog(final AbstractController controller, final URL fxml, final Window owner) {
// this(controller, fxml, owner, StageStyle.DECORATED);
// }
//
// public FXMLDialog(final AbstractController controller, final URL fxml, final Window owner, final StageStyle style) {
// super(style);
// initModality(Modality.APPLICATION_MODAL);
// initOwner(owner);
// try {
// loader = new FXMLLoader(fxml);
// loader.setControllerFactory(new Callback<Class<?>, Object>() {
// @Override
// public Object call(Class<?> aClass) {
// return controller;
// }
// });
// controller.setDialog(this);
// Scene s = new Scene((Parent) loader.load());
// setScene(s);
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// }
//
// /**
// * Return the controller associated with this dialog
// *
// * @param <T> controlled that extends from AbstractController
// * @return
// */
// public <T extends AbstractController> T getController() {
// return (T) loader.getController();
// }
// }
// Path: cnctools/src/main/java/com/rvantwisk/cnctools/Main.java
import com.rvantwisk.cnctools.misc.FXMLDialog;
import javafx.application.Application;
import javafx.stage.Stage;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
/*
* Copyright (c) 2013, R. van Twisk
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the aic-util nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.rvantwisk.cnctools;
public class Main extends Application {
private static Stage stage;
@Override
public void start(Stage stage) throws Exception{
ApplicationContext context = new AnnotationConfigApplicationContext("com.rvantwisk.cnctools");
ScreensConfiguration screens = context.getBean(ScreensConfiguration.class);
screens.setPrimaryStage(stage);
this.stage = stage;
screens.setContext(context);
|
FXMLDialog dialog = screens.cncTools();
|
Petschko/Java-RPG-Maker-MV-Decrypter
|
src/main/java/org/petschko/rpgmakermv/decrypt/cmd/CMD.java
|
// Path: src/main/java/org/petschko/lib/Const.java
// public class Const {
// public static final String CREATOR = "Petschko";
// public static final String CREATOR_URL = "https://petschko.org/";
// public static final String CREATOR_DONATION_URL = "https://www.paypal.me/petschko";
//
// // System Constance's
// public static final String DS = System.getProperty("file.separator");
// public static final String NEW_LINE = System.getProperty("line.separator");
//
// /**
// * Constructor
// */
// private Const() {
// // VOID - This is a Static-Class
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
|
import org.petschko.lib.Const;
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
|
break;
case CMD_ENCRYPT:
cmdCommand = new Encrypt();
break;
case CMD_RESTORE:
cmdCommand = new Restore();
break;
case CMD_RESTORE_PROJECT:
cmdCommand = new RestoreProject();
break;
case CMD_GET_KEY:
case CMD_GET_KEY_2:
case CMD_GET_KEY_3:
case CMD_GET_KEY_4:
case CMD_GET_KEY_5:
cmdCommand = new DetectKey();
break;
default:
// Void
}
cmdCommand.printHelp();
}
/**
* Exit the Program with a Message
*
* @param status - Exit-Status-Code
*/
static void exitCMD(int status) {
|
// Path: src/main/java/org/petschko/lib/Const.java
// public class Const {
// public static final String CREATOR = "Petschko";
// public static final String CREATOR_URL = "https://petschko.org/";
// public static final String CREATOR_DONATION_URL = "https://www.paypal.me/petschko";
//
// // System Constance's
// public static final String DS = System.getProperty("file.separator");
// public static final String NEW_LINE = System.getProperty("line.separator");
//
// /**
// * Constructor
// */
// private Const() {
// // VOID - This is a Static-Class
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/cmd/CMD.java
import org.petschko.lib.Const;
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
break;
case CMD_ENCRYPT:
cmdCommand = new Encrypt();
break;
case CMD_RESTORE:
cmdCommand = new Restore();
break;
case CMD_RESTORE_PROJECT:
cmdCommand = new RestoreProject();
break;
case CMD_GET_KEY:
case CMD_GET_KEY_2:
case CMD_GET_KEY_3:
case CMD_GET_KEY_4:
case CMD_GET_KEY_5:
cmdCommand = new DetectKey();
break;
default:
// Void
}
cmdCommand.printHelp();
}
/**
* Exit the Program with a Message
*
* @param status - Exit-Status-Code
*/
static void exitCMD(int status) {
|
App.showMessage("Done.");
|
Petschko/Java-RPG-Maker-MV-Decrypter
|
src/main/java/org/petschko/rpgmakermv/decrypt/cmd/RestoreProject.java
|
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
|
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
|
package org.petschko.rpgmakermv.decrypt.cmd;
/**
* @author Peter Dragicevic
*/
class RestoreProject implements I_CMD {
/**
* Runs the Command
*
* @param args - Command-Line commands
*/
@Override
public void run(String[] args) {
printHelp();
CMD.exitCMD(CMD.STATUS_WARNING);
}
/**
* Prints help for the command
*/
@Override
public void printHelp() {
|
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/cmd/RestoreProject.java
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
package org.petschko.rpgmakermv.decrypt.cmd;
/**
* @author Peter Dragicevic
*/
class RestoreProject implements I_CMD {
/**
* Runs the Command
*
* @param args - Command-Line commands
*/
@Override
public void run(String[] args) {
printHelp();
CMD.exitCMD(CMD.STATUS_WARNING);
}
/**
* Prints help for the command
*/
@Override
public void printHelp() {
|
App.showMessage("restoreproject -> !! NOT IMPLEMENTED YET !!", CMD.STATUS_WARNING);
|
Petschko/Java-RPG-Maker-MV-Decrypter
|
src/main/java/org/petschko/rpgmakermv/decrypt/cmd/RestoreProject.java
|
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
|
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
|
package org.petschko.rpgmakermv.decrypt.cmd;
/**
* @author Peter Dragicevic
*/
class RestoreProject implements I_CMD {
/**
* Runs the Command
*
* @param args - Command-Line commands
*/
@Override
public void run(String[] args) {
printHelp();
CMD.exitCMD(CMD.STATUS_WARNING);
}
/**
* Prints help for the command
*/
@Override
public void printHelp() {
App.showMessage("restoreproject -> !! NOT IMPLEMENTED YET !!", CMD.STATUS_WARNING);
App.showMessage("");
|
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/cmd/RestoreProject.java
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
package org.petschko.rpgmakermv.decrypt.cmd;
/**
* @author Peter Dragicevic
*/
class RestoreProject implements I_CMD {
/**
* Runs the Command
*
* @param args - Command-Line commands
*/
@Override
public void run(String[] args) {
printHelp();
CMD.exitCMD(CMD.STATUS_WARNING);
}
/**
* Prints help for the command
*/
@Override
public void printHelp() {
App.showMessage("restoreproject -> !! NOT IMPLEMENTED YET !!", CMD.STATUS_WARNING);
App.showMessage("");
|
App.showMessage("Usage: java -jar \"" + Config.THIS_JAR_FILE_NAME + "\" restoreproject");
|
Petschko/Java-RPG-Maker-MV-Decrypter
|
src/main/java/org/petschko/lib/gui/JImageLabel.java
|
// Path: src/main/java/org/petschko/lib/Image.java
// public class Image {
// private BufferedImage bufferedImage;
//
// /**
// * Image constructor
// *
// * @param bufferedImage - Buffered Image
// */
// public Image(BufferedImage bufferedImage) {
// this.bufferedImage = bufferedImage;
// }
//
// /**
// * Resize the Image
// *
// * @param newWidth - New Width
// * @param newHeight - New Height
// */
// public void resize(int newWidth, int newHeight) {
// if(this.bufferedImage == null)
// return;
//
// BufferedImage newImage = Image.drawNewPicture(newWidth, newHeight);
// Graphics g = newImage.getGraphics();
//
// g.drawImage(this.bufferedImage, 0, 0, newWidth, newHeight, null);
//
// this.bufferedImage = newImage;
// }
//
// /**
// * Returns the width of the Image
// *
// * @return - Width of the Image or null if not set
// */
// public int getWidth() {
// return bufferedImage.getWidth();
// }
//
// /**
// * Returns the height of the Image
// *
// * @return - Height if the Image or null if not set
// */
// public int getHeight() {
// return bufferedImage.getHeight();
// }
//
// /**
// * Returns the BufferedImage
// *
// * @return - Buffered Image
// */
// public BufferedImage getBufferedImage() {
// return bufferedImage;
// }
//
// /**
// *
// * @param x - width of the new picture
// * @param y - height of the new picture
// * @return - New Picture (transparency)
// * @throws NumberFormatException - Invalid-Values
// */
// public static BufferedImage drawNewPicture(int x, int y) throws NumberFormatException {
// if (x <= 0 || y <= 0)
// throw new NumberFormatException("drawNewPicture: x and y can't be <= 0!");
//
// BufferedImage bi = new BufferedImage(x, y, BufferedImage.TYPE_INT_ARGB);
// Graphics g = bi.getGraphics();
//
// Color transparency = new Color(0, 0, 0, 0);
// g.setColor(transparency);
// g.fillRect(0, 0, x, y);
//
// return bi;
// }
// }
|
import org.petschko.lib.Image;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
|
*/
private void setBufferedImage(java.io.File imageFile) {
try {
this.image = ImageIO.read(imageFile);
} catch(IOException e) {
e.printStackTrace();
this.image = null;
return;
}
// Try to create the new Panel after reading
this.createImagePanel();
}
/**
* Assign the Buffered Image to the Panel
*/
private void createImagePanel() {
if(this.image != null)
this.setIcon(new ImageIcon(this.image));
}
/**
* Resize the Element
*
* @param width - New Width
* @param height - New Height
*/
public void setImageSize(int width, int height) {
|
// Path: src/main/java/org/petschko/lib/Image.java
// public class Image {
// private BufferedImage bufferedImage;
//
// /**
// * Image constructor
// *
// * @param bufferedImage - Buffered Image
// */
// public Image(BufferedImage bufferedImage) {
// this.bufferedImage = bufferedImage;
// }
//
// /**
// * Resize the Image
// *
// * @param newWidth - New Width
// * @param newHeight - New Height
// */
// public void resize(int newWidth, int newHeight) {
// if(this.bufferedImage == null)
// return;
//
// BufferedImage newImage = Image.drawNewPicture(newWidth, newHeight);
// Graphics g = newImage.getGraphics();
//
// g.drawImage(this.bufferedImage, 0, 0, newWidth, newHeight, null);
//
// this.bufferedImage = newImage;
// }
//
// /**
// * Returns the width of the Image
// *
// * @return - Width of the Image or null if not set
// */
// public int getWidth() {
// return bufferedImage.getWidth();
// }
//
// /**
// * Returns the height of the Image
// *
// * @return - Height if the Image or null if not set
// */
// public int getHeight() {
// return bufferedImage.getHeight();
// }
//
// /**
// * Returns the BufferedImage
// *
// * @return - Buffered Image
// */
// public BufferedImage getBufferedImage() {
// return bufferedImage;
// }
//
// /**
// *
// * @param x - width of the new picture
// * @param y - height of the new picture
// * @return - New Picture (transparency)
// * @throws NumberFormatException - Invalid-Values
// */
// public static BufferedImage drawNewPicture(int x, int y) throws NumberFormatException {
// if (x <= 0 || y <= 0)
// throw new NumberFormatException("drawNewPicture: x and y can't be <= 0!");
//
// BufferedImage bi = new BufferedImage(x, y, BufferedImage.TYPE_INT_ARGB);
// Graphics g = bi.getGraphics();
//
// Color transparency = new Color(0, 0, 0, 0);
// g.setColor(transparency);
// g.fillRect(0, 0, x, y);
//
// return bi;
// }
// }
// Path: src/main/java/org/petschko/lib/gui/JImageLabel.java
import org.petschko.lib.Image;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
*/
private void setBufferedImage(java.io.File imageFile) {
try {
this.image = ImageIO.read(imageFile);
} catch(IOException e) {
e.printStackTrace();
this.image = null;
return;
}
// Try to create the new Panel after reading
this.createImagePanel();
}
/**
* Assign the Buffered Image to the Panel
*/
private void createImagePanel() {
if(this.image != null)
this.setIcon(new ImageIcon(this.image));
}
/**
* Resize the Element
*
* @param width - New Width
* @param height - New Height
*/
public void setImageSize(int width, int height) {
|
Image img = new Image(this.image);
|
Petschko/Java-RPG-Maker-MV-Decrypter
|
src/main/java/org/petschko/rpgmakermv/decrypt/cmd/Help.java
|
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
|
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
|
package org.petschko.rpgmakermv.decrypt.cmd;
/**
* @author Peter Dragicevic
*/
class Help implements I_CMD {
/**
* Runs the Command
*
* @param args - Command-Line commands
*/
@Override
public void run(String[] args) {
|
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/cmd/Help.java
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
package org.petschko.rpgmakermv.decrypt.cmd;
/**
* @author Peter Dragicevic
*/
class Help implements I_CMD {
/**
* Runs the Command
*
* @param args - Command-Line commands
*/
@Override
public void run(String[] args) {
|
App.showMessage("Invalid Command \"" + args[1] + "\"!", CMD.STATUS_WARNING);
|
Petschko/Java-RPG-Maker-MV-Decrypter
|
src/main/java/org/petschko/rpgmakermv/decrypt/cmd/Help.java
|
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
|
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
|
package org.petschko.rpgmakermv.decrypt.cmd;
/**
* @author Peter Dragicevic
*/
class Help implements I_CMD {
/**
* Runs the Command
*
* @param args - Command-Line commands
*/
@Override
public void run(String[] args) {
App.showMessage("Invalid Command \"" + args[1] + "\"!", CMD.STATUS_WARNING);
App.showMessage("");
printHelp();
}
/**
* Prints help for the command
*/
@Override
public void printHelp() {
App.showMessage("Help:");
App.showMessage("");
|
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/App.java
// public class App {
// private static Boolean useGUI = true;
// private static GUI gui;
// private static CMD cmd;
// public static String outputDir;
// public static Preferences preferences;
//
// /**
// * Main-Class
// *
// * @param args - Optional Arguments from Command-Line
// */
// public static void main(String[] args) {
// // Ensure System output dir always exists
// if(! File.existsDir(Config.DEFAULT_OUTPUT_DIR))
// File.createDirectory(Config.DEFAULT_OUTPUT_DIR);
//
// // Check whats given from CMD
// if(args.length > 0) {
// useGUI = false;
// cmd = new CMD(args);
// }
//
// if(useGUI) {
// // Show something when its started via .bat or shell file
// System.out.println(Config.PROGRAM_NAME + " - " + Config.VERSION + " by " + Const.CREATOR);
//
// // Use GUI
// preferences = new Preferences(Config.PREFERENCES_FILE);
// outputDir = App.preferences.getConfig(Preferences.LAST_OUTPUT_DIR, Config.DEFAULT_OUTPUT_DIR);
// gui = new GUI();
// } else {
// // Use Command-Line Version
// cmd.runCMD();
// }
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// * @param messageStatus - Status of the Message
// */
// public static void showMessage(String msg, int messageStatus) {
// String status;
//
// switch(messageStatus) {
// case CMD.STATUS_ERROR:
// status = "[ERROR]: ";
// break;
// case CMD.STATUS_WARNING:
// status = "[WARN]: ";
// break;
// case CMD.STATUS_OK:
// status = "[SUCCESS]: ";
// break;
// default:
// status = "[INFO]: ";
// }
//
// if(! App.useGUI)
// System.out.println(status + msg);
// }
//
// /**
// * Shows the given message if no GUI is enabled
// *
// * @param msg - Message to display
// */
// public static void showMessage(String msg) {
// showMessage(msg, CMD.STATUS_INFO);
// }
//
// /**
// * Saves the settings, close the GUI and quit the Program
// */
// public static void closeGUI() {
// if(! App.preferences.save()) {
// ErrorWindow errorWindow = new ErrorWindow("Can't save Settings...", ErrorWindow.ERROR_LEVEL_ERROR, false);
// errorWindow.show();
// }
//
// App.gui.dispose();
// System.exit(0);
// }
// }
//
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/Config.java
// public class Config {
// // Program Info
// public static final String VERSION_NUMBER = "0.4.1";
// public static final String VERSION = "v" + VERSION_NUMBER + " Alpha";
// public static final String PROGRAM_NAME = "RPG-Maker MV/MZ Decrypter";
// public static final String PROJECT_PAGE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter";
// public static final String PROJECT_BUG_REPORT_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/issues";
// public static final String PROJECT_LICENCE_URL = "https://github.com/Petschko/Java-RPG-Maker-MV-Decrypter/blob/master/LICENCE";
// public static final String AUTHOR_IMAGE = "/icons/petschko_icon.png";
// public static final String UPDATE_URL = "https://raw.githubusercontent.com/Petschko/Java-RPG-Maker-MV-Decrypter/master/version.txt";
//
// // File-Path-Settings
// public static final String DEFAULT_OUTPUT_DIR = "output";
// public static final String PREFERENCES_FILE = "config.pref";
//
// // Misc Settings
// public static final long UPDATE_CHECK_EVERY_SECS = 172800;
// public static final String THIS_JAR_FILE_NAME = "RPG Maker MV Decrypter.jar";
//
// /**
// * Constructor
// */
// private Config() {
// // VOID - This is a Static-Class
// }
// }
// Path: src/main/java/org/petschko/rpgmakermv/decrypt/cmd/Help.java
import org.petschko.rpgmakermv.decrypt.App;
import org.petschko.rpgmakermv.decrypt.Config;
package org.petschko.rpgmakermv.decrypt.cmd;
/**
* @author Peter Dragicevic
*/
class Help implements I_CMD {
/**
* Runs the Command
*
* @param args - Command-Line commands
*/
@Override
public void run(String[] args) {
App.showMessage("Invalid Command \"" + args[1] + "\"!", CMD.STATUS_WARNING);
App.showMessage("");
printHelp();
}
/**
* Prints help for the command
*/
@Override
public void printHelp() {
App.showMessage("Help:");
App.showMessage("");
|
App.showMessage("Usage: java -jar \"" + Config.THIS_JAR_FILE_NAME + "\" [command] [help|args...]");
|
vaadin/designer-tutorials
|
emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MyUI.java
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/DatabaseInitialization.java
// @Stateless
// public class DatabaseInitialization {
//
// @Inject
// private MessageRepository msgRepo;
//
// public void initDatabaseIfEmpty() {
//
// if (!msgRepo.findAll().isEmpty()) {
// return;
// }
//
// createMessage("Marc Englund", "Vaadin Designer 1.0 has arrived",
// LocalDateTime.of(2015, 10, 24, 21, 0),
// "We are thrilled to announce the release of Vaadin Designer 1.0 after 6 months of intensive beta testing. "
// + "Vaadin Designer is available for all developers, to be installed from Eclipse Marketplace today.",
// false, null);
// createMessage("Jurka Rahikkala",
// "10+1 things to know about Vaadin for job seekers",
// LocalDateTime.of(2015, 10, 22, 12, 34),
// "We are constantly seeking highly skilled software experts to join the team. The Vaadin team is constantly working on several projects, "
// + "ranging from our own products (such as Vaadin Framework, Designer and Elements) to several customer projects around the world "
// + "(examples at https://vaadin.com/success-stories). Needless to say, these projects do not get done without the right people.",
// true, null);
// createMessage("Teemu Pöntelin",
// "Building a mobile-first app with Polymer and Vaadin Elements",
// LocalDateTime.of(2015, 10, 19, 18, 20),
// "As you might have noticed, we at Vaadin have been experimenting with bringing our Grid and Charts components to a new audience by wrapping "
// + "them into Polymer elements. Polymer is Google’s project to bring Web Components into developers’ hands and into production.",
// true, Flag.FLAG_STAR);
// createMessage("Tanja Repo", "Come and meet us at JavaOne 2015",
// LocalDateTime.of(2015, 10, 13, 17, 50),
// "Once again Vaadin packs up for the upcoming JavaOne 2015 and heads to San Francisco, US. JavaOne is ‘the event’ for Java enthusiasts, "
// + "where one can hear the best speakers, get insights into the future of Java, and connect with other members of the Java community.",
// false, Flag.FLAG_STAR);
// }
//
// private Message createMessage(String sender, String subject,
// LocalDateTime dateTime, String body, boolean isRead, Flag flag) {
// Message msg = new Message();
// msg.setSender(sender);
// msg.setSubject(subject);
// msg.setSent(Date.from(dateTime.toInstant(ZoneOffset.UTC)));
// msg.setBody(body);
// msg.setRead(isRead);
// msg.setFlag(flag);
// msg.setTrashed(false);
// msgRepo.saveAndFlush(msg);
// return msg;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
|
import javax.inject.Inject;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.vaadin.example.backend.DatabaseInitialization;
import org.vaadin.example.backend.MessageFacade;
import com.vaadin.annotations.Theme;
import com.vaadin.cdi.CDIUI;
import com.vaadin.cdi.CDIViewProvider;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.UI;
|
package org.vaadin.example.ui;
/**
* UI class using Vaadin CDI addon annotation CDIUI, which makes it a managed
* bean and allows to inject dependencies to it.
*/
@Theme("mytheme")
@CDIUI("")
public class MyUI extends UI {
// CDIViewProvider implements com.vaadin.navigator.ViewProvider and
// understands container managed views.
@Inject
private CDIViewProvider viewProvider;
@Inject
private MainLayout mainLayout;
@Override
protected void init(VaadinRequest vaadinRequest) {
setContent(mainLayout);
Navigator navigator = new Navigator(this, mainLayout.messagePanel);
navigator.addProvider(viewProvider);
setNavigator(navigator);
navigator.addViewChangeListener(new ViewChangeListener() {
@Override
public boolean beforeViewChange(ViewChangeEvent event) {
return true;
}
@Override
public void afterViewChange(ViewChangeEvent event) {
String folder = event.getParameters();
mainLayout.setSelectedFolder(folder);
}
});
if (navigator.getState().isEmpty()) {
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/DatabaseInitialization.java
// @Stateless
// public class DatabaseInitialization {
//
// @Inject
// private MessageRepository msgRepo;
//
// public void initDatabaseIfEmpty() {
//
// if (!msgRepo.findAll().isEmpty()) {
// return;
// }
//
// createMessage("Marc Englund", "Vaadin Designer 1.0 has arrived",
// LocalDateTime.of(2015, 10, 24, 21, 0),
// "We are thrilled to announce the release of Vaadin Designer 1.0 after 6 months of intensive beta testing. "
// + "Vaadin Designer is available for all developers, to be installed from Eclipse Marketplace today.",
// false, null);
// createMessage("Jurka Rahikkala",
// "10+1 things to know about Vaadin for job seekers",
// LocalDateTime.of(2015, 10, 22, 12, 34),
// "We are constantly seeking highly skilled software experts to join the team. The Vaadin team is constantly working on several projects, "
// + "ranging from our own products (such as Vaadin Framework, Designer and Elements) to several customer projects around the world "
// + "(examples at https://vaadin.com/success-stories). Needless to say, these projects do not get done without the right people.",
// true, null);
// createMessage("Teemu Pöntelin",
// "Building a mobile-first app with Polymer and Vaadin Elements",
// LocalDateTime.of(2015, 10, 19, 18, 20),
// "As you might have noticed, we at Vaadin have been experimenting with bringing our Grid and Charts components to a new audience by wrapping "
// + "them into Polymer elements. Polymer is Google’s project to bring Web Components into developers’ hands and into production.",
// true, Flag.FLAG_STAR);
// createMessage("Tanja Repo", "Come and meet us at JavaOne 2015",
// LocalDateTime.of(2015, 10, 13, 17, 50),
// "Once again Vaadin packs up for the upcoming JavaOne 2015 and heads to San Francisco, US. JavaOne is ‘the event’ for Java enthusiasts, "
// + "where one can hear the best speakers, get insights into the future of Java, and connect with other members of the Java community.",
// false, Flag.FLAG_STAR);
// }
//
// private Message createMessage(String sender, String subject,
// LocalDateTime dateTime, String body, boolean isRead, Flag flag) {
// Message msg = new Message();
// msg.setSender(sender);
// msg.setSubject(subject);
// msg.setSent(Date.from(dateTime.toInstant(ZoneOffset.UTC)));
// msg.setBody(body);
// msg.setRead(isRead);
// msg.setFlag(flag);
// msg.setTrashed(false);
// msgRepo.saveAndFlush(msg);
// return msg;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MyUI.java
import javax.inject.Inject;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.vaadin.example.backend.DatabaseInitialization;
import org.vaadin.example.backend.MessageFacade;
import com.vaadin.annotations.Theme;
import com.vaadin.cdi.CDIUI;
import com.vaadin.cdi.CDIViewProvider;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.UI;
package org.vaadin.example.ui;
/**
* UI class using Vaadin CDI addon annotation CDIUI, which makes it a managed
* bean and allows to inject dependencies to it.
*/
@Theme("mytheme")
@CDIUI("")
public class MyUI extends UI {
// CDIViewProvider implements com.vaadin.navigator.ViewProvider and
// understands container managed views.
@Inject
private CDIViewProvider viewProvider;
@Inject
private MainLayout mainLayout;
@Override
protected void init(VaadinRequest vaadinRequest) {
setContent(mainLayout);
Navigator navigator = new Navigator(this, mainLayout.messagePanel);
navigator.addProvider(viewProvider);
setNavigator(navigator);
navigator.addViewChangeListener(new ViewChangeListener() {
@Override
public boolean beforeViewChange(ViewChangeEvent event) {
return true;
}
@Override
public void afterViewChange(ViewChangeEvent event) {
String folder = event.getParameters();
mainLayout.setSelectedFolder(folder);
}
});
if (navigator.getState().isEmpty()) {
|
mainLayout.navigateToFolder(MessageFacade.FOLDER_INBOX);
|
vaadin/designer-tutorials
|
emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MyUI.java
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/DatabaseInitialization.java
// @Stateless
// public class DatabaseInitialization {
//
// @Inject
// private MessageRepository msgRepo;
//
// public void initDatabaseIfEmpty() {
//
// if (!msgRepo.findAll().isEmpty()) {
// return;
// }
//
// createMessage("Marc Englund", "Vaadin Designer 1.0 has arrived",
// LocalDateTime.of(2015, 10, 24, 21, 0),
// "We are thrilled to announce the release of Vaadin Designer 1.0 after 6 months of intensive beta testing. "
// + "Vaadin Designer is available for all developers, to be installed from Eclipse Marketplace today.",
// false, null);
// createMessage("Jurka Rahikkala",
// "10+1 things to know about Vaadin for job seekers",
// LocalDateTime.of(2015, 10, 22, 12, 34),
// "We are constantly seeking highly skilled software experts to join the team. The Vaadin team is constantly working on several projects, "
// + "ranging from our own products (such as Vaadin Framework, Designer and Elements) to several customer projects around the world "
// + "(examples at https://vaadin.com/success-stories). Needless to say, these projects do not get done without the right people.",
// true, null);
// createMessage("Teemu Pöntelin",
// "Building a mobile-first app with Polymer and Vaadin Elements",
// LocalDateTime.of(2015, 10, 19, 18, 20),
// "As you might have noticed, we at Vaadin have been experimenting with bringing our Grid and Charts components to a new audience by wrapping "
// + "them into Polymer elements. Polymer is Google’s project to bring Web Components into developers’ hands and into production.",
// true, Flag.FLAG_STAR);
// createMessage("Tanja Repo", "Come and meet us at JavaOne 2015",
// LocalDateTime.of(2015, 10, 13, 17, 50),
// "Once again Vaadin packs up for the upcoming JavaOne 2015 and heads to San Francisco, US. JavaOne is ‘the event’ for Java enthusiasts, "
// + "where one can hear the best speakers, get insights into the future of Java, and connect with other members of the Java community.",
// false, Flag.FLAG_STAR);
// }
//
// private Message createMessage(String sender, String subject,
// LocalDateTime dateTime, String body, boolean isRead, Flag flag) {
// Message msg = new Message();
// msg.setSender(sender);
// msg.setSubject(subject);
// msg.setSent(Date.from(dateTime.toInstant(ZoneOffset.UTC)));
// msg.setBody(body);
// msg.setRead(isRead);
// msg.setFlag(flag);
// msg.setTrashed(false);
// msgRepo.saveAndFlush(msg);
// return msg;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
|
import javax.inject.Inject;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.vaadin.example.backend.DatabaseInitialization;
import org.vaadin.example.backend.MessageFacade;
import com.vaadin.annotations.Theme;
import com.vaadin.cdi.CDIUI;
import com.vaadin.cdi.CDIViewProvider;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.UI;
|
navigator.addProvider(viewProvider);
setNavigator(navigator);
navigator.addViewChangeListener(new ViewChangeListener() {
@Override
public boolean beforeViewChange(ViewChangeEvent event) {
return true;
}
@Override
public void afterViewChange(ViewChangeEvent event) {
String folder = event.getParameters();
mainLayout.setSelectedFolder(folder);
}
});
if (navigator.getState().isEmpty()) {
mainLayout.navigateToFolder(MessageFacade.FOLDER_INBOX);
}
}
// Test data initialization is done in contextInitialized Servlet life-cycle
// event
@WebListener
private static class MyUIServlectContextListener
implements ServletContextListener {
@Inject
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/DatabaseInitialization.java
// @Stateless
// public class DatabaseInitialization {
//
// @Inject
// private MessageRepository msgRepo;
//
// public void initDatabaseIfEmpty() {
//
// if (!msgRepo.findAll().isEmpty()) {
// return;
// }
//
// createMessage("Marc Englund", "Vaadin Designer 1.0 has arrived",
// LocalDateTime.of(2015, 10, 24, 21, 0),
// "We are thrilled to announce the release of Vaadin Designer 1.0 after 6 months of intensive beta testing. "
// + "Vaadin Designer is available for all developers, to be installed from Eclipse Marketplace today.",
// false, null);
// createMessage("Jurka Rahikkala",
// "10+1 things to know about Vaadin for job seekers",
// LocalDateTime.of(2015, 10, 22, 12, 34),
// "We are constantly seeking highly skilled software experts to join the team. The Vaadin team is constantly working on several projects, "
// + "ranging from our own products (such as Vaadin Framework, Designer and Elements) to several customer projects around the world "
// + "(examples at https://vaadin.com/success-stories). Needless to say, these projects do not get done without the right people.",
// true, null);
// createMessage("Teemu Pöntelin",
// "Building a mobile-first app with Polymer and Vaadin Elements",
// LocalDateTime.of(2015, 10, 19, 18, 20),
// "As you might have noticed, we at Vaadin have been experimenting with bringing our Grid and Charts components to a new audience by wrapping "
// + "them into Polymer elements. Polymer is Google’s project to bring Web Components into developers’ hands and into production.",
// true, Flag.FLAG_STAR);
// createMessage("Tanja Repo", "Come and meet us at JavaOne 2015",
// LocalDateTime.of(2015, 10, 13, 17, 50),
// "Once again Vaadin packs up for the upcoming JavaOne 2015 and heads to San Francisco, US. JavaOne is ‘the event’ for Java enthusiasts, "
// + "where one can hear the best speakers, get insights into the future of Java, and connect with other members of the Java community.",
// false, Flag.FLAG_STAR);
// }
//
// private Message createMessage(String sender, String subject,
// LocalDateTime dateTime, String body, boolean isRead, Flag flag) {
// Message msg = new Message();
// msg.setSender(sender);
// msg.setSubject(subject);
// msg.setSent(Date.from(dateTime.toInstant(ZoneOffset.UTC)));
// msg.setBody(body);
// msg.setRead(isRead);
// msg.setFlag(flag);
// msg.setTrashed(false);
// msgRepo.saveAndFlush(msg);
// return msg;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MyUI.java
import javax.inject.Inject;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.vaadin.example.backend.DatabaseInitialization;
import org.vaadin.example.backend.MessageFacade;
import com.vaadin.annotations.Theme;
import com.vaadin.cdi.CDIUI;
import com.vaadin.cdi.CDIViewProvider;
import com.vaadin.navigator.Navigator;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.UI;
navigator.addProvider(viewProvider);
setNavigator(navigator);
navigator.addViewChangeListener(new ViewChangeListener() {
@Override
public boolean beforeViewChange(ViewChangeEvent event) {
return true;
}
@Override
public void afterViewChange(ViewChangeEvent event) {
String folder = event.getParameters();
mainLayout.setSelectedFolder(folder);
}
});
if (navigator.getState().isEmpty()) {
mainLayout.navigateToFolder(MessageFacade.FOLDER_INBOX);
}
}
// Test data initialization is done in contextInitialized Servlet life-cycle
// event
@WebListener
private static class MyUIServlectContextListener
implements ServletContextListener {
@Inject
|
private DatabaseInitialization init;
|
vaadin/designer-tutorials
|
emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/FolderView.java
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// @Entity
// public class Message extends AbstractEntity {
//
// private boolean read;
// private boolean trashed;
// private String sender;
// @Enumerated(EnumType.STRING)
// private Flag flag;
//
// public enum Flag {
// FLAG_STAR
// }
//
// @Temporal(TemporalType.TIMESTAMP)
// private Date sent;
// private String subject;
//
// @Lob
// private String body;
//
// public boolean isRead() {
// return read;
// }
//
// public void setRead(boolean read) {
// this.read = read;
// }
//
// public boolean isTrashed() {
// return trashed;
// }
//
// public void setTrashed(boolean trashed) {
// this.trashed = trashed;
// }
//
// public Flag getFlag() {
// return flag;
// }
//
// public void setFlag(Flag flag) {
// this.flag = flag;
// }
//
// public String getSender() {
// return sender;
// }
//
// public void setSender(String sender) {
// this.sender = sender;
// }
//
// public Date getSent() {
// return sent;
// }
//
// public void setSent(Date sent) {
// this.sent = sent;
// }
//
// public String getSubject() {
// return subject;
// }
//
// public void setSubject(String subject) {
// this.subject = subject;
// }
//
// public String getBody() {
// return body;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
|
import javax.inject.Inject;
import org.vaadin.example.backend.Message;
import org.vaadin.example.backend.MessageFacade;
import com.vaadin.cdi.CDIView;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.VerticalLayout;
|
package org.vaadin.example.ui;
/**
* View listing messages fetched through MessageFacade. Also handles message
* clicks to mark them as read.
*
*/
@CDIView(supportsParameters = true, value = FolderView.VIEW_NAME)
public class FolderView extends VerticalLayout implements View {
public static final String VIEW_NAME = "folder";
@Inject
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// @Entity
// public class Message extends AbstractEntity {
//
// private boolean read;
// private boolean trashed;
// private String sender;
// @Enumerated(EnumType.STRING)
// private Flag flag;
//
// public enum Flag {
// FLAG_STAR
// }
//
// @Temporal(TemporalType.TIMESTAMP)
// private Date sent;
// private String subject;
//
// @Lob
// private String body;
//
// public boolean isRead() {
// return read;
// }
//
// public void setRead(boolean read) {
// this.read = read;
// }
//
// public boolean isTrashed() {
// return trashed;
// }
//
// public void setTrashed(boolean trashed) {
// this.trashed = trashed;
// }
//
// public Flag getFlag() {
// return flag;
// }
//
// public void setFlag(Flag flag) {
// this.flag = flag;
// }
//
// public String getSender() {
// return sender;
// }
//
// public void setSender(String sender) {
// this.sender = sender;
// }
//
// public Date getSent() {
// return sent;
// }
//
// public void setSent(Date sent) {
// this.sent = sent;
// }
//
// public String getSubject() {
// return subject;
// }
//
// public void setSubject(String subject) {
// this.subject = subject;
// }
//
// public String getBody() {
// return body;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/FolderView.java
import javax.inject.Inject;
import org.vaadin.example.backend.Message;
import org.vaadin.example.backend.MessageFacade;
import com.vaadin.cdi.CDIView;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.VerticalLayout;
package org.vaadin.example.ui;
/**
* View listing messages fetched through MessageFacade. Also handles message
* clicks to mark them as read.
*
*/
@CDIView(supportsParameters = true, value = FolderView.VIEW_NAME)
public class FolderView extends VerticalLayout implements View {
public static final String VIEW_NAME = "folder";
@Inject
|
private MessageFacade messageFacade;
|
vaadin/designer-tutorials
|
emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/FolderView.java
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// @Entity
// public class Message extends AbstractEntity {
//
// private boolean read;
// private boolean trashed;
// private String sender;
// @Enumerated(EnumType.STRING)
// private Flag flag;
//
// public enum Flag {
// FLAG_STAR
// }
//
// @Temporal(TemporalType.TIMESTAMP)
// private Date sent;
// private String subject;
//
// @Lob
// private String body;
//
// public boolean isRead() {
// return read;
// }
//
// public void setRead(boolean read) {
// this.read = read;
// }
//
// public boolean isTrashed() {
// return trashed;
// }
//
// public void setTrashed(boolean trashed) {
// this.trashed = trashed;
// }
//
// public Flag getFlag() {
// return flag;
// }
//
// public void setFlag(Flag flag) {
// this.flag = flag;
// }
//
// public String getSender() {
// return sender;
// }
//
// public void setSender(String sender) {
// this.sender = sender;
// }
//
// public Date getSent() {
// return sent;
// }
//
// public void setSent(Date sent) {
// this.sent = sent;
// }
//
// public String getSubject() {
// return subject;
// }
//
// public void setSubject(String subject) {
// this.subject = subject;
// }
//
// public String getBody() {
// return body;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
|
import javax.inject.Inject;
import org.vaadin.example.backend.Message;
import org.vaadin.example.backend.MessageFacade;
import com.vaadin.cdi.CDIView;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.VerticalLayout;
|
package org.vaadin.example.ui;
/**
* View listing messages fetched through MessageFacade. Also handles message
* clicks to mark them as read.
*
*/
@CDIView(supportsParameters = true, value = FolderView.VIEW_NAME)
public class FolderView extends VerticalLayout implements View {
public static final String VIEW_NAME = "folder";
@Inject
private MessageFacade messageFacade;
@Inject
javax.enterprise.event.Event<MessageModifiedEvent> messageSelectEvent;
@Override
public void enter(ViewChangeEvent event) {
String folder = event.getParameters();
refreshFolder(folder);
}
private void refreshFolder(String folder) {
removeAllComponents();
messageFacade.getFolderMessages(folder).stream()
.map(this::createFromEntity).forEach(this::addComponent);
}
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// @Entity
// public class Message extends AbstractEntity {
//
// private boolean read;
// private boolean trashed;
// private String sender;
// @Enumerated(EnumType.STRING)
// private Flag flag;
//
// public enum Flag {
// FLAG_STAR
// }
//
// @Temporal(TemporalType.TIMESTAMP)
// private Date sent;
// private String subject;
//
// @Lob
// private String body;
//
// public boolean isRead() {
// return read;
// }
//
// public void setRead(boolean read) {
// this.read = read;
// }
//
// public boolean isTrashed() {
// return trashed;
// }
//
// public void setTrashed(boolean trashed) {
// this.trashed = trashed;
// }
//
// public Flag getFlag() {
// return flag;
// }
//
// public void setFlag(Flag flag) {
// this.flag = flag;
// }
//
// public String getSender() {
// return sender;
// }
//
// public void setSender(String sender) {
// this.sender = sender;
// }
//
// public Date getSent() {
// return sent;
// }
//
// public void setSent(Date sent) {
// this.sent = sent;
// }
//
// public String getSubject() {
// return subject;
// }
//
// public void setSubject(String subject) {
// this.subject = subject;
// }
//
// public String getBody() {
// return body;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/FolderView.java
import javax.inject.Inject;
import org.vaadin.example.backend.Message;
import org.vaadin.example.backend.MessageFacade;
import com.vaadin.cdi.CDIView;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.VerticalLayout;
package org.vaadin.example.ui;
/**
* View listing messages fetched through MessageFacade. Also handles message
* clicks to mark them as read.
*
*/
@CDIView(supportsParameters = true, value = FolderView.VIEW_NAME)
public class FolderView extends VerticalLayout implements View {
public static final String VIEW_NAME = "folder";
@Inject
private MessageFacade messageFacade;
@Inject
javax.enterprise.event.Event<MessageModifiedEvent> messageSelectEvent;
@Override
public void enter(ViewChangeEvent event) {
String folder = event.getParameters();
refreshFolder(folder);
}
private void refreshFolder(String folder) {
removeAllComponents();
messageFacade.getFolderMessages(folder).stream()
.map(this::createFromEntity).forEach(this::addComponent);
}
|
private MessageComponent createFromEntity(Message entity) {
|
vaadin/designer-tutorials
|
emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/DatabaseInitialization.java
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// public enum Flag {
// FLAG_STAR
// }
|
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;
import javax.ejb.Stateless;
import javax.inject.Inject;
import org.vaadin.example.backend.Message.Flag;
|
package org.vaadin.example.backend;
@Stateless
public class DatabaseInitialization {
@Inject
private MessageRepository msgRepo;
public void initDatabaseIfEmpty() {
if (!msgRepo.findAll().isEmpty()) {
return;
}
createMessage("Marc Englund", "Vaadin Designer 1.0 has arrived",
LocalDateTime.of(2015, 10, 24, 21, 0),
"We are thrilled to announce the release of Vaadin Designer 1.0 after 6 months of intensive beta testing. "
+ "Vaadin Designer is available for all developers, to be installed from Eclipse Marketplace today.",
false, null);
createMessage("Jurka Rahikkala",
"10+1 things to know about Vaadin for job seekers",
LocalDateTime.of(2015, 10, 22, 12, 34),
"We are constantly seeking highly skilled software experts to join the team. The Vaadin team is constantly working on several projects, "
+ "ranging from our own products (such as Vaadin Framework, Designer and Elements) to several customer projects around the world "
+ "(examples at https://vaadin.com/success-stories). Needless to say, these projects do not get done without the right people.",
true, null);
createMessage("Teemu Pöntelin",
"Building a mobile-first app with Polymer and Vaadin Elements",
LocalDateTime.of(2015, 10, 19, 18, 20),
"As you might have noticed, we at Vaadin have been experimenting with bringing our Grid and Charts components to a new audience by wrapping "
+ "them into Polymer elements. Polymer is Google’s project to bring Web Components into developers’ hands and into production.",
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// public enum Flag {
// FLAG_STAR
// }
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/DatabaseInitialization.java
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;
import javax.ejb.Stateless;
import javax.inject.Inject;
import org.vaadin.example.backend.Message.Flag;
package org.vaadin.example.backend;
@Stateless
public class DatabaseInitialization {
@Inject
private MessageRepository msgRepo;
public void initDatabaseIfEmpty() {
if (!msgRepo.findAll().isEmpty()) {
return;
}
createMessage("Marc Englund", "Vaadin Designer 1.0 has arrived",
LocalDateTime.of(2015, 10, 24, 21, 0),
"We are thrilled to announce the release of Vaadin Designer 1.0 after 6 months of intensive beta testing. "
+ "Vaadin Designer is available for all developers, to be installed from Eclipse Marketplace today.",
false, null);
createMessage("Jurka Rahikkala",
"10+1 things to know about Vaadin for job seekers",
LocalDateTime.of(2015, 10, 22, 12, 34),
"We are constantly seeking highly skilled software experts to join the team. The Vaadin team is constantly working on several projects, "
+ "ranging from our own products (such as Vaadin Framework, Designer and Elements) to several customer projects around the world "
+ "(examples at https://vaadin.com/success-stories). Needless to say, these projects do not get done without the right people.",
true, null);
createMessage("Teemu Pöntelin",
"Building a mobile-first app with Polymer and Vaadin Elements",
LocalDateTime.of(2015, 10, 19, 18, 20),
"As you might have noticed, we at Vaadin have been experimenting with bringing our Grid and Charts components to a new audience by wrapping "
+ "them into Polymer elements. Polymer is Google’s project to bring Web Components into developers’ hands and into production.",
|
true, Flag.FLAG_STAR);
|
vaadin/designer-tutorials
|
emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MainLayout.java
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/themes/mytheme/MyTheme.java
// public class MyTheme {
// public static final String INDICATOR_STAR_RED = "indicator-star-red";
// public static final String INDICATOR_CIRCLE = "indicator-circle";
// public static final String SELECTED = "selected";
//
// public static final List<String> MESSAGE_STYLES = Collections
// .unmodifiableList(Arrays.asList(MyTheme.INDICATOR_CIRCLE,
// MyTheme.INDICATOR_STAR_RED));
// }
|
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
import javax.annotation.PostConstruct;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import org.vaadin.example.backend.MessageFacade;
import org.vaadin.example.ui.themes.mytheme.MyTheme;
import com.vaadin.cdi.UIScoped;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.UI;
|
package org.vaadin.example.ui;
/**
*
* Handles the left-side menu and the top toolbar
*/
@UIScoped
public class MainLayout extends MainLayoutDesign {
@Inject
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/themes/mytheme/MyTheme.java
// public class MyTheme {
// public static final String INDICATOR_STAR_RED = "indicator-star-red";
// public static final String INDICATOR_CIRCLE = "indicator-circle";
// public static final String SELECTED = "selected";
//
// public static final List<String> MESSAGE_STYLES = Collections
// .unmodifiableList(Arrays.asList(MyTheme.INDICATOR_CIRCLE,
// MyTheme.INDICATOR_STAR_RED));
// }
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MainLayout.java
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
import javax.annotation.PostConstruct;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import org.vaadin.example.backend.MessageFacade;
import org.vaadin.example.ui.themes.mytheme.MyTheme;
import com.vaadin.cdi.UIScoped;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.UI;
package org.vaadin.example.ui;
/**
*
* Handles the left-side menu and the top toolbar
*/
@UIScoped
public class MainLayout extends MainLayoutDesign {
@Inject
|
private MessageFacade messageFacade;
|
vaadin/designer-tutorials
|
emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MainLayout.java
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/themes/mytheme/MyTheme.java
// public class MyTheme {
// public static final String INDICATOR_STAR_RED = "indicator-star-red";
// public static final String INDICATOR_CIRCLE = "indicator-circle";
// public static final String SELECTED = "selected";
//
// public static final List<String> MESSAGE_STYLES = Collections
// .unmodifiableList(Arrays.asList(MyTheme.INDICATOR_CIRCLE,
// MyTheme.INDICATOR_STAR_RED));
// }
|
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
import javax.annotation.PostConstruct;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import org.vaadin.example.backend.MessageFacade;
import org.vaadin.example.ui.themes.mytheme.MyTheme;
import com.vaadin.cdi.UIScoped;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.UI;
|
} else {
component.setCaption(
String.format(captionFormat, folder, badgeText));
}
}
}
}
// Map button click to a navigation method.
// Map button to a folder name to allow setting selected style when folder
// is navigated without clicking the button.
// Map button to a Supplier method, that provides count for unread items
private void mapButton(Button button, String folderName,
Optional<Supplier<Long>> badgeSupplier) {
button.addClickListener(event -> navigateToFolder(folderName));
button.setData(folderName);
if (badgeSupplier.isPresent()) {
badgeSuppliers.put(folderName, badgeSupplier.get());
}
}
private void mapButton(Button button, String folderName) {
mapButton(button, folderName, Optional.empty());
}
// Checks if a given Component has a given folder name as data, and adds or
// removes selected style appropriately
private void adjustStyleByData(Component component, Object data) {
if (component instanceof Button) {
if (data != null && data.equals(((Button) component).getData())) {
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/MessageFacade.java
// @Stateless
// public class MessageFacade {
//
// public static final String FOLDER_INBOX = "inbox";
// public static final String FOLDER_DRAFTS = "drafts";
// public static final String FOLDER_SENT = "sent";
// public static final String FOLDER_JUNK = "junk";
// public static final String FOLDER_TRASH = "trash";
// public static final String FOLDER_FLAGGED = "flagged";
// public static final List<String> FOLDERS = Arrays.asList(FOLDER_INBOX,
// FOLDER_DRAFTS, FOLDER_SENT, FOLDER_JUNK, FOLDER_TRASH,
// FOLDER_FLAGGED);
//
// @Inject
// private MessageRepository repository;
//
// public List<Message> getFolderMessages(String folder) {
// if (FOLDERS.contains(folder)) {
// if (folder.equals(FOLDER_INBOX)) {
// return repository.findAll();
// } else if (folder.equals(FOLDER_FLAGGED)) {
// return repository.findByFlagIsNotNullAndTrashed(false);
// }
// }
// return new ArrayList<>();
// }
//
// public long countAllUnread() {
// return repository.findByRead(false).count();
//
// }
//
// public long countFlaggedUnread() {
// return repository.findByFlagIsNotNullAndRead(false).count();
// }
//
// public void save(Message message) {
// repository.saveAndFlush(message);
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/themes/mytheme/MyTheme.java
// public class MyTheme {
// public static final String INDICATOR_STAR_RED = "indicator-star-red";
// public static final String INDICATOR_CIRCLE = "indicator-circle";
// public static final String SELECTED = "selected";
//
// public static final List<String> MESSAGE_STYLES = Collections
// .unmodifiableList(Arrays.asList(MyTheme.INDICATOR_CIRCLE,
// MyTheme.INDICATOR_STAR_RED));
// }
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MainLayout.java
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;
import javax.annotation.PostConstruct;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import org.vaadin.example.backend.MessageFacade;
import org.vaadin.example.ui.themes.mytheme.MyTheme;
import com.vaadin.cdi.UIScoped;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.UI;
} else {
component.setCaption(
String.format(captionFormat, folder, badgeText));
}
}
}
}
// Map button click to a navigation method.
// Map button to a folder name to allow setting selected style when folder
// is navigated without clicking the button.
// Map button to a Supplier method, that provides count for unread items
private void mapButton(Button button, String folderName,
Optional<Supplier<Long>> badgeSupplier) {
button.addClickListener(event -> navigateToFolder(folderName));
button.setData(folderName);
if (badgeSupplier.isPresent()) {
badgeSuppliers.put(folderName, badgeSupplier.get());
}
}
private void mapButton(Button button, String folderName) {
mapButton(button, folderName, Optional.empty());
}
// Checks if a given Component has a given folder name as data, and adds or
// removes selected style appropriately
private void adjustStyleByData(Component component, Object data) {
if (component instanceof Button) {
if (data != null && data.equals(((Button) component).getData())) {
|
component.addStyleName(MyTheme.SELECTED);
|
vaadin/designer-tutorials
|
emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MessageComponent.java
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// @Entity
// public class Message extends AbstractEntity {
//
// private boolean read;
// private boolean trashed;
// private String sender;
// @Enumerated(EnumType.STRING)
// private Flag flag;
//
// public enum Flag {
// FLAG_STAR
// }
//
// @Temporal(TemporalType.TIMESTAMP)
// private Date sent;
// private String subject;
//
// @Lob
// private String body;
//
// public boolean isRead() {
// return read;
// }
//
// public void setRead(boolean read) {
// this.read = read;
// }
//
// public boolean isTrashed() {
// return trashed;
// }
//
// public void setTrashed(boolean trashed) {
// this.trashed = trashed;
// }
//
// public Flag getFlag() {
// return flag;
// }
//
// public void setFlag(Flag flag) {
// this.flag = flag;
// }
//
// public String getSender() {
// return sender;
// }
//
// public void setSender(String sender) {
// this.sender = sender;
// }
//
// public Date getSent() {
// return sent;
// }
//
// public void setSent(Date sent) {
// this.sent = sent;
// }
//
// public String getSubject() {
// return subject;
// }
//
// public void setSubject(String subject) {
// this.subject = subject;
// }
//
// public String getBody() {
// return body;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// public enum Flag {
// FLAG_STAR
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/themes/mytheme/MyTheme.java
// public class MyTheme {
// public static final String INDICATOR_STAR_RED = "indicator-star-red";
// public static final String INDICATOR_CIRCLE = "indicator-circle";
// public static final String SELECTED = "selected";
//
// public static final List<String> MESSAGE_STYLES = Collections
// .unmodifiableList(Arrays.asList(MyTheme.INDICATOR_CIRCLE,
// MyTheme.INDICATOR_STAR_RED));
// }
|
import org.vaadin.example.backend.Message;
import org.vaadin.example.backend.Message.Flag;
import org.vaadin.example.ui.themes.mytheme.MyTheme;
import com.vaadin.server.FontAwesome;
|
package org.vaadin.example.ui;
/**
* This is the place to implement component logic for MessageDesign. The super
* class should not be edited, because Vaadin Designer overwrites it.
*
*/
public class MessageComponent extends MessageDesign {
public MessageComponent(Message message,
MessageClickListener clickListener) {
senderLabel.setValue(message.getSender());
messageLabel.setCaption(message.getSubject());
messageLabel.setValue(message.getBody());
addLayoutClickListener(
event -> clickListener.messageClick(this, message));
setIndicator(message.isRead(), message.getFlag());
}
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// @Entity
// public class Message extends AbstractEntity {
//
// private boolean read;
// private boolean trashed;
// private String sender;
// @Enumerated(EnumType.STRING)
// private Flag flag;
//
// public enum Flag {
// FLAG_STAR
// }
//
// @Temporal(TemporalType.TIMESTAMP)
// private Date sent;
// private String subject;
//
// @Lob
// private String body;
//
// public boolean isRead() {
// return read;
// }
//
// public void setRead(boolean read) {
// this.read = read;
// }
//
// public boolean isTrashed() {
// return trashed;
// }
//
// public void setTrashed(boolean trashed) {
// this.trashed = trashed;
// }
//
// public Flag getFlag() {
// return flag;
// }
//
// public void setFlag(Flag flag) {
// this.flag = flag;
// }
//
// public String getSender() {
// return sender;
// }
//
// public void setSender(String sender) {
// this.sender = sender;
// }
//
// public Date getSent() {
// return sent;
// }
//
// public void setSent(Date sent) {
// this.sent = sent;
// }
//
// public String getSubject() {
// return subject;
// }
//
// public void setSubject(String subject) {
// this.subject = subject;
// }
//
// public String getBody() {
// return body;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// public enum Flag {
// FLAG_STAR
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/themes/mytheme/MyTheme.java
// public class MyTheme {
// public static final String INDICATOR_STAR_RED = "indicator-star-red";
// public static final String INDICATOR_CIRCLE = "indicator-circle";
// public static final String SELECTED = "selected";
//
// public static final List<String> MESSAGE_STYLES = Collections
// .unmodifiableList(Arrays.asList(MyTheme.INDICATOR_CIRCLE,
// MyTheme.INDICATOR_STAR_RED));
// }
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MessageComponent.java
import org.vaadin.example.backend.Message;
import org.vaadin.example.backend.Message.Flag;
import org.vaadin.example.ui.themes.mytheme.MyTheme;
import com.vaadin.server.FontAwesome;
package org.vaadin.example.ui;
/**
* This is the place to implement component logic for MessageDesign. The super
* class should not be edited, because Vaadin Designer overwrites it.
*
*/
public class MessageComponent extends MessageDesign {
public MessageComponent(Message message,
MessageClickListener clickListener) {
senderLabel.setValue(message.getSender());
messageLabel.setCaption(message.getSubject());
messageLabel.setValue(message.getBody());
addLayoutClickListener(
event -> clickListener.messageClick(this, message));
setIndicator(message.isRead(), message.getFlag());
}
|
public void setIndicator(boolean read, Flag flag) {
|
vaadin/designer-tutorials
|
emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MessageComponent.java
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// @Entity
// public class Message extends AbstractEntity {
//
// private boolean read;
// private boolean trashed;
// private String sender;
// @Enumerated(EnumType.STRING)
// private Flag flag;
//
// public enum Flag {
// FLAG_STAR
// }
//
// @Temporal(TemporalType.TIMESTAMP)
// private Date sent;
// private String subject;
//
// @Lob
// private String body;
//
// public boolean isRead() {
// return read;
// }
//
// public void setRead(boolean read) {
// this.read = read;
// }
//
// public boolean isTrashed() {
// return trashed;
// }
//
// public void setTrashed(boolean trashed) {
// this.trashed = trashed;
// }
//
// public Flag getFlag() {
// return flag;
// }
//
// public void setFlag(Flag flag) {
// this.flag = flag;
// }
//
// public String getSender() {
// return sender;
// }
//
// public void setSender(String sender) {
// this.sender = sender;
// }
//
// public Date getSent() {
// return sent;
// }
//
// public void setSent(Date sent) {
// this.sent = sent;
// }
//
// public String getSubject() {
// return subject;
// }
//
// public void setSubject(String subject) {
// this.subject = subject;
// }
//
// public String getBody() {
// return body;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// public enum Flag {
// FLAG_STAR
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/themes/mytheme/MyTheme.java
// public class MyTheme {
// public static final String INDICATOR_STAR_RED = "indicator-star-red";
// public static final String INDICATOR_CIRCLE = "indicator-circle";
// public static final String SELECTED = "selected";
//
// public static final List<String> MESSAGE_STYLES = Collections
// .unmodifiableList(Arrays.asList(MyTheme.INDICATOR_CIRCLE,
// MyTheme.INDICATOR_STAR_RED));
// }
|
import org.vaadin.example.backend.Message;
import org.vaadin.example.backend.Message.Flag;
import org.vaadin.example.ui.themes.mytheme.MyTheme;
import com.vaadin.server.FontAwesome;
|
package org.vaadin.example.ui;
/**
* This is the place to implement component logic for MessageDesign. The super
* class should not be edited, because Vaadin Designer overwrites it.
*
*/
public class MessageComponent extends MessageDesign {
public MessageComponent(Message message,
MessageClickListener clickListener) {
senderLabel.setValue(message.getSender());
messageLabel.setCaption(message.getSubject());
messageLabel.setValue(message.getBody());
addLayoutClickListener(
event -> clickListener.messageClick(this, message));
setIndicator(message.isRead(), message.getFlag());
}
public void setIndicator(boolean read, Flag flag) {
|
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// @Entity
// public class Message extends AbstractEntity {
//
// private boolean read;
// private boolean trashed;
// private String sender;
// @Enumerated(EnumType.STRING)
// private Flag flag;
//
// public enum Flag {
// FLAG_STAR
// }
//
// @Temporal(TemporalType.TIMESTAMP)
// private Date sent;
// private String subject;
//
// @Lob
// private String body;
//
// public boolean isRead() {
// return read;
// }
//
// public void setRead(boolean read) {
// this.read = read;
// }
//
// public boolean isTrashed() {
// return trashed;
// }
//
// public void setTrashed(boolean trashed) {
// this.trashed = trashed;
// }
//
// public Flag getFlag() {
// return flag;
// }
//
// public void setFlag(Flag flag) {
// this.flag = flag;
// }
//
// public String getSender() {
// return sender;
// }
//
// public void setSender(String sender) {
// this.sender = sender;
// }
//
// public Date getSent() {
// return sent;
// }
//
// public void setSent(Date sent) {
// this.sent = sent;
// }
//
// public String getSubject() {
// return subject;
// }
//
// public void setSubject(String subject) {
// this.subject = subject;
// }
//
// public String getBody() {
// return body;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/backend/Message.java
// public enum Flag {
// FLAG_STAR
// }
//
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/themes/mytheme/MyTheme.java
// public class MyTheme {
// public static final String INDICATOR_STAR_RED = "indicator-star-red";
// public static final String INDICATOR_CIRCLE = "indicator-circle";
// public static final String SELECTED = "selected";
//
// public static final List<String> MESSAGE_STYLES = Collections
// .unmodifiableList(Arrays.asList(MyTheme.INDICATOR_CIRCLE,
// MyTheme.INDICATOR_STAR_RED));
// }
// Path: emailclient-tutorial-data/src/main/java/org/vaadin/example/ui/MessageComponent.java
import org.vaadin.example.backend.Message;
import org.vaadin.example.backend.Message.Flag;
import org.vaadin.example.ui.themes.mytheme.MyTheme;
import com.vaadin.server.FontAwesome;
package org.vaadin.example.ui;
/**
* This is the place to implement component logic for MessageDesign. The super
* class should not be edited, because Vaadin Designer overwrites it.
*
*/
public class MessageComponent extends MessageDesign {
public MessageComponent(Message message,
MessageClickListener clickListener) {
senderLabel.setValue(message.getSender());
messageLabel.setCaption(message.getSubject());
messageLabel.setValue(message.getBody());
addLayoutClickListener(
event -> clickListener.messageClick(this, message));
setIndicator(message.isRead(), message.getFlag());
}
public void setIndicator(boolean read, Flag flag) {
|
MyTheme.MESSAGE_STYLES.forEach(indicatorButton::removeStyleName);
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/services/StatusScheduleReceiver.java
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
|
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.parallelzero.hancel.Config;
import java.util.Calendar;
|
package org.parallelzero.hancel.services;
public class StatusScheduleReceiver extends BroadcastReceiver {
public static final String TAG = StatusScheduleReceiver.class.getSimpleName();
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
// Path: app/src/main/java/org/parallelzero/hancel/services/StatusScheduleReceiver.java
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.parallelzero.hancel.Config;
import java.util.Calendar;
package org.parallelzero.hancel.services;
public class StatusScheduleReceiver extends BroadcastReceiver {
public static final String TAG = StatusScheduleReceiver.class.getSimpleName();
|
private static final boolean DEBUG = Config.DEBUG;
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/Firebase/FirebaseHandler.java
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/services/TrackLocationService.java
// public class TrackLocationService extends Service implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener{
//
// public static final String TAG = TrackLocationService.class.getSimpleName();
// private static final boolean DEBUG = Config.DEBUG;
// public static final String TRACK_SERVICE_CONNECT = "brodcast_onfirebase_connected";
// public static final String KEY_TRACKID = "key_trackId";
//
//
// private GoogleApiClient mGoogleApiClient;
// private Location location;
// private LocationRequest locationRequest;
// private String trackId;
//
// @Override
// public void onCreate(){
// startLocationService();
// }
//
// @Override
// public int onStartCommand(Intent intent, int flags, int startId){
// if(DEBUG) Log.i(TAG, "=== OnStartCommand ");
// this.trackId = Storage.getTrackId(this);
// sendBroadcast(new Intent(TRACK_SERVICE_CONNECT));
// return Service.START_STICKY;
// }
//
// @Nullable
// @Override
// public IBinder onBind(Intent intent) {
// return null;
//
// }
//
// public void onDestroy(){
// stopLocationService();
// if(DEBUG)Log.i(TAG, "=== onDestroy");
// }
//
//
// public void stopLocationService() {
// if(DEBUG)Log.i(TAG, "=== stopLocationService");
// if (mGoogleApiClient!=null&&mGoogleApiClient.isConnected()) {
// mGoogleApiClient.disconnect();
// }
// }
//
// private void sendDataFrame(Location location) {
// if(DEBUG)Log.i(TAG, "=== Sending Tracking to server");
// Track track = new Track();
// track.lat=location.getLatitude();
// track.lon=location.getLongitude();
// track.acu=location.getAccuracy();
// track.upd=location.getTime();
//
// track.alias=Storage.getCurrentAlias(this);
// track.color=Storage.getCurrentColor(this);
// }
//
// private void setupLocationForMap() {
// long fastUpdate = Config.DEFAULT_INTERVAL_FASTER;
// locationRequest = LocationRequest.create();
// locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
// locationRequest.setInterval(Config.DEFAULT_INTERVAL);
// locationRequest.setFastestInterval(fastUpdate);
// }
//
// private synchronized void startLocationService() {
// if( mGoogleApiClient == null || !mGoogleApiClient.isConnected()) {
// if(DEBUG)Log.i(TAG, "=== Starting LocationServices: NON CONECTED -> CONECTED");
// mGoogleApiClient = new GoogleApiClient.Builder(this)
// .addApi(LocationServices.API)
// .addConnectionCallbacks(this)
// .addOnConnectionFailedListener(this)
// .build();
// mGoogleApiClient.connect();
// }
// else
// if(DEBUG)Log.i(TAG, "=== GPS service started: CONECTED");
// }
//
// @Override
// public void onConnected(Bundle bundle) {
//
// setupLocationForMap();
//
// if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
// startLocationUpdates();
// }
//
// }
//
// protected void startLocationUpdates() {
// LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, locationRequest, this);
// }
//
// @Override
// public void onConnectionSuspended(int i) {
// if(DEBUG)Log.i(TAG, "=== Connection suspended");
// }
//
// @Override
// public void onLocationChanged(Location location) {
// this.location = location;
// if(DEBUG)Log.i(TAG, "=== onLocationChanged: Latitude: " + this.location.getLatitude() + " Longitude: " + this.location.getLongitude());
// sendDataFrame(location);
// }
//
//
// @Override
// public void onConnectionFailed(ConnectionResult connectionResult) {
// if(DEBUG)Log.i(TAG, "=== Connection Fail");
// }
//
//
// }
|
import android.util.Log;
import org.parallelzero.hancel.Config;
import org.parallelzero.hancel.services.TrackLocationService;
|
package org.parallelzero.hancel.Firebase;
/**
* Created by Antonio Vanegas @hpsaturn on 11/2/15.
*/
public class FirebaseHandler {
public static final String TAG = TrackLocationService.class.getSimpleName();
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/services/TrackLocationService.java
// public class TrackLocationService extends Service implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener{
//
// public static final String TAG = TrackLocationService.class.getSimpleName();
// private static final boolean DEBUG = Config.DEBUG;
// public static final String TRACK_SERVICE_CONNECT = "brodcast_onfirebase_connected";
// public static final String KEY_TRACKID = "key_trackId";
//
//
// private GoogleApiClient mGoogleApiClient;
// private Location location;
// private LocationRequest locationRequest;
// private String trackId;
//
// @Override
// public void onCreate(){
// startLocationService();
// }
//
// @Override
// public int onStartCommand(Intent intent, int flags, int startId){
// if(DEBUG) Log.i(TAG, "=== OnStartCommand ");
// this.trackId = Storage.getTrackId(this);
// sendBroadcast(new Intent(TRACK_SERVICE_CONNECT));
// return Service.START_STICKY;
// }
//
// @Nullable
// @Override
// public IBinder onBind(Intent intent) {
// return null;
//
// }
//
// public void onDestroy(){
// stopLocationService();
// if(DEBUG)Log.i(TAG, "=== onDestroy");
// }
//
//
// public void stopLocationService() {
// if(DEBUG)Log.i(TAG, "=== stopLocationService");
// if (mGoogleApiClient!=null&&mGoogleApiClient.isConnected()) {
// mGoogleApiClient.disconnect();
// }
// }
//
// private void sendDataFrame(Location location) {
// if(DEBUG)Log.i(TAG, "=== Sending Tracking to server");
// Track track = new Track();
// track.lat=location.getLatitude();
// track.lon=location.getLongitude();
// track.acu=location.getAccuracy();
// track.upd=location.getTime();
//
// track.alias=Storage.getCurrentAlias(this);
// track.color=Storage.getCurrentColor(this);
// }
//
// private void setupLocationForMap() {
// long fastUpdate = Config.DEFAULT_INTERVAL_FASTER;
// locationRequest = LocationRequest.create();
// locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
// locationRequest.setInterval(Config.DEFAULT_INTERVAL);
// locationRequest.setFastestInterval(fastUpdate);
// }
//
// private synchronized void startLocationService() {
// if( mGoogleApiClient == null || !mGoogleApiClient.isConnected()) {
// if(DEBUG)Log.i(TAG, "=== Starting LocationServices: NON CONECTED -> CONECTED");
// mGoogleApiClient = new GoogleApiClient.Builder(this)
// .addApi(LocationServices.API)
// .addConnectionCallbacks(this)
// .addOnConnectionFailedListener(this)
// .build();
// mGoogleApiClient.connect();
// }
// else
// if(DEBUG)Log.i(TAG, "=== GPS service started: CONECTED");
// }
//
// @Override
// public void onConnected(Bundle bundle) {
//
// setupLocationForMap();
//
// if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) {
// startLocationUpdates();
// }
//
// }
//
// protected void startLocationUpdates() {
// LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, locationRequest, this);
// }
//
// @Override
// public void onConnectionSuspended(int i) {
// if(DEBUG)Log.i(TAG, "=== Connection suspended");
// }
//
// @Override
// public void onLocationChanged(Location location) {
// this.location = location;
// if(DEBUG)Log.i(TAG, "=== onLocationChanged: Latitude: " + this.location.getLatitude() + " Longitude: " + this.location.getLongitude());
// sendDataFrame(location);
// }
//
//
// @Override
// public void onConnectionFailed(ConnectionResult connectionResult) {
// if(DEBUG)Log.i(TAG, "=== Connection Fail");
// }
//
//
// }
// Path: app/src/main/java/org/parallelzero/hancel/Firebase/FirebaseHandler.java
import android.util.Log;
import org.parallelzero.hancel.Config;
import org.parallelzero.hancel.services.TrackLocationService;
package org.parallelzero.hancel.Firebase;
/**
* Created by Antonio Vanegas @hpsaturn on 11/2/15.
*/
public class FirebaseHandler {
public static final String TAG = TrackLocationService.class.getSimpleName();
|
private static final boolean DEBUG = Config.DEBUG;
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/view/ListTrackersAdapter.java
|
// Path: app/src/main/java/org/parallelzero/hancel/models/Track.java
// public class Track {
//
// public String trackId;
//
//
// public String alias;
//
// public int color;
//
// private boolean enable;
//
// private String lastUpdate;
//
// public double lat;
//
// public double lon;
//
// public float acu;
//
// public long upd;
//
// public Track(String trackId, String alias) {
// this.trackId = trackId;
// this.alias = alias;
// }
//
// public Track() {
//
// }
//
// public int getColor() {
// return color;
// }
//
// public void setColor(int color) {
// this.color = color;
// }
//
// public void setEnable(boolean enable) {
// this.enable = enable;
// }
//
// public boolean isEnable() {
// return enable;
// }
//
// @Override
// public String toString() {
// return "track: " + trackId + " alias:" + alias;
// }
//
// public String getLastUpdate() {
// // TODO: set last update on track
// lastUpdate = "Wednesday 23, 17:25";
// return lastUpdate;
// }
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/view/ListTrackersAdapter.java
// public class TrackerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// protected final RelativeLayout track_ly;
// protected final TextView track_alias;
// private final ListTrackersAdapter mAdapter;
//
// public TrackerViewHolder(View itemView, ListTrackersAdapter adapter) {
// super(itemView);
// itemView.setOnClickListener(this);
// this.mAdapter = adapter;
// track_alias = (TextView) itemView.findViewById(R.id.tv_partner_alias);
// track_ly = (RelativeLayout) itemView.findViewById(R.id.rl_track);
// }
//
// @Override
// public void onClick(View view) {
// mAdapter.onItemHolderClick(this);
// }
// }
|
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import org.parallelzero.hancel.R;
import org.parallelzero.hancel.models.Track;
import org.parallelzero.hancel.view.ListTrackersAdapter.TrackerViewHolder;
import java.util.ArrayList;
import java.util.Collections;
|
package org.parallelzero.hancel.view;
/**
* Created by Antonio Vanegas @hpsaturn on 11/10/15.
*/
public class ListTrackersAdapter extends RecyclerView.Adapter<TrackerViewHolder> implements ItemTouchHelperAdapter{
private AdapterView.OnItemClickListener mOnItemClickListener;
private Context ctx;
|
// Path: app/src/main/java/org/parallelzero/hancel/models/Track.java
// public class Track {
//
// public String trackId;
//
//
// public String alias;
//
// public int color;
//
// private boolean enable;
//
// private String lastUpdate;
//
// public double lat;
//
// public double lon;
//
// public float acu;
//
// public long upd;
//
// public Track(String trackId, String alias) {
// this.trackId = trackId;
// this.alias = alias;
// }
//
// public Track() {
//
// }
//
// public int getColor() {
// return color;
// }
//
// public void setColor(int color) {
// this.color = color;
// }
//
// public void setEnable(boolean enable) {
// this.enable = enable;
// }
//
// public boolean isEnable() {
// return enable;
// }
//
// @Override
// public String toString() {
// return "track: " + trackId + " alias:" + alias;
// }
//
// public String getLastUpdate() {
// // TODO: set last update on track
// lastUpdate = "Wednesday 23, 17:25";
// return lastUpdate;
// }
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/view/ListTrackersAdapter.java
// public class TrackerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// protected final RelativeLayout track_ly;
// protected final TextView track_alias;
// private final ListTrackersAdapter mAdapter;
//
// public TrackerViewHolder(View itemView, ListTrackersAdapter adapter) {
// super(itemView);
// itemView.setOnClickListener(this);
// this.mAdapter = adapter;
// track_alias = (TextView) itemView.findViewById(R.id.tv_partner_alias);
// track_ly = (RelativeLayout) itemView.findViewById(R.id.rl_track);
// }
//
// @Override
// public void onClick(View view) {
// mAdapter.onItemHolderClick(this);
// }
// }
// Path: app/src/main/java/org/parallelzero/hancel/view/ListTrackersAdapter.java
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import org.parallelzero.hancel.R;
import org.parallelzero.hancel.models.Track;
import org.parallelzero.hancel.view.ListTrackersAdapter.TrackerViewHolder;
import java.util.ArrayList;
import java.util.Collections;
package org.parallelzero.hancel.view;
/**
* Created by Antonio Vanegas @hpsaturn on 11/10/15.
*/
public class ListTrackersAdapter extends RecyclerView.Adapter<TrackerViewHolder> implements ItemTouchHelperAdapter{
private AdapterView.OnItemClickListener mOnItemClickListener;
private Context ctx;
|
private ArrayList<Track> tracks = new ArrayList<>();
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/IntroActivity.java
|
// Path: app/src/main/java/org/parallelzero/hancel/Fragments/SlideItemFragment.java
// public class SlideItemFragment extends Fragment {
//
// public static String TAG = SlideItemFragment.class.getSimpleName();
// private static final boolean DEBUG = Config.DEBUG;
// private static final String ARG_LAYOUT_RES_ID = "layoutResId";
// private static final String ARG_LAYOUT_BG_ID = "layoutBackgroundId";
// private int layoutResId;
// private int layoutBgId;
//
// public static SlideItemFragment newInstance(int layoutResId) {
// SlideItemFragment sampleSlide = new SlideItemFragment();
// Bundle args = new Bundle();
// args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
// sampleSlide.setArguments(args);
//
// return sampleSlide;
// }
//
// public static SlideItemFragment newInstance(int layoutResId, int background){
// SlideItemFragment sampleSlide = new SlideItemFragment();
// Bundle args = new Bundle();
// args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
// sampleSlide.setArguments(args);
// args.putInt(ARG_LAYOUT_BG_ID, background);
// sampleSlide.setArguments(args);
//
// return sampleSlide;
// }
//
//
// public SlideItemFragment() {
//
// }
//
// @Override
// public void onCreate(@Nullable Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
//
// Log.i(TAG, getArguments() != null?"NULL":"NOT NULL");
//
// if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID))
// layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID);
//
// if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_BG_ID))
// layoutBgId = getArguments().getInt(ARG_LAYOUT_BG_ID);
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//
// if(DEBUG) Log.i(TAG, "onCreateView " + " " + layoutBgId + " " + layoutResId);
//
// if(layoutResId !=0 && layoutBgId != 0) {
// View rootView = inflater.inflate(R.layout.welcome, container, false);
// RelativeLayout layout = (RelativeLayout) rootView.findViewById(R.id.rl_welcome_bigimage);
// layout.setBackgroundResource(layoutBgId);
// return rootView;
// }
// else if(layoutResId != 0)
// return inflater.inflate(layoutResId, container, false);
//
// return null;
// }
// }
|
import android.content.Intent;
import android.os.Bundle;
import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntro2;
import com.github.paolorotolo.appintro.AppIntroFragment;
import android.app.Activity;
import org.parallelzero.hancel.Fragments.SlideItemFragment;
|
package org.parallelzero.hancel;
/**
* Created by izel on 8/11/15.
*/
public class IntroActivity extends AppIntro2 {
@Override
public void init(Bundle savedInstanceState) {
|
// Path: app/src/main/java/org/parallelzero/hancel/Fragments/SlideItemFragment.java
// public class SlideItemFragment extends Fragment {
//
// public static String TAG = SlideItemFragment.class.getSimpleName();
// private static final boolean DEBUG = Config.DEBUG;
// private static final String ARG_LAYOUT_RES_ID = "layoutResId";
// private static final String ARG_LAYOUT_BG_ID = "layoutBackgroundId";
// private int layoutResId;
// private int layoutBgId;
//
// public static SlideItemFragment newInstance(int layoutResId) {
// SlideItemFragment sampleSlide = new SlideItemFragment();
// Bundle args = new Bundle();
// args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
// sampleSlide.setArguments(args);
//
// return sampleSlide;
// }
//
// public static SlideItemFragment newInstance(int layoutResId, int background){
// SlideItemFragment sampleSlide = new SlideItemFragment();
// Bundle args = new Bundle();
// args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
// sampleSlide.setArguments(args);
// args.putInt(ARG_LAYOUT_BG_ID, background);
// sampleSlide.setArguments(args);
//
// return sampleSlide;
// }
//
//
// public SlideItemFragment() {
//
// }
//
// @Override
// public void onCreate(@Nullable Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
//
// Log.i(TAG, getArguments() != null?"NULL":"NOT NULL");
//
// if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID))
// layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID);
//
// if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_BG_ID))
// layoutBgId = getArguments().getInt(ARG_LAYOUT_BG_ID);
// }
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//
// if(DEBUG) Log.i(TAG, "onCreateView " + " " + layoutBgId + " " + layoutResId);
//
// if(layoutResId !=0 && layoutBgId != 0) {
// View rootView = inflater.inflate(R.layout.welcome, container, false);
// RelativeLayout layout = (RelativeLayout) rootView.findViewById(R.id.rl_welcome_bigimage);
// layout.setBackgroundResource(layoutBgId);
// return rootView;
// }
// else if(layoutResId != 0)
// return inflater.inflate(layoutResId, container, false);
//
// return null;
// }
// }
// Path: app/src/main/java/org/parallelzero/hancel/IntroActivity.java
import android.content.Intent;
import android.os.Bundle;
import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntro2;
import com.github.paolorotolo.appintro.AppIntroFragment;
import android.app.Activity;
import org.parallelzero.hancel.Fragments.SlideItemFragment;
package org.parallelzero.hancel;
/**
* Created by izel on 8/11/15.
*/
public class IntroActivity extends AppIntro2 {
@Override
public void init(Bundle savedInstanceState) {
|
addSlide(SlideItemFragment.newInstance(R.layout.welcome, R.drawable.slide_rings));
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/view/ListPartnersAdapter.java
|
// Path: app/src/main/java/org/parallelzero/hancel/models/Partner.java
// public class Partner {
//
// public String alias;
//
// public Bitmap avatar;
//
//
// public String last_update;
//
// public Partner(String alias, String last_update) {
// this.alias=alias;
// this.avatar=avatar;
// this.last_update=last_update;
// }
//
// public String getAlias() {
// return alias;
// }
//
// public String getLast_update() {
// return last_update;
// }
//
// @Override
// public String toString() {
// return "alias: "+alias;
// }
//
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/view/ListPartnersAdapter.java
// public class PartnerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// protected final TextView alias;
// protected final TextView last_update;
// private final ListPartnersAdapter mAdapter;
//
//
// public PartnerViewHolder(View itemView, ListPartnersAdapter adapter) {
// super(itemView);
// itemView.setOnClickListener(this);
// this.mAdapter = adapter;
// alias = (TextView) itemView.findViewById(R.id.tv_partner_alias);
// last_update = (TextView) itemView.findViewById(R.id.tv_partner_last_update);
//
// }
//
// @Override
// public void onClick(View view) {
// mAdapter.onItemHolderClick(this);
// }
// }
|
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.TextView;
import org.parallelzero.hancel.R;
import org.parallelzero.hancel.models.Partner;
import org.parallelzero.hancel.view.ListPartnersAdapter.PartnerViewHolder;
import java.util.ArrayList;
import java.util.Collections;
|
package org.parallelzero.hancel.view;
/**
* Created by Antonio Vanegas @hpsaturn on 10/20/15.
*/
public class ListPartnersAdapter extends RecyclerView.Adapter<PartnerViewHolder> implements ItemTouchHelperAdapter {
private AdapterView.OnItemClickListener mOnItemClickListener;
private Context ctx;
|
// Path: app/src/main/java/org/parallelzero/hancel/models/Partner.java
// public class Partner {
//
// public String alias;
//
// public Bitmap avatar;
//
//
// public String last_update;
//
// public Partner(String alias, String last_update) {
// this.alias=alias;
// this.avatar=avatar;
// this.last_update=last_update;
// }
//
// public String getAlias() {
// return alias;
// }
//
// public String getLast_update() {
// return last_update;
// }
//
// @Override
// public String toString() {
// return "alias: "+alias;
// }
//
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/view/ListPartnersAdapter.java
// public class PartnerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// protected final TextView alias;
// protected final TextView last_update;
// private final ListPartnersAdapter mAdapter;
//
//
// public PartnerViewHolder(View itemView, ListPartnersAdapter adapter) {
// super(itemView);
// itemView.setOnClickListener(this);
// this.mAdapter = adapter;
// alias = (TextView) itemView.findViewById(R.id.tv_partner_alias);
// last_update = (TextView) itemView.findViewById(R.id.tv_partner_last_update);
//
// }
//
// @Override
// public void onClick(View view) {
// mAdapter.onItemHolderClick(this);
// }
// }
// Path: app/src/main/java/org/parallelzero/hancel/view/ListPartnersAdapter.java
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.TextView;
import org.parallelzero.hancel.R;
import org.parallelzero.hancel.models.Partner;
import org.parallelzero.hancel.view.ListPartnersAdapter.PartnerViewHolder;
import java.util.ArrayList;
import java.util.Collections;
package org.parallelzero.hancel.view;
/**
* Created by Antonio Vanegas @hpsaturn on 10/20/15.
*/
public class ListPartnersAdapter extends RecyclerView.Adapter<PartnerViewHolder> implements ItemTouchHelperAdapter {
private AdapterView.OnItemClickListener mOnItemClickListener;
private Context ctx;
|
private ArrayList<Partner> partners = new ArrayList<>();
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/services/StartStatusServiceReceiver.java
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
|
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.parallelzero.hancel.Config;
|
package org.parallelzero.hancel.services;
public class StartStatusServiceReceiver extends BroadcastReceiver {
public static final String TAG = StartStatusServiceReceiver.class.getSimpleName();
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
// Path: app/src/main/java/org/parallelzero/hancel/services/StartStatusServiceReceiver.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.parallelzero.hancel.Config;
package org.parallelzero.hancel.services;
public class StartStatusServiceReceiver extends BroadcastReceiver {
public static final String TAG = StartStatusServiceReceiver.class.getSimpleName();
|
private static final boolean DEBUG = Config.DEBUG&&Config.DEBUG_LOCATION;
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/Fragments/AboutFragment.java
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
|
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ScrollView;
import android.widget.TextView;
import com.hpsaturn.tools.DeviceUtil;
import com.hpsaturn.tools.UITools;
import org.parallelzero.hancel.Config;
import org.parallelzero.hancel.R;
import java.util.Objects;
|
package org.parallelzero.hancel.Fragments;
/**
* Created by izel on 9/11/15.
*/
public class AboutFragment extends Fragment {
public static final String TAG = AboutFragment.class.getSimpleName();
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
// Path: app/src/main/java/org/parallelzero/hancel/Fragments/AboutFragment.java
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ScrollView;
import android.widget.TextView;
import com.hpsaturn.tools.DeviceUtil;
import com.hpsaturn.tools.UITools;
import org.parallelzero.hancel.Config;
import org.parallelzero.hancel.R;
import java.util.Objects;
package org.parallelzero.hancel.Fragments;
/**
* Created by izel on 9/11/15.
*/
public class AboutFragment extends Fragment {
public static final String TAG = AboutFragment.class.getSimpleName();
|
private static final boolean DEBUG = Config.DEBUG;
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/view/ListContactsAdapter.java
|
// Path: app/src/main/java/org/parallelzero/hancel/models/Contact.java
// public class Contact {
//
// public String photoUri;
//
// public String name;
//
// public String phone;
//
// public Bitmap photo;
//
// public Contact(String name, String phone, Bitmap photo) {
// this.name=name;
// this.phone=phone;
// this.photo=photo;
// }
//
//
// public Contact(String name, String phone, String uri) {
// this.name=name;
// this.phone=phone;
// this.photoUri =uri;
// }
//
//
// public String getName() {
// return name;
// }
//
// @Override
// public String toString() {
// return "name: "+name+" phone:"+phone;
// }
//
// public String getPhone() {
// return phone;
// }
//
// public Bitmap getPhoto() {
// return photo;
// }
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/view/ListContactsAdapter.java
// public class ContactViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// protected final TextView contact_name;
// protected final TextView contact_phone;
// protected final ImageView contact_photo;
//
// private final ListContactsAdapter mAdapter;
//
//
// public ContactViewHolder(View itemView, ListContactsAdapter adapter) {
// super(itemView);
// itemView.setOnClickListener(this);
// this.mAdapter = adapter;
// contact_name = (TextView) itemView.findViewById(R.id.tv_contact_name);
// contact_phone = (TextView) itemView.findViewById(R.id.tv_contact_phone);
// contact_photo = (ImageView) itemView.findViewById(R.id.iv_contact_icon);
// }
//
// @Override
// public void onClick(View view) {
// mAdapter.onItemHolderClick(this);
// }
// }
|
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.TextView;
import org.parallelzero.hancel.R;
import org.parallelzero.hancel.models.Contact;
import org.parallelzero.hancel.view.ListContactsAdapter.ContactViewHolder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
|
package org.parallelzero.hancel.view;
/**
* Created by Antonio Vanegas @hpsaturn on 10/20/15.
*/
public class ListContactsAdapter extends RecyclerView.Adapter<ContactViewHolder> implements ItemTouchHelperAdapter {
private AdapterView.OnItemClickListener mOnItemClickListener;
private Context ctx;
|
// Path: app/src/main/java/org/parallelzero/hancel/models/Contact.java
// public class Contact {
//
// public String photoUri;
//
// public String name;
//
// public String phone;
//
// public Bitmap photo;
//
// public Contact(String name, String phone, Bitmap photo) {
// this.name=name;
// this.phone=phone;
// this.photo=photo;
// }
//
//
// public Contact(String name, String phone, String uri) {
// this.name=name;
// this.phone=phone;
// this.photoUri =uri;
// }
//
//
// public String getName() {
// return name;
// }
//
// @Override
// public String toString() {
// return "name: "+name+" phone:"+phone;
// }
//
// public String getPhone() {
// return phone;
// }
//
// public Bitmap getPhoto() {
// return photo;
// }
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/view/ListContactsAdapter.java
// public class ContactViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// protected final TextView contact_name;
// protected final TextView contact_phone;
// protected final ImageView contact_photo;
//
// private final ListContactsAdapter mAdapter;
//
//
// public ContactViewHolder(View itemView, ListContactsAdapter adapter) {
// super(itemView);
// itemView.setOnClickListener(this);
// this.mAdapter = adapter;
// contact_name = (TextView) itemView.findViewById(R.id.tv_contact_name);
// contact_phone = (TextView) itemView.findViewById(R.id.tv_contact_phone);
// contact_photo = (ImageView) itemView.findViewById(R.id.iv_contact_icon);
// }
//
// @Override
// public void onClick(View view) {
// mAdapter.onItemHolderClick(this);
// }
// }
// Path: app/src/main/java/org/parallelzero/hancel/view/ListContactsAdapter.java
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.TextView;
import org.parallelzero.hancel.R;
import org.parallelzero.hancel.models.Contact;
import org.parallelzero.hancel.view.ListContactsAdapter.ContactViewHolder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
package org.parallelzero.hancel.view;
/**
* Created by Antonio Vanegas @hpsaturn on 10/20/15.
*/
public class ListContactsAdapter extends RecyclerView.Adapter<ContactViewHolder> implements ItemTouchHelperAdapter {
private AdapterView.OnItemClickListener mOnItemClickListener;
private Context ctx;
|
private ArrayList<Contact> contacts = new ArrayList<>();
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/services/HardwareButtonReceiver.java
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
|
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.parallelzero.hancel.Config;
import java.util.Calendar;
|
package org.parallelzero.hancel.services;
/**
* Created by izel on 4/11/15.
*/
public class HardwareButtonReceiver extends BroadcastReceiver {
public static final String TAG = HardwareButtonReceiver.class.getSimpleName();
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
// Path: app/src/main/java/org/parallelzero/hancel/services/HardwareButtonReceiver.java
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import org.parallelzero.hancel.Config;
import java.util.Calendar;
package org.parallelzero.hancel.services;
/**
* Created by izel on 4/11/15.
*/
public class HardwareButtonReceiver extends BroadcastReceiver {
public static final String TAG = HardwareButtonReceiver.class.getSimpleName();
|
private static final boolean DEBUG = Config.DEBUG;
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/view/ListRingsAdapter.java
|
// Path: app/src/main/java/org/parallelzero/hancel/models/Ring.java
// public class Ring {
//
// public String name;
//
// public String description;
//
// public boolean enable=true;
//
// public List<Contact> contacts;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public void setContacts(List<Contact> contacts) {
// this.contacts = contacts;
// }
//
// public List<Contact> getContacts(){return contacts;}
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getDescription() {
// return description;
// }
//
// public boolean isEnable() {
// return enable;
// }
//
// public void setEnable(boolean enable) {
// this.enable = enable;
// }
//
//
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/view/ListRingsAdapter.java
// public class RingViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// protected final TextView ring_name;
// protected final TextView ring_description;
// protected final ImageView ringIcon;
// private final ListRingsAdapter mAdapter;
//
//
// public RingViewHolder(View itemView, ListRingsAdapter adapter) {
// super(itemView);
// itemView.setOnClickListener(this);
// this.mAdapter = adapter;
// ringIcon = (ImageView) itemView.findViewById(R.id.iv_ring_icon);
// ring_name = (TextView) itemView.findViewById(R.id.tv_ring_name);
// ring_description = (TextView) itemView.findViewById(R.id.tv_ring_description);
//
// }
//
// @Override
// public void onClick(View view) {
// mAdapter.onItemHolderClick(this);
// }
// }
|
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.TextView;
import org.parallelzero.hancel.R;
import org.parallelzero.hancel.models.Ring;
import org.parallelzero.hancel.view.ListRingsAdapter.RingViewHolder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
|
package org.parallelzero.hancel.view;
/**
* Created by Antonio Vanegas @hpsaturn on 10/20/15.
*/
public class ListRingsAdapter extends RecyclerView.Adapter<RingViewHolder> implements ItemTouchHelperAdapter {
private AdapterView.OnItemClickListener mOnItemClickListener;
private Context ctx;
|
// Path: app/src/main/java/org/parallelzero/hancel/models/Ring.java
// public class Ring {
//
// public String name;
//
// public String description;
//
// public boolean enable=true;
//
// public List<Contact> contacts;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public void setContacts(List<Contact> contacts) {
// this.contacts = contacts;
// }
//
// public List<Contact> getContacts(){return contacts;}
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getDescription() {
// return description;
// }
//
// public boolean isEnable() {
// return enable;
// }
//
// public void setEnable(boolean enable) {
// this.enable = enable;
// }
//
//
// }
//
// Path: app/src/main/java/org/parallelzero/hancel/view/ListRingsAdapter.java
// public class RingViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
//
// protected final TextView ring_name;
// protected final TextView ring_description;
// protected final ImageView ringIcon;
// private final ListRingsAdapter mAdapter;
//
//
// public RingViewHolder(View itemView, ListRingsAdapter adapter) {
// super(itemView);
// itemView.setOnClickListener(this);
// this.mAdapter = adapter;
// ringIcon = (ImageView) itemView.findViewById(R.id.iv_ring_icon);
// ring_name = (TextView) itemView.findViewById(R.id.tv_ring_name);
// ring_description = (TextView) itemView.findViewById(R.id.tv_ring_description);
//
// }
//
// @Override
// public void onClick(View view) {
// mAdapter.onItemHolderClick(this);
// }
// }
// Path: app/src/main/java/org/parallelzero/hancel/view/ListRingsAdapter.java
import android.content.Context;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.TextView;
import org.parallelzero.hancel.R;
import org.parallelzero.hancel.models.Ring;
import org.parallelzero.hancel.view.ListRingsAdapter.RingViewHolder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
package org.parallelzero.hancel.view;
/**
* Created by Antonio Vanegas @hpsaturn on 10/20/15.
*/
public class ListRingsAdapter extends RecyclerView.Adapter<RingViewHolder> implements ItemTouchHelperAdapter {
private AdapterView.OnItemClickListener mOnItemClickListener;
private Context ctx;
|
private ArrayList<Ring> rings = new ArrayList<>();
|
HancelParallelZero/hancel_android
|
app/src/main/java/org/parallelzero/hancel/Fragments/SlideItemFragment.java
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
|
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import org.parallelzero.hancel.Config;
import org.parallelzero.hancel.R;
|
package org.parallelzero.hancel.Fragments;
/**
* Created by izel on 8/11/15.
*/
public class SlideItemFragment extends Fragment {
public static String TAG = SlideItemFragment.class.getSimpleName();
|
// Path: app/src/main/java/org/parallelzero/hancel/Config.java
// public class Config {
//
// public static final boolean DEBUG=true; // ==> R E V I S A R P A R A T I E N D A S //
// public static final boolean DEBUG_SERVICE = true;
// public static final boolean DEBUG_LOCATION = false;
// public static final boolean DEBUG_TASKS = true;
// public static final boolean DEBUG_MAP = true;
//
// //Alert Button
// public static final int RESTART_HARDWARE_BUTTON_TIME = 5000;
//
// // location
// public static final int TIME_AFTER_START = 15; // Start on x seconds after init Scheduler
// public static final long DEFAULT_INTERVAL = 1000 * 15 * 1; // Default interval for background service: 3 minutes
// public static final long DEFAULT_INTERVAL_FASTER = 1000 * 10 * 1;
// public static final float ACCURACY = 200;
// public static final long LOCATION_ROUTE_INTERVAL = 1000 * 60;
// public static final long LOCATION_MAP_INTERVAL = 1000 * 120;
//
// public static final int VIBRATION_TIME_SMS = 500;
//
// public static final String FIREBASE_MAIN = "https://hancel.firebaseio.com";
// public static final String FIREBASE_TRANSACTIONS = "tracks";
// public static float map_zoom_init = 14;
// }
// Path: app/src/main/java/org/parallelzero/hancel/Fragments/SlideItemFragment.java
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import org.parallelzero.hancel.Config;
import org.parallelzero.hancel.R;
package org.parallelzero.hancel.Fragments;
/**
* Created by izel on 8/11/15.
*/
public class SlideItemFragment extends Fragment {
public static String TAG = SlideItemFragment.class.getSimpleName();
|
private static final boolean DEBUG = Config.DEBUG;
|
ewidgetfx/ewidgetfx
|
widget-core/src/main/java/org/ewidgetfx/util/WidgetLoader.java
|
// Path: widget-core/src/main/java/org/ewidgetfx/core/Widget.java
// public interface Widget {
//
// public static enum DECORATION {
//
// STAGED_OS_TITLE_BAR,
// STAGED_CLOSE,
// STAGED_CONFIG_CLOSE,
// STAGED_CONFIG,
// STAGED_UNDECORATED,
// NON_STAGED_CLOSE,
// NON_STAGED_CONFIG_CLOSE,
// NON_STAGED_CONFIG,
// NON_STAGED_UNDECORATED
// };
//
// DECORATION getDecoration();
//
// void setDecoration(DECORATION decoration);
//
// String getName();
//
// void setName(String name);
//
// StringProperty nameProperty();
//
// String getVersion();
//
// void setVersion(String version);
//
// StringProperty versionProperty();
//
// String getDescription();
//
// void setDescription(String descr);
//
// String getVendor();
//
// void setVendor(String vendor);
//
// String getVendorUrl();
//
// void setVendorUrl(String vendorUrl);
//
// String getVendorEmail();
//
// void setVendorEmail(String vendorEmail);
//
// LaunchInfo getLaunchInfo();
//
// void setLaunchInfo(LaunchInfo launchInfo);
//
// WidgetIcon getWidgetIcon();
//
// void setWidgetIcon(WidgetIcon widgetIcon);
//
// ObjectProperty<WidgetIcon> widgetIconProperty();
//
// Pane getAsNode();
//
// Stage getParentStage();
//
// void setParentStage(Stage stage);
//
// WidgetState getWidgetState();
//
// /**
// * Returns a created WidgetIcon for the app container to use. Called 1st.
// *
// * @return WidgetIcon containing a raw node representing the icon. App containers can resize.
// */
// WidgetIcon buildWidgetIcon();
//
// /**
// * Called after buildWidgetIcon() method to allow background processes to occur. Called 2nd. Typically to collect
// * data to update WidgetIcon's Icon overlay. An example would be an email widget periodically checking email to
// * update Icon overlay the number of emails received.
// */
// void startBackground();
//
// /**
// * Initialize the widget. If the developer calls this method the framework will not call it. Called 3rd.
// */
// void init();
//
// /**
// * Start is meant to be called when the user clicks to the icon to launch window. Called 4th. Typically to start
// * animations. This should not be confused with backgroundStart()
// */
// void start();
//
// /**
// * Pause is typically used to pause animations. Or other developer defined resources.
// */
// void pause();
//
// /**
// * Resume is typically used to resume a animations. Or other developer defined resources.
// */
// void resume();
//
// /**
// * Stop is called when the widget is closed and not visible. Typically this is to stop animations, and minor
// * cleanup. The framework will call stop and stopBackground() method when exiting the app container.
// */
// void stop();
//
// /**
// * Stops any background processes. Called when widget is being closed by the framework when exiting app contain.
// * Called last.
// *
// */
// void stopBackground();
//
// }
|
import javafx.collections.ObservableMap;
import javafx.stage.Stage;
import org.ewidgetfx.core.Widget;
import java.io.File;
|
/*
* Copyright 2013 eWidgetFX.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ewidgetfx.util;
/**
*
* @author Carl Dea <carl.dea@gmail.com>
* @since 1.0
*/
public interface WidgetLoader {
File getDefaultWidgetDirectory();
|
// Path: widget-core/src/main/java/org/ewidgetfx/core/Widget.java
// public interface Widget {
//
// public static enum DECORATION {
//
// STAGED_OS_TITLE_BAR,
// STAGED_CLOSE,
// STAGED_CONFIG_CLOSE,
// STAGED_CONFIG,
// STAGED_UNDECORATED,
// NON_STAGED_CLOSE,
// NON_STAGED_CONFIG_CLOSE,
// NON_STAGED_CONFIG,
// NON_STAGED_UNDECORATED
// };
//
// DECORATION getDecoration();
//
// void setDecoration(DECORATION decoration);
//
// String getName();
//
// void setName(String name);
//
// StringProperty nameProperty();
//
// String getVersion();
//
// void setVersion(String version);
//
// StringProperty versionProperty();
//
// String getDescription();
//
// void setDescription(String descr);
//
// String getVendor();
//
// void setVendor(String vendor);
//
// String getVendorUrl();
//
// void setVendorUrl(String vendorUrl);
//
// String getVendorEmail();
//
// void setVendorEmail(String vendorEmail);
//
// LaunchInfo getLaunchInfo();
//
// void setLaunchInfo(LaunchInfo launchInfo);
//
// WidgetIcon getWidgetIcon();
//
// void setWidgetIcon(WidgetIcon widgetIcon);
//
// ObjectProperty<WidgetIcon> widgetIconProperty();
//
// Pane getAsNode();
//
// Stage getParentStage();
//
// void setParentStage(Stage stage);
//
// WidgetState getWidgetState();
//
// /**
// * Returns a created WidgetIcon for the app container to use. Called 1st.
// *
// * @return WidgetIcon containing a raw node representing the icon. App containers can resize.
// */
// WidgetIcon buildWidgetIcon();
//
// /**
// * Called after buildWidgetIcon() method to allow background processes to occur. Called 2nd. Typically to collect
// * data to update WidgetIcon's Icon overlay. An example would be an email widget periodically checking email to
// * update Icon overlay the number of emails received.
// */
// void startBackground();
//
// /**
// * Initialize the widget. If the developer calls this method the framework will not call it. Called 3rd.
// */
// void init();
//
// /**
// * Start is meant to be called when the user clicks to the icon to launch window. Called 4th. Typically to start
// * animations. This should not be confused with backgroundStart()
// */
// void start();
//
// /**
// * Pause is typically used to pause animations. Or other developer defined resources.
// */
// void pause();
//
// /**
// * Resume is typically used to resume a animations. Or other developer defined resources.
// */
// void resume();
//
// /**
// * Stop is called when the widget is closed and not visible. Typically this is to stop animations, and minor
// * cleanup. The framework will call stop and stopBackground() method when exiting the app container.
// */
// void stop();
//
// /**
// * Stops any background processes. Called when widget is being closed by the framework when exiting app contain.
// * Called last.
// *
// */
// void stopBackground();
//
// }
// Path: widget-core/src/main/java/org/ewidgetfx/util/WidgetLoader.java
import javafx.collections.ObservableMap;
import javafx.stage.Stage;
import org.ewidgetfx.core.Widget;
import java.io.File;
/*
* Copyright 2013 eWidgetFX.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ewidgetfx.util;
/**
*
* @author Carl Dea <carl.dea@gmail.com>
* @since 1.0
*/
public interface WidgetLoader {
File getDefaultWidgetDirectory();
|
Widget loadFile(File jarFile, Stage containerStage, ClassLoader parentClassLoader);
|
ewidgetfx/ewidgetfx
|
widget-core/src/main/java/org/ewidgetfx/util/WidgetFactory.java
|
// Path: widget-core/src/main/java/org/ewidgetfx/core/Widget.java
// public interface Widget {
//
// public static enum DECORATION {
//
// STAGED_OS_TITLE_BAR,
// STAGED_CLOSE,
// STAGED_CONFIG_CLOSE,
// STAGED_CONFIG,
// STAGED_UNDECORATED,
// NON_STAGED_CLOSE,
// NON_STAGED_CONFIG_CLOSE,
// NON_STAGED_CONFIG,
// NON_STAGED_UNDECORATED
// };
//
// DECORATION getDecoration();
//
// void setDecoration(DECORATION decoration);
//
// String getName();
//
// void setName(String name);
//
// StringProperty nameProperty();
//
// String getVersion();
//
// void setVersion(String version);
//
// StringProperty versionProperty();
//
// String getDescription();
//
// void setDescription(String descr);
//
// String getVendor();
//
// void setVendor(String vendor);
//
// String getVendorUrl();
//
// void setVendorUrl(String vendorUrl);
//
// String getVendorEmail();
//
// void setVendorEmail(String vendorEmail);
//
// LaunchInfo getLaunchInfo();
//
// void setLaunchInfo(LaunchInfo launchInfo);
//
// WidgetIcon getWidgetIcon();
//
// void setWidgetIcon(WidgetIcon widgetIcon);
//
// ObjectProperty<WidgetIcon> widgetIconProperty();
//
// Pane getAsNode();
//
// Stage getParentStage();
//
// void setParentStage(Stage stage);
//
// WidgetState getWidgetState();
//
// /**
// * Returns a created WidgetIcon for the app container to use. Called 1st.
// *
// * @return WidgetIcon containing a raw node representing the icon. App containers can resize.
// */
// WidgetIcon buildWidgetIcon();
//
// /**
// * Called after buildWidgetIcon() method to allow background processes to occur. Called 2nd. Typically to collect
// * data to update WidgetIcon's Icon overlay. An example would be an email widget periodically checking email to
// * update Icon overlay the number of emails received.
// */
// void startBackground();
//
// /**
// * Initialize the widget. If the developer calls this method the framework will not call it. Called 3rd.
// */
// void init();
//
// /**
// * Start is meant to be called when the user clicks to the icon to launch window. Called 4th. Typically to start
// * animations. This should not be confused with backgroundStart()
// */
// void start();
//
// /**
// * Pause is typically used to pause animations. Or other developer defined resources.
// */
// void pause();
//
// /**
// * Resume is typically used to resume a animations. Or other developer defined resources.
// */
// void resume();
//
// /**
// * Stop is called when the widget is closed and not visible. Typically this is to stop animations, and minor
// * cleanup. The framework will call stop and stopBackground() method when exiting the app container.
// */
// void stop();
//
// /**
// * Stops any background processes. Called when widget is being closed by the framework when exiting app contain.
// * Called last.
// *
// */
// void stopBackground();
//
// }
|
import javafx.collections.FXCollections;
import javafx.collections.MapChangeListener;
import javafx.collections.ObservableMap;
import javafx.event.EventHandler;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
import org.ewidgetfx.core.Widget;
import org.ewidgetfx.core.WidgetStage;
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import org.apache.log4j.Logger;
|
/*
* Copyright 2013 eWidgetFX.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ewidgetfx.util;
/**
*
* @author Carl Dea <carl.dea@gmail.com>
* @since 1.0
*/
public class WidgetFactory {
private static final Logger logger = Logger.getLogger(WidgetFactory.class);
static WidgetLoader widgetLoader = new WidgetLoaderImpl(new File(new File(".").getAbsoluteFile().getParentFile() + File.separator + "jabs"));
|
// Path: widget-core/src/main/java/org/ewidgetfx/core/Widget.java
// public interface Widget {
//
// public static enum DECORATION {
//
// STAGED_OS_TITLE_BAR,
// STAGED_CLOSE,
// STAGED_CONFIG_CLOSE,
// STAGED_CONFIG,
// STAGED_UNDECORATED,
// NON_STAGED_CLOSE,
// NON_STAGED_CONFIG_CLOSE,
// NON_STAGED_CONFIG,
// NON_STAGED_UNDECORATED
// };
//
// DECORATION getDecoration();
//
// void setDecoration(DECORATION decoration);
//
// String getName();
//
// void setName(String name);
//
// StringProperty nameProperty();
//
// String getVersion();
//
// void setVersion(String version);
//
// StringProperty versionProperty();
//
// String getDescription();
//
// void setDescription(String descr);
//
// String getVendor();
//
// void setVendor(String vendor);
//
// String getVendorUrl();
//
// void setVendorUrl(String vendorUrl);
//
// String getVendorEmail();
//
// void setVendorEmail(String vendorEmail);
//
// LaunchInfo getLaunchInfo();
//
// void setLaunchInfo(LaunchInfo launchInfo);
//
// WidgetIcon getWidgetIcon();
//
// void setWidgetIcon(WidgetIcon widgetIcon);
//
// ObjectProperty<WidgetIcon> widgetIconProperty();
//
// Pane getAsNode();
//
// Stage getParentStage();
//
// void setParentStage(Stage stage);
//
// WidgetState getWidgetState();
//
// /**
// * Returns a created WidgetIcon for the app container to use. Called 1st.
// *
// * @return WidgetIcon containing a raw node representing the icon. App containers can resize.
// */
// WidgetIcon buildWidgetIcon();
//
// /**
// * Called after buildWidgetIcon() method to allow background processes to occur. Called 2nd. Typically to collect
// * data to update WidgetIcon's Icon overlay. An example would be an email widget periodically checking email to
// * update Icon overlay the number of emails received.
// */
// void startBackground();
//
// /**
// * Initialize the widget. If the developer calls this method the framework will not call it. Called 3rd.
// */
// void init();
//
// /**
// * Start is meant to be called when the user clicks to the icon to launch window. Called 4th. Typically to start
// * animations. This should not be confused with backgroundStart()
// */
// void start();
//
// /**
// * Pause is typically used to pause animations. Or other developer defined resources.
// */
// void pause();
//
// /**
// * Resume is typically used to resume a animations. Or other developer defined resources.
// */
// void resume();
//
// /**
// * Stop is called when the widget is closed and not visible. Typically this is to stop animations, and minor
// * cleanup. The framework will call stop and stopBackground() method when exiting the app container.
// */
// void stop();
//
// /**
// * Stops any background processes. Called when widget is being closed by the framework when exiting app contain.
// * Called last.
// *
// */
// void stopBackground();
//
// }
// Path: widget-core/src/main/java/org/ewidgetfx/util/WidgetFactory.java
import javafx.collections.FXCollections;
import javafx.collections.MapChangeListener;
import javafx.collections.ObservableMap;
import javafx.event.EventHandler;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;
import org.ewidgetfx.core.Widget;
import org.ewidgetfx.core.WidgetStage;
import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import org.apache.log4j.Logger;
/*
* Copyright 2013 eWidgetFX.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ewidgetfx.util;
/**
*
* @author Carl Dea <carl.dea@gmail.com>
* @since 1.0
*/
public class WidgetFactory {
private static final Logger logger = Logger.getLogger(WidgetFactory.class);
static WidgetLoader widgetLoader = new WidgetLoaderImpl(new File(new File(".").getAbsoluteFile().getParentFile() + File.separator + "jabs"));
|
static ObservableMap<String, Widget> widgetMap = FXCollections.observableMap(new HashMap<String, Widget>());
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomethingcomposite.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonObject;
|
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomethingcomposite.java
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonObject;
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public interface ISomethingcomposite extends VertxPojo, Serializable {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomethingcomposite.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonObject;
|
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomethingcomposite.java
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonObject;
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public interface ISomethingcomposite extends VertxPojo, Serializable {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomethingwithoutjson.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
|
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomethingwithoutjson.java
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public interface ISomethingwithoutjson extends VertxPojo, Serializable {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/pojos/Somethingwithoutjson.java
|
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomethingwithoutjson.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingwithoutjson extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingWithoutJson.someId</code>.
// */
// public ISomethingwithoutjson setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingWithoutJson.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingWithoutJson.someString</code>.
// */
// public ISomethingwithoutjson setSomestring(String value);
//
// /**
// * Getter for <code>somethingWithoutJson.someString</code>.
// */
// public String getSomestring();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public void from(generated.classic.async.vertx.tables.interfaces.ISomethingwithoutjson from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public <E extends generated.classic.async.vertx.tables.interfaces.ISomethingwithoutjson> E into(E into);
//
// @Override
// default ISomethingwithoutjson fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// return json;
// }
//
// }
|
import javax.annotation.Generated;
import generated.classic.async.vertx.tables.interfaces.ISomethingwithoutjson;
|
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomethingwithoutjson.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingwithoutjson extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingWithoutJson.someId</code>.
// */
// public ISomethingwithoutjson setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingWithoutJson.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingWithoutJson.someString</code>.
// */
// public ISomethingwithoutjson setSomestring(String value);
//
// /**
// * Getter for <code>somethingWithoutJson.someString</code>.
// */
// public String getSomestring();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public void from(generated.classic.async.vertx.tables.interfaces.ISomethingwithoutjson from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public <E extends generated.classic.async.vertx.tables.interfaces.ISomethingwithoutjson> E into(E into);
//
// @Override
// default ISomethingwithoutjson fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// return json;
// }
//
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/pojos/Somethingwithoutjson.java
import javax.annotation.Generated;
import generated.classic.async.vertx.tables.interfaces.ISomethingwithoutjson;
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public class Somethingwithoutjson implements ISomethingwithoutjson {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/pojos/Something.java
|
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomething.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomething extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>something.someId</code>.
// */
// public ISomething setSomeid(Integer value);
//
// /**
// * Getter for <code>something.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>something.someString</code>.
// */
// public ISomething setSomestring(String value);
//
// /**
// * Getter for <code>something.someString</code>.
// */
// public String getSomestring();
//
// /**
// * Setter for <code>something.someHugeNumber</code>.
// */
// public ISomething setSomehugenumber(Long value);
//
// /**
// * Getter for <code>something.someHugeNumber</code>.
// */
// public Long getSomehugenumber();
//
// /**
// * Setter for <code>something.someSmallNumber</code>.
// */
// public ISomething setSomesmallnumber(Short value);
//
// /**
// * Getter for <code>something.someSmallNumber</code>.
// */
// public Short getSomesmallnumber();
//
// /**
// * Setter for <code>something.someRegularNumber</code>.
// */
// public ISomething setSomeregularnumber(Integer value);
//
// /**
// * Getter for <code>something.someRegularNumber</code>.
// */
// public Integer getSomeregularnumber();
//
// /**
// * Setter for <code>something.someDouble</code>.
// */
// public ISomething setSomedouble(Double value);
//
// /**
// * Getter for <code>something.someDouble</code>.
// */
// public Double getSomedouble();
//
// /**
// * Setter for <code>something.someEnum</code>.
// */
// public ISomething setSomeenum(String value);
//
// /**
// * Getter for <code>something.someEnum</code>.
// */
// public String getSomeenum();
//
// /**
// * Setter for <code>something.someJsonObject</code>.
// */
// public ISomething setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>something.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// /**
// * Setter for <code>something.someJsonArray</code>.
// */
// public ISomething setSomejsonarray(JsonArray value);
//
// /**
// * Getter for <code>something.someJsonArray</code>.
// */
// public JsonArray getSomejsonarray();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomething
// */
// public void from(generated.classic.async.vertx.tables.interfaces.ISomething from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomething
// */
// public <E extends generated.classic.async.vertx.tables.interfaces.ISomething> E into(E into);
//
// @Override
// default ISomething fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// setSomehugenumber(json.getLong("someHugeNumber"));
// setSomesmallnumber(json.getInteger("someSmallNumber")==null?null:json.getInteger("someSmallNumber").shortValue());
// setSomeregularnumber(json.getInteger("someRegularNumber"));
// setSomedouble(json.getDouble("someDouble"));
// setSomeenum(json.getString("someEnum"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// setSomejsonarray(json.getJsonArray("someJsonArray"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// json.put("someHugeNumber",getSomehugenumber());
// json.put("someSmallNumber",getSomesmallnumber());
// json.put("someRegularNumber",getSomeregularnumber());
// json.put("someDouble",getSomedouble());
// json.put("someEnum",getSomeenum());
// json.put("someJsonObject",getSomejsonobject());
// json.put("someJsonArray",getSomejsonarray());
// return json;
// }
//
// }
|
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.classic.async.vertx.tables.interfaces.ISomething;
|
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomething.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomething extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>something.someId</code>.
// */
// public ISomething setSomeid(Integer value);
//
// /**
// * Getter for <code>something.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>something.someString</code>.
// */
// public ISomething setSomestring(String value);
//
// /**
// * Getter for <code>something.someString</code>.
// */
// public String getSomestring();
//
// /**
// * Setter for <code>something.someHugeNumber</code>.
// */
// public ISomething setSomehugenumber(Long value);
//
// /**
// * Getter for <code>something.someHugeNumber</code>.
// */
// public Long getSomehugenumber();
//
// /**
// * Setter for <code>something.someSmallNumber</code>.
// */
// public ISomething setSomesmallnumber(Short value);
//
// /**
// * Getter for <code>something.someSmallNumber</code>.
// */
// public Short getSomesmallnumber();
//
// /**
// * Setter for <code>something.someRegularNumber</code>.
// */
// public ISomething setSomeregularnumber(Integer value);
//
// /**
// * Getter for <code>something.someRegularNumber</code>.
// */
// public Integer getSomeregularnumber();
//
// /**
// * Setter for <code>something.someDouble</code>.
// */
// public ISomething setSomedouble(Double value);
//
// /**
// * Getter for <code>something.someDouble</code>.
// */
// public Double getSomedouble();
//
// /**
// * Setter for <code>something.someEnum</code>.
// */
// public ISomething setSomeenum(String value);
//
// /**
// * Getter for <code>something.someEnum</code>.
// */
// public String getSomeenum();
//
// /**
// * Setter for <code>something.someJsonObject</code>.
// */
// public ISomething setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>something.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// /**
// * Setter for <code>something.someJsonArray</code>.
// */
// public ISomething setSomejsonarray(JsonArray value);
//
// /**
// * Getter for <code>something.someJsonArray</code>.
// */
// public JsonArray getSomejsonarray();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomething
// */
// public void from(generated.classic.async.vertx.tables.interfaces.ISomething from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomething
// */
// public <E extends generated.classic.async.vertx.tables.interfaces.ISomething> E into(E into);
//
// @Override
// default ISomething fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// setSomehugenumber(json.getLong("someHugeNumber"));
// setSomesmallnumber(json.getInteger("someSmallNumber")==null?null:json.getInteger("someSmallNumber").shortValue());
// setSomeregularnumber(json.getInteger("someRegularNumber"));
// setSomedouble(json.getDouble("someDouble"));
// setSomeenum(json.getString("someEnum"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// setSomejsonarray(json.getJsonArray("someJsonArray"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// json.put("someHugeNumber",getSomehugenumber());
// json.put("someSmallNumber",getSomesmallnumber());
// json.put("someRegularNumber",getSomeregularnumber());
// json.put("someDouble",getSomedouble());
// json.put("someEnum",getSomeenum());
// json.put("someJsonObject",getSomejsonobject());
// json.put("someJsonArray",getSomejsonarray());
// return json;
// }
//
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/pojos/Something.java
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.classic.async.vertx.tables.interfaces.ISomething;
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public class Something implements ISomething {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomethingwithoutjson.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
|
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomethingwithoutjson.java
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public interface ISomethingwithoutjson extends VertxPojo, Serializable {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomething.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import java.io.Serializable;
import javax.annotation.Generated;
|
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomething.java
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import java.io.Serializable;
import javax.annotation.Generated;
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public interface ISomething extends VertxPojo, Serializable {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/pojos/Somethingcomposite.java
|
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomethingcomposite.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingcomposite extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingComposite.someId</code>.
// */
// public ISomethingcomposite setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingComposite.someSecondId</code>.
// */
// public ISomethingcomposite setSomesecondid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someSecondId</code>.
// */
// public Integer getSomesecondid();
//
// /**
// * Setter for <code>somethingComposite.someJsonObject</code>.
// */
// public ISomethingcomposite setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>somethingComposite.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public void from(generated.classic.async.vertx.tables.interfaces.ISomethingcomposite from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public <E extends generated.classic.async.vertx.tables.interfaces.ISomethingcomposite> E into(E into);
//
// @Override
// default ISomethingcomposite fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomesecondid(json.getInteger("someSecondId"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someSecondId",getSomesecondid());
// json.put("someJsonObject",getSomejsonobject());
// return json;
// }
//
// }
|
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.classic.async.vertx.tables.interfaces.ISomethingcomposite;
|
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomethingcomposite.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingcomposite extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingComposite.someId</code>.
// */
// public ISomethingcomposite setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingComposite.someSecondId</code>.
// */
// public ISomethingcomposite setSomesecondid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someSecondId</code>.
// */
// public Integer getSomesecondid();
//
// /**
// * Setter for <code>somethingComposite.someJsonObject</code>.
// */
// public ISomethingcomposite setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>somethingComposite.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public void from(generated.classic.async.vertx.tables.interfaces.ISomethingcomposite from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public <E extends generated.classic.async.vertx.tables.interfaces.ISomethingcomposite> E into(E into);
//
// @Override
// default ISomethingcomposite fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomesecondid(json.getInteger("someSecondId"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someSecondId",getSomesecondid());
// json.put("someJsonObject",getSomejsonobject());
// return json;
// }
//
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/pojos/Somethingcomposite.java
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.classic.async.vertx.tables.interfaces.ISomethingcomposite;
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public class Somethingcomposite implements ISomethingcomposite {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomethingwithoutjson.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
|
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomethingwithoutjson.java
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public interface ISomethingwithoutjson extends VertxPojo, Serializable {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomethingcomposite.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonObject;
|
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomethingcomposite.java
import java.io.Serializable;
import javax.annotation.Generated;
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonObject;
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public interface ISomethingcomposite extends VertxPojo, Serializable {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/pojos/Somethingcomposite.java
|
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomethingcomposite.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingcomposite extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingComposite.someId</code>.
// */
// public ISomethingcomposite setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingComposite.someSecondId</code>.
// */
// public ISomethingcomposite setSomesecondid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someSecondId</code>.
// */
// public Integer getSomesecondid();
//
// /**
// * Setter for <code>somethingComposite.someJsonObject</code>.
// */
// public ISomethingcomposite setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>somethingComposite.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public void from(generated.future.async.vertx.tables.interfaces.ISomethingcomposite from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public <E extends generated.future.async.vertx.tables.interfaces.ISomethingcomposite> E into(E into);
//
// @Override
// default ISomethingcomposite fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomesecondid(json.getInteger("someSecondId"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someSecondId",getSomesecondid());
// json.put("someJsonObject",getSomejsonobject());
// return json;
// }
//
// }
|
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.future.async.vertx.tables.interfaces.ISomethingcomposite;
|
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomethingcomposite.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingcomposite extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingComposite.someId</code>.
// */
// public ISomethingcomposite setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingComposite.someSecondId</code>.
// */
// public ISomethingcomposite setSomesecondid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someSecondId</code>.
// */
// public Integer getSomesecondid();
//
// /**
// * Setter for <code>somethingComposite.someJsonObject</code>.
// */
// public ISomethingcomposite setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>somethingComposite.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public void from(generated.future.async.vertx.tables.interfaces.ISomethingcomposite from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public <E extends generated.future.async.vertx.tables.interfaces.ISomethingcomposite> E into(E into);
//
// @Override
// default ISomethingcomposite fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomesecondid(json.getInteger("someSecondId"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someSecondId",getSomesecondid());
// json.put("someJsonObject",getSomejsonobject());
// return json;
// }
//
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/pojos/Somethingcomposite.java
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.future.async.vertx.tables.interfaces.ISomethingcomposite;
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public class Somethingcomposite implements ISomethingcomposite {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-rx/src/main/java/io/github/jklingsporn/vertx/jooq/async/rx/AsyncJooqSQLClient.java
|
// Path: vertx-jooq-async-rx/src/main/java/io/github/jklingsporn/vertx/jooq/async/rx/util/AsyncJooqSQLClientImpl.java
// public class AsyncJooqSQLClientImpl implements AsyncJooqSQLClient {
//
// private final Vertx vertx;
// private final AsyncSQLClient delegate;
//
// public AsyncJooqSQLClientImpl(Vertx vertx, AsyncSQLClient delegate) {
// this.vertx = vertx;
// this.delegate = delegate;
// }
//
// @Override
// public <P> Single<List<P>> fetch(Query query, java.util.function.Function<JsonObject, P> mapper){
// return getConnection().flatMap(executeAndClose(sqlConnection ->
// sqlConnection.rxQueryWithParams(query.getSQL(), getBindValues(query)).map(rs ->
// rs.getRows().stream().map(mapper).collect(Collectors.toList())
// )));
// }
//
// @Override
// public <P> Single<P> fetchOne(Query query, Function<JsonObject, P> mapper){
// return getConnection().flatMap(executeAndClose(sqlConnection ->
// sqlConnection.rxQueryWithParams(query.getSQL(), getBindValues(query)).map(rs -> {
// Optional<P> optional = rs.getRows().stream().findFirst().map(mapper);
// return optional.orElseGet(() -> null);
// })));
// }
//
// @Override
// public Single<Integer> execute(Query query){
// return getConnection()
// .flatMap(executeAndClose(sqlConnection ->
// sqlConnection
// .rxUpdateWithParams(query.getSQL(), getBindValues(query))
// .map(UpdateResult::getUpdated))
// );
// }
//
// @Override
// public Single<Long> insertReturning(Query query) {
// return getConnection()
// .flatMap(executeAndClose(sqlConnection ->
// sqlConnection
// .rxUpdateWithParams(query.getSQL(), getBindValues(query))
// .map(updateResult -> updateResult.getKeys().getLong(0)))
// );
// }
//
// private JsonArray getBindValues(Query query) {
// JsonArray bindValues = new JsonArray();
// for (Param<?> param : query.getParams().values()) {
// Object value = convertToDatabaseType(param);
// if(value==null){
// bindValues.addNull();
// }else{
// bindValues.add(value);
// }
// }
// return bindValues;
// }
//
// static <T> Object convertToDatabaseType(Param<T> param) {
// return param.getBinding().converter().to(param.getValue());
// }
//
// /**
// * @return a CompletableFuture that returns a SQLConnection or an Exception.
// */
// private Single<SQLConnection> getConnection(){
// return delegate().rxGetConnection();
// }
//
// private <R> io.reactivex.functions.Function<SQLConnection, Single<? extends R>> executeAndClose(Function<SQLConnection, Single<? extends R>> func) {
// return sqlConnection -> func.apply(sqlConnection).doAfterTerminate(sqlConnection::close);
// }
//
// @Override
// public AsyncSQLClient delegate() {
// return delegate;
// }
// }
|
import io.github.jklingsporn.vertx.jooq.async.rx.util.AsyncJooqSQLClientImpl;
import io.reactivex.Single;
import io.vertx.core.json.JsonObject;
import io.vertx.reactivex.core.Vertx;
import io.vertx.reactivex.ext.asyncsql.AsyncSQLClient;
import org.jooq.Query;
import java.util.List;
import java.util.function.Function;
|
package io.github.jklingsporn.vertx.jooq.async.rx;
/**
* Created by jensklingsporn on 13.06.17.
*/
public interface AsyncJooqSQLClient {
public static AsyncJooqSQLClient create(Vertx vertx, AsyncSQLClient delegate){
|
// Path: vertx-jooq-async-rx/src/main/java/io/github/jklingsporn/vertx/jooq/async/rx/util/AsyncJooqSQLClientImpl.java
// public class AsyncJooqSQLClientImpl implements AsyncJooqSQLClient {
//
// private final Vertx vertx;
// private final AsyncSQLClient delegate;
//
// public AsyncJooqSQLClientImpl(Vertx vertx, AsyncSQLClient delegate) {
// this.vertx = vertx;
// this.delegate = delegate;
// }
//
// @Override
// public <P> Single<List<P>> fetch(Query query, java.util.function.Function<JsonObject, P> mapper){
// return getConnection().flatMap(executeAndClose(sqlConnection ->
// sqlConnection.rxQueryWithParams(query.getSQL(), getBindValues(query)).map(rs ->
// rs.getRows().stream().map(mapper).collect(Collectors.toList())
// )));
// }
//
// @Override
// public <P> Single<P> fetchOne(Query query, Function<JsonObject, P> mapper){
// return getConnection().flatMap(executeAndClose(sqlConnection ->
// sqlConnection.rxQueryWithParams(query.getSQL(), getBindValues(query)).map(rs -> {
// Optional<P> optional = rs.getRows().stream().findFirst().map(mapper);
// return optional.orElseGet(() -> null);
// })));
// }
//
// @Override
// public Single<Integer> execute(Query query){
// return getConnection()
// .flatMap(executeAndClose(sqlConnection ->
// sqlConnection
// .rxUpdateWithParams(query.getSQL(), getBindValues(query))
// .map(UpdateResult::getUpdated))
// );
// }
//
// @Override
// public Single<Long> insertReturning(Query query) {
// return getConnection()
// .flatMap(executeAndClose(sqlConnection ->
// sqlConnection
// .rxUpdateWithParams(query.getSQL(), getBindValues(query))
// .map(updateResult -> updateResult.getKeys().getLong(0)))
// );
// }
//
// private JsonArray getBindValues(Query query) {
// JsonArray bindValues = new JsonArray();
// for (Param<?> param : query.getParams().values()) {
// Object value = convertToDatabaseType(param);
// if(value==null){
// bindValues.addNull();
// }else{
// bindValues.add(value);
// }
// }
// return bindValues;
// }
//
// static <T> Object convertToDatabaseType(Param<T> param) {
// return param.getBinding().converter().to(param.getValue());
// }
//
// /**
// * @return a CompletableFuture that returns a SQLConnection or an Exception.
// */
// private Single<SQLConnection> getConnection(){
// return delegate().rxGetConnection();
// }
//
// private <R> io.reactivex.functions.Function<SQLConnection, Single<? extends R>> executeAndClose(Function<SQLConnection, Single<? extends R>> func) {
// return sqlConnection -> func.apply(sqlConnection).doAfterTerminate(sqlConnection::close);
// }
//
// @Override
// public AsyncSQLClient delegate() {
// return delegate;
// }
// }
// Path: vertx-jooq-async-rx/src/main/java/io/github/jklingsporn/vertx/jooq/async/rx/AsyncJooqSQLClient.java
import io.github.jklingsporn.vertx.jooq.async.rx.util.AsyncJooqSQLClientImpl;
import io.reactivex.Single;
import io.vertx.core.json.JsonObject;
import io.vertx.reactivex.core.Vertx;
import io.vertx.reactivex.ext.asyncsql.AsyncSQLClient;
import org.jooq.Query;
import java.util.List;
import java.util.function.Function;
package io.github.jklingsporn.vertx.jooq.async.rx;
/**
* Created by jensklingsporn on 13.06.17.
*/
public interface AsyncJooqSQLClient {
public static AsyncJooqSQLClient create(Vertx vertx, AsyncSQLClient delegate){
|
return new AsyncJooqSQLClientImpl(vertx, delegate);
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-classic/src/main/java/io/github/jklingsporn/vertx/jooq/async/classic/AsyncJooqSQLClient.java
|
// Path: vertx-jooq-async-classic/src/main/java/io/github/jklingsporn/vertx/jooq/async/classic/impl/AsyncJooqSQLClientImpl.java
// public class AsyncJooqSQLClientImpl implements AsyncJooqSQLClient {
//
// private static final Logger logger = LoggerFactory.getLogger(AsyncJooqSQLClientImpl.class);
//
// private final Vertx vertx;
// private final AsyncSQLClient delegate;
//
// public AsyncJooqSQLClientImpl(Vertx vertx, AsyncSQLClient delegate) {
// this.vertx = vertx;
// this.delegate = delegate;
// }
//
// @Override
// public <P> void fetch(Query query, Function<JsonObject, P> mapper, Handler<AsyncResult<List<P>>> resultHandler) {
// getConnection().setHandler(sqlConnectionResult->{
// if(sqlConnectionResult.succeeded()){
// log("Fetch", ()-> query.getSQL(ParamType.INLINED));
// sqlConnectionResult.result().queryWithParams(
// query.getSQL(),
// getBindValues(query),
// executeAndClose(rs -> rs.getRows().stream().map(mapper).collect(Collectors.toList()), sqlConnectionResult.result(), resultHandler)
// );
// }else{
// resultHandler.handle(Future.failedFuture(sqlConnectionResult.cause()));
// }
// });
// }
//
// @Override
// public <P> void fetchOne(Query query, Function<JsonObject, P> mapper, Handler<AsyncResult<P>> resultHandler) {
// getConnection().setHandler(sqlConnectionResult->{
// if(sqlConnectionResult.succeeded()){
// log("Fetch one", ()-> query.getSQL(ParamType.INLINED));
// sqlConnectionResult.result().queryWithParams(
// query.getSQL(),
// getBindValues(query),
// executeAndClose(rs -> {
// if(rs.getRows().size() > 1){
// throw new TooManyRowsException(String.format("Got more than one row: %d",rs.getRows().size()));
// }
// Optional<P> optional = rs.getRows().stream().findFirst().map(mapper);
// return (optional.orElseGet(() -> null));
// },
// sqlConnectionResult.result(),
// resultHandler)
// );
// }else{
// resultHandler.handle(Future.failedFuture(sqlConnectionResult.cause()));
// }
// });
// }
//
// @Override
// public void execute(Query query, Handler<AsyncResult<Integer>> resultHandler) {
// getConnection().setHandler(sqlConnectionResult->{
// if(sqlConnectionResult.succeeded()){
// log("Execute", ()-> query.getSQL(ParamType.INLINED));
// sqlConnectionResult.result().updateWithParams(
// query.getSQL(),
// getBindValues(query),
// executeAndClose(UpdateResult::getUpdated,
// sqlConnectionResult.result(),
// resultHandler)
// );
// }else{
// resultHandler.handle(Future.failedFuture(sqlConnectionResult.cause()));
// }
// });
// }
//
// @Override
// public void insertReturning(Query query, Handler<AsyncResult<Long>> resultHandler) {
// getConnection().setHandler(sqlConnectionResult->{
// if(sqlConnectionResult.succeeded()){
// log("Insert Returning", ()-> query.getSQL(ParamType.INLINED));
// sqlConnectionResult.result().update(
// query.getSQL(ParamType.INLINED),
// executeAndClose(res -> res.getKeys().getLong(0),
// sqlConnectionResult.result(),
// resultHandler)
// );
// }else{
// resultHandler.handle(Future.failedFuture(sqlConnectionResult.cause()));
// }
// });
// }
//
// private void log(String type, Supplier<String> messageSupplier){
// if(logger.isDebugEnabled()){
// logger.debug("{}: {}",type, messageSupplier.get());
// }
// }
//
// private <P,U> Handler<AsyncResult<U>> executeAndClose(Function<U, P> func, SQLConnection sqlConnection, Handler<AsyncResult<P>> resultHandler) {
// return rs -> {
// try{
// if (rs.succeeded()) {
// resultHandler.handle(Future.succeededFuture(func.apply(rs.result())));
// } else {
// resultHandler.handle(Future.failedFuture(rs.cause()));
// }
// }catch(Throwable e) {
// resultHandler.handle(Future.failedFuture(e));
// }finally {
// sqlConnection.close();
// }
// };
// }
//
// private JsonArray getBindValues(Query query) {
// JsonArray bindValues = new JsonArray();
// for (Param<?> param : query.getParams().values()) {
// Object value = convertToDatabaseType(param);
// if(value==null){
// bindValues.addNull();
// }else{
// bindValues.add(value);
// }
// }
// return bindValues;
// }
//
// static <T> Object convertToDatabaseType(Param<T> param) {
// return param.getBinding().converter().to(param.getValue());
// }
//
// /**
// * @return a Future that returns a SQLConnection or an Exception.
// */
// private Future<SQLConnection> getConnection(){
// Future<SQLConnection> future = Future.future();
// delegate.getConnection(future);
// return future;
// }
//
// @Override
// public AsyncSQLClient delegate() {
// return delegate;
// }
// }
|
import io.github.jklingsporn.vertx.jooq.async.classic.impl.AsyncJooqSQLClientImpl;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.asyncsql.AsyncSQLClient;
import org.jooq.Query;
import java.util.List;
import java.util.function.Function;
|
package io.github.jklingsporn.vertx.jooq.async.classic;
/**
* Created by jensklingsporn on 13.06.17.
*/
public interface AsyncJooqSQLClient {
public static AsyncJooqSQLClient create(Vertx vertx, AsyncSQLClient delegate){
|
// Path: vertx-jooq-async-classic/src/main/java/io/github/jklingsporn/vertx/jooq/async/classic/impl/AsyncJooqSQLClientImpl.java
// public class AsyncJooqSQLClientImpl implements AsyncJooqSQLClient {
//
// private static final Logger logger = LoggerFactory.getLogger(AsyncJooqSQLClientImpl.class);
//
// private final Vertx vertx;
// private final AsyncSQLClient delegate;
//
// public AsyncJooqSQLClientImpl(Vertx vertx, AsyncSQLClient delegate) {
// this.vertx = vertx;
// this.delegate = delegate;
// }
//
// @Override
// public <P> void fetch(Query query, Function<JsonObject, P> mapper, Handler<AsyncResult<List<P>>> resultHandler) {
// getConnection().setHandler(sqlConnectionResult->{
// if(sqlConnectionResult.succeeded()){
// log("Fetch", ()-> query.getSQL(ParamType.INLINED));
// sqlConnectionResult.result().queryWithParams(
// query.getSQL(),
// getBindValues(query),
// executeAndClose(rs -> rs.getRows().stream().map(mapper).collect(Collectors.toList()), sqlConnectionResult.result(), resultHandler)
// );
// }else{
// resultHandler.handle(Future.failedFuture(sqlConnectionResult.cause()));
// }
// });
// }
//
// @Override
// public <P> void fetchOne(Query query, Function<JsonObject, P> mapper, Handler<AsyncResult<P>> resultHandler) {
// getConnection().setHandler(sqlConnectionResult->{
// if(sqlConnectionResult.succeeded()){
// log("Fetch one", ()-> query.getSQL(ParamType.INLINED));
// sqlConnectionResult.result().queryWithParams(
// query.getSQL(),
// getBindValues(query),
// executeAndClose(rs -> {
// if(rs.getRows().size() > 1){
// throw new TooManyRowsException(String.format("Got more than one row: %d",rs.getRows().size()));
// }
// Optional<P> optional = rs.getRows().stream().findFirst().map(mapper);
// return (optional.orElseGet(() -> null));
// },
// sqlConnectionResult.result(),
// resultHandler)
// );
// }else{
// resultHandler.handle(Future.failedFuture(sqlConnectionResult.cause()));
// }
// });
// }
//
// @Override
// public void execute(Query query, Handler<AsyncResult<Integer>> resultHandler) {
// getConnection().setHandler(sqlConnectionResult->{
// if(sqlConnectionResult.succeeded()){
// log("Execute", ()-> query.getSQL(ParamType.INLINED));
// sqlConnectionResult.result().updateWithParams(
// query.getSQL(),
// getBindValues(query),
// executeAndClose(UpdateResult::getUpdated,
// sqlConnectionResult.result(),
// resultHandler)
// );
// }else{
// resultHandler.handle(Future.failedFuture(sqlConnectionResult.cause()));
// }
// });
// }
//
// @Override
// public void insertReturning(Query query, Handler<AsyncResult<Long>> resultHandler) {
// getConnection().setHandler(sqlConnectionResult->{
// if(sqlConnectionResult.succeeded()){
// log("Insert Returning", ()-> query.getSQL(ParamType.INLINED));
// sqlConnectionResult.result().update(
// query.getSQL(ParamType.INLINED),
// executeAndClose(res -> res.getKeys().getLong(0),
// sqlConnectionResult.result(),
// resultHandler)
// );
// }else{
// resultHandler.handle(Future.failedFuture(sqlConnectionResult.cause()));
// }
// });
// }
//
// private void log(String type, Supplier<String> messageSupplier){
// if(logger.isDebugEnabled()){
// logger.debug("{}: {}",type, messageSupplier.get());
// }
// }
//
// private <P,U> Handler<AsyncResult<U>> executeAndClose(Function<U, P> func, SQLConnection sqlConnection, Handler<AsyncResult<P>> resultHandler) {
// return rs -> {
// try{
// if (rs.succeeded()) {
// resultHandler.handle(Future.succeededFuture(func.apply(rs.result())));
// } else {
// resultHandler.handle(Future.failedFuture(rs.cause()));
// }
// }catch(Throwable e) {
// resultHandler.handle(Future.failedFuture(e));
// }finally {
// sqlConnection.close();
// }
// };
// }
//
// private JsonArray getBindValues(Query query) {
// JsonArray bindValues = new JsonArray();
// for (Param<?> param : query.getParams().values()) {
// Object value = convertToDatabaseType(param);
// if(value==null){
// bindValues.addNull();
// }else{
// bindValues.add(value);
// }
// }
// return bindValues;
// }
//
// static <T> Object convertToDatabaseType(Param<T> param) {
// return param.getBinding().converter().to(param.getValue());
// }
//
// /**
// * @return a Future that returns a SQLConnection or an Exception.
// */
// private Future<SQLConnection> getConnection(){
// Future<SQLConnection> future = Future.future();
// delegate.getConnection(future);
// return future;
// }
//
// @Override
// public AsyncSQLClient delegate() {
// return delegate;
// }
// }
// Path: vertx-jooq-async-classic/src/main/java/io/github/jklingsporn/vertx/jooq/async/classic/AsyncJooqSQLClient.java
import io.github.jklingsporn.vertx.jooq.async.classic.impl.AsyncJooqSQLClientImpl;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.asyncsql.AsyncSQLClient;
import org.jooq.Query;
import java.util.List;
import java.util.function.Function;
package io.github.jklingsporn.vertx.jooq.async.classic;
/**
* Created by jensklingsporn on 13.06.17.
*/
public interface AsyncJooqSQLClient {
public static AsyncJooqSQLClient create(Vertx vertx, AsyncSQLClient delegate){
|
return new AsyncJooqSQLClientImpl(vertx, delegate);
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-future/src/main/java/io/github/jklingsporn/vertx/jooq/async/future/AsyncJooqSQLClient.java
|
// Path: vertx-jooq-async-future/src/main/java/io/github/jklingsporn/vertx/jooq/async/future/impl/AsyncJooqSQLClientImpl.java
// public class AsyncJooqSQLClientImpl implements AsyncJooqSQLClient {
//
// private final Vertx vertx;
// private final AsyncSQLClient delegate;
//
// public AsyncJooqSQLClientImpl(Vertx vertx, AsyncSQLClient delegate) {
// this.vertx = vertx;
// this.delegate = delegate;
// }
//
// @Override
// public <P> CompletableFuture<List<P>> fetch(Query query, Function<JsonObject, P> mapper){
// return getConnection().thenCompose(sqlConnection -> {
// CompletableFuture<List<P>> cf = new VertxCompletableFuture<>(vertx);
// sqlConnection.queryWithParams(
// query.getSQL(),
// getBindValues(query),
// executeAndClose(rs ->
// rs.getRows().stream().map(mapper).collect(Collectors.toList()),
// sqlConnection,
// cf)
// );
// return cf;
// });
// }
//
// @Override
// public <P> CompletableFuture<P> fetchOne(Query query, Function<JsonObject, P> mapper){
// return getConnection().thenCompose(sqlConnection -> {
// CompletableFuture<P> cf = new VertxCompletableFuture<P>(vertx);
// sqlConnection.queryWithParams(query.getSQL(), getBindValues(query), executeAndClose(rs -> {
// Optional<P> optional = rs.getRows().stream().findFirst().map(mapper);
// return optional.orElseGet(() -> null);
// }, sqlConnection, cf));
// return cf;
// });
// }
//
// @Override
// public CompletableFuture<Integer> execute(Query query){
// return getConnection().thenCompose(sqlConnection -> {
// CompletableFuture<Integer> cf = new VertxCompletableFuture<>(vertx);
// JsonArray bindValues = getBindValues(query);
// sqlConnection.updateWithParams(query.getSQL(), bindValues, executeAndClose(UpdateResult::getUpdated,sqlConnection,cf));
// return cf;
// });
// }
//
// @Override
// public CompletableFuture<Long> insertReturning(Query query) {
// return getConnection().thenCompose(sqlConnection -> {
// CompletableFuture<Long> cf = new VertxCompletableFuture<>(vertx);
// sqlConnection.update(query.getSQL(ParamType.INLINED), executeAndClose(updateResult->updateResult.getKeys().getLong(0), sqlConnection, cf));
// return cf;
// });
// }
//
// private JsonArray getBindValues(Query query) {
// JsonArray bindValues = new JsonArray();
// for (Param<?> param : query.getParams().values()) {
// Object value = convertToDatabaseType(param);
// if(value==null){
// bindValues.addNull();
// }else{
// bindValues.add(value);
// }
// }
// return bindValues;
// }
//
// static <T> Object convertToDatabaseType(Param<T> param) {
// return param.getBinding().converter().to(param.getValue());
// }
//
// /**
// * @return a CompletableFuture that returns a SQLConnection or an Exception.
// */
// private CompletableFuture<SQLConnection> getConnection(){
// CompletableFuture<SQLConnection> cf = new VertxCompletableFuture<>(vertx);
// delegate.getConnection(h -> {
// if (h.succeeded()) {
// cf.complete(h.result());
// } else {
// cf.completeExceptionally(h.cause());
// }
// });
// return cf;
// }
//
// private <P,U> Handler<AsyncResult<U>> executeAndClose(Function<U, P> func, SQLConnection sqlConnection, CompletableFuture<P> cf) {
// return rs -> {
// try{
// if (rs.succeeded()) {
// cf.complete(func.apply(rs.result()));
// } else {
// cf.completeExceptionally(rs.cause());
// }
// }finally {
// sqlConnection.close();
// }
// };
// }
//
// @Override
// public AsyncSQLClient delegate() {
// return delegate;
// }
// }
|
import io.github.jklingsporn.vertx.jooq.async.future.impl.AsyncJooqSQLClientImpl;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.asyncsql.AsyncSQLClient;
import org.jooq.Query;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
|
package io.github.jklingsporn.vertx.jooq.async.future;
/**
* Created by jensklingsporn on 13.06.17.
*/
public interface AsyncJooqSQLClient {
public static AsyncJooqSQLClient create(Vertx vertx,AsyncSQLClient delegate){
|
// Path: vertx-jooq-async-future/src/main/java/io/github/jklingsporn/vertx/jooq/async/future/impl/AsyncJooqSQLClientImpl.java
// public class AsyncJooqSQLClientImpl implements AsyncJooqSQLClient {
//
// private final Vertx vertx;
// private final AsyncSQLClient delegate;
//
// public AsyncJooqSQLClientImpl(Vertx vertx, AsyncSQLClient delegate) {
// this.vertx = vertx;
// this.delegate = delegate;
// }
//
// @Override
// public <P> CompletableFuture<List<P>> fetch(Query query, Function<JsonObject, P> mapper){
// return getConnection().thenCompose(sqlConnection -> {
// CompletableFuture<List<P>> cf = new VertxCompletableFuture<>(vertx);
// sqlConnection.queryWithParams(
// query.getSQL(),
// getBindValues(query),
// executeAndClose(rs ->
// rs.getRows().stream().map(mapper).collect(Collectors.toList()),
// sqlConnection,
// cf)
// );
// return cf;
// });
// }
//
// @Override
// public <P> CompletableFuture<P> fetchOne(Query query, Function<JsonObject, P> mapper){
// return getConnection().thenCompose(sqlConnection -> {
// CompletableFuture<P> cf = new VertxCompletableFuture<P>(vertx);
// sqlConnection.queryWithParams(query.getSQL(), getBindValues(query), executeAndClose(rs -> {
// Optional<P> optional = rs.getRows().stream().findFirst().map(mapper);
// return optional.orElseGet(() -> null);
// }, sqlConnection, cf));
// return cf;
// });
// }
//
// @Override
// public CompletableFuture<Integer> execute(Query query){
// return getConnection().thenCompose(sqlConnection -> {
// CompletableFuture<Integer> cf = new VertxCompletableFuture<>(vertx);
// JsonArray bindValues = getBindValues(query);
// sqlConnection.updateWithParams(query.getSQL(), bindValues, executeAndClose(UpdateResult::getUpdated,sqlConnection,cf));
// return cf;
// });
// }
//
// @Override
// public CompletableFuture<Long> insertReturning(Query query) {
// return getConnection().thenCompose(sqlConnection -> {
// CompletableFuture<Long> cf = new VertxCompletableFuture<>(vertx);
// sqlConnection.update(query.getSQL(ParamType.INLINED), executeAndClose(updateResult->updateResult.getKeys().getLong(0), sqlConnection, cf));
// return cf;
// });
// }
//
// private JsonArray getBindValues(Query query) {
// JsonArray bindValues = new JsonArray();
// for (Param<?> param : query.getParams().values()) {
// Object value = convertToDatabaseType(param);
// if(value==null){
// bindValues.addNull();
// }else{
// bindValues.add(value);
// }
// }
// return bindValues;
// }
//
// static <T> Object convertToDatabaseType(Param<T> param) {
// return param.getBinding().converter().to(param.getValue());
// }
//
// /**
// * @return a CompletableFuture that returns a SQLConnection or an Exception.
// */
// private CompletableFuture<SQLConnection> getConnection(){
// CompletableFuture<SQLConnection> cf = new VertxCompletableFuture<>(vertx);
// delegate.getConnection(h -> {
// if (h.succeeded()) {
// cf.complete(h.result());
// } else {
// cf.completeExceptionally(h.cause());
// }
// });
// return cf;
// }
//
// private <P,U> Handler<AsyncResult<U>> executeAndClose(Function<U, P> func, SQLConnection sqlConnection, CompletableFuture<P> cf) {
// return rs -> {
// try{
// if (rs.succeeded()) {
// cf.complete(func.apply(rs.result()));
// } else {
// cf.completeExceptionally(rs.cause());
// }
// }finally {
// sqlConnection.close();
// }
// };
// }
//
// @Override
// public AsyncSQLClient delegate() {
// return delegate;
// }
// }
// Path: vertx-jooq-async-future/src/main/java/io/github/jklingsporn/vertx/jooq/async/future/AsyncJooqSQLClient.java
import io.github.jklingsporn.vertx.jooq.async.future.impl.AsyncJooqSQLClientImpl;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.asyncsql.AsyncSQLClient;
import org.jooq.Query;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
package io.github.jklingsporn.vertx.jooq.async.future;
/**
* Created by jensklingsporn on 13.06.17.
*/
public interface AsyncJooqSQLClient {
public static AsyncJooqSQLClient create(Vertx vertx,AsyncSQLClient delegate){
|
return new AsyncJooqSQLClientImpl(vertx, delegate);
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/internal/VertxDAOHelper.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.impl.Arguments;
import io.vertx.core.json.JsonObject;
import org.jooq.*;
import org.jooq.impl.DSL;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import static org.jooq.impl.DSL.row;
|
package io.github.jklingsporn.vertx.jooq.async.shared.internal;
/**
* Created by jensklingsporn on 23.11.17.
* Utility class to reduce duplicate code in the different VertxDAO implementations.
* Only meant to be used by vertx-jooq-async.
*/
public class VertxDAOHelper {
private VertxDAOHelper() {
}
static EnumSet<SQLDialect> INSERT_RETURNING_SUPPORT = EnumSet.of(SQLDialect.MYSQL,SQLDialect.MYSQL_5_7,SQLDialect.MYSQL_8_0);
@SuppressWarnings("unchecked")
public static <R extends UpdatableRecord<R>,T,F> F applyConditionally(T id, Table<R> table, Function<Condition, F> function){
UniqueKey<?> uk = table.getPrimaryKey();
Objects.requireNonNull(uk,()->"No primary key");
/**
* Copied from jOOQs DAOImpl#equal-method
*/
TableField<? extends Record, ?>[] pk = uk.getFieldsArray();
Condition condition;
if (pk.length == 1) {
condition = ((Field<Object>) pk[0]).equal(pk[0].getDataType().convert(id));
}
else {
condition = row(pk).equal((Record) id);
}
return function.apply(condition);
}
@SuppressWarnings("unchecked")
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/internal/VertxDAOHelper.java
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.impl.Arguments;
import io.vertx.core.json.JsonObject;
import org.jooq.*;
import org.jooq.impl.DSL;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import static org.jooq.impl.DSL.row;
package io.github.jklingsporn.vertx.jooq.async.shared.internal;
/**
* Created by jensklingsporn on 23.11.17.
* Utility class to reduce duplicate code in the different VertxDAO implementations.
* Only meant to be used by vertx-jooq-async.
*/
public class VertxDAOHelper {
private VertxDAOHelper() {
}
static EnumSet<SQLDialect> INSERT_RETURNING_SUPPORT = EnumSet.of(SQLDialect.MYSQL,SQLDialect.MYSQL_5_7,SQLDialect.MYSQL_8_0);
@SuppressWarnings("unchecked")
public static <R extends UpdatableRecord<R>,T,F> F applyConditionally(T id, Table<R> table, Function<Condition, F> function){
UniqueKey<?> uk = table.getPrimaryKey();
Objects.requireNonNull(uk,()->"No primary key");
/**
* Copied from jOOQs DAOImpl#equal-method
*/
TableField<? extends Record, ?>[] pk = uk.getFieldsArray();
Condition condition;
if (pk.length == 1) {
condition = ((Field<Object>) pk[0]).equal(pk[0].getDataType().convert(id));
}
else {
condition = row(pk).equal((Record) id);
}
return function.apply(condition);
}
@SuppressWarnings("unchecked")
|
public static <P extends VertxPojo, R extends UpdatableRecord<R>,T,F> F updateExecAsync(P object, DAO<R,P,T> dao, Function<Query,F> function){
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/main/java/io/github/jklingsporn/vertx/jooq/async/generate/VertxGeneratorStrategy.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import org.jooq.util.DefaultGeneratorStrategy;
import org.jooq.util.Definition;
import java.util.List;
|
package io.github.jklingsporn.vertx.jooq.async.generate;
/**
* Created by jensklingsporn on 25.10.16.
*
* We need this class to let the DAOs implements <code>VertxDAO</code>.
* Unfortunately we can not get the type easily, that's why we have to
* set the placeholder.
*/
public class VertxGeneratorStrategy extends DefaultGeneratorStrategy {
private final String daoClassName;
public VertxGeneratorStrategy(String daoClassName) {
this.daoClassName = daoClassName;
}
@Override
public List<String> getJavaClassImplements(Definition definition, Mode mode) {
List<String> javaClassImplements = super.getJavaClassImplements(definition, mode);
if(mode.equals(Mode.DAO)){
final String tableRecord = getFullJavaClassName(definition, Mode.RECORD);
final String pType = getFullJavaClassName(definition, Mode.POJO);
javaClassImplements.add(String.format("%s<%s,%s,%s>",daoClassName,tableRecord,pType, VertxJavaWriter.PLACEHOLDER_DAO_TYPE));
}else if(mode.equals(Mode.INTERFACE)){
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/main/java/io/github/jklingsporn/vertx/jooq/async/generate/VertxGeneratorStrategy.java
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import org.jooq.util.DefaultGeneratorStrategy;
import org.jooq.util.Definition;
import java.util.List;
package io.github.jklingsporn.vertx.jooq.async.generate;
/**
* Created by jensklingsporn on 25.10.16.
*
* We need this class to let the DAOs implements <code>VertxDAO</code>.
* Unfortunately we can not get the type easily, that's why we have to
* set the placeholder.
*/
public class VertxGeneratorStrategy extends DefaultGeneratorStrategy {
private final String daoClassName;
public VertxGeneratorStrategy(String daoClassName) {
this.daoClassName = daoClassName;
}
@Override
public List<String> getJavaClassImplements(Definition definition, Mode mode) {
List<String> javaClassImplements = super.getJavaClassImplements(definition, mode);
if(mode.equals(Mode.DAO)){
final String tableRecord = getFullJavaClassName(definition, Mode.RECORD);
final String pType = getFullJavaClassName(definition, Mode.POJO);
javaClassImplements.add(String.format("%s<%s,%s,%s>",daoClassName,tableRecord,pType, VertxJavaWriter.PLACEHOLDER_DAO_TYPE));
}else if(mode.equals(Mode.INTERFACE)){
|
javaClassImplements.add(VertxPojo.class.getName());
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/pojos/Somethingcomposite.java
|
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomethingcomposite.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingcomposite extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingComposite.someId</code>.
// */
// public ISomethingcomposite setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingComposite.someSecondId</code>.
// */
// public ISomethingcomposite setSomesecondid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someSecondId</code>.
// */
// public Integer getSomesecondid();
//
// /**
// * Setter for <code>somethingComposite.someJsonObject</code>.
// */
// public ISomethingcomposite setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>somethingComposite.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public void from(generated.rx.async.vertx.tables.interfaces.ISomethingcomposite from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public <E extends generated.rx.async.vertx.tables.interfaces.ISomethingcomposite> E into(E into);
//
// @Override
// default ISomethingcomposite fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomesecondid(json.getInteger("someSecondId"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someSecondId",getSomesecondid());
// json.put("someJsonObject",getSomejsonobject());
// return json;
// }
//
// }
|
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.rx.async.vertx.tables.interfaces.ISomethingcomposite;
|
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomethingcomposite.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingcomposite extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingComposite.someId</code>.
// */
// public ISomethingcomposite setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingComposite.someSecondId</code>.
// */
// public ISomethingcomposite setSomesecondid(Integer value);
//
// /**
// * Getter for <code>somethingComposite.someSecondId</code>.
// */
// public Integer getSomesecondid();
//
// /**
// * Setter for <code>somethingComposite.someJsonObject</code>.
// */
// public ISomethingcomposite setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>somethingComposite.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public void from(generated.rx.async.vertx.tables.interfaces.ISomethingcomposite from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingcomposite
// */
// public <E extends generated.rx.async.vertx.tables.interfaces.ISomethingcomposite> E into(E into);
//
// @Override
// default ISomethingcomposite fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomesecondid(json.getInteger("someSecondId"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someSecondId",getSomesecondid());
// json.put("someJsonObject",getSomejsonobject());
// return json;
// }
//
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/pojos/Somethingcomposite.java
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.rx.async.vertx.tables.interfaces.ISomethingcomposite;
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public class Somethingcomposite implements ISomethingcomposite {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/pojos/Somethingwithoutjson.java
|
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomethingwithoutjson.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingwithoutjson extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingWithoutJson.someId</code>.
// */
// public ISomethingwithoutjson setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingWithoutJson.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingWithoutJson.someString</code>.
// */
// public ISomethingwithoutjson setSomestring(String value);
//
// /**
// * Getter for <code>somethingWithoutJson.someString</code>.
// */
// public String getSomestring();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public void from(generated.rx.async.vertx.tables.interfaces.ISomethingwithoutjson from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public <E extends generated.rx.async.vertx.tables.interfaces.ISomethingwithoutjson> E into(E into);
//
// @Override
// default ISomethingwithoutjson fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// return json;
// }
//
// }
|
import javax.annotation.Generated;
import generated.rx.async.vertx.tables.interfaces.ISomethingwithoutjson;
|
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomethingwithoutjson.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingwithoutjson extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingWithoutJson.someId</code>.
// */
// public ISomethingwithoutjson setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingWithoutJson.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingWithoutJson.someString</code>.
// */
// public ISomethingwithoutjson setSomestring(String value);
//
// /**
// * Getter for <code>somethingWithoutJson.someString</code>.
// */
// public String getSomestring();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public void from(generated.rx.async.vertx.tables.interfaces.ISomethingwithoutjson from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public <E extends generated.rx.async.vertx.tables.interfaces.ISomethingwithoutjson> E into(E into);
//
// @Override
// default ISomethingwithoutjson fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// return json;
// }
//
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/pojos/Somethingwithoutjson.java
import javax.annotation.Generated;
import generated.rx.async.vertx.tables.interfaces.ISomethingwithoutjson;
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public class Somethingwithoutjson implements ISomethingwithoutjson {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/pojos/Something.java
|
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomething.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomething extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>something.someId</code>.
// */
// public ISomething setSomeid(Integer value);
//
// /**
// * Getter for <code>something.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>something.someString</code>.
// */
// public ISomething setSomestring(String value);
//
// /**
// * Getter for <code>something.someString</code>.
// */
// public String getSomestring();
//
// /**
// * Setter for <code>something.someHugeNumber</code>.
// */
// public ISomething setSomehugenumber(Long value);
//
// /**
// * Getter for <code>something.someHugeNumber</code>.
// */
// public Long getSomehugenumber();
//
// /**
// * Setter for <code>something.someSmallNumber</code>.
// */
// public ISomething setSomesmallnumber(Short value);
//
// /**
// * Getter for <code>something.someSmallNumber</code>.
// */
// public Short getSomesmallnumber();
//
// /**
// * Setter for <code>something.someRegularNumber</code>.
// */
// public ISomething setSomeregularnumber(Integer value);
//
// /**
// * Getter for <code>something.someRegularNumber</code>.
// */
// public Integer getSomeregularnumber();
//
// /**
// * Setter for <code>something.someDouble</code>.
// */
// public ISomething setSomedouble(Double value);
//
// /**
// * Getter for <code>something.someDouble</code>.
// */
// public Double getSomedouble();
//
// /**
// * Setter for <code>something.someEnum</code>.
// */
// public ISomething setSomeenum(String value);
//
// /**
// * Getter for <code>something.someEnum</code>.
// */
// public String getSomeenum();
//
// /**
// * Setter for <code>something.someJsonObject</code>.
// */
// public ISomething setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>something.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// /**
// * Setter for <code>something.someJsonArray</code>.
// */
// public ISomething setSomejsonarray(JsonArray value);
//
// /**
// * Getter for <code>something.someJsonArray</code>.
// */
// public JsonArray getSomejsonarray();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomething
// */
// public void from(generated.rx.async.vertx.tables.interfaces.ISomething from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomething
// */
// public <E extends generated.rx.async.vertx.tables.interfaces.ISomething> E into(E into);
//
// @Override
// default ISomething fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// setSomehugenumber(json.getLong("someHugeNumber"));
// setSomesmallnumber(json.getInteger("someSmallNumber")==null?null:json.getInteger("someSmallNumber").shortValue());
// setSomeregularnumber(json.getInteger("someRegularNumber"));
// setSomedouble(json.getDouble("someDouble"));
// setSomeenum(json.getString("someEnum"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// setSomejsonarray(json.getJsonArray("someJsonArray"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// json.put("someHugeNumber",getSomehugenumber());
// json.put("someSmallNumber",getSomesmallnumber());
// json.put("someRegularNumber",getSomeregularnumber());
// json.put("someDouble",getSomedouble());
// json.put("someEnum",getSomeenum());
// json.put("someJsonObject",getSomejsonobject());
// json.put("someJsonArray",getSomejsonarray());
// return json;
// }
//
// }
|
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.rx.async.vertx.tables.interfaces.ISomething;
|
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomething.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomething extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>something.someId</code>.
// */
// public ISomething setSomeid(Integer value);
//
// /**
// * Getter for <code>something.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>something.someString</code>.
// */
// public ISomething setSomestring(String value);
//
// /**
// * Getter for <code>something.someString</code>.
// */
// public String getSomestring();
//
// /**
// * Setter for <code>something.someHugeNumber</code>.
// */
// public ISomething setSomehugenumber(Long value);
//
// /**
// * Getter for <code>something.someHugeNumber</code>.
// */
// public Long getSomehugenumber();
//
// /**
// * Setter for <code>something.someSmallNumber</code>.
// */
// public ISomething setSomesmallnumber(Short value);
//
// /**
// * Getter for <code>something.someSmallNumber</code>.
// */
// public Short getSomesmallnumber();
//
// /**
// * Setter for <code>something.someRegularNumber</code>.
// */
// public ISomething setSomeregularnumber(Integer value);
//
// /**
// * Getter for <code>something.someRegularNumber</code>.
// */
// public Integer getSomeregularnumber();
//
// /**
// * Setter for <code>something.someDouble</code>.
// */
// public ISomething setSomedouble(Double value);
//
// /**
// * Getter for <code>something.someDouble</code>.
// */
// public Double getSomedouble();
//
// /**
// * Setter for <code>something.someEnum</code>.
// */
// public ISomething setSomeenum(String value);
//
// /**
// * Getter for <code>something.someEnum</code>.
// */
// public String getSomeenum();
//
// /**
// * Setter for <code>something.someJsonObject</code>.
// */
// public ISomething setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>something.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// /**
// * Setter for <code>something.someJsonArray</code>.
// */
// public ISomething setSomejsonarray(JsonArray value);
//
// /**
// * Getter for <code>something.someJsonArray</code>.
// */
// public JsonArray getSomejsonarray();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomething
// */
// public void from(generated.rx.async.vertx.tables.interfaces.ISomething from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomething
// */
// public <E extends generated.rx.async.vertx.tables.interfaces.ISomething> E into(E into);
//
// @Override
// default ISomething fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// setSomehugenumber(json.getLong("someHugeNumber"));
// setSomesmallnumber(json.getInteger("someSmallNumber")==null?null:json.getInteger("someSmallNumber").shortValue());
// setSomeregularnumber(json.getInteger("someRegularNumber"));
// setSomedouble(json.getDouble("someDouble"));
// setSomeenum(json.getString("someEnum"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// setSomejsonarray(json.getJsonArray("someJsonArray"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// json.put("someHugeNumber",getSomehugenumber());
// json.put("someSmallNumber",getSomesmallnumber());
// json.put("someRegularNumber",getSomeregularnumber());
// json.put("someDouble",getSomedouble());
// json.put("someEnum",getSomeenum());
// json.put("someJsonObject",getSomejsonobject());
// json.put("someJsonArray",getSomejsonarray());
// return json;
// }
//
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/pojos/Something.java
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.rx.async.vertx.tables.interfaces.ISomething;
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public class Something implements ISomething {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/main/java/io/github/jklingsporn/vertx/jooq/async/generate/AbstractVertxGenerator.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/JsonArrayConverter.java
// public class JsonArrayConverter implements Converter<String,JsonArray> {
//
// private static JsonArrayConverter INSTANCE;
// public static JsonArrayConverter getInstance() {
// return INSTANCE == null ? INSTANCE = new JsonArrayConverter() : INSTANCE;
// }
//
// @Override
// public JsonArray from(String databaseObject) {
// return databaseObject==null?null:new JsonArray(databaseObject);
// }
//
// @Override
// public String to(JsonArray userObject) {
// return userObject==null?null:userObject.encode();
// }
//
// @Override
// public Class<String> fromType() {
// return String.class;
// }
//
// @Override
// public Class<JsonArray> toType() {
// return JsonArray.class;
// }
// }
//
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/JsonObjectConverter.java
// public class JsonObjectConverter implements Converter<String,JsonObject> {
//
// private static JsonObjectConverter INSTANCE;
// public static JsonObjectConverter getInstance() {
// return INSTANCE == null ? INSTANCE = new JsonObjectConverter() : INSTANCE;
// }
//
// @Override
// public JsonObject from(String databaseObject) {
// return databaseObject==null?null:new JsonObject(databaseObject);
// }
//
// @Override
// public String to(JsonObject userObject) {
// return userObject==null?null:userObject.encode();
// }
//
// @Override
// public Class<String> fromType() {
// return String.class;
// }
//
// @Override
// public Class<JsonObject> toType() {
// return JsonObject.class;
// }
// }
|
import io.github.jklingsporn.vertx.jooq.async.shared.JsonArrayConverter;
import io.github.jklingsporn.vertx.jooq.async.shared.JsonObjectConverter;
import io.vertx.core.json.JsonObject;
import org.jooq.Constants;
import org.jooq.Record;
import org.jooq.tools.JooqLogger;
import org.jooq.util.*;
import java.io.File;
import java.time.Instant;
import java.util.Collection;
import java.util.List;
|
out.tab(1).println("@Override");
out.tab(1).println("default %s fromJson(io.vertx.core.json.JsonObject json) {",className);
for (ColumnDefinition column : table.getColumns()) {
String setter = getStrategy().getJavaSetterName(column, GeneratorStrategy.Mode.INTERFACE);
String columnType = getJavaType(column.getType());
String jsonName = getJsonName(column);
if(handleCustomTypeFromJson(column, setter, columnType, jsonName, out)) {
//handled by user
}else if(isType(columnType, Integer.class)){
out.tab(2).println("%s(json.getInteger(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Short.class)){
out.tab(2).println("%s(json.getInteger(\"%s\")==null?null:json.getInteger(\"%s\").shortValue());", setter, jsonName, jsonName);
}else if(isType(columnType, Byte.class)){
out.tab(2).println("%s(json.getInteger(\"%s\")==null?null:json.getInteger(\"%s\").byteValue());", setter,jsonName, jsonName);
}else if(isType(columnType, Long.class)){
out.tab(2).println("%s(json.getLong(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Float.class)){
out.tab(2).println("%s(json.getFloat(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Double.class)){
out.tab(2).println("%s(json.getDouble(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Boolean.class)){
out.tab(2).println("%s(json.getBoolean(\"%s\"));", setter, jsonName);
}else if(isType(columnType, String.class)){
out.tab(2).println("%s(json.getString(\"%s\"));", setter, jsonName);
}else if(columnType.equals(byte.class.getName()+"[]")){
out.tab(2).println("%s(json.getBinary(\"%s\"));", setter, jsonName);
}else if(isType(columnType,Instant.class)){
out.tab(2).println("%s(json.getInstant(\"%s\"));", setter, jsonName);
}else if(isEnum(table, column)) {
out.tab(2).println("%s(java.util.Arrays.stream(%s.values()).filter(td -> td.getLiteral().equals(json.getString(\"%s\"))).findFirst().orElse(null));", setter, columnType, jsonName);
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/JsonArrayConverter.java
// public class JsonArrayConverter implements Converter<String,JsonArray> {
//
// private static JsonArrayConverter INSTANCE;
// public static JsonArrayConverter getInstance() {
// return INSTANCE == null ? INSTANCE = new JsonArrayConverter() : INSTANCE;
// }
//
// @Override
// public JsonArray from(String databaseObject) {
// return databaseObject==null?null:new JsonArray(databaseObject);
// }
//
// @Override
// public String to(JsonArray userObject) {
// return userObject==null?null:userObject.encode();
// }
//
// @Override
// public Class<String> fromType() {
// return String.class;
// }
//
// @Override
// public Class<JsonArray> toType() {
// return JsonArray.class;
// }
// }
//
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/JsonObjectConverter.java
// public class JsonObjectConverter implements Converter<String,JsonObject> {
//
// private static JsonObjectConverter INSTANCE;
// public static JsonObjectConverter getInstance() {
// return INSTANCE == null ? INSTANCE = new JsonObjectConverter() : INSTANCE;
// }
//
// @Override
// public JsonObject from(String databaseObject) {
// return databaseObject==null?null:new JsonObject(databaseObject);
// }
//
// @Override
// public String to(JsonObject userObject) {
// return userObject==null?null:userObject.encode();
// }
//
// @Override
// public Class<String> fromType() {
// return String.class;
// }
//
// @Override
// public Class<JsonObject> toType() {
// return JsonObject.class;
// }
// }
// Path: vertx-jooq-async-generate/src/main/java/io/github/jklingsporn/vertx/jooq/async/generate/AbstractVertxGenerator.java
import io.github.jklingsporn.vertx.jooq.async.shared.JsonArrayConverter;
import io.github.jklingsporn.vertx.jooq.async.shared.JsonObjectConverter;
import io.vertx.core.json.JsonObject;
import org.jooq.Constants;
import org.jooq.Record;
import org.jooq.tools.JooqLogger;
import org.jooq.util.*;
import java.io.File;
import java.time.Instant;
import java.util.Collection;
import java.util.List;
out.tab(1).println("@Override");
out.tab(1).println("default %s fromJson(io.vertx.core.json.JsonObject json) {",className);
for (ColumnDefinition column : table.getColumns()) {
String setter = getStrategy().getJavaSetterName(column, GeneratorStrategy.Mode.INTERFACE);
String columnType = getJavaType(column.getType());
String jsonName = getJsonName(column);
if(handleCustomTypeFromJson(column, setter, columnType, jsonName, out)) {
//handled by user
}else if(isType(columnType, Integer.class)){
out.tab(2).println("%s(json.getInteger(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Short.class)){
out.tab(2).println("%s(json.getInteger(\"%s\")==null?null:json.getInteger(\"%s\").shortValue());", setter, jsonName, jsonName);
}else if(isType(columnType, Byte.class)){
out.tab(2).println("%s(json.getInteger(\"%s\")==null?null:json.getInteger(\"%s\").byteValue());", setter,jsonName, jsonName);
}else if(isType(columnType, Long.class)){
out.tab(2).println("%s(json.getLong(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Float.class)){
out.tab(2).println("%s(json.getFloat(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Double.class)){
out.tab(2).println("%s(json.getDouble(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Boolean.class)){
out.tab(2).println("%s(json.getBoolean(\"%s\"));", setter, jsonName);
}else if(isType(columnType, String.class)){
out.tab(2).println("%s(json.getString(\"%s\"));", setter, jsonName);
}else if(columnType.equals(byte.class.getName()+"[]")){
out.tab(2).println("%s(json.getBinary(\"%s\"));", setter, jsonName);
}else if(isType(columnType,Instant.class)){
out.tab(2).println("%s(json.getInstant(\"%s\"));", setter, jsonName);
}else if(isEnum(table, column)) {
out.tab(2).println("%s(java.util.Arrays.stream(%s.values()).filter(td -> td.getLiteral().equals(json.getString(\"%s\"))).findFirst().orElse(null));", setter, columnType, jsonName);
|
}else if(column.getType().getConverter() != null && isType(column.getType().getConverter(),JsonObjectConverter.class)){
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/main/java/io/github/jklingsporn/vertx/jooq/async/generate/AbstractVertxGenerator.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/JsonArrayConverter.java
// public class JsonArrayConverter implements Converter<String,JsonArray> {
//
// private static JsonArrayConverter INSTANCE;
// public static JsonArrayConverter getInstance() {
// return INSTANCE == null ? INSTANCE = new JsonArrayConverter() : INSTANCE;
// }
//
// @Override
// public JsonArray from(String databaseObject) {
// return databaseObject==null?null:new JsonArray(databaseObject);
// }
//
// @Override
// public String to(JsonArray userObject) {
// return userObject==null?null:userObject.encode();
// }
//
// @Override
// public Class<String> fromType() {
// return String.class;
// }
//
// @Override
// public Class<JsonArray> toType() {
// return JsonArray.class;
// }
// }
//
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/JsonObjectConverter.java
// public class JsonObjectConverter implements Converter<String,JsonObject> {
//
// private static JsonObjectConverter INSTANCE;
// public static JsonObjectConverter getInstance() {
// return INSTANCE == null ? INSTANCE = new JsonObjectConverter() : INSTANCE;
// }
//
// @Override
// public JsonObject from(String databaseObject) {
// return databaseObject==null?null:new JsonObject(databaseObject);
// }
//
// @Override
// public String to(JsonObject userObject) {
// return userObject==null?null:userObject.encode();
// }
//
// @Override
// public Class<String> fromType() {
// return String.class;
// }
//
// @Override
// public Class<JsonObject> toType() {
// return JsonObject.class;
// }
// }
|
import io.github.jklingsporn.vertx.jooq.async.shared.JsonArrayConverter;
import io.github.jklingsporn.vertx.jooq.async.shared.JsonObjectConverter;
import io.vertx.core.json.JsonObject;
import org.jooq.Constants;
import org.jooq.Record;
import org.jooq.tools.JooqLogger;
import org.jooq.util.*;
import java.io.File;
import java.time.Instant;
import java.util.Collection;
import java.util.List;
|
for (ColumnDefinition column : table.getColumns()) {
String setter = getStrategy().getJavaSetterName(column, GeneratorStrategy.Mode.INTERFACE);
String columnType = getJavaType(column.getType());
String jsonName = getJsonName(column);
if(handleCustomTypeFromJson(column, setter, columnType, jsonName, out)) {
//handled by user
}else if(isType(columnType, Integer.class)){
out.tab(2).println("%s(json.getInteger(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Short.class)){
out.tab(2).println("%s(json.getInteger(\"%s\")==null?null:json.getInteger(\"%s\").shortValue());", setter, jsonName, jsonName);
}else if(isType(columnType, Byte.class)){
out.tab(2).println("%s(json.getInteger(\"%s\")==null?null:json.getInteger(\"%s\").byteValue());", setter,jsonName, jsonName);
}else if(isType(columnType, Long.class)){
out.tab(2).println("%s(json.getLong(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Float.class)){
out.tab(2).println("%s(json.getFloat(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Double.class)){
out.tab(2).println("%s(json.getDouble(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Boolean.class)){
out.tab(2).println("%s(json.getBoolean(\"%s\"));", setter, jsonName);
}else if(isType(columnType, String.class)){
out.tab(2).println("%s(json.getString(\"%s\"));", setter, jsonName);
}else if(columnType.equals(byte.class.getName()+"[]")){
out.tab(2).println("%s(json.getBinary(\"%s\"));", setter, jsonName);
}else if(isType(columnType,Instant.class)){
out.tab(2).println("%s(json.getInstant(\"%s\"));", setter, jsonName);
}else if(isEnum(table, column)) {
out.tab(2).println("%s(java.util.Arrays.stream(%s.values()).filter(td -> td.getLiteral().equals(json.getString(\"%s\"))).findFirst().orElse(null));", setter, columnType, jsonName);
}else if(column.getType().getConverter() != null && isType(column.getType().getConverter(),JsonObjectConverter.class)){
out.tab(2).println("%s(json.getJsonObject(\"%s\"));", setter, jsonName);
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/JsonArrayConverter.java
// public class JsonArrayConverter implements Converter<String,JsonArray> {
//
// private static JsonArrayConverter INSTANCE;
// public static JsonArrayConverter getInstance() {
// return INSTANCE == null ? INSTANCE = new JsonArrayConverter() : INSTANCE;
// }
//
// @Override
// public JsonArray from(String databaseObject) {
// return databaseObject==null?null:new JsonArray(databaseObject);
// }
//
// @Override
// public String to(JsonArray userObject) {
// return userObject==null?null:userObject.encode();
// }
//
// @Override
// public Class<String> fromType() {
// return String.class;
// }
//
// @Override
// public Class<JsonArray> toType() {
// return JsonArray.class;
// }
// }
//
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/JsonObjectConverter.java
// public class JsonObjectConverter implements Converter<String,JsonObject> {
//
// private static JsonObjectConverter INSTANCE;
// public static JsonObjectConverter getInstance() {
// return INSTANCE == null ? INSTANCE = new JsonObjectConverter() : INSTANCE;
// }
//
// @Override
// public JsonObject from(String databaseObject) {
// return databaseObject==null?null:new JsonObject(databaseObject);
// }
//
// @Override
// public String to(JsonObject userObject) {
// return userObject==null?null:userObject.encode();
// }
//
// @Override
// public Class<String> fromType() {
// return String.class;
// }
//
// @Override
// public Class<JsonObject> toType() {
// return JsonObject.class;
// }
// }
// Path: vertx-jooq-async-generate/src/main/java/io/github/jklingsporn/vertx/jooq/async/generate/AbstractVertxGenerator.java
import io.github.jklingsporn.vertx.jooq.async.shared.JsonArrayConverter;
import io.github.jklingsporn.vertx.jooq.async.shared.JsonObjectConverter;
import io.vertx.core.json.JsonObject;
import org.jooq.Constants;
import org.jooq.Record;
import org.jooq.tools.JooqLogger;
import org.jooq.util.*;
import java.io.File;
import java.time.Instant;
import java.util.Collection;
import java.util.List;
for (ColumnDefinition column : table.getColumns()) {
String setter = getStrategy().getJavaSetterName(column, GeneratorStrategy.Mode.INTERFACE);
String columnType = getJavaType(column.getType());
String jsonName = getJsonName(column);
if(handleCustomTypeFromJson(column, setter, columnType, jsonName, out)) {
//handled by user
}else if(isType(columnType, Integer.class)){
out.tab(2).println("%s(json.getInteger(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Short.class)){
out.tab(2).println("%s(json.getInteger(\"%s\")==null?null:json.getInteger(\"%s\").shortValue());", setter, jsonName, jsonName);
}else if(isType(columnType, Byte.class)){
out.tab(2).println("%s(json.getInteger(\"%s\")==null?null:json.getInteger(\"%s\").byteValue());", setter,jsonName, jsonName);
}else if(isType(columnType, Long.class)){
out.tab(2).println("%s(json.getLong(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Float.class)){
out.tab(2).println("%s(json.getFloat(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Double.class)){
out.tab(2).println("%s(json.getDouble(\"%s\"));", setter, jsonName);
}else if(isType(columnType, Boolean.class)){
out.tab(2).println("%s(json.getBoolean(\"%s\"));", setter, jsonName);
}else if(isType(columnType, String.class)){
out.tab(2).println("%s(json.getString(\"%s\"));", setter, jsonName);
}else if(columnType.equals(byte.class.getName()+"[]")){
out.tab(2).println("%s(json.getBinary(\"%s\"));", setter, jsonName);
}else if(isType(columnType,Instant.class)){
out.tab(2).println("%s(json.getInstant(\"%s\"));", setter, jsonName);
}else if(isEnum(table, column)) {
out.tab(2).println("%s(java.util.Arrays.stream(%s.values()).filter(td -> td.getLiteral().equals(json.getString(\"%s\"))).findFirst().orElse(null));", setter, columnType, jsonName);
}else if(column.getType().getConverter() != null && isType(column.getType().getConverter(),JsonObjectConverter.class)){
out.tab(2).println("%s(json.getJsonObject(\"%s\"));", setter, jsonName);
|
}else if(column.getType().getConverter() != null && isType(column.getType().getConverter(),JsonArrayConverter.class)){
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/pojos/Somethingwithoutjson.java
|
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomethingwithoutjson.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingwithoutjson extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingWithoutJson.someId</code>.
// */
// public ISomethingwithoutjson setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingWithoutJson.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingWithoutJson.someString</code>.
// */
// public ISomethingwithoutjson setSomestring(String value);
//
// /**
// * Getter for <code>somethingWithoutJson.someString</code>.
// */
// public String getSomestring();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public void from(generated.future.async.vertx.tables.interfaces.ISomethingwithoutjson from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public <E extends generated.future.async.vertx.tables.interfaces.ISomethingwithoutjson> E into(E into);
//
// @Override
// default ISomethingwithoutjson fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// return json;
// }
//
// }
|
import javax.annotation.Generated;
import generated.future.async.vertx.tables.interfaces.ISomethingwithoutjson;
|
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomethingwithoutjson.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomethingwithoutjson extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>somethingWithoutJson.someId</code>.
// */
// public ISomethingwithoutjson setSomeid(Integer value);
//
// /**
// * Getter for <code>somethingWithoutJson.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>somethingWithoutJson.someString</code>.
// */
// public ISomethingwithoutjson setSomestring(String value);
//
// /**
// * Getter for <code>somethingWithoutJson.someString</code>.
// */
// public String getSomestring();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public void from(generated.future.async.vertx.tables.interfaces.ISomethingwithoutjson from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomethingwithoutjson
// */
// public <E extends generated.future.async.vertx.tables.interfaces.ISomethingwithoutjson> E into(E into);
//
// @Override
// default ISomethingwithoutjson fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// return json;
// }
//
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/pojos/Somethingwithoutjson.java
import javax.annotation.Generated;
import generated.future.async.vertx.tables.interfaces.ISomethingwithoutjson;
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public class Somethingwithoutjson implements ISomethingwithoutjson {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/pojos/Something.java
|
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomething.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomething extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>something.someId</code>.
// */
// public ISomething setSomeid(Integer value);
//
// /**
// * Getter for <code>something.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>something.someString</code>.
// */
// public ISomething setSomestring(String value);
//
// /**
// * Getter for <code>something.someString</code>.
// */
// public String getSomestring();
//
// /**
// * Setter for <code>something.someHugeNumber</code>.
// */
// public ISomething setSomehugenumber(Long value);
//
// /**
// * Getter for <code>something.someHugeNumber</code>.
// */
// public Long getSomehugenumber();
//
// /**
// * Setter for <code>something.someSmallNumber</code>.
// */
// public ISomething setSomesmallnumber(Short value);
//
// /**
// * Getter for <code>something.someSmallNumber</code>.
// */
// public Short getSomesmallnumber();
//
// /**
// * Setter for <code>something.someRegularNumber</code>.
// */
// public ISomething setSomeregularnumber(Integer value);
//
// /**
// * Getter for <code>something.someRegularNumber</code>.
// */
// public Integer getSomeregularnumber();
//
// /**
// * Setter for <code>something.someDouble</code>.
// */
// public ISomething setSomedouble(Double value);
//
// /**
// * Getter for <code>something.someDouble</code>.
// */
// public Double getSomedouble();
//
// /**
// * Setter for <code>something.someEnum</code>.
// */
// public ISomething setSomeenum(String value);
//
// /**
// * Getter for <code>something.someEnum</code>.
// */
// public String getSomeenum();
//
// /**
// * Setter for <code>something.someJsonObject</code>.
// */
// public ISomething setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>something.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// /**
// * Setter for <code>something.someJsonArray</code>.
// */
// public ISomething setSomejsonarray(JsonArray value);
//
// /**
// * Getter for <code>something.someJsonArray</code>.
// */
// public JsonArray getSomejsonarray();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomething
// */
// public void from(generated.future.async.vertx.tables.interfaces.ISomething from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomething
// */
// public <E extends generated.future.async.vertx.tables.interfaces.ISomething> E into(E into);
//
// @Override
// default ISomething fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// setSomehugenumber(json.getLong("someHugeNumber"));
// setSomesmallnumber(json.getInteger("someSmallNumber")==null?null:json.getInteger("someSmallNumber").shortValue());
// setSomeregularnumber(json.getInteger("someRegularNumber"));
// setSomedouble(json.getDouble("someDouble"));
// setSomeenum(json.getString("someEnum"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// setSomejsonarray(json.getJsonArray("someJsonArray"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// json.put("someHugeNumber",getSomehugenumber());
// json.put("someSmallNumber",getSomesmallnumber());
// json.put("someRegularNumber",getSomeregularnumber());
// json.put("someDouble",getSomedouble());
// json.put("someEnum",getSomeenum());
// json.put("someJsonObject",getSomejsonobject());
// json.put("someJsonArray",getSomejsonarray());
// return json;
// }
//
// }
|
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.future.async.vertx.tables.interfaces.ISomething;
|
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/interfaces/ISomething.java
// @Generated(
// value = {
// "http://www.jooq.org",
// "jOOQ version:3.10.1"
// },
// comments = "This class is generated by jOOQ"
// )
// @SuppressWarnings({ "all", "unchecked", "rawtypes" })
// public interface ISomething extends VertxPojo, Serializable {
//
// /**
// * Setter for <code>something.someId</code>.
// */
// public ISomething setSomeid(Integer value);
//
// /**
// * Getter for <code>something.someId</code>.
// */
// public Integer getSomeid();
//
// /**
// * Setter for <code>something.someString</code>.
// */
// public ISomething setSomestring(String value);
//
// /**
// * Getter for <code>something.someString</code>.
// */
// public String getSomestring();
//
// /**
// * Setter for <code>something.someHugeNumber</code>.
// */
// public ISomething setSomehugenumber(Long value);
//
// /**
// * Getter for <code>something.someHugeNumber</code>.
// */
// public Long getSomehugenumber();
//
// /**
// * Setter for <code>something.someSmallNumber</code>.
// */
// public ISomething setSomesmallnumber(Short value);
//
// /**
// * Getter for <code>something.someSmallNumber</code>.
// */
// public Short getSomesmallnumber();
//
// /**
// * Setter for <code>something.someRegularNumber</code>.
// */
// public ISomething setSomeregularnumber(Integer value);
//
// /**
// * Getter for <code>something.someRegularNumber</code>.
// */
// public Integer getSomeregularnumber();
//
// /**
// * Setter for <code>something.someDouble</code>.
// */
// public ISomething setSomedouble(Double value);
//
// /**
// * Getter for <code>something.someDouble</code>.
// */
// public Double getSomedouble();
//
// /**
// * Setter for <code>something.someEnum</code>.
// */
// public ISomething setSomeenum(String value);
//
// /**
// * Getter for <code>something.someEnum</code>.
// */
// public String getSomeenum();
//
// /**
// * Setter for <code>something.someJsonObject</code>.
// */
// public ISomething setSomejsonobject(JsonObject value);
//
// /**
// * Getter for <code>something.someJsonObject</code>.
// */
// public JsonObject getSomejsonobject();
//
// /**
// * Setter for <code>something.someJsonArray</code>.
// */
// public ISomething setSomejsonarray(JsonArray value);
//
// /**
// * Getter for <code>something.someJsonArray</code>.
// */
// public JsonArray getSomejsonarray();
//
// // -------------------------------------------------------------------------
// // FROM and INTO
// // -------------------------------------------------------------------------
//
// /**
// * Load data from another generated Record/POJO implementing the common interface ISomething
// */
// public void from(generated.future.async.vertx.tables.interfaces.ISomething from);
//
// /**
// * Copy data into another generated Record/POJO implementing the common interface ISomething
// */
// public <E extends generated.future.async.vertx.tables.interfaces.ISomething> E into(E into);
//
// @Override
// default ISomething fromJson(io.vertx.core.json.JsonObject json) {
// setSomeid(json.getInteger("someId"));
// setSomestring(json.getString("someString"));
// setSomehugenumber(json.getLong("someHugeNumber"));
// setSomesmallnumber(json.getInteger("someSmallNumber")==null?null:json.getInteger("someSmallNumber").shortValue());
// setSomeregularnumber(json.getInteger("someRegularNumber"));
// setSomedouble(json.getDouble("someDouble"));
// setSomeenum(json.getString("someEnum"));
// setSomejsonobject(json.getJsonObject("someJsonObject"));
// setSomejsonarray(json.getJsonArray("someJsonArray"));
// return this;
// }
//
//
// @Override
// default io.vertx.core.json.JsonObject toJson() {
// io.vertx.core.json.JsonObject json = new io.vertx.core.json.JsonObject();
// json.put("someId",getSomeid());
// json.put("someString",getSomestring());
// json.put("someHugeNumber",getSomehugenumber());
// json.put("someSmallNumber",getSomesmallnumber());
// json.put("someRegularNumber",getSomeregularnumber());
// json.put("someDouble",getSomedouble());
// json.put("someEnum",getSomeenum());
// json.put("someJsonObject",getSomejsonobject());
// json.put("someJsonArray",getSomejsonarray());
// return json;
// }
//
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/future/async/vertx/tables/pojos/Something.java
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import javax.annotation.Generated;
import generated.future.async.vertx.tables.interfaces.ISomething;
/*
* This file is generated by jOOQ.
*/
package generated.future.async.vertx.tables.pojos;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public class Something implements ISomething {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomething.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import java.io.Serializable;
import javax.annotation.Generated;
|
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/classic/async/vertx/tables/interfaces/ISomething.java
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import java.io.Serializable;
import javax.annotation.Generated;
/*
* This file is generated by jOOQ.
*/
package generated.classic.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public interface ISomething extends VertxPojo, Serializable {
|
jklingsporn/vertx-jooq-async
|
vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomething.java
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
|
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import java.io.Serializable;
import javax.annotation.Generated;
|
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
// Path: vertx-jooq-async-shared/src/main/java/io/github/jklingsporn/vertx/jooq/async/shared/VertxPojo.java
// public interface VertxPojo {
//
// public VertxPojo fromJson(io.vertx.core.json.JsonObject json);
//
// public io.vertx.core.json.JsonObject toJson();
// }
// Path: vertx-jooq-async-generate/src/test/java/generated/rx/async/vertx/tables/interfaces/ISomething.java
import io.github.jklingsporn.vertx.jooq.async.shared.VertxPojo;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import java.io.Serializable;
import javax.annotation.Generated;
/*
* This file is generated by jOOQ.
*/
package generated.rx.async.vertx.tables.interfaces;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.1"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
public interface ISomething extends VertxPojo, Serializable {
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.