Skip to content

Commit

Permalink
Merge pull request #1 from SpinyOwl/feature/css
Browse files Browse the repository at this point in the history
Feature/css
  • Loading branch information
Alexander committed Feb 25, 2019
2 parents 4145efd + 91c9fdc commit 5801543
Show file tree
Hide file tree
Showing 43 changed files with 14,183 additions and 68 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.spinyowl.spinygui.backend.opengl32.service.internal;

import com.spinyowl.spinygui.backend.opengl32.service.SpinyGuiOpenGL32WindowService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.logging.Level;
import java.util.logging.Logger;

import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicBoolean;

public class SpinyGuiOpenGL32Service {
private static final Logger LOGGER = LoggerFactory.getLogger(SpinyGuiOpenGL32Service.class);
private static final Logger LOGGER = Logger.getLogger(SpinyGuiOpenGL32Service.class.getName());
private static final SpinyGuiOpenGL32Service INSTANCE = new SpinyGuiOpenGL32Service();

private AtomicBoolean started = new AtomicBoolean(false);
Expand Down Expand Up @@ -38,12 +38,12 @@ public void startService() {
}

public void stopService() {
LOGGER.debug("WAITING FOR ALL WINDOWS ARE CLOSED");
LOGGER.log(Level.INFO,"WAITING FOR ALL WINDOWS ARE CLOSED");
while (!SpinyGuiOpenGL32WindowService.getInstance().getWindows().isEmpty()) {
Thread.yield();
}

LOGGER.debug("STOPPING THE SERVICE");
LOGGER.log(Level.INFO,"STOPPING THE SERVICE");
if (started.compareAndSet(true, false)) {
Future<?> submit = serviceThread.addTask(this::destroyAllResources);
while (!submit.isDone()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import com.spinyowl.spinygui.backend.opengl32.service.SpinyGuiOpenGL32WindowService;
import com.spinyowl.spinygui.core.event.processor.EventProcessor;
import org.lwjgl.glfw.GLFW;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Queue;
Expand All @@ -14,9 +12,11 @@
import java.util.concurrent.FutureTask;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;

public class SpinyGuiOpenGL32ServiceThread {
private static final Logger LOGGER = LoggerFactory.getLogger(SpinyGuiOpenGL32ServiceThread.class);
private static final Logger LOGGER = Logger.getLogger(SpinyGuiOpenGL32ServiceThread.class.getName());

private Thread thread;

Expand All @@ -34,7 +34,7 @@ public class SpinyGuiOpenGL32ServiceThread {
public void start() {
if (destroyed.get()) {
String message = "Service thread could not be started again when it was destroyed.";
LOGGER.error(message);
LOGGER.log(Level.WARNING, message);
throw new IllegalStateException(message);
}

Expand All @@ -46,7 +46,7 @@ public void start() {
}};
thread.start();
} else {
LOGGER.warn("Service thread could not be started twice.");
LOGGER.log(Level.WARNING,"Service thread could not be started twice.");
}
}

Expand All @@ -63,13 +63,13 @@ private void service() {
destroy();
}
} catch (Throwable t) {
LOGGER.error("Faced with some exception during executing service thread. Trying to destroy service thread.");
LOGGER.error("Exception: " + t.getMessage(), t);
LOGGER.log(Level.WARNING,"Faced with some exception during executing service thread. Trying to destroy service thread.");
LOGGER.log(Level.WARNING,"Exception: " + t.getMessage(), t);
if (destroyed.compareAndSet(failed, true)) {
try {
destroy();
} catch (Throwable dt) {
LOGGER.error(dt.getMessage(), dt);
LOGGER.log(Level.WARNING,dt.getMessage(), dt);
}
}

Expand Down Expand Up @@ -190,7 +190,7 @@ public <T> T addTaskAndGet(Callable<T> t) {
try {
return addTask(t).get();
} catch (InterruptedException | ExecutionException e) {
LOGGER.error(e.getMessage(), e);
LOGGER.log(Level.WARNING,e.getMessage(), e);
throw new IllegalStateException(e);
}
}
Expand All @@ -199,7 +199,7 @@ public void addTaskAndWait(Runnable r) {
try {
addTask(r).get();
} catch (InterruptedException | ExecutionException e) {
LOGGER.error(e.getMessage(), e);
LOGGER.log(Level.WARNING,e.getMessage(), e);
throw new IllegalStateException(e);
}
}
Expand Down
1 change: 0 additions & 1 deletion backend.opengl32/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
requires org.lwjgl.opengl.natives;

requires guava.base.r03;
requires org.slf4j;

exports com.spinyowl.spinygui.backend.opengl32.api;
exports com.spinyowl.spinygui.backend.opengl32.service;
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ subprojects {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://raw.githubusercontent.com/LiquidEngine/repo/snapshots" }
maven { url "https://raw.githubusercontent.com/LiquidEngine/repo/releases" }

}

dependencies {// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.8.0-beta2'
compile group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.8.0-beta2'
// compile group: 'org.slf4j', name: 'slf4j-api', version: '1.8.0-beta2'
// compile group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.8.0-beta2'
}

sourceCompatibility = 1.11
Expand Down
2 changes: 2 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ dependencies {
// https://mvnrepository.com/artifact/com.google.guava/guava-collections
compile group: 'com.google.guava', name: 'guava-collections', version: 'r03'

// https://mvnrepository.com/artifact/org.antlr/antlr4-runtime
compile group: 'org.antlr', name: 'antlr4-runtime', version: '4.7.1'
// https://mvnrepository.com/artifact/org.joml/joml
compile group: 'org.joml', name: 'joml', version: '1.9.12'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.spinyowl.spinygui.core.component;

import com.spinyowl.spinygui.core.component.base.Container;
import com.spinyowl.spinygui.core.converter.RawProcessor;
import com.spinyowl.spinygui.core.converter.dom.RawProcessor;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,29 @@
import com.google.common.collect.HashBiMap;
import com.spinyowl.spinygui.core.component.*;
import com.spinyowl.spinygui.core.component.base.Component;
import com.spinyowl.spinygui.core.converter.dom.ComponentMarshaller;

/**
* Component mapping - contains component to tag mapping for {@link ComponentMarshaller}.
*/
public final class ComponentMapping {
public final class TagNameMapping {
private static final BiMap<Class<? extends Component>, String> tagMapping = HashBiMap.create();
private static final BiMap<String, String> tagNameMapping = HashBiMap.create();

static {
tagMapping.put(Button.class, "button");
tagMapping.put(Input.class, "input");
tagMapping.put(Label.class, "label");
tagMapping.put(Panel.class, "div");
tagMapping.put(Pre.class, "pre");
tagMapping.put(RadioButton.class, "radioButton");
addMapping(Button.class, "button");
addMapping(Input.class, "input");
addMapping(Label.class, "label");
addMapping(Panel.class, "panel");
addMapping(Pre.class, "pre");
addMapping(RadioButton.class, "radioButton");
}

private ComponentMapping() {
private TagNameMapping() {
}

public static void addMapping(Class<? extends Component> aClass, String tagName) {
tagMapping.put(aClass, "radioButton");
tagMapping.put(aClass, tagName);
tagNameMapping.put(tagName.toUpperCase(), tagName);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
T__0=1
T__1=2
T__2=3
T__3=4
T__4=5
T__5=6
T__6=7
T__7=8
T__8=9
T__9=10
T__10=11
T__11=12
T__12=13
T__13=14
T__14=15
Comment=16
Space=17
Cdo=18
Cdc=19
Includes=20
DashMatch=21
Hash=22
Import=23
Page=24
Media=25
Namespace=26
Charset=27
Important=28
Percentage=29
Uri=30
UnicodeRange=31
MediaOnly=32
Not=33
And=34
Dimension=35
UnknownDimension=36
Plus=37
Minus=38
Greater=39
Comma=40
Tilde=41
PseudoNot=42
Number=43
String=44
PrefixMatch=45
SuffixMatch=46
SubstringMatch=47
FontFace=48
Supports=49
Or=50
Keyframes=51
From=52
To=53
Calc=54
Viewport=55
CounterStyle=56
FontFeatureValues=57
DxImageTransform=58
Variable=59
Var=60
Ident=61
Function=62
';'=1
'('=2
':'=3
')'=4
'{'=5
'}'=6
'*'=7
'|'=8
'.'=9
'['=10
'='=11
']'=12
'/'=13
'_'=14
'@'=15
'<!--'=18
'-->'=19
'~='=20
'|='=21
'@charset '=27
'+'=37
'-'=38
'>'=39
','=40
'~'=41
'^='=45
'$='=46
'*='=47
'calc('=54
'var('=60
Loading

0 comments on commit 5801543

Please sign in to comment.