clean up, many changes in spring. REST controller finally working with JSON Input and Output

This commit is contained in:
Lucas Pleß 2012-03-09 23:37:26 +01:00
parent 5ceedf36e0
commit b034715014
50 changed files with 10044 additions and 1011 deletions

155
pom.xml
View File

@ -9,61 +9,30 @@
<properties> <properties>
<org.springframework.version>3.0.5.RELEASE</org.springframework.version> <org.springframework.version>3.0.5.RELEASE</org.springframework.version>
<jettyVersion>7.2.0.v20101020</jettyVersion> <jettyVersion>7.2.0.v20101020</jettyVersion>
<org.slf4j.version>1.6.4</org.slf4j.version>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
<id>com.springsource.repository.bundles.release</id> <id>org.jboss.repository.release</id>
<name>EBR Spring Release Repository</name> <name>JBoss Maven Release Repository</name>
<url>http://repository.springsource.com/maven/bundles/release</url> <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
<snapshots><enabled>false</enabled></snapshots>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>com.sun.grizzly</groupId>
<artifactId>grizzly-websockets</artifactId>
<version>1.9.46</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId> <artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version> <version>${org.springframework.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -72,10 +41,74 @@
<version>${org.springframework.version}</version> <version>${org.springframework.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.slf4j</groupId>
<artifactId>spring-oxm</artifactId> <artifactId>slf4j-api</artifactId>
<version>${org.springframework.version}</version> <version>${org.slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency> </dependency>
<dependency> <dependency>
@ -83,16 +116,13 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.10</version> <version>4.10</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.validation</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>validation-api</artifactId> <artifactId>jetty-server</artifactId>
<version>1.0.0.GA</version> <version>${jettyVersion}</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
@ -100,22 +130,33 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<version>2.9.1</version> <executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.mortbay.jetty</groupId> <groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId> <artifactId>jetty-maven-plugin</artifactId>
<version>${jettyVersion}</version> <version>${jettyVersion}</version>
<configuration>
<scanIntervalSeconds>5</scanIntervalSeconds>
</configuration>
</plugin> </plugin>
</plugins> </plugins>

View File

@ -10,6 +10,6 @@ public interface BuntiController {
Collection<BuntiDevice> getAllDevices(); Collection<BuntiDevice> getAllDevices();
BuntiDevice getDeviceById(int deviceId); BuntiDevice getDeviceById(int deviceId);
boolean setDevice(int deviceId, Map<String, Object> options); boolean updateDeviceData(int deviceId, Map<String, Object> options);
} }

View File

@ -26,16 +26,18 @@ public class BuntiControllerImpl implements BuntiController, ApplicationEventPub
} }
@Override @Override
public Collection<BuntiDevice> getAllDevices() { public final void setApplicationEventPublisher(ApplicationEventPublisher publisher) {
return devicesDAO.getAllDevices(); this.applicationEventPublisher = publisher;
} }
@Override @Override
public final boolean setDevice(int deviceId, Map<String, Object> options) { public final boolean updateDeviceData(int deviceId, Map<String, Object> options) {
BuntiDevice device = devicesDAO.getDeviceById(deviceId); BuntiDevice device = devicesDAO.getDeviceById(deviceId);
if (device != null) { if (device != null) {
this.applicationEventPublisher.publishEvent(new DeviceChangedEvent(this, device, options)); this.applicationEventPublisher.publishEvent(new DeviceChangedEvent(this, device, options));
LOGGER.debug("publishEvent in BuntiController"); LOGGER.debug("publishEvent in BuntiController");
return true; return true;
} }
@ -43,19 +45,14 @@ public class BuntiControllerImpl implements BuntiController, ApplicationEventPub
return false; return false;
} }
@Override
public Collection<BuntiDevice> getAllDevices() {
return devicesDAO.getAllDevices();
}
@Override @Override
public BuntiDevice getDeviceById(int deviceId) { public BuntiDevice getDeviceById(int deviceId) {
return devicesDAO.getDeviceById(deviceId); return devicesDAO.getDeviceById(deviceId);
} }
@Override
public final void setApplicationEventPublisher(ApplicationEventPublisher publisher) {
this.applicationEventPublisher = publisher;
}
// public void sendBroadcastMessage(String message) {
// for (BroadcastListener l : listeners) {
// l.Broadcast(message);
// }
// }
} }

View File

@ -13,7 +13,7 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public final class BuntiDevicesDAOImpl implements BuntiDevicesDAO { public final class BuntiDevicesDAOImpl implements BuntiDevicesDAO {
private Logger logger = LoggerFactory.getLogger(getClass()); private static final Logger LOGGER = LoggerFactory.getLogger(BuntiDevicesDAOImpl.class);
private List<BuntiDevice> devices = new ArrayList<BuntiDevice>(); private List<BuntiDevice> devices = new ArrayList<BuntiDevice>();
public BuntiDevicesDAOImpl() { public BuntiDevicesDAOImpl() {
@ -30,7 +30,7 @@ public final class BuntiDevicesDAOImpl implements BuntiDevicesDAO {
devices.add(new Par56Spot(deviceID++, 16, "Par56 Lampe 4")); devices.add(new Par56Spot(deviceID++, 16, "Par56 Lampe 4"));
devices.add(new Strobe1500(deviceID++, 21, "Stroboskop 1")); devices.add(new Strobe1500(deviceID++, 21, "Stroboskop 1"));
devices.add(new Par56Spot(deviceID, 508, "Par56 Lampe 5")); devices.add(new Par56Spot(deviceID, 508, "Par56 Lampe 5"));
logger.debug("added dummy devices in DAO"); LOGGER.debug("added dummy devices in DAO");
} }

View File

@ -15,7 +15,6 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Component
public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChangedEvent> { public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChangedEvent> {
private static final Logger LOGGER = LoggerFactory.getLogger(DMXMixerImpl.class); private static final Logger LOGGER = LoggerFactory.getLogger(DMXMixerImpl.class);
private static final int NET_SEND_INTERVAL = 100; private static final int NET_SEND_INTERVAL = 100;
@ -28,6 +27,7 @@ public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChanged
@Autowired @Autowired
public final void setArtNetSender(SimpleArtNetSender artNetSender) { public final void setArtNetSender(SimpleArtNetSender artNetSender) {
this.artNetSender = artNetSender; this.artNetSender = artNetSender;
LOGGER.debug("autowired arnetSender in DMXMixerImpl");
} }
public void setArtNetDeviceAddress(String artNetDeviceAddress) { public void setArtNetDeviceAddress(String artNetDeviceAddress) {

View File

@ -3,6 +3,7 @@ package de.ctdo.bunti.model;
import de.ctdo.bunti.dmx.DMX; import de.ctdo.bunti.dmx.DMX;
import de.ctdo.bunti.dmx.DMXChannel; import de.ctdo.bunti.dmx.DMXChannel;
import de.ctdo.bunti.dmx.DMXChannels; import de.ctdo.bunti.dmx.DMXChannels;
import org.codehaus.jackson.annotate.JsonIgnore;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -10,7 +11,6 @@ import java.util.Map.Entry;
public abstract class BuntiDMXDevice extends BuntiDevice { public abstract class BuntiDMXDevice extends BuntiDevice {
private int startAddress; private int startAddress;
private long lastSendOut;
private final DMXChannels dmxChannels = new DMXChannels(); private final DMXChannels dmxChannels = new DMXChannels();
public BuntiDMXDevice(int deviceId, int startAddress, String name) { public BuntiDMXDevice(int deviceId, int startAddress, String name) {
@ -18,18 +18,19 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
setStartAddress(startAddress); setStartAddress(startAddress);
} }
public final long getLastSendOut() { /**
return lastSendOut; * Gets the DMX start address for this device
} * @return The address value from 1 to max 512
*/
public final void setSendOutNow() {
this.lastSendOut = System.currentTimeMillis();
}
public final int getStartAddress() { public final int getStartAddress() {
return startAddress; return startAddress;
} }
/**
* Gets the DMX start address for this device
* @param startAddress The address value from 1 to max 512
* @return True on success, false if start address is wrong
*/
public final boolean setStartAddress(int startAddress) { public final boolean setStartAddress(int startAddress) {
if(startAddress < DMX.DMX_CHANNEL_INDEX_MIN || if(startAddress < DMX.DMX_CHANNEL_INDEX_MIN ||
startAddress - 1 + dmxChannels.getCount() > DMX.DMX_CHANNEL_INDEX_MAX) { startAddress - 1 + dmxChannels.getCount() > DMX.DMX_CHANNEL_INDEX_MAX) {
@ -50,7 +51,6 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
DMXChannel dx = dmxChannels.getChannelByName(name); DMXChannel dx = dmxChannels.getChannelByName(name);
if (dx != null) { if (dx != null) {
dx.setValue(DMX.sanitizeDMXValue(value)); dx.setValue(DMX.sanitizeDMXValue(value));
lastChangedNow();
return true; return true;
} }
return false; return false;
@ -74,6 +74,7 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
* Collect the DMX Channel Data with correct DMX512 calculated offsets * Collect the DMX Channel Data with correct DMX512 calculated offsets
* @return The channel data with startaddress+offset of every channel * @return The channel data with startaddress+offset of every channel
*/ */
@JsonIgnore
public Map<Integer, Integer> getChannelData() { public Map<Integer, Integer> getChannelData() {
Map<Integer, Integer> map = new HashMap<Integer, Integer>(); Map<Integer, Integer> map = new HashMap<Integer, Integer>();

View File

@ -1,41 +1,55 @@
package de.ctdo.bunti.model; package de.ctdo.bunti.model;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.util.Map; import java.util.Map;
@XStreamAlias("buntiDevice") /**
* A physical device type in the bunti system.
* Maybe this is a lamp, or a switchable power source, or a strobe, ...
* @author lucas
*/
public abstract class BuntiDevice { public abstract class BuntiDevice {
private int deviceId; private int deviceId;
private String deviceName; private String deviceName;
private long lastChanged;
public BuntiDevice(int deviceId, String deviceName, long lastChanged) {
this.deviceId = deviceId;
this.deviceName = deviceName;
this.lastChanged = lastChanged;
}
public BuntiDevice(int deviceId, String deviceName) { public BuntiDevice(int deviceId, String deviceName) {
this(deviceId, deviceName, System.currentTimeMillis()); this.deviceId = deviceId;
this.deviceName = deviceName;
} }
/**
* Get the type of this device
* @return a string with the class name (=the Type)
*/
@SuppressWarnings("UnusedDeclaration")
public final String getType() {
String FQClassName = this.getClass().getName();
int firstChar = FQClassName.lastIndexOf ('.') + 1;
if ( firstChar > 0 ) {
FQClassName = FQClassName.substring ( firstChar );
}
return FQClassName;
}
/**
* Gets the device Id
* @return the device Id
*/
public final int getDeviceId() { public final int getDeviceId() {
return deviceId; return deviceId;
} }
public final long getLastChanged() { /**
return lastChanged; * Gets the device name
} * @return The name of the device
*/
protected final void lastChangedNow() {
this.lastChanged = System.currentTimeMillis();
}
public final String getDeviceName() { public final String getDeviceName() {
return deviceName; return deviceName;
} }
/**
* Sets the device Name
* @param deviceName a String with the device name
*/
public final void setDeviceName(String deviceName) { public final void setDeviceName(String deviceName) {
this.deviceName = deviceName; this.deviceName = deviceName;
} }

View File

@ -5,10 +5,6 @@ import java.util.Map;
public abstract class BuntiSwitchingDevice extends BuntiDevice { public abstract class BuntiSwitchingDevice extends BuntiDevice {
public BuntiSwitchingDevice(int deviceId, String deviceName, long lastChanged) {
super(deviceId, deviceName, lastChanged);
}
public BuntiSwitchingDevice(int deviceId, String deviceName) { public BuntiSwitchingDevice(int deviceId, String deviceName) {
super(deviceId, deviceName); super(deviceId, deviceName);
} }

View File

@ -1,20 +1,27 @@
package de.ctdo.bunti.web; package de.ctdo.bunti.web;
import de.ctdo.bunti.control.BuntiController; import de.ctdo.bunti.control.BuntiController;
import de.ctdo.bunti.model.BuntiDevice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.validation.Validator;
import java.util.Collection;
import java.util.Map;
@Controller @Controller
public class RestController { public class RestController {
// private Validator validator; private static final Logger LOGGER = LoggerFactory.getLogger(RestController.class);
private Validator validator;
private BuntiController controller; private BuntiController controller;
// @Autowired @Autowired
// public void setValidator(Validator validator) { public void setValidator(Validator validator) {
// this.validator = validator; this.validator = validator;
// } }
@Autowired @Autowired
public final void setController(BuntiController controller) { public final void setController(BuntiController controller) {
@ -23,23 +30,23 @@ public class RestController {
@RequestMapping(value = "/devices", method = RequestMethod.GET) @RequestMapping(value = "/devices", method = RequestMethod.GET)
public final ModelAndView getAll() { public @ResponseBody Collection<BuntiDevice> getAll() {
return new ModelAndView("deviceList", "deviceList", controller.getAllDevices()); LOGGER.info("handle GET /devices request");
return controller.getAllDevices();
} }
@RequestMapping(value = "/devices/{id}", method = RequestMethod.GET) @RequestMapping(value = "/devices/{id}", method = RequestMethod.GET)
public final ModelAndView getDeviceById(@PathVariable("id") int id) { public @ResponseBody BuntiDevice getDeviceById(@PathVariable("id") int id) {
return new ModelAndView("device", "device", controller.getDeviceById(id)); LOGGER.info("handle GET /devices/" + id + " request");
return controller.getDeviceById(id);
} }
// @RequestMapping(value = "/devices/{id}", method = RequestMethod.PUT) @RequestMapping(value = "/devices/{id}", method = RequestMethod.PUT)
// public String setDeviceById(@ModelAttribute @Valid DeviceUpdate update, BindingResult errors) { public String setDeviceById(@PathVariable("id") int id, @RequestBody Map<String, Object> update) {
// if (errors.hasErrors()) { LOGGER.info("handle PUT /devices/" + id + " request update=" + update.toString() );
// return "redirect:/index.html";
// } else { controller.updateDeviceData(id, update);
// controller.setDevice(update.getDeviceId(), update.getOptions()); return "redirect:devices/" + id;
// return "redirect:devices/" + update.getDeviceId(); }
// }
// }
} }

View File

@ -0,0 +1,25 @@
package de.ctdo.bunti.web.json;
//import org.codehaus.jackson.map.AnnotationIntrospector;
//import org.codehaus.jackson.map.DeserializationConfig;
//import org.codehaus.jackson.map.ObjectMapper;
//import org.codehaus.jackson.map.SerializationConfig;
//import org.codehaus.jackson.map.introspect.VisibilityChecker;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.core.convert.ConversionService;
//
///**
// * A custom Jackson ObjectMapper that installs JSON serialization/deserialization support
// * for properties annotated with Spring format annotations such as @DateTimeFormat and @NumberFormat.
// */
//public class ConversionServiceAwareObjectMapper extends ObjectMapper {
//
// @Autowired
// public ConversionServiceAwareObjectMapper(ConversionService conversionService) {
// AnnotationIntrospector introspector = AnnotationIntrospector.pair(new FormatAnnotationIntrospector(conversionService), DEFAULT_ANNOTATION_INTROSPECTOR);
// SerializationConfig sconfig = new SerializationConfig(DEFAULT_INTROSPECTOR, introspector, VisibilityChecker.Std.defaultInstance(), null);
// DeserializationConfig dconfig = new DeserializationConfig(DEFAULT_INTROSPECTOR, introspector, VisibilityChecker.Std.defaultInstance(), null);
// setSerializationConfig(sconfig);
// setDeserializationConfig(dconfig);
// }
//}

View File

@ -0,0 +1,31 @@
package de.ctdo.bunti.web.json;
//
//import java.io.IOException;
//
//import org.codehaus.jackson.JsonParser;
//import org.codehaus.jackson.JsonProcessingException;
//import org.codehaus.jackson.map.DeserializationContext;
//import org.codehaus.jackson.map.JsonDeserializer;
//import org.springframework.core.convert.ConversionService;
//import org.springframework.core.convert.TypeDescriptor;
//
//final class ConvertingDeserializer extends JsonDeserializer<Object> {
//
// private final ConversionService conversionService;
//
// private final TypeDescriptor targetType;
//
// public ConvertingDeserializer(ConversionService conversionService, TypeDescriptor targetType) {
// this.conversionService = conversionService;
// this.targetType = targetType;
// }
//
// @Override
// public Object deserialize(JsonParser jp, DeserializationContext ctxt)
// throws IOException, JsonProcessingException {
// Object value = jp.getText();
// TypeDescriptor sourceType = TypeDescriptor.forObject(value);
// return this.conversionService.convert(value, sourceType, targetType);
// }
//
//}

View File

@ -0,0 +1,30 @@
package de.ctdo.bunti.web.json;
//
//import java.io.IOException;
//
//import org.codehaus.jackson.JsonGenerator;
//import org.codehaus.jackson.JsonProcessingException;
//import org.codehaus.jackson.map.JsonSerializer;
//import org.codehaus.jackson.map.SerializerProvider;
//import org.springframework.core.convert.ConversionService;
//import org.springframework.core.convert.TypeDescriptor;
//
//final class ConvertingSerializer extends JsonSerializer<Object> {
//
// private final ConversionService conversionService;
//
// private final TypeDescriptor sourceType;
//
// public ConvertingSerializer(ConversionService conversionService, TypeDescriptor sourceType) {
// this.conversionService = conversionService;
// this.sourceType = sourceType;
// }
//
// @Override
// public void serialize(Object value, JsonGenerator jgen,
// SerializerProvider provider) throws IOException,
// JsonProcessingException {
// jgen.writeString((String) this.conversionService.convert(value, sourceType, TypeDescriptor.valueOf(String.class)));
// }
//
//}

View File

@ -0,0 +1,87 @@
package de.ctdo.bunti.web.json;
//
//import java.lang.annotation.Annotation;
//import java.lang.reflect.Field;
//
//import org.codehaus.jackson.map.introspect.Annotated;
//import org.codehaus.jackson.map.introspect.AnnotatedMethod;
//import org.codehaus.jackson.map.introspect.NopAnnotationIntrospector;
//import org.springframework.core.convert.ConversionService;
//import org.springframework.core.convert.TypeDescriptor;
//import org.springframework.util.Assert;
//import org.springframework.util.ReflectionUtils;
//import org.springframework.util.StringUtils;
//
//class FormatAnnotationIntrospector extends NopAnnotationIntrospector {
//
// private final ConversionService conversionService;
//
// public FormatAnnotationIntrospector(ConversionService conversionService) {
// this.conversionService = conversionService;
// }
//
// @Override
// public boolean isHandled(Annotation ann) {
// return ann.toString().startsWith("@org.springframework.format.annotation");
// }
//
// @Override
// public Object findDeserializer(Annotated a) {
// if (a instanceof AnnotatedMethod) {
// AnnotatedMethod method = (AnnotatedMethod) a;
// TypeDescriptor typeDescriptor = getTypeDescriptorForDeserializer(method);
// for (Annotation ann : typeDescriptor.getAnnotations()){
// if (isHandled(ann)) {
// return new ConvertingDeserializer(this.conversionService, typeDescriptor);
// }
// }
// }
// return null;
// }
//
// @Override
// public Object findSerializer(Annotated a) {
// // this seems to be called even if the method is not annotated with an actual annotation???
// if (a instanceof AnnotatedMethod) {
// AnnotatedMethod method = (AnnotatedMethod) a;
// TypeDescriptor typeDescriptor = getTypeDescriptorForSerializer(method);
// for (Annotation ann : typeDescriptor.getAnnotations()){
// if (isHandled(ann)) {
// return new ConvertingSerializer(this.conversionService, typeDescriptor);
// }
// }
// }
// return null;
// }
//
// private TypeDescriptor getTypeDescriptorForDeserializer(AnnotatedMethod method) {
// // TODO - Could handle annotated getter/is/setter method here - those should probably take precedence over field annotations
// Assert.isTrue(method.getName().startsWith("set"), "Expected a setter method, but was " + method.getName());
// String fieldName = StringUtils.uncapitalize(method.getName().substring(3));
// // TODO the field could obviously be named anything, relies on convention
// Field field = ReflectionUtils.findField(method.getDeclaringClass(), fieldName);
// if (field != null) {
// return new TypeDescriptor(field);
// }
// return null;
// }
//
// private TypeDescriptor getTypeDescriptorForSerializer(AnnotatedMethod method) {
// // TODO - Could handle annotated getter/is methods here - those should probably take precedence over field annotations
// String fieldName;
// if (method.getName().startsWith("get")) {
// fieldName = StringUtils.uncapitalize(method.getName().substring(3));
// } else if (method.getName().startsWith("is")) {
// fieldName = StringUtils.uncapitalize(method.getName().substring(2));
// } else {
// throw new IllegalArgumentException("Expected a getter method, but was " + method.getName());
// }
// // TODO the field could obviously be named anything, relies on convention
// Field field = ReflectionUtils.findField(method.getDeclaringClass(), fieldName);
// if (field != null) {
// return new TypeDescriptor(field);
// }
// return null;
// }
//
//}

View File

@ -0,0 +1,47 @@
package de.ctdo.bunti.web.json;
//import org.springframework.beans.BeansException;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.config.BeanPostProcessor;
//import org.springframework.core.convert.ConversionService;
//import org.springframework.http.converter.HttpMessageConverter;
//import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter;
//
///**
// * A custom BeanPostProcessor for Spring MVC environments that configures Jackson
// * with awareness of Spring-specific format annotations such as @DateTimeFormat and @NumberFormat.
// *
// * This is an example of extending Spring to plug-in unique functionality not yet available
// * in a released Spring distribution.
// */
//@Component
//public class JacksonConversionServiceConfigurer implements BeanPostProcessor {
//
// private final ConversionService conversionService;
//
// @Autowired
// public JacksonConversionServiceConfigurer(ConversionService conversionService) {
// this.conversionService = conversionService;
// }
//
// public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
// return bean;
// }
//
// public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
// if (bean instanceof AnnotationMethodHandlerAdapter) {
// AnnotationMethodHandlerAdapter adapter = (AnnotationMethodHandlerAdapter) bean;
// HttpMessageConverter<?>[] converters = adapter.getMessageConverters();
// for (HttpMessageConverter<?> converter : converters) {
// if (converter instanceof MappingJacksonHttpMessageConverter) {
// MappingJacksonHttpMessageConverter jsonConverter = (MappingJacksonHttpMessageConverter) converter;
// jsonConverter.setObjectMapper(new ConversionServiceAwareObjectMapper(this.conversionService));
// }
// }
// }
// return bean;
// }
//
//}

View File

@ -1,11 +1,9 @@
package de.ctdo.bunti.webmodel; package de.ctdo.bunti.webmodel;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;
@XStreamAlias("deviceUpdate")
public class DeviceUpdate implements Serializable { public class DeviceUpdate implements Serializable {
private int deviceId; private int deviceId;
private Map<String, Object> options; private Map<String, Object> options;

View File

@ -1,55 +1,51 @@
package de.ctdo.bunti.websocket; package de.ctdo.bunti.websocket;
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
import com.sun.grizzly.tcp.Request;
import com.sun.grizzly.websockets.ProtocolHandler;
import com.sun.grizzly.websockets.WebSocket;
import com.sun.grizzly.websockets.WebSocketApplication;
import com.sun.grizzly.websockets.WebSocketListener;
@Component
public class BuntiControllerApplication extends WebSocketApplication {
private static final Logger LOGGER = LoggerFactory.getLogger(BuntiControllerApplication.class);
@Override
public final WebSocket createWebSocket(ProtocolHandler protocolHandler, WebSocketListener... listeners) {
BuntiControllerWebSocket socket = new BuntiControllerWebSocket(protocolHandler, listeners);
// BuntiControllerImpl.getInstance().addListener(socket);
return socket;
}
@Override
public final boolean isApplicationRequest(Request request) {
final String uri = request.requestURI().toString();
return uri.endsWith("/bunti");
}
@Override
public final void onClose(WebSocket socket, com.sun.grizzly.websockets.DataFrame frame) {
BuntiControllerWebSocket ws = (BuntiControllerWebSocket) socket;
// BuntiControllerImpl.getInstance().removeListener(ws);
}
@Override
public void onMessage(WebSocket socket, String text) {
// BuntiControllerImpl.getInstance().performJSONString(text);
// for (final WebSocket webSocket : getWebSockets()) {
// DMXControllerWebSocket ws = (DMXControllerWebSocket) webSocket;
// //
//import com.sun.grizzly.tcp.Request;
//import com.sun.grizzly.websockets.ProtocolHandler;
//import com.sun.grizzly.websockets.WebSocket;
//import com.sun.grizzly.websockets.WebSocketApplication;
//import com.sun.grizzly.websockets.WebSocketListener;
// //
//@Component
//public class BuntiControllerApplication extends WebSocketApplication {
// private static final Logger LOGGER = LoggerFactory.getLogger(BuntiControllerApplication.class);
//
// @Override
// public final WebSocket createWebSocket(ProtocolHandler protocolHandler, WebSocketListener... listeners) {
// BuntiControllerWebSocket socket = new BuntiControllerWebSocket(protocolHandler, listeners);
//// BuntiControllerImpl.getInstance().addListener(socket);
// return socket;
// } // }
//super.onMessage(socket, text); //
} // @Override
// public final boolean isApplicationRequest(Request request) {
// final String uri = request.requestURI().toString();
// return uri.endsWith("/bunti");
// }
//
} // @Override
// public final void onClose(WebSocket socket, com.sun.grizzly.websockets.DataFrame frame) {
// BuntiControllerWebSocket ws = (BuntiControllerWebSocket) socket;
//// BuntiControllerImpl.getInstance().removeListener(ws);
// }
//
// @Override
// public void onMessage(WebSocket socket, String text) {
//
//
//// BuntiControllerImpl.getInstance().performJSONString(text);
//
//
//// for (final WebSocket webSocket : getWebSockets()) {
//// DMXControllerWebSocket ws = (DMXControllerWebSocket) webSocket;
////
////
//// }
// //super.onMessage(socket, text);
// }
//
//}

View File

@ -1,40 +1,40 @@
package de.ctdo.bunti.websocket; package de.ctdo.bunti.websocket;
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
// das klappt so jedenfalls alles noch nicht :) //// das klappt so jedenfalls alles noch nicht :)
@Component //@Component
public class BuntiControllerServlet { // extends HttpServlet { //public class BuntiControllerServlet { // extends HttpServlet {
private static final long serialVersionUID = 1L; // private static final long serialVersionUID = 1L;
private static final Logger LOGGER = LoggerFactory.getLogger(BuntiControllerServlet.class); // private static final Logger LOGGER = LoggerFactory.getLogger(BuntiControllerServlet.class);
//
private BuntiControllerApplication app; // private BuntiControllerApplication app;
//
@Autowired // @Autowired
public final void setApp(BuntiControllerApplication app) { // public final void setApp(BuntiControllerApplication app) {
this.app = app; // this.app = app;
}
public void buntiControllerApplication() {
// WebSocketEngine.getEngine().register(app);
// LOGGER.debug("registered buntiControllerApplication");
}
// @Override
// public void init(ServletConfig config) throws ServletException {
// WebSocketEngine.getEngine().register(app);
// LOGGER.debug("registered buntiControllerApplication");
// } // }
// //
// @Override //
// public void destroy() { //
// WebSocketEngine.getEngine().unregister(app); // public void buntiControllerApplication() {
// LOGGER.debug("unregistered buntiControllerApplication"); //// WebSocketEngine.getEngine().register(app);
//// LOGGER.debug("registered buntiControllerApplication");
// } // }
//
} //// @Override
//// public void init(ServletConfig config) throws ServletException {
//// WebSocketEngine.getEngine().register(app);
//// LOGGER.debug("registered buntiControllerApplication");
//// }
////
//// @Override
//// public void destroy() {
//// WebSocketEngine.getEngine().unregister(app);
//// LOGGER.debug("unregistered buntiControllerApplication");
//// }
//
//}

View File

@ -1,36 +1,36 @@
package de.ctdo.bunti.websocket; package de.ctdo.bunti.websocket;
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import com.sun.grizzly.websockets.DefaultWebSocket;
import com.sun.grizzly.websockets.ProtocolHandler;
import com.sun.grizzly.websockets.WebSocketListener;
/**
* Ein DMXControllerWebSocket gehoert immer zu einem Browserfenster/Tab
* @author lucas
*
*/
public class BuntiControllerWebSocket extends DefaultWebSocket {
private static final Logger LOGGER = LoggerFactory.getLogger(BuntiControllerWebSocket.class);
public BuntiControllerWebSocket(ProtocolHandler protocolHandler, WebSocketListener[] listeners) {
super(protocolHandler, listeners);
}
// @Override
// public void DMXDataChanged(int[] dmx512data) {
// //
// JSONArray arr = JSONArray.fromObject(dmx512data); //import com.sun.grizzly.websockets.DefaultWebSocket;
// JSONObject obj = new JSONObject(); //import com.sun.grizzly.websockets.ProtocolHandler;
// obj.put("dmx512values", arr); //import com.sun.grizzly.websockets.WebSocketListener;
// //
// send(obj.toString()); ///**
// * Ein DMXControllerWebSocket gehoert immer zu einem Browserfenster/Tab
// * @author lucas
// *
// */
//public class BuntiControllerWebSocket extends DefaultWebSocket {
//
// private static final Logger LOGGER = LoggerFactory.getLogger(BuntiControllerWebSocket.class);
//
// public BuntiControllerWebSocket(ProtocolHandler protocolHandler, WebSocketListener[] listeners) {
// super(protocolHandler, listeners);
// } // }
//
//
//// @Override
} //// public void DMXDataChanged(int[] dmx512data) {
////
//// JSONArray arr = JSONArray.fromObject(dmx512data);
//// JSONObject obj = new JSONObject();
//// obj.put("dmx512values", arr);
////
//// send(obj.toString());
//// }
//
//
//
//}

View File

@ -8,22 +8,20 @@
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd" http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"
> >
<context:component-scan base-package="de.ctdo"> <!--<context:component-scan base-package="de.ctdo">-->
<!--<context:exclude-filter type="regex" expression="de\.ctdo\.bunti\.web.*" />--> <!--&lt;!&ndash;<context:exclude-filter type="regex" expression="de\.ctdo\.bunti\.web.*" />&ndash;&gt;-->
</context:component-scan> <!--</context:component-scan>-->
<task:annotation-driven scheduler="myScheduler"/> <!--<task:annotation-driven scheduler="myScheduler"/>-->
<task:scheduler id="myScheduler" pool-size="3"/> <!--<task:scheduler id="myScheduler" pool-size="3"/>-->
<bean id="propertyPlaceholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <!--<bean id="propertyPlaceholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">-->
<property name="location" value="classpath:bunti.properties"/> <!--<property name="location" value="classpath:bunti.properties"/>-->
</bean> <!--</bean>-->
<!-- <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /> --> <!--<bean id="dmxMixer" class="de.ctdo.bunti.dmx.DMXMixerImpl">-->
<!--<property name="artNetDeviceAddress" value="${artnet.deviceAddress}"/>-->
<bean id="dmxMixer" class="de.ctdo.bunti.dmx.DMXMixerImpl"> <!--</bean>-->
<property name="artNetDeviceAddress" value="${artnet.deviceAddress}"/>
</bean>
</beans> </beans>

View File

@ -1,15 +1,15 @@
log4j.rootLogger=debug, stdout #log4j.rootLogger=debug, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender #log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout #log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format # Print the date in ISO 8601 format
#log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n ##log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c: %m%n #log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c: %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender #log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=application.log #log4j.appender.R.File=application.log
log4j.appender.R.MaxFileSize=100KB #log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1 #log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout #log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n #log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
</layout>
</appender>
<!-- 3rdparty Loggers -->
<logger name="org.springframework.core">
<level value="info" />
</logger>
<logger name="org.springframework.beans">
<level value="info" />
</logger>
<logger name="org.springframework.context">
<level value="info" />
</logger>
<logger name="org.springframework.web">
<level value="info" />
</logger>
<logger name="de.ctdo">
<level value="debug" />
</logger>
<!-- Root Logger -->
<root>
<priority value="warn" />
<appender-ref ref="console" />
</root>
</log4j:configuration>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
</beans>

View File

@ -2,36 +2,40 @@
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> <context:component-scan base-package="de.ctdo.bunti"/>
<property name="favorPathExtension" value="true" />
</bean> <!-- Configures the @Controller programming model -->
<mvc:annotation-driven />
<!-- Forwards requests to the "/" resource to the "welcome" view -->
<mvc:view-controller path="/" view-name="index"/>
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources/ directory -->
<mvc:resources mapping="/resources/**" location="/resources/" />
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver">
<property name="order" value="1" />
</bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" /> <property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" /> <property name="suffix" value=".jsp" />
<property name="order" value="2" />
</bean> </bean>
<bean id="deviceList" class="org.springframework.web.servlet.view.xml.MarshallingView"> <task:annotation-driven scheduler="myScheduler"/>
<constructor-arg> <task:scheduler id="myScheduler" pool-size="3"/>
<bean class="org.springframework.oxm.xstream.XStreamMarshaller">
<property name="autodetectAnnotations" value="true"/>
</bean> <bean id="propertyPlaceholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
</constructor-arg> <property name="location" value="classpath:bunti.properties"/>
</bean> </bean>
<context:component-scan base-package="de.ctdo.bunti.web"/> <bean id="dmxMixer" class="de.ctdo.bunti.dmx.DMXMixerImpl">
<property name="artNetDeviceAddress" value="${artnet.deviceAddress}"/>
</bean>
<!--<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />-->
<import resource="classpath:marshaller.xml" /> <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />
</beans> </beans>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Device</title>
</head>
<body>
<h2>Device</h2>
<spring:bind path="device">
<font color="red"> <b><c:out value="${status.errorMessage}" /></b></font>
</spring:bind>
<c:out value="${device.deviceId}" />
<br />
<c:out value="${device.deviceName}" />
<br />
<a href="<spring:url value="/"/>">Home</a>
</body>
</html>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Devices</title>
</head>
<body>
<h2>Devices</h2>
<table border="1">
<thead>
<th>Id</th>
<th>Name</th>
</thead>
<c:forEach var="device" items="${deviceList}">
<tr>
<td><c:out value="${device.deviceId}" /></td>
<td><c:out value="${device.deviceName}" /></td>
</tr>
</c:forEach>
</table>
<a href="<spring:url value="/"/>">Home</a>
</body>
</html>

View File

@ -1,13 +0,0 @@
<html>
<head><title>Hello :: Spring Application</title></head>
<body>
<h1>Hello - Spring Application</h1>
<p>Greetings.</p>
</body>
</html>

View File

@ -1 +1,107 @@
<% response.sendRedirect("index.html"); %> <?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WebSockets</title>
<link type="text/css" href="<c:url value="/resources/css/smoothness/jquery-ui-1.8.18.custom.css"/>" rel="stylesheet" />
<script type="text/javascript" src="<c:url value="/resources/js/jquery-1.7.1.min.js" />"></script>
<script type="text/javascript" src="<c:url value="/resources/js/jquery-ui-1.8.18.custom.min.js" />"></script>
<script type="text/javascript">
var ws;
var dmxData;
$(document).ready(
function() {
var Socket = "MozWebSocket" in window ? MozWebSocket : WebSocket;
ws = new Socket("ws://" + window.location.hostname + ":" + window.location.port + "/bunti_server/bunti");
ws.onmessage = function (message) {
//$("#messages").append("<p>" + message.data + "</p>");
var obj = jQuery.parseJSON(message.data);
if( obj.dmx512values != null) {
dmxData = obj.dmx512values;
// das direkt zu machen ist evtl etwas unklug, da das sliden des sliders im
// gleichen browser dann hier zu ner aenderung fuehrt und der slider dann
// ruckelt. Aber es tut :D
$("#slider1").slider("value", dmxData[1]);
$("#slider2").slider("value", dmxData[2]);
$("#slider3").slider("value", dmxData[3]);
}
};
ws.onopen = function () {
$("#messages").append("<p>WS opened</p>");
};
ws.onclose = function () {
$("#messages").append("<p>WS closed</p>");
};
$("#slider1").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:2=" + ui.value);
ws.send("channel:7=" + ui.value);
ws.send("channel:12=" + ui.value);
ws.send("channel:17=" + ui.value);
} });
$("#slider2").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:3=" + ui.value);
ws.send("channel:8=" + ui.value);
ws.send("channel:13=" + ui.value);
ws.send("channel:18=" + ui.value);
} });
$("#slider3").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:4=" + ui.value);
ws.send("channel:9=" + ui.value);
ws.send("channel:14=" + ui.value);
ws.send("channel:19=" + ui.value);
} });
$("#buttonLampe1").click(function() {
$.getJSON('/devices/1', function(data) {
alert("data: " + data.deviceId + " " + data.colorRed );
});
});
});
</script>
</head>
<body>
<h1>Hello World!</h1>
<script>
</script>
<div class="demo">
<div id="slider1" style="width: 300px"></div>
<div id="slider2" style="width: 300px; margin-top: 10px"></div>
<div id="slider3" style="width: 300px; margin-top: 10px"></div>
</div>
<div id="messages"></div>
<input type="button" value="Update Lampe 1" id="buttonLampe1" />
</body>
</html>

View File

@ -11,14 +11,23 @@
<description>CTDO bunti control Server</description> <description>CTDO bunti control Server</description>
<listener> <filter>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> <filter-name>characterEncodingFilter</filter-name>
</listener> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<context-param> <filter-mapping>
<param-name>contextConfigLocation</param-name> <filter-name>characterEncodingFilter</filter-name>
<param-value>classpath:applicationContext.xml</param-value> <url-pattern>/*</url-pattern>
</context-param> </filter-mapping>
<servlet> <servlet>
<servlet-name>dispatcher</servlet-name> <servlet-name>dispatcher</servlet-name>

View File

@ -1,2 +0,0 @@

View File

@ -1,6 +0,0 @@
#messages {
width: 800px;
height: 100px;
background-color: #eee;
margin-top: 50px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -1,568 +0,0 @@
/*
* jQuery UI CSS Framework 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; }
/* required comment for clearfix to work in Opera \*/
* html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; }
/* end clearfix */
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*
* jQuery UI CSS Framework 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
.ui-widget-header a { color: #ffffff; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
.ui-widget :active { outline: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
* jQuery UI Resizable 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Resizable#theming
*/
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
* jQuery UI Selectable 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Selectable#theming
*/
.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
/*
* jQuery UI Accordion 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Accordion#theming
*/
/* IE/Win - Fix animation bug - #4615 */
.ui-accordion { width: 100%; }
.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
.ui-accordion .ui-accordion-li-fix { display: inline; }
.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
.ui-accordion .ui-accordion-content-active { display: block; }
/*
* jQuery UI Autocomplete 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Autocomplete#theming
*/
.ui-autocomplete { position: absolute; cursor: default; }
/* workarounds */
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
/*
* jQuery UI Menu 1.8.16
*
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Menu#theming
*/
.ui-menu {
list-style:none;
padding: 2px;
margin: 0;
display:block;
float: left;
}
.ui-menu .ui-menu {
margin-top: -3px;
}
.ui-menu .ui-menu-item {
margin:0;
padding: 0;
zoom: 1;
float: left;
clear: left;
width: 100%;
}
.ui-menu .ui-menu-item a {
text-decoration:none;
display:block;
padding:.2em .4em;
line-height:1.5;
zoom:1;
}
.ui-menu .ui-menu-item a.ui-state-hover,
.ui-menu .ui-menu-item a.ui-state-active {
font-weight: normal;
margin: -1px;
}
/*
* jQuery UI Button 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Button#theming
*/
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
.ui-button-icons-only { width: 3.4em; }
button.ui-button-icons-only { width: 3.7em; }
/*button text element */
.ui-button .ui-button-text { display: block; line-height: 1.4; }
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
/* no icon support for input elements, provide padding by default */
input.ui-button { padding: .4em 1em; }
/*button icon element(s) */
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
/*button sets*/
.ui-buttonset { margin-right: 7px; }
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
/* workarounds */
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
/*
* jQuery UI Dialog 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Dialog#theming
*/
.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
.ui-draggable .ui-dialog-titlebar { cursor: move; }
/*
* jQuery UI Slider 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Slider#theming
*/
.ui-slider { position: relative; text-align: left; }
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
.ui-slider-vertical { width: .8em; height: 100px; }
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
* jQuery UI Tabs 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Tabs#theming
*/
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
.ui-tabs .ui-tabs-hide { display: none !important; }
/*
* jQuery UI Datepicker 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Datepicker#theming
*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
.ui-datepicker td { border: 0; padding: 1px; }
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; }
.ui-datepicker-multi .ui-datepicker-group { float:left; }
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
/* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}/*
* jQuery UI Progressbar 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Progressbar#theming
*/
.ui-progressbar { height:2em; text-align: left; }
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }

View File

@ -1,13 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bla</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>

View File

@ -5,13 +5,10 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WebSockets</title> <title>WebSockets</title>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<link type="text/css" href="css/screen.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script> <link type="text/css" href="css/smoothness/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script> <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var ws; var ws;
@ -49,6 +46,38 @@
ws.onclose = function () { ws.onclose = function () {
$("#messages").append("<p>WS closed</p>"); $("#messages").append("<p>WS closed</p>");
}; };
$("#slider1").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:2=" + ui.value);
ws.send("channel:7=" + ui.value);
ws.send("channel:12=" + ui.value);
ws.send("channel:17=" + ui.value);
} });
$("#slider2").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:3=" + ui.value);
ws.send("channel:8=" + ui.value);
ws.send("channel:13=" + ui.value);
ws.send("channel:18=" + ui.value);
} });
$("#slider3").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:4=" + ui.value);
ws.send("channel:9=" + ui.value);
ws.send("channel:14=" + ui.value);
ws.send("channel:19=" + ui.value);
} });
$("#buttonLampe1").click(function() {
$.getJSON('/devices/1', function(data) {
alert("data: " + data.deviceId + " " + data.colorRed );
});
});
}); });
</script> </script>
@ -57,30 +86,9 @@
<h1>Hello World!</h1> <h1>Hello World!</h1>
<script> <script>
$(function() {
$("#slider1").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:2=" + ui.value);
ws.send("channel:7=" + ui.value);
ws.send("channel:12=" + ui.value);
ws.send("channel:17=" + ui.value);
} });
});
$(function() {
$("#slider2").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:3=" + ui.value);
ws.send("channel:8=" + ui.value);
ws.send("channel:13=" + ui.value);
ws.send("channel:18=" + ui.value);
} });
});
$(function() {
$("#slider3").slider({ min: 0, max: 255, slide: function(event, ui) {
ws.send("channel:4=" + ui.value);
ws.send("channel:9=" + ui.value);
ws.send("channel:14=" + ui.value);
ws.send("channel:19=" + ui.value);
} });
});
</script> </script>
<div class="demo"> <div class="demo">
@ -90,7 +98,7 @@
</div> </div>
<div id="messages"></div> <div id="messages"></div>
<input type="button" onclick="javascript:alert(dmx512values);" value="Bla" /> <input type="button" value="Update Lampe 1" id="buttonLampe1" />
</body> </body>
</html> </html>

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@ public class BuntiControllerTest {
// Map<String,Object> options = new HashMap<String, Object>(); // Map<String,Object> options = new HashMap<String, Object>();
// options.put("optionA", "valueA"); // options.put("optionA", "valueA");
// options.put("optionB", 42); // options.put("optionB", 42);
// assertTrue(dut.setDevice(12, options)); // assertTrue(dut.updateDeviceData(12, options));
// } // }
} }

View File

@ -146,11 +146,6 @@ public class BuntiDMXDeviceTest {
assertEquals(6, channelData.size()); assertEquals(6, channelData.size());
} }
@Test
public void testGetLastChanged() throws Exception {
assert(dut.getLastChanged() > 0);
}
@Test @Test
public void testSetDeviceName() throws Exception { public void testSetDeviceName() throws Exception {
dut.setDeviceName("rapunzel"); dut.setDeviceName("rapunzel");