You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2006/01/09 12:45:25 UTC
svn commit: r367280 [3/3] - in /xmlgraphics/batik/branches/anim: ./
sources/org/apache/batik/anim/ sources/org/apache/batik/anim/timing/
sources/org/apache/batik/parser/ sources/org/w3c/dom/smil/
Added: xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierListParser.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierListParser.java?rev=367280&view=auto
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierListParser.java (added)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierListParser.java Mon Jan 9 03:45:00 2006
@@ -0,0 +1,97 @@
+/*
+
+ Copyright 2006 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+package org.apache.batik.parser;
+
+import java.io.IOException;
+
+/**
+ * This class implements an event-based parser for SMIL timing specifier
+ * list values.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id$
+ */
+public class TimingSpecifierListParser extends TimingSpecifierParser {
+
+ /**
+ * Creates a new TimingSpecifierListParser.
+ * @param useSVG11AccessKeys allows the use of accessKey() timing
+ * specifiers with a single character
+ * @param useSVG12Accesskeys allows the use of accessKey() with a
+ * DOM 3 key name
+ */
+ public TimingSpecifierListParser(boolean useSVG11AccessKeys,
+ boolean useSVG12AccessKeys) {
+ super(useSVG11AccessKeys, useSVG12AccessKeys);
+ timingSpecifierHandler = DefaultTimingSpecifierListHandler.INSTANCE;
+ }
+
+ /**
+ * Registers a parse event handler.
+ */
+ public void setTimingSpecifierListHandler
+ (TimingSpecifierListHandler handler) {
+ timingSpecifierHandler = handler;
+ }
+
+ /**
+ * Returns the parse event handler in use.
+ */
+ public TimingSpecifierListHandler getTimingSpecifierListHandler() {
+ return (TimingSpecifierListHandler) timingSpecifierHandler;
+ }
+
+ /**
+ * Parses a timing specifier list.
+ */
+ protected void doParse() throws ParseException, IOException {
+ current = reader.read();
+
+ ((TimingSpecifierListHandler) timingSpecifierHandler)
+ .startTimingSpecifierList();
+
+ skipSpaces();
+
+ if (current != -1) {
+ for (;;) {
+ Object[] spec = parseTimingSpecifier();
+ handleTimingSpecifier(spec);
+ skipSpaces();
+ if (current == -1) {
+ break;
+ }
+ if (current == ';') {
+ current = reader.read();
+ continue;
+ }
+ reportError("character.unexpected",
+ new Object[] { new Integer(current) });
+ }
+ }
+
+ skipSpaces();
+
+ if (current != -1) {
+ reportError("character.unexpected",
+ new Object[] { new Integer(current) });
+ }
+
+ ((TimingSpecifierListHandler) timingSpecifierHandler)
+ .endTimingSpecifierList();
+ }
+}
Propchange: xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierListParser.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierParser.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierParser.java?rev=367280&view=auto
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierParser.java (added)
+++ xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierParser.java Mon Jan 9 03:45:00 2006
@@ -0,0 +1,131 @@
+/*
+
+ Copyright 2006 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ */
+package org.apache.batik.parser;
+
+import java.io.IOException;
+import java.util.Calendar;
+
+/**
+ * This class implements an event-based parser for SMIL timing specifier
+ * list values.
+ *
+ * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
+ * @version $Id$
+ */
+public class TimingSpecifierParser extends TimingParser {
+
+ /**
+ * The handler used to report parse events.
+ */
+ protected TimingSpecifierHandler timingSpecifierHandler;
+
+ /**
+ * Creates a new TimingSpecifierParser.
+ * @param useSVG11AccessKeys allows the use of accessKey() timing
+ * specifiers with a single character
+ * @param useSVG12Accesskeys allows the use of accessKey() with a
+ * DOM 3 key name
+ */
+ public TimingSpecifierParser(boolean useSVG11AccessKeys,
+ boolean useSVG12AccessKeys) {
+ super(useSVG11AccessKeys, useSVG12AccessKeys);
+ timingSpecifierHandler = DefaultTimingSpecifierHandler.INSTANCE;
+ }
+
+ /**
+ * Registers a parse event handler.
+ */
+ public void setTimingSpecifierHandler(TimingSpecifierHandler handler) {
+ timingSpecifierHandler = handler;
+ }
+
+ /**
+ * Returns the parse event handler in use.
+ */
+ public TimingSpecifierHandler getTimingSpecifierHandler() {
+ return timingSpecifierHandler;
+ }
+
+ /**
+ * Parses a timing specifier.
+ */
+ protected void doParse() throws ParseException, IOException {
+ current = reader.read();
+ Object[] spec = parseTimingSpecifier();
+ skipSpaces();
+ if (current != -1) {
+ reportError("end.of.stream.expected",
+ new Object[] { new Integer(current) });
+ }
+ handleTimingSpecifier(spec);
+ }
+
+ /**
+ * Calls the appropriate parse event handler function for the given
+ * parsed timing specifier.
+ */
+ protected void handleTimingSpecifier(Object[] spec) {
+ int type = ((Integer) spec[0]).intValue();
+ switch (type) {
+ case TIME_OFFSET:
+ timingSpecifierHandler.offset(((Float) spec[1]).floatValue());
+ break;
+ case TIME_SYNCBASE:
+ timingSpecifierHandler.syncbase(((Float) spec[1]).floatValue(),
+ (String) spec[2],
+ (String) spec[3]);
+ break;
+ case TIME_EVENTBASE:
+ timingSpecifierHandler.eventbase(((Float) spec[1]).floatValue(),
+ (String) spec[2],
+ (String) spec[3]);
+ break;
+ case TIME_REPEAT: {
+ float offset = ((Float) spec[1]).floatValue();
+ String syncbaseID = (String) spec[2];
+ if (spec[3] == null) {
+ timingSpecifierHandler.repeat(offset, syncbaseID);
+ } else {
+ timingSpecifierHandler.repeat
+ (offset, syncbaseID, ((Integer) spec[3]).intValue());
+ }
+ break;
+ }
+ case TIME_ACCESSKEY:
+ timingSpecifierHandler.accesskey
+ (((Float) spec[1]).floatValue(),
+ ((Character) spec[2]).charValue());
+ break;
+ case TIME_ACCESSKEY_SVG12:
+ timingSpecifierHandler.accessKeySVG12
+ (((Float) spec[1]).floatValue(),
+ (String) spec[2]);
+ break;
+ case TIME_MEDIA_MARKER:
+ timingSpecifierHandler.mediaMarker((String) spec[1],
+ (String) spec[2]);
+ break;
+ case TIME_WALLCLOCK:
+ timingSpecifierHandler.wallclock((Calendar) spec[1]);
+ break;
+ case TIME_INDEFINITE:
+ timingSpecifierHandler.indefinite();
+ break;
+ }
+ }
+}
Propchange: xmlgraphics/batik/branches/anim/sources/org/apache/batik/parser/TimingSpecifierParser.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xmlgraphics/batik/branches/anim/sources/org/w3c/dom/smil/TimeEvent.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/anim/sources/org/w3c/dom/smil/TimeEvent.java?rev=367280&view=auto
==============================================================================
--- xmlgraphics/batik/branches/anim/sources/org/w3c/dom/smil/TimeEvent.java (added)
+++ xmlgraphics/batik/branches/anim/sources/org/w3c/dom/smil/TimeEvent.java Mon Jan 9 03:45:00 2006
@@ -0,0 +1,13 @@
+package org.w3c.dom.smil;
+
+import org.w3c.dom.events.Event;
+import org.w3c.dom.views.AbstractView;
+
+public interface TimeEvent extends Event {
+
+ AbstractView getView();
+
+ int getDetail();
+
+ void initTimeEvent(String typeArg, AbstractView viewArg, int detailArg);
+}
Propchange: xmlgraphics/batik/branches/anim/sources/org/w3c/dom/smil/TimeEvent.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision