<!-- <disableClassMetadata>true</disableClassMetadata> -->
<disableCastChecking>true</disableCastChecking>
<modules>
- <module>gwtquery.jsquery.JsQueryXs</module>
+ <module>com.google.gwt.query.jsquery.JsQueryApi</module>
</modules>
</configuration>
<executions>
--- /dev/null
+/*
+ * Copyright 2007 Google Inc.
+ *
+ * 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 com.google.gwt.dev.javac;
+
+import com.google.gwt.core.ext.Generator;
+import com.google.gwt.core.ext.GeneratorContext;
+import com.google.gwt.core.ext.GeneratorContextExt;
+import com.google.gwt.core.ext.GeneratorExt;
+import com.google.gwt.core.ext.GeneratorExtWrapper;
+import com.google.gwt.core.ext.PropertyOracle;
+import com.google.gwt.core.ext.TreeLogger;
+import com.google.gwt.core.ext.UnableToCompleteException;
+import com.google.gwt.core.ext.linker.Artifact;
+import com.google.gwt.core.ext.linker.ArtifactSet;
+import com.google.gwt.core.ext.linker.GeneratedResource;
+import com.google.gwt.core.ext.linker.impl.StandardGeneratedResource;
+import com.google.gwt.core.ext.typeinfo.JClassType;
+import com.google.gwt.core.ext.typeinfo.TypeOracle;
+import com.google.gwt.dev.cfg.ModuleDef;
+import com.google.gwt.dev.javac.rebind.CachedRebindResult;
+import com.google.gwt.dev.javac.rebind.RebindResult;
+import com.google.gwt.dev.javac.rebind.RebindRuleResolver;
+import com.google.gwt.dev.javac.rebind.RebindStatus;
+import com.google.gwt.dev.resource.ResourceOracle;
+import com.google.gwt.dev.util.DiskCache;
+import com.google.gwt.dev.util.Util;
+import com.google.gwt.dev.util.collect.HashSet;
+import com.google.gwt.dev.util.collect.IdentityHashMap;
+import com.google.gwt.dev.util.log.speedtracer.CompilerEventType;
+import com.google.gwt.dev.util.log.speedtracer.SpeedTracerLogger;
+import com.google.gwt.dev.util.log.speedtracer.SpeedTracerLogger.Event;
+import com.google.gwt.util.tools.Utility;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.SortedSet;
+
+/**
+ * Manages generators and generated units during a single compilation.
+ */
+public class StandardGeneratorContext implements GeneratorContextExt {
+
+ /**
+ * Extras added to {@link GeneratedUnit}.
+ */
+ private static interface Generated extends GeneratedUnit {
+ void abort();
+
+ void commit(TreeLogger logger);
+
+ /**
+ * Returns the strong hash of the source.
+ */
+ String getStrongHash();
+
+ String getTypeName();
+ }
+
+ /**
+ * This generated unit acts as a normal generated unit as well as a buffer
+ * into which generators can write their source. A controller should ensure
+ * that source isn't requested until the generator has finished writing it.
+ * This version is backed by {@link StandardGeneratorContext#diskCache}.
+ */
+ private static class GeneratedUnitImpl implements Generated {
+
+ /**
+ * A token to retrieve this object's bytes from the disk cache.
+ */
+ protected long sourceToken = -1;
+
+ private long creationTime;
+
+ private String strongHash; // cache so that refreshes work correctly
+
+ private StringWriter sw;
+
+ private final String typeName;
+
+ public GeneratedUnitImpl(StringWriter sw, String typeName) {
+ this.typeName = typeName;
+ this.sw = sw;
+ }
+
+ public void abort() {
+ sw = null;
+ }
+
+ /**
+ * Finalizes the source and adds this generated unit to the host.
+ */
+ public void commit(TreeLogger logger) {
+ String source = sw.toString();
+ System.out.println(">>>>> \n" + source);
+ strongHash = Util.computeStrongName(Util.getBytes(source));
+ sourceToken = diskCache.writeString(source);
+ sw = null;
+ creationTime = System.currentTimeMillis();
+ }
+
+ public long creationTime() {
+ return creationTime;
+ }
+
+ public String getSource() {
+ if (sw != null) {
+ throw new IllegalStateException("source not committed");
+ }
+ return diskCache.readString(sourceToken);
+ }
+
+ public long getSourceToken() {
+ if (sw != null) {
+ throw new IllegalStateException("source not committed");
+ }
+ return sourceToken;
+ }
+
+ public String getStrongHash() {
+ return strongHash;
+ }
+
+ public String getTypeName() {
+ return typeName;
+ }
+
+ public String optionalFileLocation() {
+ return null;
+ }
+ }
+
+ /**
+ * This generated unit acts as a normal generated unit as well as a buffer
+ * into which generators can write their source. A controller should ensure
+ * that source isn't requested until the generator has finished writing it.
+ * This version is backed by an explicit generated file.
+ */
+ private static class GeneratedUnitWithFile extends GeneratedUnitImpl {
+ private final File file;
+
+ public GeneratedUnitWithFile(File file, StringWriter pw, String typeName) {
+ super(pw, typeName);
+ this.file = file;
+ }
+
+ @Override
+ public void commit(TreeLogger logger) {
+ super.commit(logger);
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(file);
+ diskCache.transferToStream(sourceToken, fos);
+ } catch (IOException e) {
+ logger.log(TreeLogger.WARN, "Error writing out generated unit at '"
+ + file.getAbsolutePath() + "': " + e);
+ } finally {
+ Utility.close(fos);
+ }
+ }
+
+ @Override
+ public String optionalFileLocation() {
+ return file.exists() ? file.getAbsolutePath() : null;
+ }
+ }
+
+ /**
+ * Manages a resource that is in the process of being created by a generator.
+ */
+ private static class PendingResource extends OutputStream {
+
+ private ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ private final String partialPath;
+
+ public PendingResource(String partialPath) {
+ this.partialPath = partialPath;
+ }
+
+ public void abort() {
+ baos = null;
+ }
+
+ public String getPartialPath() {
+ return partialPath;
+ }
+
+ public byte[] takeBytes() {
+ byte[] result = baos.toByteArray();
+ baos = null;
+ return result;
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException {
+ if (baos == null) {
+ throw new IOException("stream closed");
+ }
+ baos.write(b);
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
+ if (baos == null) {
+ throw new IOException("stream closed");
+ }
+ baos.write(b, off, len);
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ if (baos == null) {
+ throw new IOException("stream closed");
+ }
+ baos.write(b);
+ }
+ }
+
+ private static DiskCache diskCache = DiskCache.INSTANCE;
+
+ private static final Map<String, CompilerEventType> eventsByGeneratorType =
+ new HashMap<String, CompilerEventType>();
+ static {
+ eventsByGeneratorType.put(
+ "com.google.gwt.resources.rebind.context.InlineClientBundleGenerator",
+ CompilerEventType.GENERATOR_CLIENT_BUNDLE);
+ eventsByGeneratorType.put("com.google.gwt.i18n.rebind.LocalizableGenerator",
+ CompilerEventType.GENERATOR_I18N);
+ eventsByGeneratorType.put("com.google.gwt.i18n.rebind.LocaleInfoGenerator",
+ CompilerEventType.GENERATOR_I18N);
+ eventsByGeneratorType.put("com.google.gwt.i18n.rebind.CurrencyListGenerator",
+ CompilerEventType.GENERATOR_I18N);
+ eventsByGeneratorType.put("com.google.gwt.i18n.rebind.CustomDateTimeFormatGenerator",
+ CompilerEventType.GENERATOR_I18N);
+ eventsByGeneratorType.put("com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator",
+ CompilerEventType.GENERATOR_RPC);
+ eventsByGeneratorType.put("com.google.gwt.rpc.rebind.RpcServiceGenerator",
+ CompilerEventType.GENERATOR_RPC); // deRPC
+ eventsByGeneratorType.put("com.google.gwt.uibinder.rebind.UiBinderGenerator",
+ CompilerEventType.GENERATOR_UIBINDER);
+ eventsByGeneratorType.put("com.google.gwt.inject.rebind.GinjectorGenerator",
+ CompilerEventType.GENERATOR_GIN);
+ }
+
+ private final ArtifactSet allGeneratedArtifacts;
+
+ private final Map<String, GeneratedUnit> committedGeneratedCups =
+ new HashMap<String, GeneratedUnit>();
+
+ private CompilationState compilationState;
+
+ private Class<? extends Generator> currentGenerator;
+
+ private final File genDir;
+
+ private final Map<Class<? extends Generator>, Generator> generators =
+ new IdentityHashMap<Class<? extends Generator>, Generator>();
+
+ private final ModuleDef module;
+
+ private ArtifactSet newlyGeneratedArtifacts = new ArtifactSet();
+
+ private final Set<String> newlyGeneratedTypeNames = new HashSet<String>();
+
+ private final Map<String, PendingResource> pendingResources =
+ new HashMap<String, PendingResource>();
+
+ private transient PropertyOracle propOracle;
+
+ private RebindRuleResolver rebindRuleResolver;
+
+ private final Map<PrintWriter, Generated> uncommittedGeneratedCupsByPrintWriter =
+ new IdentityHashMap<PrintWriter, Generated>();
+
+ private CachedRebindResult cachedRebindResult = null;
+
+ private boolean generatorResultCachingEnabled = false;
+
+ private List<String> cachedTypeNamesToReuse = null;
+
+ private boolean isProdMode;
+
+ /**
+ * Normally, the compiler host would be aware of the same types that are
+ * available in the supplied type oracle although it isn't strictly required.
+ */
+ public StandardGeneratorContext(CompilationState compilationState, ModuleDef module, File genDir,
+ ArtifactSet allGeneratedArtifacts, boolean isProdMode) {
+ this.compilationState = compilationState;
+ this.module = module;
+ this.genDir = genDir;
+ this.allGeneratedArtifacts = allGeneratedArtifacts;
+ this.isProdMode = isProdMode;
+ }
+
+ /**
+ * Adds a generated unit to the context if not already present, but will not
+ * overwrite an existing unit.
+ */
+ public void addGeneratedUnit(GeneratedUnit gu) {
+ if (!committedGeneratedCups.containsKey(gu.getTypeName())) {
+ committedGeneratedCups.put(gu.getTypeName(), gu);
+ }
+ }
+
+ /**
+ * Adds generated units to the context, but will not overwrite any existing
+ * units that might already be present.
+ */
+ public void addGeneratedUnits(Collection<GeneratedUnit> generatedUnits) {
+ for (GeneratedUnit gu : generatedUnits) {
+ addGeneratedUnit(gu);
+ }
+ }
+
+ /**
+ * Adds all available cached generated units to the context. Existing units
+ * for a given type will not be overwritten.
+ */
+ public void addGeneratedUnitsFromCache() {
+ if (cachedRebindResult != null && cachedRebindResult.getGeneratedUnits() != null) {
+ addGeneratedUnits(cachedRebindResult.getGeneratedUnits());
+ }
+ }
+
+ /**
+ * Adds cached generated units to the context that have been marked for reuse.
+ * Existing units for a given type will not be overwritten.
+ */
+ public void addGeneratedUnitsMarkedForReuseFromCache() {
+ if (cachedTypeNamesToReuse != null && cachedRebindResult != null) {
+ for (String typeName : cachedTypeNamesToReuse) {
+ GeneratedUnit gu = cachedRebindResult.getGeneratedUnit(typeName);
+ if (gu != null) {
+ addGeneratedUnit(gu);
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks whether a rebind rule is available for a given sourceTypeName.
+ */
+ public boolean checkRebindRuleAvailable(String sourceTypeName) {
+ if (rebindRuleResolver != null) {
+ return rebindRuleResolver.checkRebindRuleResolvable(sourceTypeName);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Frees memory used up by compilation state.
+ */
+ public void clear() {
+ compilationState = null;
+ generators.clear();
+ }
+
+ /**
+ * Commits a pending generated type.
+ */
+ public final void commit(TreeLogger logger, PrintWriter pw) {
+ Generated gcup = uncommittedGeneratedCupsByPrintWriter.get(pw);
+ if (gcup != null) {
+ gcup.commit(logger);
+ uncommittedGeneratedCupsByPrintWriter.remove(pw);
+ committedGeneratedCups.put(gcup.getTypeName(), gcup);
+ } else {
+ logger.log(TreeLogger.WARN, "Generator attempted to commit an unknown PrintWriter", null);
+ }
+ }
+
+ /**
+ * Adds an Artifact to the context's ArtifactSets. This will replace a
+ * pre-existing entry in allGeneratedArtifacts, but will not overwrite an
+ * entry in the newlyGeneratedArtifacts (since it is assumed by convention
+ * that only new entries will ever be inserted here for a given generator
+ * run).
+ */
+ public void commitArtifact(TreeLogger logger, Artifact<?> artifact) {
+ allGeneratedArtifacts.replace(artifact);
+ newlyGeneratedArtifacts.add(artifact);
+ }
+
+ /**
+ * Commits all available cached Artifacts to the context.
+ */
+ public void commitArtifactsFromCache(TreeLogger logger) {
+ if (cachedRebindResult != null && cachedRebindResult.getArtifacts() != null) {
+ for (Artifact<?> art : cachedRebindResult.getArtifacts()) {
+ commitArtifact(logger, art);
+ }
+ }
+ }
+
+ public GeneratedResource commitResource(TreeLogger logger, OutputStream os)
+ throws UnableToCompleteException {
+
+ PendingResource pendingResource = null;
+ String partialPath = null;
+ if (os instanceof PendingResource) {
+ pendingResource = (PendingResource) os;
+ partialPath = pendingResource.getPartialPath();
+ // Make sure it's ours by looking it up in the map.
+ if (pendingResource != pendingResources.get(partialPath)) {
+ pendingResource = null;
+ }
+ }
+ if (pendingResource == null) {
+ logger.log(TreeLogger.WARN, "Generator attempted to commit an unknown OutputStream", null);
+ throw new UnableToCompleteException();
+ }
+
+ // Add the GeneratedResource to the ArtifactSet
+ GeneratedResource toReturn =
+ new StandardGeneratedResource(currentGenerator, partialPath, pendingResource.takeBytes());
+ commitArtifact(logger, toReturn);
+ pendingResources.remove(pendingResource.getPartialPath());
+ return toReturn;
+ }
+
+ /**
+ * Call this whenever generators are known to not be running to clear out
+ * uncommitted compilation units and to force committed compilation units to
+ * be parsed and added to the type oracle.
+ *
+ * @return any newly generated artifacts since the last call
+ */
+ public final ArtifactSet finish(TreeLogger logger) {
+ abortUncommittedResources(logger);
+
+ try {
+ TreeLogger branch;
+ if (!committedGeneratedCups.isEmpty()) {
+ // Assimilate the new types into the type oracle.
+ //
+ String msg = "Assimilating generated source";
+ branch = logger.branch(TreeLogger.DEBUG, msg, null);
+
+ TreeLogger subBranch = null;
+ if (branch.isLoggable(TreeLogger.DEBUG)) {
+ subBranch = branch.branch(TreeLogger.DEBUG, "Generated source files...", null);
+ }
+
+ for (GeneratedUnit gcup : committedGeneratedCups.values()) {
+ String qualifiedTypeName = gcup.getTypeName();
+ if (subBranch != null) {
+ subBranch.log(TreeLogger.DEBUG, qualifiedTypeName, null);
+ }
+ }
+
+ compilationState.addGeneratedCompilationUnits(logger, committedGeneratedCups.values());
+ }
+ return newlyGeneratedArtifacts;
+ } finally {
+
+ // Remind the user if there uncommitted cups.
+ if (!uncommittedGeneratedCupsByPrintWriter.isEmpty()) {
+ String msg =
+ "For the following type(s), generated source was never committed (did you forget to call commit()?)";
+ logger = logger.branch(TreeLogger.WARN, msg, null);
+
+ for (Generated unit : uncommittedGeneratedCupsByPrintWriter.values()) {
+ logger.log(TreeLogger.WARN, unit.getTypeName(), null);
+ }
+ }
+
+ uncommittedGeneratedCupsByPrintWriter.clear();
+ committedGeneratedCups.clear();
+ newlyGeneratedTypeNames.clear();
+ newlyGeneratedArtifacts = new ArtifactSet();
+ cachedRebindResult = null;
+ cachedTypeNamesToReuse = null;
+ }
+ }
+
+ public Set<String> getActiveLinkerNames() {
+ return module.getActiveLinkerNames();
+ }
+
+ /**
+ * Gets newly committed artifacts.
+ */
+ public ArtifactSet getArtifacts() {
+ return new ArtifactSet(newlyGeneratedArtifacts);
+ }
+
+ /**
+ * Gets the previously cached rebind result for the current generator.
+ */
+ public CachedRebindResult getCachedGeneratorResult() {
+ return cachedRebindResult;
+ }
+
+ public GeneratorContext getCanonicalContext() {
+ return this;
+ }
+
+ public CompilationState getCompilationState() {
+ return compilationState;
+ }
+
+ /**
+ * Gets all committed Java units.
+ */
+ public Map<String, GeneratedUnit> getGeneratedUnitMap() {
+ return committedGeneratedCups;
+ }
+
+ public final PropertyOracle getPropertyOracle() {
+ return propOracle;
+ }
+
+ public ResourceOracle getResourcesOracle() {
+ return module.getResourcesOracle();
+ }
+
+ public final TypeOracle getTypeOracle() {
+ return compilationState.getTypeOracle();
+ }
+
+ public boolean isGeneratorResultCachingEnabled() {
+ return generatorResultCachingEnabled;
+ }
+
+ public boolean isProdMode() {
+ return isProdMode;
+ }
+
+ /**
+ * Adds a type name to the list of types to be reused from cache, if
+ * available.
+ *
+ * @param typeName The fully qualified name of a type.
+ *
+ * @return true, if the type is available in the cache and was successfully
+ * added to the list for reuse, false otherwise.
+ */
+ public boolean reuseTypeFromCacheIfAvailable(String typeName) {
+ if (!isGeneratorResultCachingEnabled() || cachedRebindResult == null
+ || !cachedRebindResult.isTypeCached(typeName)) {
+ return false;
+ }
+
+ if (cachedTypeNamesToReuse == null) {
+ cachedTypeNamesToReuse = new ArrayList<String>();
+ }
+ cachedTypeNamesToReuse.add(typeName);
+ return true;
+ }
+
+ /**
+ * This method is maintained for backwards compatibility.
+ * {@link #runGeneratorIncrementally} should be used instead.
+ */
+ public String runGenerator(TreeLogger logger, Class<? extends Generator> generatorClass,
+ String typeName) throws UnableToCompleteException {
+
+ RebindResult result = runGeneratorIncrementally(logger, generatorClass, typeName);
+
+ return result.getReturnedTypeName();
+ }
+
+ /**
+ * Runs a generator incrementally, with support for managing the returned
+ * {@link RebindResult} object, which can contain status and cached results.
+ * This is a replacement for the {@link #runGenerator} method.
+ * <p>
+ * If the passed in generatorClass is an instance of {@link GeneratorExt},
+ * it's {@link GeneratorExt#generateIncrementally} method will be called.
+ * <p>
+ * Otherwise, for backwards compatibility, the generatorClass will be wrapped
+ * in a {@link GeneratorExt} instance, and it's {@link Generator#generate}
+ * method will be called.
+ *
+ * @param logger
+ * @param generatorClass
+ * @param typeName
+ * @return a RebindResult
+ * @throws UnableToCompleteException
+ */
+ public RebindResult runGeneratorIncrementally(TreeLogger logger,
+ Class<? extends Generator> generatorClass, String typeName) throws UnableToCompleteException {
+ String msg = "Invoking generator " + generatorClass.getName();
+ logger = logger.branch(TreeLogger.DEBUG, msg, null);
+
+ Generator generator = generators.get(generatorClass);
+ if (generator == null) {
+ try {
+ generator = generatorClass.newInstance();
+ generators.put(generatorClass, generator);
+ } catch (Throwable e) {
+ logger.log(TreeLogger.ERROR, "Unexpected error trying to instantiate Generator '"
+ + generatorClass.getName() + "'", e);
+ throw new UnableToCompleteException();
+ }
+ }
+
+ setCurrentGenerator(generatorClass);
+
+ // Avoid call to System.currentTimeMillis() if not logging DEBUG level
+ boolean loggable = logger.isLoggable(TreeLogger.DEBUG);
+ long before = loggable ? System.currentTimeMillis() : 0L;
+ String generatorClassName = generator.getClass().getName();
+ CompilerEventType type = eventsByGeneratorType.get(generatorClassName);
+
+ if (type == null) {
+ type = CompilerEventType.GENERATOR_OTHER;
+ }
+
+ Event generatorEvent =
+ SpeedTracerLogger.start(type, "class", generatorClassName, "type", typeName);
+
+ try {
+ GeneratorExt generatorExt;
+ if (generator instanceof GeneratorExt) {
+ generatorExt = (GeneratorExt) generator;
+ } else {
+ generatorExt = GeneratorExtWrapper.newInstance(generator);
+ }
+
+ RebindResult result;
+ result = generatorExt.generateIncrementally(logger, this, typeName);
+
+ if (loggable) {
+ if (result.getResultStatus() == RebindStatus.USE_EXISTING) {
+ msg = "Generator did not return a new class, type will be used as is";
+ } else {
+ msg = "Generator returned class '" + result.getReturnedTypeName() + "'";
+ }
+ long after = System.currentTimeMillis();
+ msg += "; in " + (after - before) + " ms";
+ logger.log(TreeLogger.DEBUG, msg, null);
+ }
+ return result;
+ } catch (AssertionError e) {
+ // Catch and log the assertion as a convenience to the developer
+ logger.log(TreeLogger.ERROR, "Generator '" + generatorClass.getName()
+ + "' failed an assertion while rebinding '" + typeName + "'", e);
+ throw new UnableToCompleteException();
+ } catch (RuntimeException e) {
+ logger.log(TreeLogger.ERROR, "Generator '" + generatorClass.getName()
+ + "' threw an exception while rebinding '" + typeName + "'", e);
+ throw new UnableToCompleteException();
+ } finally {
+ generatorEvent.end();
+ }
+ }
+
+ /**
+ * Set previously cached rebind result for currently active generator.
+ */
+ public void setCachedGeneratorResult(CachedRebindResult cachedRebindResult) {
+ this.cachedRebindResult = cachedRebindResult;
+ }
+
+ public void setCurrentGenerator(Class<? extends Generator> currentGenerator) {
+ this.currentGenerator = currentGenerator;
+ }
+
+ public void setGeneratorResultCachingEnabled(boolean enabled) {
+ this.generatorResultCachingEnabled = enabled;
+ }
+
+ /**
+ * Sets the current transient property oracle to answer current property
+ * questions.
+ */
+ public void setPropertyOracle(PropertyOracle propOracle) {
+ this.propOracle = propOracle;
+ }
+
+ public void setRebindRuleResolver(RebindRuleResolver resolver) {
+ this.rebindRuleResolver = resolver;
+ }
+
+ public final PrintWriter tryCreate(TreeLogger logger, String packageName, String simpleTypeName) {
+ String typeName;
+ if (packageName.length() == 0) {
+ typeName = simpleTypeName;
+ } else {
+ typeName = packageName + '.' + simpleTypeName;
+ }
+ // Is type already known to the host?
+ JClassType existingType = getTypeOracle().findType(packageName, simpleTypeName);
+ if (existingType != null) {
+ if (logger.isLoggable(TreeLogger.DEBUG)) {
+ logger.log(TreeLogger.DEBUG, "Type '" + typeName
+ + "' already exists and will not be re-created ", null);
+ }
+ return null;
+ }
+
+ // Type recently generated?
+ if (newlyGeneratedTypeNames.contains(typeName)) {
+ return null;
+ }
+
+ // The type isn't there, so we can let the caller create it. Remember that
+ // it is pending so another attempt to create the same type will fail.
+ Generated gcup;
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw, true) {
+ /**
+ * Overridden to force unix-style line endings for consistent behavior
+ * across platforms.
+ */
+ @Override
+ public void println() {
+ super.print('\n');
+ super.flush();
+ }
+ };
+ if (this.genDir == null) {
+ gcup = new GeneratedUnitImpl(sw, typeName);
+ } else {
+ File dir = new File(genDir, packageName.replace('.', File.separatorChar));
+ // No need to check mkdirs result because an IOException will occur anyway
+ dir.mkdirs();
+ File srcFile = new File(dir, simpleTypeName + ".java");
+ if (srcFile.exists()) {
+ srcFile.delete();
+ }
+ gcup = new GeneratedUnitWithFile(srcFile, sw, typeName);
+ }
+ uncommittedGeneratedCupsByPrintWriter.put(pw, gcup);
+ newlyGeneratedTypeNames.add(typeName);
+ return pw;
+ }
+
+ public OutputStream tryCreateResource(TreeLogger logger, String partialPath)
+ throws UnableToCompleteException {
+
+ logger =
+ logger.branch(TreeLogger.DEBUG, "Preparing pending output resource '" + partialPath + "'",
+ null);
+
+ // Disallow null or empty names.
+ if (partialPath == null || partialPath.trim().equals("")) {
+ logger.log(TreeLogger.ERROR, "The resource name must be a non-empty string", null);
+ throw new UnableToCompleteException();
+ }
+
+ // Disallow absolute paths.
+ if (new File(partialPath).isAbsolute()) {
+ logger
+ .log(
+ TreeLogger.ERROR,
+ "Resource paths are intended to be relative to the compiled output directory and cannot be absolute",
+ null);
+ throw new UnableToCompleteException();
+ }
+
+ // Disallow backslashes (to promote consistency in calling code).
+ if (partialPath.indexOf('\\') >= 0) {
+ logger.log(TreeLogger.ERROR,
+ "Resource paths must contain forward slashes (not backslashes) to denote subdirectories",
+ null);
+ throw new UnableToCompleteException();
+ }
+
+ // Check for public path collision.
+ if (module.findPublicFile(partialPath) != null) {
+ logger.log(TreeLogger.WARN, "Cannot create resource '" + partialPath
+ + "' because it already exists on the public path", null);
+ return null;
+ }
+
+ // See if the file is already committed.
+ SortedSet<GeneratedResource> resources = allGeneratedArtifacts.find(GeneratedResource.class);
+ for (GeneratedResource resource : resources) {
+ if (partialPath.equals(resource.getPartialPath())) {
+ return null;
+ }
+ }
+
+ // See if the file is pending.
+ if (pendingResources.containsKey(partialPath)) {
+ // It is already pending.
+ logger.log(TreeLogger.WARN, "The file '" + partialPath + "' is already a pending resource",
+ null);
+ return null;
+ }
+ PendingResource pendingResource = new PendingResource(partialPath);
+ pendingResources.put(partialPath, pendingResource);
+ return pendingResource;
+ }
+
+ private void abortUncommittedResources(TreeLogger logger) {
+ if (pendingResources.isEmpty()) {
+ // Nothing to do.
+ return;
+ }
+
+ // Warn the user about uncommitted resources.
+ logger =
+ logger
+ .branch(
+ TreeLogger.WARN,
+ "The following resources will not be created because they were never committed (did you forget to call commit()?)",
+ null);
+
+ for (Entry<String, PendingResource> entry : pendingResources.entrySet()) {
+ logger.log(TreeLogger.WARN, entry.getKey());
+ entry.getValue().abort();
+ }
+ pendingResources.clear();
+ }
+}
--- /dev/null
+<module>
+ <inherits name='com.google.gwt.query.Query' />
+
+ <entry-point class="com.google.gwt.query.jsquery.client.JsQuery" />
+ <inherits name='org.timepedia.exporter.Exporter' />
+ <set-property name="export" value="yes" />
+</module>
+
--- /dev/null
+<!--
+ This Module creates a javascript library able to replace jquery.js
+-->
+<module rename-to='jsquery'>
+ <inherits name='com.google.gwt.query.jsquery.JsQuery' />
+
+ <entry-point class="com.google.gwt.query.jsquery.client.JsQueryApi" />
+
+ <!-- Minimize JS -->
+ <set-property name="compiler.stackMode" value="strip"/>
+
+ <!-- cross-site -->
+ <add-linker name="xsiframe"/>
+
+ <!--
+ Hack to put code into the jsquery.nocache.js so as $ is available early
+ and we can handle the $().ready method which is widely used in jquery pages.
+ Otherwise $ wont be available until the async loading of the gwt permutation
+ which happens after the page was ready.
+ -->
+ <define-property name="onload" values="default, foo"/>
+ <property-provider name="onload">
+ <![CDATA[
+ $wnd.JsQuery = {
+ onLoadArray: [],
+ onLoad: function() {
+ for (i in $wnd.JsQuery.onLoadArray)
+ $wnd.JsQuery.onLoadArray[i]();
+ },
+ ready: function(f) {
+ $wnd.JsQuery.onLoadArray.push(f);
+ }
+ };
+ $wnd._$_ = $wnd.$;
+ $wnd.$ = function() {return $wnd.JsQuery;}
+ return 'default';
+ ]]>
+ </property-provider>
+</module>
+
--- /dev/null
+package com.google.gwt.query.jsquery.client;
+
+import org.timepedia.exporter.client.Export;
+import org.timepedia.exporter.client.ExportAfterCreateMethod;
+import org.timepedia.exporter.client.ExportClosure;
+import org.timepedia.exporter.client.ExportInstanceMethod;
+import org.timepedia.exporter.client.ExportJsInitMethod;
+import org.timepedia.exporter.client.ExportOverlay;
+import org.timepedia.exporter.client.ExportPackage;
+import org.timepedia.exporter.client.ExportStaticMethod;
+import org.timepedia.exporter.client.ExporterUtil;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Node;
+import com.google.gwt.dom.client.NodeList;
+import com.google.gwt.query.client.Function;
+import com.google.gwt.query.client.GQuery;
+import com.google.gwt.query.client.GQuery.Offset;
+import com.google.gwt.query.client.Predicate;
+import com.google.gwt.query.client.Properties;
+import com.google.gwt.query.client.js.JsUtils;
+import com.google.gwt.query.client.plugins.Effects;
+import com.google.gwt.query.client.plugins.effects.PropertiesAnimation;
+import com.google.gwt.user.client.Event;
+
+/**
+ * Class used to expose GQuery methods and object to Javascript using
+ * gwt-exporter annotations.
+ *
+ * We prefer to overlay the original GQuery object instead of adding
+ * the gwt-exporter dependency to the project.
+ *
+ * Because of the differences between java and js apis, we need to
+ * override some methods in order to deal with complex cases.
+ *
+ */
+@ExportPackage("JsQuery")
+@Export(value="fn", all=false)
+public class GQueryOverlay implements ExportOverlay<GQuery> {
+
+ @ExportPackage("JsQuery")
+ @Export("jFunction")
+ @ExportClosure()
+ public interface FunctionOverlay extends ExportOverlay<Function> {
+ public void f();
+ public boolean f(Event e);
+ public Object f(Element e, int i);
+ }
+
+ @ExportPackage("JsQuery")
+ @Export("jPredicate")
+ @ExportClosure()
+ public interface PredicateOverlay extends ExportOverlay<Predicate> {
+ public boolean f(Element e, int i);
+ }
+
+ private GQueryOverlay(){}
+
+ /**
+ * In js a GQuery object represents a Nodelist.
+ * gwt-exporter will use the object returned by get() to wrap
+ * the GQuery object
+ */
+ @ExportJsInitMethod
+ public NodeList<Element> get() {return null;}
+
+ /**
+ * Customized JS code to execute after GQuery has been exported.
+ */
+ @ExportAfterCreateMethod
+ public static native void afterCreate() /*-{
+ $ = $wnd.$;
+ window = $wnd;
+ document = $doc;
+ }-*/;
+
+ @ExportStaticMethod("$wnd.$")
+ public static GQuery $(Object o) {
+ return JsQueryUtils.dollar(o);
+ }
+
+ @ExportStaticMethod("$wnd.$")
+ public static GQuery $(String s, Element ctx) {
+ return GQuery.$(s, ctx);
+ }
+
+ @ExportStaticMethod("$wnd.$.extend")
+ public static JavaScriptObject extend(Object...objs) {
+ return JsQueryUtils.extend(objs);
+ }
+
+ @ExportStaticMethod("$wnd.$.each")
+ public static JavaScriptObject[] each(JavaScriptObject[] objs, Function f) {
+ return JsQueryUtils.each(objs, f);
+ }
+
+ @ExportStaticMethod("$wnd.$.inArray")
+ public static int inArray(Object o, Object arr) {
+ return JsQueryUtils.inArray(o, arr);
+ }
+
+ @ExportStaticMethod("$wnd.$.isArray")
+ public static boolean isArray(JavaScriptObject o) {
+ return JsUtils.isArray(o);
+ }
+
+ @ExportInstanceMethod
+ public static GQuery ready(GQuery g, Function f) {
+ f.fe();
+ return g;
+ }
+
+ @ExportInstanceMethod
+ // TODO: normally plugins adds new easing functions to jquery.easing array
+ public static GQuery animate(GQuery g, Object stringOrProperties, int duration, String easing, Function... funcs) {
+ return g.animate(stringOrProperties, duration,
+ "linear".equalsIgnoreCase(easing)
+ ? PropertiesAnimation.Easing.LINEAR
+ : PropertiesAnimation.Easing.SWING, funcs);
+ }
+
+ @ExportInstanceMethod
+ public static Object css(GQuery g, Object o) {
+ if (o instanceof String) {
+ return g.css((String)o, false);
+ } else {
+ return ExporterUtil.wrap(g.css((Properties)o));
+ }
+ }
+
+ @ExportInstanceMethod
+ public static GQuery css(GQuery g, String k, Object v) {
+ return g.css(k, String.valueOf(v));
+ }
+
+ @ExportInstanceMethod
+ public static JavaScriptObject offset(GQuery instance) {
+ Offset o = instance.offset();
+ return Properties.create("left: " + o.left + ", top:" + o.top);
+ }
+
+ @ExportInstanceMethod
+ public static GQuery unbind(GQuery g, String s, Function o) {
+ return g.unbind(s);
+ }
+
+ public String toString() {return null;}
+ public GQuery add(GQuery previousObject) {return null;}
+ public GQuery add(String selector) {return null;}
+ public GQuery addClass(String... classes) {return null;}
+ public GQuery after(GQuery query) {return null;}
+ public GQuery after(Node n) {return null;}
+ public GQuery after(String html) {return null;}
+ public GQuery andSelf() {return null;}
+
+// public GQuery animate(Object stringOrProperties, int duration, Easing easing, Function... funcs) {return null;}
+ public GQuery animate(Object stringOrProperties, Function... funcs) {return null;}
+ public GQuery animate(Object stringOrProperties, int duration, Function... funcs) {return null;}
+// public GQuery attr(Properties properties) {return null;}
+ public String attr(String name) {return null;}
+// public GQuery attr(String key, Function closure) {return null;}
+ public GQuery attr(String key, Object value) {return null;}
+ public int size() {return 0;}
+
+ public GQuery append(GQuery query) {return null;}
+ public GQuery append(Node n) {return null;}
+ public GQuery append(String html) {return null;}
+ public GQuery appendTo(GQuery other) {return null;}
+ public GQuery appendTo(Node n) {return null;}
+ public GQuery appendTo(String html) {return null;}
+ public <T extends GQuery> T as(Class<T> plugin) {return null;}
+
+ public GQuery before(GQuery query) {return null;}
+ public GQuery before(Node n) {return null;}
+ public GQuery before(String html) {return null;}
+// public GQuery bind(int eventbits, Object data, Function... funcs) {return null;}
+// public GQuery bind(String eventType, Object data, Function... funcs) {return null;}
+ @ExportInstanceMethod
+ public static GQuery bind(GQuery g, String events, Function func) {
+ return g.bind(events, null, func);
+ }
+ public GQuery blur(Function... f) {return null;}
+ public GQuery change(Function... f) {return null;}
+ public GQuery children() {return null;}
+ public GQuery children(String... filters) {return null;}
+ public GQuery clearQueue() {return null;}
+ public GQuery clone() {return null;}
+ public GQuery clearQueue(String queueName) {return null;}
+ public GQuery click(Function... f) {return null;}
+ public GQuery closest(String selector) {return null;}
+// public JsNamedArray<NodeList<Element>> closest(String[] selectors) {return null;}
+// public JsNamedArray<NodeList<Element>> closest(String[] selectors, Node context) {return null;}
+ public GQuery closest(String selector, Node context) {return null;}
+ public GQuery contains(String text) {return null;}
+ public GQuery contents() {return null;}
+// public GQuery css(Properties properties) {return null;}
+// public String css(String name) {return null;}
+// public String css(String name, boolean force) {return null;}
+ public GQuery css(String prop, String val) {return null;}
+ public double cur(String prop) {return 0;}
+ public double cur(String prop, boolean force) {return 0;}
+ public Object data(String name) {return null;}
+// public <T> T data(String name, Class<T> clz) {return null;}
+ public GQuery data(String name, Object value) {return null;}
+ public GQuery dblclick(Function... f) {return null;}
+
+ @ExportInstanceMethod
+ public static GQuery delay(GQuery g, int milliseconds) {
+ System.out.println("DDDDD");
+ return g.delay(milliseconds);
+ }
+
+ public GQuery delay(int milliseconds, Function... f) {return null;}
+ public GQuery delay(int milliseconds, String queueName, Function... f) {return null;}
+ public GQuery delegate(String selector, String eventType, Function... handlers) {return null;}
+ public GQuery delegate(String selector, String eventType, Object data, Function... handlers) {return null;}
+ public GQuery delegate(String selector, int eventbits, Function... handlers) {return null;}
+ public GQuery delegate(String selector, int eventbits, Object data, Function... handlers) {return null;}
+ public GQuery dequeue() {return null;}
+ public GQuery dequeue(String queueName) {return null;}
+ public GQuery detach() {return null;}
+ public GQuery detach(String filter) {return null;}
+ public GQuery die() {return null;}
+ public GQuery die(String eventName) {return null;}
+// public GQuery die(int eventbits) {return null;}
+ public GQuery each(Function... f) {return null;}
+ public Element[] elements() {return null;}
+ public GQuery empty() {return null;}
+// public GQuery end() {return null;}
+ public GQuery eq(int pos) {return null;}
+ public GQuery error(Function... f) {return null;}
+ public GQuery fadeIn(Function... f) {return null;}
+ public GQuery fadeIn(int millisecs, Function... f) {return null;}
+ public GQuery fadeOut(Function... f) {return null;}
+ public GQuery fadeOut(int millisecs, Function... f) {return null;}
+ public Effects fadeToggle(int millisecs, Function... f) {return null;}
+ public GQuery filter(Predicate filterFn) {return null;}
+// public GQuery filter(String... filters) {return null;}
+ public GQuery find(String... filters) {return null;}
+ public GQuery first() {return null;}
+ public GQuery focus(Function... f) {return null;}
+ public Element get(int i) {return null;}
+ public Node getContext() {return null;}
+ public GQuery getPreviousObject() {return null;}
+ public String getSelector() {return null;}
+ public GQuery gt(int pos) {return null;}
+ public boolean hasClass(String... classes) {return false;}
+ public int height() {return 0;}
+ public GQuery height(int height) {return null;}
+ public GQuery height(String height) {return null;}
+ public GQuery hide() {return null;}
+ public GQuery hover(Function fover, Function fout) {return null;}
+ public String html() {return null;}
+ public GQuery html(String html) {return null;}
+ public String id() {return null;}
+ public GQuery id(String id) {return null;}
+ public int index(Element element) {return 0;}
+ public int innerHeight() {return 0;}
+ public int innerWidth() {return 0;}
+ public GQuery insertAfter(Element elem) {return null;}
+ public GQuery insertAfter(GQuery query) {return null;}
+ public GQuery insertAfter(String selector) {return null;}
+ public GQuery insertBefore(Element item) {return null;}
+ public GQuery insertBefore(GQuery query) {return null;}
+ public GQuery insertBefore(String selector) {return null;}
+ public boolean is(String... filters) {return false;}
+ public boolean isEmpty() {return false;}
+ public GQuery keydown(Function... f) {return null;}
+ public GQuery keydown(int key) {return null;}
+ public GQuery keypress(Function... f) {return null;}
+ public GQuery keypress(int key) {return null;}
+ public GQuery keyup(Function... f) {return null;}
+ public GQuery keyup(int key) {return null;}
+ public GQuery last() {return null;}
+ public int left() {return 0;}
+ public int length() {return 0;}
+ public GQuery live(String eventName, Function... funcs) {return null;}
+// public GQuery live(int eventbits, Function... funcs) {return null;}
+// public GQuery live(int eventbits, Object data, Function... funcs) {return null;}
+ public GQuery live(String eventName, Object data, Function... funcs) {return null;}
+// public GQuery load(Function f) {return null;}
+ public GQuery lt(int pos) {return null;}
+// public <W> List<W> map(Function f) {return null;}
+ public GQuery mousedown(Function... f) {return null;}
+ public GQuery mousemove(Function... f) {return null;}
+ public GQuery mouseout(Function... f) {return null;}
+ public GQuery mouseover(Function... f) {return null;}
+ public GQuery mouseup(Function... f) {return null;}
+ public GQuery next() {return null;}
+ public GQuery next(String... selectors) {return null;}
+ public GQuery nextAll() {return null;}
+ public GQuery nextUntil(String selector) {return null;}
+ public GQuery not(Element elem) {return null;}
+ public GQuery not(GQuery gq) {return null;}
+ public GQuery not(String... filters) {return null;}
+ public GQuery offsetParent() {return null;}
+ public GQuery one(int eventbits, Object data, Function f) {return null;}
+ public int outerHeight() {return 0;}
+ public int outerHeight(boolean includeMargin) {return 0;}
+ public int outerWidth() {return 0;}
+ public int outerWidth(boolean includeMargin) {return 0;}
+ public GQuery parent() {return null;}
+ public GQuery parent(String... filters) {return null;}
+ public GQuery parents() {return null;}
+ public GQuery parents(String... filters) {return null;}
+ public GQuery parentsUntil(String selector) {return null;}
+// public Offset position() {return null;}
+ public GQuery prepend(GQuery query) {return null;}
+ public GQuery prepend(Node n) {return null;}
+ public GQuery prepend(String html) {return null;}
+ public GQuery prependTo(GQuery other) {return null;}
+ public GQuery prependTo(Node n) {return null;}
+ public GQuery prependTo(String html) {return null;}
+ public GQuery prev() {return null;}
+ public GQuery prev(String... selectors) {return null;}
+ public GQuery prevAll() {return null;}
+ public GQuery prevUntil(String selector) {return null;}
+ public boolean prop(String key) {return false;}
+ public GQuery prop(String key, boolean value) {return null;}
+ public GQuery prop(String key, Function closure) {return null;}
+ public int queue() {return 0;}
+ public int queue(String queueName) {return 0;}
+ public GQuery queue(Function... f) {return null;}
+ public GQuery queue(String queueName, Function... f) {return null;}
+ public GQuery remove() {return null;}
+ public GQuery remove(String filter) {return null;}
+ public GQuery removeAttr(String key) {return null;}
+ public GQuery removeClass(String... classes) {return null;}
+ public GQuery removeData(String name) {return null;}
+ public GQuery replaceAll(Element elem) {return null;}
+ public GQuery replaceAll(GQuery target) {return null;}
+ public GQuery replaceAll(String selector) {return null;}
+ public GQuery replaceWith(Element elem) {return null;}
+ public GQuery replaceWith(GQuery target) {return null;}
+ public GQuery replaceWith(String html) {return null;}
+ public GQuery resize(Function... f) {return null;}
+ public void restoreCssAttrs(String... cssProps) {}
+ public void resize(Function f) {}
+ public void saveCssAttrs(String... cssProps) {}
+ public GQuery scroll(Function... f) {return null;}
+ public GQuery scrollIntoView() {return null;}
+ public GQuery scrollIntoView(boolean ensure) {return null;}
+ public int scrollLeft() {return 0;}
+ public GQuery scrollLeft(int left) {return null;}
+ public GQuery scrollTo(int left, int top) {return null;}
+ public int scrollTop() {return 0;}
+ public GQuery scrollTop(int top) {return null;}
+ public GQuery select() {return null;}
+ public GQuery setArray(NodeList<Element> list) {return null;}
+ public void setPreviousObject(GQuery previousObject) {}
+ public GQuery setSelector(String selector) {return null;}
+ public GQuery show() {return null;}
+ public GQuery siblings() {return null;}
+ public GQuery siblings(String... selectors) {return null;}
+ public GQuery slice(int start, int end) {return null;}
+ public Effects slideDown(Function... f) {return null;}
+ public Effects slideDown(int millisecs, Function... f) {return null;}
+ public Effects slideToggle(int millisecs, Function... f) {return null;}
+ public Effects slideUp(Function... f) {return null;}
+ public Effects slideUp(int millisecs, Function... f) {return null;}
+ public GQuery stop() {return null;}
+ public GQuery stop(boolean clearQueue) {return null;}
+ public GQuery stop(boolean clearQueue, boolean jumpToEnd) {return null;}
+ public GQuery submit(Function... funcs) {return null;}
+ public String text() {return null;}
+ public GQuery text(String txt) {return null;}
+ public GQuery toggle() {return null;}
+ public GQuery toggle(Function... fn) {return null;}
+ public GQuery toggleClass(String... classes) {return null;}
+ public GQuery toggleClass(String clz, boolean addOrRemove) {return null;}
+ public int top() {return 0;}
+ public String toString(boolean pretty) {return null;}
+// public GQuery trigger(int eventbits, int... keys) {return null;}
+// public GQuery unbind(int eventbits) {return null;}
+ public GQuery undelegate() {return null;}
+ public GQuery undelegate(String selector) {return null;}
+ public GQuery undelegate(String selector, String eventName) {return null;}
+ public GQuery undelegate(String selector, int eventBit) {return null;}
+// public JsNodeArray unique(NodeList<Element> result) {return null;}
+ public GQuery unwrap() {return null;}
+ public String val() {return null;}
+ public GQuery val(String... values) {return null;}
+ public String[] vals() {return null;}
+ public boolean isVisible() {return false;}
+ public int width() {return 0;}
+ public GQuery width(int width) {return null;}
+ public GQuery wrap(Element elem) {return null;}
+ public GQuery wrap(GQuery query) {return null;}
+ public GQuery wrap(String html) {return null;}
+ public GQuery wrapAll(Element elem) {return null;}
+ public GQuery wrapAll(GQuery query) {return null;}
+ public GQuery wrapAll(String html) {return null;}
+ public GQuery wrapInner(Element elem) {return null;}
+ public GQuery wrapInner(GQuery query) {return null;}
+ public GQuery wrapInner(String html) {return null;}
+}
--- /dev/null
+package com.google.gwt.query.jsquery.client;
+
+import java.util.logging.Logger;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.query.jsquery.client.GQueryOverlay.FunctionOverlay;
+import com.google.gwt.query.jsquery.client.GQueryOverlay.PredicateOverlay;
+
+public class JsQuery implements EntryPoint {
+
+ public void onModuleLoad() {
+ GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
+ Logger l = Logger.getLogger("JsQuery");
+ public void onUncaughtException(Throwable e) {
+ String r = "";
+ for (StackTraceElement s :e.getStackTrace()) {
+ r += s + "\n";
+ }
+ l.info(r);
+ }
+ });
+ // We just export the api, but we do not call GQueryOverlay.onLoad() so as
+ // apps and plugins could load their stuff before calling it
+ export();
+
+ // Un comment for testing stuff below
+ // testJs();
+ }
+
+ public static void export() {
+ GWT.create(FunctionOverlay.class);
+ GWT.create(PredicateOverlay.class);
+ GWT.create(GQueryOverlay.class);
+ }
+
+ public static native void onLoad() /*-{
+ $wnd.onJsQueryLoad && $wnd.onJsQueryLoad();
+ $wnd.JsQuery && $wnd.JsQuery.onLoad && $wnd.JsQuery.onLoad();
+ }-*/;
+
+ /**
+ * Used to paste jquery code and test it in dev mode
+ */
+ private native static void testJs() /*-{
+ var l = @com.google.gwt.query.jsquery.client.JsQueryUtils::log(Ljava/lang/Object;);
+ window = $wnd;
+ document = $doc;
+ $ = $wnd.$;
+
+ // Paste jquery code here
+
+ }-*/;
+}
--- /dev/null
+package com.google.gwt.query.jsquery.client;
+
+import com.google.gwt.core.client.EntryPoint;
+
+public class JsQueryApi implements EntryPoint {
+
+ public void onModuleLoad() {
+ JsQuery.onLoad();
+ }
+}
--- /dev/null
+package com.google.gwt.query.jsquery.client;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Node;
+import com.google.gwt.query.client.Function;
+import com.google.gwt.query.client.GQuery;
+import com.google.gwt.query.client.js.JsCache;
+import com.google.gwt.query.client.js.JsNodeArray;
+import com.google.gwt.query.client.js.JsUtils;
+
+/**
+ * These are a set of utility methods needed in jsquery because
+ * either they are not in the GQuery core yet, or they are already
+ * there but we need to modify their behavior.
+ * Most of them should be moved to the GQuery core api.
+ *
+ */
+public abstract class JsQueryUtils {
+
+ private native static String dumpObject(JavaScriptObject o) /*-{
+ var s = "";
+ for (k in o)
+ s += " " + k;
+ return s;
+ }-*/;
+
+ public static GQuery dollar(Object o) {
+ if (o instanceof String) {
+ return GQuery.$((String) o);
+ } else if (o instanceof JavaScriptObject) {
+ JavaScriptObject jso = (JavaScriptObject) o;
+ if (JsUtils.isFunction(jso)) {
+ new JsUtils.JsFunction(jso).fe();
+ } else {
+ GQuery r = GQuery.$(jso);
+ if (!JsUtils.isWindow(jso) && !JsUtils.isElement(jso) && JsUtils.isArray(jso)) {
+ JsCache c = jso.cast();
+ JsNodeArray elms = JsNodeArray.create();
+ for (int i = 0; i < c.length(); i++) {
+ Object obj = c.get(i);
+ if (obj instanceof Node) {
+ elms.addNode((Node) obj);
+ }
+ }
+ r = GQuery.$(elms);
+ }
+ return r;
+ }
+ }
+ return GQuery.$();
+ }
+
+ public static GQuery dollar(String s, Element ctx) {
+ return GQuery.$(s, ctx);
+ }
+
+ public static void ready(Function f) {
+ f.f();
+ }
+
+ public static int inArray(Object object, Object array) {
+ if (array instanceof List) {
+ return ((List<?>)array).indexOf(object);
+ } else if (object instanceof JavaScriptObject
+ && JsUtils.isElement((JavaScriptObject) object)) {
+ return dollar(array).index((Element) object);
+ } else if (array instanceof JavaScriptObject
+ && JsUtils.isArray((JavaScriptObject) array)) {
+ return ((JsCache) array).indexOf(object);
+ }
+ return -1;
+ }
+
+ public static JavaScriptObject extend(Object... objs) {
+ int i = 0, l = objs.length;
+ boolean deep = false;
+ JavaScriptObject ctx = null;
+ Object target = objs[i];
+ if (target instanceof Boolean) {
+ deep = (Boolean) target;
+ if (l == 1)
+ return ctx;
+ target = objs[i++];
+ }
+ if (l - i == 1) {
+ i--;
+ } else {
+ ctx = (JavaScriptObject) target;
+ }
+
+ for (++i; i < l; i++) {
+ if (objs[i] != null) {
+ ctx = extendImpl(deep, ctx, objs[i]);
+ }
+ }
+ return ctx;
+ }
+
+ private static native JavaScriptObject getDefaultPrototype() /*-{
+ return $wnd.JsQuery && $wnd.JsQuery.fn
+ ? $wnd.JsQuery.fn.prototype
+ : null;
+ }-*/;
+
+ private static native JavaScriptObject extendImpl(boolean deep,
+ JavaScriptObject ctx, Object s) /*-{
+ var d = ctx ? ctx : $wnd.JsQuery.fn.prototype || {};
+ for (k in s) {
+ d[k] = s[k];
+ if (!ctx)
+ $wnd.$[k] = s[k];
+ }
+ return d;
+ }-*/;
+
+ public static JavaScriptObject[] each(JavaScriptObject[] objs, Function f) {
+ ArrayList<Object> ret = new ArrayList<Object>();
+ for (Object o : objs) {
+ f.setDataObject(o);
+ if (f.fe(null, o)) {
+ ret.add(o);
+ }
+ }
+ return ret.toArray(new JavaScriptObject[0]);
+ }
+
+ public static void log(Object l) {
+ System.out.println(l);
+ }
+
+}
--- /dev/null
+<module rename-to='dev'>
+ <inherits name='com.google.gwt.query.Query' />
+
+ <inherits name='org.timepedia.exporter.Exporter' />
+ <set-property name="export" value="yes" />
+
+ <entry-point class="gwtquery.jsquery.client.JsQuery" />
+</module>
+
--- /dev/null
+<module rename-to='jsquery'>
+ <inherits name='gwtquery.jsquery.JsQuery' />
+
+ <!--
+ Hack to put code into the jsquery.nocache.js so as $ is available early
+ and we can handle the $().ready method which is widely used in jquery pages.
+ Otherwise $ wont be available until the async loading of the gwt permutation
+ which happens after the page was ready.
+ -->
+ <define-property name="onload" values="default, foo"/>
+ <property-provider name="onload">
+ <![CDATA[
+ $wnd.JsQuery = {
+ onLoadArray: [],
+ onLoad: function() {
+ for (i in $wnd.JsQuery.onLoadArray)
+ $wnd.JsQuery.onLoadArray[i]();
+ },
+ ready: function(f) {
+ $wnd.JsQuery.onLoadArray.push(f);
+ }
+ };
+ $wnd._$_ = $wnd.$;
+ $wnd.$ = function() {return $wnd.JsQuery;}
+ return 'default';
+ ]]>
+ </property-provider>
+
+ <!-- Minimize JS -->
+ <set-property name="compiler.stackMode" value="strip"/>
+ <!-- cross-site -->
+ <add-linker name="xsiframe"/>
+
+</module>
+
--- /dev/null
+package gwtquery.jsquery.client;
+
+import gwtquery.jsquery.client.plugins.menu.JsMenu;
+
+import java.util.logging.Logger;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.core.client.GWT;
+
+public class JsQuery implements EntryPoint {
+
+ public void onModuleLoad() {
+ GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
+ Logger l = Logger.getLogger("jsQuery");
+ public void onUncaughtException(Throwable e) {
+ String r = "";
+ for (StackTraceElement s :e.getStackTrace()) {
+ r += s + "\n";
+ }
+ l.info(r);
+ }
+ });
+
+ OverlayGQuery.export();
+ JsMenu.loadPlugin();
+ OverlayGQuery.onLoad();
+
+// testJs();
+ }
+
+ /**
+ * Useful to paste js code here and test in dev mode
+ */
+ private native static void testJs() /*-{
+ var l = @gwtquery.jsquery.client.utils.JsQueryUtils::log(Ljava/lang/Object;);
+ window = $wnd;
+ document = $doc;
+ $ = $wnd.$;
+
+ }-*/;
+}
--- /dev/null
+package gwtquery.jsquery.client;
+
+import gwtquery.jsquery.client.utils.JsQueryUtils;
+
+import org.timepedia.exporter.client.Export;
+import org.timepedia.exporter.client.ExportAfterCreateMethod;
+import org.timepedia.exporter.client.ExportClosure;
+import org.timepedia.exporter.client.ExportInstanceMethod;
+import org.timepedia.exporter.client.ExportJsInitMethod;
+import org.timepedia.exporter.client.ExportOverlay;
+import org.timepedia.exporter.client.ExportPackage;
+import org.timepedia.exporter.client.ExportStaticMethod;
+import org.timepedia.exporter.client.ExporterUtil;
+import org.timepedia.exporter.client.NoExport;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Node;
+import com.google.gwt.dom.client.NodeList;
+import com.google.gwt.query.client.Function;
+import com.google.gwt.query.client.GQuery;
+import com.google.gwt.query.client.GQuery.Offset;
+import com.google.gwt.query.client.Predicate;
+import com.google.gwt.query.client.Properties;
+import com.google.gwt.query.client.js.JsUtils;
+import com.google.gwt.query.client.plugins.Effects;
+import com.google.gwt.query.client.plugins.effects.PropertiesAnimation;
+import com.google.gwt.user.client.Event;
+
+/**
+ * Class used to expose GQuery methods and object to Javascript using
+ * gwt-exporter annotations.
+ *
+ * We prefer to overlay the original GQuery object instead of adding
+ * the gwt-exporter dependency to the project.
+ *
+ * Because of the differences between java and js apis, we need to
+ * override some methods in order to deal with complex cases.
+ *
+ */
+@ExportPackage("JsQuery")
+@Export(value="fn", all=false)
+public class OverlayGQuery implements ExportOverlay<GQuery> {
+
+ @NoExport
+ public static void export() {
+ GWT.create(OverlayFunction.class);
+ GWT.create(OverlayPredicate.class);
+ GWT.create(OverlayGQuery.class);
+ }
+
+ @NoExport
+ public static native void onLoad() /*-{
+ $wnd.onJsQueryLoad && $wnd.onJsQueryLoad();
+ $wnd.JsQuery && $wnd.JsQuery.onLoad && $wnd.JsQuery.onLoad();
+ }-*/;
+
+ @ExportPackage("JsQuery")
+ @Export("jFunction")
+ @ExportClosure()
+ protected interface OverlayFunction extends ExportOverlay<Function> {
+ public void f();
+ public boolean f(Event e);
+ public Object f(Element e, int i);
+ }
+
+ @ExportPackage("JsQuery")
+ @Export("jPredicate")
+ @ExportClosure()
+ protected interface OverlayPredicate extends ExportOverlay<Predicate> {
+ public boolean f(Element e, int i);
+ }
+
+ private OverlayGQuery(){}
+
+ /**
+ * In js a GQuery object represents a Nodelist.
+ * gwt-exporter will use the object returned by get() to wrap
+ * the GQuery object
+ */
+ @ExportJsInitMethod
+ public NodeList<Element> get() {return null;}
+
+ /**
+ * Customized JS code to execute after GQuery has been exported.
+ */
+ @ExportAfterCreateMethod
+ public static native void afterCreate() /*-{
+ $ = $wnd.$;
+ window = $wnd;
+ document = $doc;
+ }-*/;
+
+ @ExportStaticMethod("$wnd.$")
+ public static GQuery $(Object o) {
+ return JsQueryUtils.dollar(o);
+ }
+
+ @ExportStaticMethod("$wnd.$")
+ public static GQuery $(String s, Element ctx) {
+ return GQuery.$(s, ctx);
+ }
+
+ @ExportStaticMethod("$wnd.$.extend")
+ public static JavaScriptObject extend(Object...objs) {
+ return JsQueryUtils.extend(objs);
+ }
+
+ @ExportStaticMethod("$wnd.$.each")
+ public static JavaScriptObject[] each(JavaScriptObject[] objs, Function f) {
+ return JsQueryUtils.each(objs, f);
+ }
+
+ @ExportStaticMethod("$wnd.$.inArray")
+ public static int inArray(Object o, Object arr) {
+ return JsQueryUtils.inArray(o, arr);
+ }
+
+ @ExportStaticMethod("$wnd.$.isArray")
+ public static boolean isArray(JavaScriptObject o) {
+ return JsUtils.isArray(o);
+ }
+
+ @ExportInstanceMethod
+ public static GQuery ready(GQuery g, Function f) {
+ f.fe();
+ return g;
+ }
+
+ @ExportInstanceMethod
+ // TODO: normally plugins adds new easing functions to jquery.easing array
+ public static GQuery animate(GQuery g, Object stringOrProperties, int duration, String easing, Function... funcs) {
+ return g.animate(stringOrProperties, duration,
+ "linear".equalsIgnoreCase(easing)
+ ? PropertiesAnimation.Easing.LINEAR
+ : PropertiesAnimation.Easing.SWING, funcs);
+ }
+
+ @ExportInstanceMethod
+ public static Object css(GQuery g, Object o) {
+ if (o instanceof String) {
+ return g.css((String)o, false);
+ } else {
+ return ExporterUtil.wrap(g.css((Properties)o));
+ }
+ }
+
+ @ExportInstanceMethod
+ public static GQuery css(GQuery g, String k, Object v) {
+ return g.css(k, String.valueOf(v));
+ }
+
+ @ExportInstanceMethod
+ public static JavaScriptObject offset(GQuery instance) {
+ Offset o = instance.offset();
+ return Properties.create("left: " + o.left + ", top:" + o.top);
+ }
+
+ @ExportInstanceMethod
+ public static GQuery unbind(GQuery g, String s, Function o) {
+ return g.unbind(s);
+ }
+
+ public String toString() {return null;}
+ public GQuery add(GQuery previousObject) {return null;}
+ public GQuery add(String selector) {return null;}
+ public GQuery addClass(String... classes) {return null;}
+ public GQuery after(GQuery query) {return null;}
+ public GQuery after(Node n) {return null;}
+ public GQuery after(String html) {return null;}
+ public GQuery andSelf() {return null;}
+
+// public GQuery animate(Object stringOrProperties, int duration, Easing easing, Function... funcs) {return null;}
+ public GQuery animate(Object stringOrProperties, Function... funcs) {return null;}
+ public GQuery animate(Object stringOrProperties, int duration, Function... funcs) {return null;}
+// public GQuery attr(Properties properties) {return null;}
+ public String attr(String name) {return null;}
+// public GQuery attr(String key, Function closure) {return null;}
+ public GQuery attr(String key, Object value) {return null;}
+ public int size() {return 0;}
+
+ public GQuery append(GQuery query) {return null;}
+ public GQuery append(Node n) {return null;}
+ public GQuery append(String html) {return null;}
+ public GQuery appendTo(GQuery other) {return null;}
+ public GQuery appendTo(Node n) {return null;}
+ public GQuery appendTo(String html) {return null;}
+ public <T extends GQuery> T as(Class<T> plugin) {return null;}
+
+ public GQuery before(GQuery query) {return null;}
+ public GQuery before(Node n) {return null;}
+ public GQuery before(String html) {return null;}
+// public GQuery bind(int eventbits, Object data, Function... funcs) {return null;}
+// public GQuery bind(String eventType, Object data, Function... funcs) {return null;}
+ @ExportInstanceMethod
+ public static GQuery bind(GQuery g, String events, Function func) {
+ return g.bind(events, null, func);
+ }
+ public GQuery blur(Function... f) {return null;}
+ public GQuery change(Function... f) {return null;}
+ public GQuery children() {return null;}
+ public GQuery children(String... filters) {return null;}
+ public GQuery clearQueue() {return null;}
+ public GQuery clone() {return null;}
+ public GQuery clearQueue(String queueName) {return null;}
+ public GQuery click(Function... f) {return null;}
+ public GQuery closest(String selector) {return null;}
+// public JsNamedArray<NodeList<Element>> closest(String[] selectors) {return null;}
+// public JsNamedArray<NodeList<Element>> closest(String[] selectors, Node context) {return null;}
+ public GQuery closest(String selector, Node context) {return null;}
+ public GQuery contains(String text) {return null;}
+ public GQuery contents() {return null;}
+// public GQuery css(Properties properties) {return null;}
+// public String css(String name) {return null;}
+// public String css(String name, boolean force) {return null;}
+ public GQuery css(String prop, String val) {return null;}
+ public double cur(String prop) {return 0;}
+ public double cur(String prop, boolean force) {return 0;}
+ public Object data(String name) {return null;}
+// public <T> T data(String name, Class<T> clz) {return null;}
+ public GQuery data(String name, Object value) {return null;}
+ public GQuery dblclick(Function... f) {return null;}
+ public GQuery delay(int milliseconds, Function... f) {return null;}
+ public GQuery delay(int milliseconds, String queueName, Function... f) {return null;}
+ public GQuery delegate(String selector, String eventType, Function... handlers) {return null;}
+ public GQuery delegate(String selector, String eventType, Object data, Function... handlers) {return null;}
+ public GQuery delegate(String selector, int eventbits, Function... handlers) {return null;}
+ public GQuery delegate(String selector, int eventbits, Object data, Function... handlers) {return null;}
+ public GQuery dequeue() {return null;}
+ public GQuery dequeue(String queueName) {return null;}
+ public GQuery detach() {return null;}
+ public GQuery detach(String filter) {return null;}
+ public GQuery die() {return null;}
+ public GQuery die(String eventName) {return null;}
+// public GQuery die(int eventbits) {return null;}
+ public GQuery each(Function... f) {return null;}
+ public Element[] elements() {return null;}
+ public GQuery empty() {return null;}
+// public GQuery end() {return null;}
+ public GQuery eq(int pos) {return null;}
+ public GQuery error(Function... f) {return null;}
+ public GQuery fadeIn(Function... f) {return null;}
+ public GQuery fadeIn(int millisecs, Function... f) {return null;}
+ public GQuery fadeOut(Function... f) {return null;}
+ public GQuery fadeOut(int millisecs, Function... f) {return null;}
+ public Effects fadeToggle(int millisecs, Function... f) {return null;}
+ public GQuery filter(Predicate filterFn) {return null;}
+// public GQuery filter(String... filters) {return null;}
+ public GQuery find(String... filters) {return null;}
+ public GQuery first() {return null;}
+ public GQuery focus(Function... f) {return null;}
+ public Element get(int i) {return null;}
+ public Node getContext() {return null;}
+ public GQuery getPreviousObject() {return null;}
+ public String getSelector() {return null;}
+ public GQuery gt(int pos) {return null;}
+ public boolean hasClass(String... classes) {return false;}
+ public int height() {return 0;}
+ public GQuery height(int height) {return null;}
+ public GQuery height(String height) {return null;}
+ public GQuery hide() {return null;}
+ public GQuery hover(Function fover, Function fout) {return null;}
+ public String html() {return null;}
+ public GQuery html(String html) {return null;}
+ public String id() {return null;}
+ public GQuery id(String id) {return null;}
+ public int index(Element element) {return 0;}
+ public int innerHeight() {return 0;}
+ public int innerWidth() {return 0;}
+ public GQuery insertAfter(Element elem) {return null;}
+ public GQuery insertAfter(GQuery query) {return null;}
+ public GQuery insertAfter(String selector) {return null;}
+ public GQuery insertBefore(Element item) {return null;}
+ public GQuery insertBefore(GQuery query) {return null;}
+ public GQuery insertBefore(String selector) {return null;}
+ public boolean is(String... filters) {return false;}
+ public boolean isEmpty() {return false;}
+ public GQuery keydown(Function... f) {return null;}
+ public GQuery keydown(int key) {return null;}
+ public GQuery keypress(Function... f) {return null;}
+ public GQuery keypress(int key) {return null;}
+ public GQuery keyup(Function... f) {return null;}
+ public GQuery keyup(int key) {return null;}
+ public GQuery last() {return null;}
+ public int left() {return 0;}
+ public int length() {return 0;}
+ public GQuery live(String eventName, Function... funcs) {return null;}
+// public GQuery live(int eventbits, Function... funcs) {return null;}
+// public GQuery live(int eventbits, Object data, Function... funcs) {return null;}
+ public GQuery live(String eventName, Object data, Function... funcs) {return null;}
+// public GQuery load(Function f) {return null;}
+ public GQuery lt(int pos) {return null;}
+// public <W> List<W> map(Function f) {return null;}
+ public GQuery mousedown(Function... f) {return null;}
+ public GQuery mousemove(Function... f) {return null;}
+ public GQuery mouseout(Function... f) {return null;}
+ public GQuery mouseover(Function... f) {return null;}
+ public GQuery mouseup(Function... f) {return null;}
+ public GQuery next() {return null;}
+ public GQuery next(String... selectors) {return null;}
+ public GQuery nextAll() {return null;}
+ public GQuery nextUntil(String selector) {return null;}
+ public GQuery not(Element elem) {return null;}
+ public GQuery not(GQuery gq) {return null;}
+ public GQuery not(String... filters) {return null;}
+ public GQuery offsetParent() {return null;}
+ public GQuery one(int eventbits, Object data, Function f) {return null;}
+ public int outerHeight() {return 0;}
+ public int outerHeight(boolean includeMargin) {return 0;}
+ public int outerWidth() {return 0;}
+ public int outerWidth(boolean includeMargin) {return 0;}
+ public GQuery parent() {return null;}
+ public GQuery parent(String... filters) {return null;}
+ public GQuery parents() {return null;}
+ public GQuery parents(String... filters) {return null;}
+ public GQuery parentsUntil(String selector) {return null;}
+// public Offset position() {return null;}
+ public GQuery prepend(GQuery query) {return null;}
+ public GQuery prepend(Node n) {return null;}
+ public GQuery prepend(String html) {return null;}
+ public GQuery prependTo(GQuery other) {return null;}
+ public GQuery prependTo(Node n) {return null;}
+ public GQuery prependTo(String html) {return null;}
+ public GQuery prev() {return null;}
+ public GQuery prev(String... selectors) {return null;}
+ public GQuery prevAll() {return null;}
+ public GQuery prevUntil(String selector) {return null;}
+ public boolean prop(String key) {return false;}
+ public GQuery prop(String key, boolean value) {return null;}
+ public GQuery prop(String key, Function closure) {return null;}
+ public int queue() {return 0;}
+ public int queue(String queueName) {return 0;}
+ public GQuery queue(Function... f) {return null;}
+ public GQuery queue(String queueName, Function... f) {return null;}
+ public GQuery remove() {return null;}
+ public GQuery remove(String filter) {return null;}
+ public GQuery removeAttr(String key) {return null;}
+ public GQuery removeClass(String... classes) {return null;}
+ public GQuery removeData(String name) {return null;}
+ public GQuery replaceAll(Element elem) {return null;}
+ public GQuery replaceAll(GQuery target) {return null;}
+ public GQuery replaceAll(String selector) {return null;}
+ public GQuery replaceWith(Element elem) {return null;}
+ public GQuery replaceWith(GQuery target) {return null;}
+ public GQuery replaceWith(String html) {return null;}
+ public GQuery resize(Function... f) {return null;}
+ public void restoreCssAttrs(String... cssProps) {}
+ public void resize(Function f) {}
+ public void saveCssAttrs(String... cssProps) {}
+ public GQuery scroll(Function... f) {return null;}
+ public GQuery scrollIntoView() {return null;}
+ public GQuery scrollIntoView(boolean ensure) {return null;}
+ public int scrollLeft() {return 0;}
+ public GQuery scrollLeft(int left) {return null;}
+ public GQuery scrollTo(int left, int top) {return null;}
+ public int scrollTop() {return 0;}
+ public GQuery scrollTop(int top) {return null;}
+ public GQuery select() {return null;}
+ public GQuery setArray(NodeList<Element> list) {return null;}
+ public void setPreviousObject(GQuery previousObject) {}
+ public GQuery setSelector(String selector) {return null;}
+ public GQuery show() {return null;}
+ public GQuery siblings() {return null;}
+ public GQuery siblings(String... selectors) {return null;}
+ public GQuery slice(int start, int end) {return null;}
+ public Effects slideDown(Function... f) {return null;}
+ public Effects slideDown(int millisecs, Function... f) {return null;}
+ public Effects slideToggle(int millisecs, Function... f) {return null;}
+ public Effects slideUp(Function... f) {return null;}
+ public Effects slideUp(int millisecs, Function... f) {return null;}
+ public GQuery stop() {return null;}
+ public GQuery stop(boolean clearQueue) {return null;}
+ public GQuery stop(boolean clearQueue, boolean jumpToEnd) {return null;}
+ public GQuery submit(Function... funcs) {return null;}
+ public String text() {return null;}
+ public GQuery text(String txt) {return null;}
+ public GQuery toggle() {return null;}
+ public GQuery toggle(Function... fn) {return null;}
+ public GQuery toggleClass(String... classes) {return null;}
+ public GQuery toggleClass(String clz, boolean addOrRemove) {return null;}
+ public int top() {return 0;}
+ public String toString(boolean pretty) {return null;}
+// public GQuery trigger(int eventbits, int... keys) {return null;}
+// public GQuery unbind(int eventbits) {return null;}
+ public GQuery undelegate() {return null;}
+ public GQuery undelegate(String selector) {return null;}
+ public GQuery undelegate(String selector, String eventName) {return null;}
+ public GQuery undelegate(String selector, int eventBit) {return null;}
+// public JsNodeArray unique(NodeList<Element> result) {return null;}
+ public GQuery unwrap() {return null;}
+ public String val() {return null;}
+ public GQuery val(String... values) {return null;}
+ public String[] vals() {return null;}
+ public boolean isVisible() {return false;}
+ public int width() {return 0;}
+ public GQuery width(int width) {return null;}
+ public GQuery wrap(Element elem) {return null;}
+ public GQuery wrap(GQuery query) {return null;}
+ public GQuery wrap(String html) {return null;}
+ public GQuery wrapAll(Element elem) {return null;}
+ public GQuery wrapAll(GQuery query) {return null;}
+ public GQuery wrapAll(String html) {return null;}
+ public GQuery wrapInner(Element elem) {return null;}
+ public GQuery wrapInner(GQuery query) {return null;}
+ public GQuery wrapInner(String html) {return null;}
+}
--- /dev/null
+package gwtquery.jsquery.client.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Node;
+import com.google.gwt.query.client.Function;
+import com.google.gwt.query.client.GQuery;
+import com.google.gwt.query.client.js.JsCache;
+import com.google.gwt.query.client.js.JsNodeArray;
+import com.google.gwt.query.client.js.JsUtils;
+
+/**
+ * These are a set of utility methods needed in jsquery because
+ * either they are not in the GQuery core yet, or they are already
+ * there but we need to modify their behavior.
+ * Most of them should be moved to the GQuery core api.
+ *
+ */
+public abstract class JsQueryUtils {
+
+ private native static String dumpObject(JavaScriptObject o) /*-{
+ var s = "";
+ for (k in o)
+ s += " " + k;
+ return s;
+ }-*/;
+
+ public static GQuery dollar(Object o) {
+ if (o instanceof String) {
+ return GQuery.$((String) o);
+ } else if (o instanceof JavaScriptObject) {
+ JavaScriptObject jso = (JavaScriptObject) o;
+ if (JsUtils.isFunction(jso)) {
+ new JsUtils.JsFunction(jso).fe();
+ } else {
+ GQuery r = GQuery.$(jso);
+ if (!JsUtils.isWindow(jso) && !JsUtils.isElement(jso) && JsUtils.isArray(jso)) {
+ JsCache c = jso.cast();
+ JsNodeArray elms = JsNodeArray.create();
+ for (int i = 0; i < c.length(); i++) {
+ Object obj = c.get(i);
+ if (obj instanceof Node) {
+ elms.addNode((Node) obj);
+ }
+ }
+ r = GQuery.$(elms);
+ }
+ return r;
+ }
+ }
+ return GQuery.$();
+ }
+
+ public static GQuery dollar(String s, Element ctx) {
+ return GQuery.$(s, ctx);
+ }
+
+ public static void ready(Function f) {
+ f.f();
+ }
+
+ public static int inArray(Object object, Object array) {
+ if (array instanceof List) {
+ return ((List<?>)array).indexOf(object);
+ } else if (object instanceof JavaScriptObject
+ && JsUtils.isElement((JavaScriptObject) object)) {
+ return dollar(array).index((Element) object);
+ } else if (array instanceof JavaScriptObject
+ && JsUtils.isArray((JavaScriptObject) array)) {
+ return ((JsCache) array).indexOf(object);
+ }
+ return -1;
+ }
+
+ public static JavaScriptObject extend(Object... objs) {
+ int i = 0, l = objs.length;
+ boolean deep = false;
+ JavaScriptObject ctx = null;
+ Object target = objs[i];
+ if (target instanceof Boolean) {
+ deep = (Boolean) target;
+ if (l == 1)
+ return ctx;
+ target = objs[i++];
+ }
+ if (l - i == 1) {
+ i--;
+ } else {
+ ctx = (JavaScriptObject) target;
+ }
+
+ for (++i; i < l; i++) {
+ if (objs[i] != null) {
+ ctx = extendImpl(deep, ctx, objs[i]);
+ }
+ }
+ return ctx;
+ }
+
+ private static native JavaScriptObject getDefaultPrototype() /*-{
+ return $wnd.JsQuery && $wnd.JsQuery.fn
+ ? $wnd.JsQuery.fn.prototype
+ : null;
+ }-*/;
+
+ private static native JavaScriptObject extendImpl(boolean deep,
+ JavaScriptObject ctx, Object s) /*-{
+ var d = ctx ? ctx : $wnd.JsQuery.fn.prototype || {};
+ for (k in s) {
+ d[k] = s[k];
+ if (!ctx)
+ $wnd.$[k] = s[k];
+ }
+ return d;
+ }-*/;
+
+ public static JavaScriptObject[] each(JavaScriptObject[] objs, Function f) {
+ ArrayList<Object> ret = new ArrayList<Object>();
+ for (Object o : objs) {
+ f.setDataObject(o);
+ if (f.fe(null, o)) {
+ ret.add(o);
+ }
+ }
+ return ret.toArray(new JavaScriptObject[0]);
+ }
+
+ public static void log(Object l) {
+ System.out.println(l);
+ }
+
+}
--- /dev/null
+<!doctype html>
+<html>
+<head>
+<title>JsQuery</title>
+<script src="dev.nocache.js" ></script>
+</head>
+<body>
+ <div id='hello' style='display: none'>Hello</div>
+ <script>
+ onJsQueryLoad = function(){
+ $('#hello').show().attr("width", true);
+ $('#hello').fadeOut(1000).queue(2000).text("Hello word").fadeIn();
+ }
+ if (window.$) {
+ $(document).ready(onJsQueryLoad);
+ onJsQueryLoad = null;
+ }
+ </script>
+</body>
+</html>
--- /dev/null
+<!doctype html>
+<html>
+<head>
+<title>JsQuery</title>
+<script src="jsquery.nocache.js" ></script>
+</head>
+<body>
+ <div id='hello' style='display: none'>Hello</div>
+ <script>
+ onJsQueryLoad = function(){
+ $('#hello').show().attr("width", true);
+ $('#hello').fadeOut(1000).text("Hello word").fadeIn();
+ }
+ if (window.$) {
+ $(document).ready(onJsQueryLoad);
+ onJsQueryLoad = null;
+ }
+ </script>
+</body>
+</html>
--- /dev/null
+<module rename-to='jsmenu'>
+ <inherits name='com.google.gwt.query.jsquery.JsQuery' />
+ <entry-point class="gwtquery.jsplugins.menu.client.JsQueryMenu" />
+
+
+</module>
+
--- /dev/null
+package gwtquery.jsplugins.menu.client;
+
+/**
+ *
+ * This class wraps the jquery menu plugin from:
+ *
+ * http://p.sohei.org/jquery-plugins/menu/
+ *
+ */
+public abstract class JsMenu {
+
+ public static native void loadPlugin() /*-{
+ var l = @com.google.gwt.query.jsquery.client.JsQueryUtils::log(Ljava/lang/Object;);
+ var window = $wnd;
+ var document = $doc;
+ var jQuery = $wnd.$;
+
+(function($)
+{
+ var menus = [], //list of all menus
+ visibleMenus = [], //list of all visible menus
+ activeMenu = activeItem = null,
+ menuDIVElement = $('<div class="menu-div outerbox" style="position:absolute;top:0;left:0;display:none;"><div class="shadowbox1"></div><div class="shadowbox2"></div><div class="shadowbox3"></div></div>')[0],
+ menuULElement = $('<ul class="menu-ul innerbox"></ul>')[0],
+ menuItemElement = $('<li style="position:relative;"><div class="menu-item"></div></li>')[0],
+ arrowElement = $('<img class="menu-item-arrow" />')[0],
+ $rootDiv = $('<div id="root-menu-div" style="position:absolute;top:0;left:0;"></div>'), //create main menu div
+ defaults = {
+ // $.Menu options
+ showDelay : 200,
+ hideDelay : 200,
+ hoverOpenDelay: 0,
+ offsetTop : 0,
+ offsetLeft : 0,
+ minWidth: 0,
+ onOpen: null,
+ onClose: null,
+
+ // $.MenuItem options
+ onClick: null,
+ arrowSrc: null,
+ addExpando: false,
+
+ // $.fn.menuFromElement options
+ copyClassAttr: false
+ };
+
+ $(function(){
+ $rootDiv.appendTo('body');
+ });
+
+ $.extend({
+ MenuCollection : function(items) {
+
+ this.menus = [];
+
+ this.init(items);
+ }
+ });
+ $.extend($.MenuCollection, {
+ prototype : {
+ init : function(items)
+ {
+ if ( items && items.length )
+ {
+ for ( var i = 0; i < items.length; i++ )
+ {
+ this.addMenu(items[i]);
+ items[i].menuCollection = this;
+ }
+ }
+ },
+ addMenu : function(menu)
+ {
+ if ( menu instanceof $.Menu )
+ this.menus.push(menu);
+
+ menu.menuCollection = this;
+
+ var self = this;
+ $(menu.target).hover(function(){
+ if ( menu.visible )
+ return;
+
+ //when there is an open menu in this collection, hide it and show the new one
+ for ( var i = 0; i < self.menus.length; i++ )
+ {
+ if ( self.menus[i].visible )
+ {
+ self.menus[i].hide();
+ menu.show();
+ return;
+ }
+ }
+ }, function(){});
+ }
+ }
+ });
+
+ $.extend({
+ Menu : function(target, items, options) {
+ this.menuItems = []; //all direct child $.MenuItem objects
+ this.subMenus = []; //all subMenus from this.menuItems
+ this.visible = false;
+ this.active = false; //this menu has hover or one of its submenus is open
+ this.parentMenuItem = null;
+ this.settings = $.extend({}, defaults, options);
+ this.target = target;
+ this.$eDIV = null;
+ this.$eUL = null;
+ this.timer = null;
+ this.menuCollection = null;
+ this.openTimer = null;
+
+ this.init();
+ if ( items && $.isArray(items) )
+ this.addItems(items);
+ }
+ });
+ $.extend($.Menu, {
+ checkMouse : function(e)
+ {
+ var t = e.target;
+ //the user clicked on the target of the currenty open menu
+ if ( visibleMenus.length && t == visibleMenus[0].target )
+ return;
+
+ //get the last node before the #root-menu-div
+ while ( t.parentNode && t.parentNode != $rootDiv[0] )
+ t = t.parentNode;
+
+ // FIXME: why do we need a timeout
+ setTimeout($.Menu.closeAll, 100);
+
+ // FIXME: JsQuery each doesn't work with arrays
+ // if ( !$(visibleMenus).filter(function(){ return this.$eDIV[0] == t }).length )
+ // {
+ // $.Menu.closeAll();
+ // }
+ return true;
+ },
+ checkKey : function(e)
+ {
+ switch ( e.keyCode )
+ {
+ case 13: //return
+ if ( activeItem )
+ activeItem.click(e, activeItem.$eLI[0]);
+ break;
+ case 27: //ESC
+ $.Menu.closeAll();
+ break;
+ case 37: //left
+ if ( !activeMenu )
+ activeMenu = visibleMenus[0];
+ var a = activeMenu;
+ if ( a && a.parentMenuItem ) //select the parent menu and close the submenu
+ {
+ //unbind the events temporary, as we dont want the hoverout event to fire
+ var pmi = a.parentMenuItem;
+ pmi.$eLI.unbind('mouseout').unbind('mouseover');
+ a.hide();
+ pmi.hoverIn(true);
+ setTimeout(function(){ //bind again..but delay it
+ pmi.bindHover();
+ });
+ }
+ else if ( a && a.menuCollection ) //select the previous menu in the collection
+ {
+ var pos,
+ mcm = a.menuCollection.menus;
+ if ( (pos = $.inArray(a, mcm)) > -1 )
+ {
+ if ( --pos < 0 )
+ pos = mcm.length - 1;
+ $.Menu.closeAll();
+ mcm[pos].show();
+ mcm[pos].setActive();
+ if ( mcm[pos].menuItems.length ) //select the first item
+ mcm[pos].menuItems[0].hoverIn(true);
+ }
+ }
+ break;
+ case 38: //up
+ if ( activeMenu )
+ activeMenu.selectNextItem(-1);
+ break;
+ case 39: //right
+ if ( !activeMenu )
+ activeMenu = visibleMenus[0];
+ var m,
+ a = activeMenu,
+ asm = activeItem ? activeItem.subMenu : null;
+ if ( a )
+ {
+ if ( asm && asm.menuItems.length ) //select the submenu
+ {
+ asm.show();
+ asm.menuItems[0].hoverIn();
+ }
+ else if ( (a = a.inMenuCollection()) ) //select the next menu in the collection
+ {
+ var pos,
+ mcm = a.menuCollection.menus;
+ if ( (pos = $.inArray(a, mcm)) > -1 )
+ {
+ if ( ++pos >= mcm.length )
+ pos = 0;
+ $.Menu.closeAll();
+ mcm[pos].show();
+ mcm[pos].setActive();
+ if ( mcm[pos].menuItems.length ) //select the first item
+ mcm[pos].menuItems[0].hoverIn(true);
+ }
+ }
+ }
+ break;
+ case 40: //down
+ if ( !activeMenu )
+ {
+ if ( visibleMenus.length && visibleMenus[0].menuItems.length )
+ visibleMenus[0].menuItems[0].hoverIn();
+ }
+ else
+ activeMenu.selectNextItem();
+ break;
+ }
+ if ( e.keyCode > 36 && e.keyCode < 41 )
+ return false; //this will prevent scrolling
+ },
+ closeAll : function()
+ {
+ while ( visibleMenus.length )
+ visibleMenus[0].hide();
+ },
+ setDefaults : function(d)
+ {
+ $.extend(defaults, d);
+ },
+ prototype : {
+
+ init : function()
+ {
+ var self = this;
+ if ( !this.target )
+ return;
+ else if ( this.target instanceof $.MenuItem )
+ {
+ this.parentMenuItem = this.target;
+ this.target.addSubMenu(this);
+ this.target = this.target.$eLI;
+ }
+
+ menus.push(this);
+
+ //use the dom methods instead the ones from jquery (faster)
+ this.$eDIV = $(menuDIVElement.cloneNode(1));
+ this.$eUL = $(menuULElement.cloneNode(1));
+ this.$eDIV[0].appendChild(this.$eUL[0]);
+ $rootDiv[0].appendChild(this.$eDIV[0]);
+
+ //bind events
+ if ( !this.parentMenuItem )
+ {
+ $(this.target).click(function(e){
+ self.onClick(e);
+ }).hover(function(e){
+ self.setActive();
+
+ if ( self.settings.hoverOpenDelay )
+ {
+ self.openTimer = setTimeout(function(){
+ if ( !self.visible )
+ self.onClick(e);
+ }, self.settings.hoverOpenDelay);
+ }
+ }, function(){
+ if ( !self.visible )
+ $(this).removeClass('activetarget');
+
+ if ( self.openTimer )
+ clearTimeout(self.openTimer);
+ });
+ }
+ else
+ {
+ this.$eDIV.hover(function(){
+ self.setActive();
+ }, function(){});
+ }
+ },
+ setActive : function()
+ {
+ if ( !this.parentMenuItem )
+ $(this.target).addClass('activetarget');
+ else
+ this.active = true;
+ },
+ addItem : function(item)
+ {
+ if ( item instanceof $.MenuItem )
+ {
+ if ( $.inArray(item, this.menuItems) == -1 )
+ {
+ this.$eUL.append(item.$eLI);
+ this.menuItems.push(item);
+ item.parentMenu = this;
+ if ( item.subMenu )
+ this.subMenus.push(item.subMenu);
+ }
+ }
+ else
+ {
+ this.addItem(new $.MenuItem(item, this.settings));
+ }
+ },
+ addItems : function(items)
+ {
+ for ( var i = 0; i < items.length; i++ )
+ {
+ this.addItem(items[i]);
+ }
+ },
+ removeItem : function(item)
+ {
+ var pos = $.inArray(item, this.menuItems);
+ if ( pos > -1 )
+ this.menuItems.splice(pos, 1);
+ item.parentMenu = null;
+ },
+ hide : function()
+ {
+ if ( !this.visible )
+ return;
+
+ var i,
+ pos = $.inArray(this, visibleMenus);
+
+ this.$eDIV.hide();
+
+ if ( pos >= 0 )
+ visibleMenus.splice(pos, 1);
+ this.visible = this.active = false;
+
+ $(this.target).removeClass('activetarget');
+
+ //hide all submenus
+ for ( i = 0; i < this.subMenus.length; i++ )
+ {
+ this.subMenus[i].hide();
+ }
+
+ //set all items inactive (e.g. remove hover class..)
+ for ( i = 0; i < this.menuItems.length; i++ )
+ {
+ if ( this.menuItems[i].active )
+ this.menuItems[i].setInactive();
+ }
+
+ if ( !visibleMenus.length ) //unbind events when the last menu was closed
+ $(document).unbind('mousedown', $.Menu.checkMouse).unbind('keydown', $.Menu.checkKey);
+
+ if ( activeMenu == this )
+ activeMenu = null;
+
+ if ( this.settings.onClose )
+ this.settings.onClose.call(this);
+ },
+ show : function(e)
+ {
+ if ( this.visible )
+ return;
+
+ var zi,
+ pmi = this.parentMenuItem;
+
+ if ( this.menuItems.length ) //show only when it has items
+ {
+ if ( pmi ) //set z-index
+ {
+ zi = parseInt(pmi.parentMenu.$eDIV.css('z-index'));
+ this.$eDIV.css('z-index', (isNaN(zi) ? 1 : zi + 1));
+ }
+ this.$eDIV.css({visibility: 'hidden', display:'block'});
+
+ //set min-width
+ if ( this.settings.minWidth )
+ {
+ if ( this.$eDIV.width() < this.settings.minWidth )
+ this.$eDIV.css('width', this.settings.minWidth);
+ }
+
+ this.setPosition();
+ this.$eDIV.css({display:'none', visibility: ''}).show();
+
+ //IEs default width: auto is bad! ie6 and ie7 have are producing different errors.. (7 = 5px shadowbox + 2px border)
+ if ( 0) //$.browser.msie )
+ this.$eUL.css('width', parseInt($.browser.version) == 6 ? this.$eDIV.width() - 7 : this.$eUL.width());
+
+ if ( this.settings.onOpen )
+ this.settings.onOpen.call(this);
+ }
+
+ if ( visibleMenus.length == 0 )
+ $(document).bind('mousedown', $.Menu.checkMouse).bind('keydown', $.Menu.checkKey);
+
+ this.visible = true;
+ visibleMenus.push(this);
+ },
+ setPosition : function()
+ {
+ var $t, o, posX, posY,
+ pmo, //parent menu offset
+ wst, //window scroll top
+ wsl, //window scroll left
+ ww = $(window).width(),
+ wh = $(window).height(),
+ pmi = this.parentMenuItem,
+ height = this.$eDIV[0].clientHeight,
+ width = this.$eDIV[0].clientWidth,
+ pheight; //parent height
+
+ if ( pmi )
+ {
+ //position on the right side of the parent menu item
+ o = pmi.$eLI.offset();
+ posX = o.left + pmi.$eLI.width();
+ posY = o.top;
+ }
+ else
+ {
+ //position right below the target
+ $t = $(this.target);
+ o = $t.offset();
+
+ posX = o.left + this.settings.offsetLeft;
+ posY = o.top + $t.height() + this.settings.offsetTop;
+ }
+
+ //y-pos
+ if ($().scrollTop )
+ {
+ wst = $(window).scrollTop();
+ if ( wh < height ) //menu is bigger than the window
+ {
+ //position the menu at the top of the visible area
+ posY = wst;
+ }
+ else if ( wh + wst < posY + height ) //outside on the bottom?
+ {
+ if ( pmi )
+ {
+ pmo = pmi.parentMenu.$eDIV.offset();
+ pheight = pmi.parentMenu.$eDIV[0].clientHeight;
+ if ( height <= pheight )
+ {
+ //bottom position = parentmenu-bottom position
+ posY = pmo.top + pheight - height;
+ }
+ else
+ {
+ //top position = parentmenu-top position
+ posY = pmo.top;
+ }
+ //still outside on the bottom?
+ if ( wh + wst < posY + height )
+ {
+ //shift the menu upwards till the bottom is visible
+ posY -= posY + height - (wh + wst);
+ }
+ }
+ else
+ {
+ //shift the menu upwards till the bottom is visible
+ posY -= posY + height - (wh + wst);
+ }
+ }
+ }
+ //x-pos
+ if ($().scrollLeft )
+ {
+ wsl = $(window).scrollLeft();
+ if ( ww + wsl < posX + width )
+ {
+ if ( pmi )
+ {
+ //display the menu not on the right side but on the left side
+ posX -= pmi.$eLI.width() + width;
+ //outside on the left now?
+ if ( posX < wsl )
+ posX = wsl;
+ }
+ else
+ {
+ //shift the menu to the left until it fits
+ posX -= posX + width - (ww + wsl);
+ }
+ }
+ }
+
+ //set position
+ this.$eDIV.css({left: posX, top: posY});
+ },
+ onClick : function(e)
+ {
+ if ( this.visible )
+ {
+ this.hide();
+ this.setActive(); //the class is removed in the hide() method..add it again
+ }
+ else
+ {
+ //close all open menus
+ $.Menu.closeAll();
+ this.show(e);
+ }
+ },
+ addTimer : function(callback, delay)
+ {
+ var self = this;
+ this.timer = setTimeout(function(){
+ callback.call(self);
+ self.timer = null;
+ }, delay);
+ },
+ removeTimer : function()
+ {
+ if ( this.timer )
+ {
+ clearTimeout(this.timer);
+ this.timer = null;
+ }
+ },
+ selectNextItem : function(offset)
+ {
+ var i, pos = 0,
+ mil = this.menuItems.length,
+ o = offset || 1;
+
+ //get current pos
+ for ( i = 0; i < mil; i++ )
+ {
+ if ( this.menuItems[i].active )
+ {
+ pos = i;
+ break;
+ }
+ }
+ this.menuItems[pos].hoverOut();
+
+ do //jump over the separators
+ {
+ pos += o;
+ if ( pos >= mil )
+ pos = 0;
+ else if ( pos < 0 )
+ pos = mil - 1;
+ } while ( this.menuItems[pos].separator );
+ this.menuItems[pos].hoverIn(true);
+ },
+ inMenuCollection : function()
+ {
+ var m = this;
+ while ( m.parentMenuItem )
+ m = m.parentMenuItem.parentMenu;
+ return m.menuCollection ? m : null;
+ },
+ destroy : function() //delete menu
+ {
+ var pos, item;
+
+ this.hide();
+
+ //unbind events
+ if ( !this.parentMenuItem )
+ $(this.target).unbind('click').unbind('mouseover').unbind('mouseout');
+ else
+ this.$eDIV.unbind('mouseover').unbind('mouseout');
+
+ //destroy all items
+ while ( this.menuItems.length )
+ {
+ item = this.menuItems[0];
+ item.destroy();
+ delete item;
+ }
+
+ if ( (pos = $.inArray(this, menus)) > -1 )
+ menus.splice(pos, 1);
+
+ if ( this.menuCollection )
+ {
+ if ( (pos = $.inArray(this, this.menuCollection.menus)) > -1 )
+ this.menuCollection.menus.splice(pos, 1);
+ }
+
+ this.$eDIV.remove();
+ }
+ }
+ });
+
+ $.extend({
+ MenuItem : function(obj, options)
+ {
+ if ( typeof obj == 'string' )
+ obj = {src: obj};
+
+ this.src = obj.src || '';
+ this.url = obj.url || null;
+ this.urlTarget = obj.target || null;
+ this.addClass = obj.addClass || null;
+ this.data = obj.data || null;
+
+ this.$eLI = null;
+ this.parentMenu = null;
+ this.subMenu = null;
+ this.settings = $.extend({}, defaults, options);
+ this.active = false;
+ this.enabled = true;
+ this.separator = false;
+
+ this.init();
+
+ if ( obj.subMenu )
+ new $.Menu(this, obj.subMenu, options);
+ }
+ });
+
+ $.extend($.MenuItem, {
+ prototype : {
+ init : function()
+ {
+ var i, isStr,
+ src = this.src,
+ self = this;
+
+ this.$eLI = $(menuItemElement.cloneNode(1));
+ if ( this.addClass )
+ this.$eLI[0].setAttribute('class', this.addClass);
+
+ if ( this.settings.addExpando && this.data )
+ this.$eLI[0].menuData = this.data;
+
+ if ( src == '' )
+ {
+ this.$eLI.addClass('menu-separator');
+ this.separator = true;
+ }
+ else
+ {
+ isStr = typeof src == 'string';
+ if ( isStr && this.url ) //create a link node, when we have an url
+ src = $('<a href="' + this.url + '"' + (this.urlTarget ? 'target="' + this.urlTarget + '"' : '') + '>' + src + '</a>');
+ else if ( isStr || !src.length )
+ src = [src];
+ //go through the passed DOM-Elements (or jquery objects or text nodes.) and append them to the menus list item
+ //this.$eLI.append(this.src) is really slow when having a lot(!!!) of items
+ for ( i = 0; i < src.length; i++ )
+ {
+ if ( typeof src[i] == 'string' )
+ {
+ //we cant use createTextNode, as html entities won't be displayed correctly (eg. ©)
+ elem = document.createElement('span');
+ elem.innerHTML = src[i];
+ this.$eLI[0].firstChild.appendChild(elem);
+ }
+ else
+ this.$eLI[0].firstChild.appendChild(src[i].cloneNode(1));
+ }
+ }
+
+ this.$eLI.click(function(e){
+ self.click(e, this);
+ });
+ this.bindHover();
+ },
+ click : function(e, scope)
+ {
+ if ( this.enabled && this.settings.onClick )
+ this.settings.onClick.call(scope, e, this);
+ },
+ bindHover : function()
+ {
+ var self = this;
+ this.$eLI.hover(function(){
+ self.hoverIn();
+ }, function(){
+ self.hoverOut();
+ });
+ },
+ hoverIn : function(noSubMenu)
+ {
+ this.removeTimer();
+
+ var i,
+ pms = this.parentMenu.subMenus,
+ pmi = this.parentMenu.menuItems,
+ self = this;
+
+ //remove the timer from the parent item, when there is one (e.g. to close the menu)
+ if ( this.parentMenu.timer )
+ this.parentMenu.removeTimer();
+
+ if ( !this.enabled )
+ return;
+
+ //deactivate all menuItems on the same level
+ for ( i = 0; i < pmi.length; i++ )
+ {
+ if ( pmi[i].active )
+ pmi[i].setInactive();
+ }
+
+ this.setActive();
+ activeMenu = this.parentMenu;
+
+ //are there open submenus on the same level? close them!
+ for ( i = 0; i < pms.length; i++ )
+ {
+ if ( pms[i].visible && pms[i] != this.subMenu && !pms[i].timer ) //close if there is no closetimer running already
+ pms[i].addTimer(function(){
+ this.hide();
+ }, pms[i].settings.hideDelay);
+ }
+
+ if ( this.subMenu && !noSubMenu )
+ {
+ //set timeout to show menu
+ this.subMenu.addTimer(function(){
+ this.show();
+ }, this.subMenu.settings.showDelay);
+ }
+ },
+ hoverOut : function()
+ {
+ this.removeTimer();
+
+ if ( !this.enabled )
+ return;
+
+ if ( !this.subMenu || !this.subMenu.visible )
+ this.setInactive();
+ },
+ removeTimer : function()
+ {
+ if ( this.subMenu )
+ {
+ this.subMenu.removeTimer();
+ }
+ },
+ setActive : function()
+ {
+ this.active = true;
+ this.$eLI.addClass('active');
+
+ //set the parent menu item active too if necessary
+ var pmi = this.parentMenu.parentMenuItem;
+ if ( pmi && !pmi.active )
+ pmi.setActive();
+
+ activeItem = this;
+ },
+ setInactive : function()
+ {
+ this.active = false;
+ this.$eLI.removeClass('active');
+ if ( this == activeItem )
+ activeItem = null;
+ },
+ enable : function()
+ {
+ this.$eLI.removeClass('disabled');
+ this.enabled = true;
+ },
+ disable : function()
+ {
+ this.$eLI.addClass('disabled');
+ this.enabled = false;
+ },
+ destroy : function()
+ {
+ this.removeTimer();
+
+ this.$eLI.remove();
+
+ //unbind events
+ this.$eLI.unbind('mouseover').unbind('mouseout').unbind('click');
+ //delete submenu
+ if ( this.subMenu )
+ {
+ this.subMenu.destroy();
+ delete this.subMenu;
+ }
+ this.parentMenu.removeItem(this);
+ },
+ addSubMenu : function(menu)
+ {
+ if ( this.subMenu )
+ return;
+ this.subMenu = menu;
+ if ( this.parentMenu && $.inArray(menu, this.parentMenu.subMenus) == -1 )
+ this.parentMenu.subMenus.push(menu);
+ if ( this.settings.arrowSrc )
+ {
+ var a = arrowElement.cloneNode(0);
+ a.setAttribute('src', this.settings.arrowSrc);
+ this.$eLI[0].firstChild.appendChild(a);
+ }
+ }
+ }
+ });
+
+
+ $.extend($.fn, {
+ menuFromElement : function(options, list, bar)
+ {
+ var createItems = function(ul)
+ {
+ var menuItems = [],
+ subItems,
+ menuItem,
+ lis, $li, i, subUL, submenu, target,
+ classNames = null;
+
+ lis = getAllChilds(ul, 'LI');
+ for ( i = 0; i < lis.length; i++ )
+ {
+ subItems = [];
+
+ if ( !lis[i].childNodes.length ) //empty item? add separator
+ {
+ menuItems.push(new $.MenuItem('', options));
+ continue;
+ }
+
+ if ( (subUL = getOneChild(lis[i], 'UL')) )
+ {
+ subItems = createItems(subUL);
+ //remove subUL from DOM
+ $(subUL).remove();
+ }
+
+ //select the target...get the elements inside the li
+ $li = $(lis[i]);
+ if ( $li[0].childNodes.length == 1 && $li[0].childNodes[0].nodeType == 3 )
+ target = $li[0].childNodes[0].nodeValue;
+ else
+ target = $li[0].childNodes;
+
+ if ( options && options.copyClassAttr )
+ classNames = $li.attr('class');
+
+ //create item
+ menuItem = new $.MenuItem({src: target, addClass: classNames}, options);
+ menuItems.push(menuItem);
+ //add submenu
+ if ( subItems.length )
+ new $.Menu(menuItem, subItems, options);
+
+ }
+ return menuItems;
+ };
+ return this.each(function()
+ {
+ var ul, m;
+ //get the list element
+ if ( list || (ul = getOneChild(this, 'UL')) )
+ {
+ //if a specific list element is used, clone it, as we probably need it more than once
+ ul = list ? $(list).clone(true)[0] : ul;
+ menuItems = createItems(ul);
+ if ( menuItems.length )
+ {
+ m = new $.Menu(this, menuItems, options);
+ if ( bar )
+ bar.addMenu(m);
+ }
+ $(ul).hide();
+ }
+ });
+ },
+ menuBarFromUL : function(options)
+ {
+ return this.each(function()
+ {
+ var i,
+ lis = getAllChilds(this, 'LI');
+ if ( lis.length )
+ {
+ bar = new $.MenuCollection();
+ for ( i = 0; i < lis.length; i++ )
+ $(lis[i]).menuFromElement(options, null, bar);
+ }
+ });
+ },
+ menu : function(options, items)
+ {
+ return this.each(function()
+ {
+ if ( items && $.isArray(items) )
+ new $.Menu(this, items, options);
+ else
+ {
+ if ( this.nodeName.toUpperCase() == 'UL' )
+ $(this).menuBarFromUL(options);
+ else
+ $(this).menuFromElement(options, items);
+ }
+ });
+ }
+ });
+
+ //faster than using jquery
+ var getOneChild = function(elem, name)
+ {
+ if ( !elem )
+ return null;
+
+ var n = elem.firstChild;
+ for ( ; n; n = n.nextSibling )
+ {
+ if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name )
+ return n;
+ }
+ return null;
+ };
+ //faster than using jquery
+ var getAllChilds = function(elem, name)
+ {
+ if ( !elem )
+ return [];
+
+ var r = [],
+ n = elem.firstChild;
+ for ( ; n; n = n.nextSibling )
+ {
+ if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name )
+ r[r.length] = n;
+ }
+ return r;
+ };
+
+})(jQuery);
+
+ }-*/;
+}
--- /dev/null
+package gwtquery.jsplugins.menu.client;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.query.jsquery.client.JsQuery;
+
+public class JsQueryMenu implements EntryPoint {
+
+ public void onModuleLoad() {
+ JsMenu.loadPlugin();
+ JsQuery.onLoad();
+ }
+}
--- /dev/null
+--- query.menu.js 2012-03-17 21:13:29.000000000 +0100
++++ JsMenu.java 2012-03-17 21:04:09.000000000 +0100
+@@ -114,7 +113,7 @@
+ this.openTimer = null;
+
+ this.init();
+- if ( items && items.constructor == Array )
++ if ( items && $.isArray(items) )
+ this.addItems(items);
+ }
+ });
+@@ -132,11 +129,15 @@
+ while ( t.parentNode && t.parentNode != $rootDiv[0] )
+ t = t.parentNode;
+
+- //is the found node one of the visible menu elements?
+- if ( !$(visibleMenus).filter(function(){ return this.$eDIV[0] == t }).length )
+- {
+- $.Menu.closeAll();
+- }
++ // FIXME: why do we need a timeout
++ setTimeout($.Menu.closeAll, 100);
++
++ // FIXME: JsQuery each doesn't work with arrays
++ // if ( !$(visibleMenus).filter(function(){ return this.$eDIV[0] == t }).length )
++ // {
++ // $.Menu.closeAll();
++ // }
++ return true;
+ },
+ checkKey : function(e)
+ {
+@@ -395,7 +394,7 @@
+ this.$eDIV.css({display:'none', visibility: ''}).show();
+
+ //IEs default width: auto is bad! ie6 and ie7 have are producing different errors.. (7 = 5px shadowbox + 2px border)
+- if ( $.browser.msie )
++ if ( 0) //$.browser.msie )
+ this.$eUL.css('width', parseInt($.browser.version) == 6 ? this.$eDIV.width() - 7 : this.$eUL.width());
+
+ if ( this.settings.onOpen )
+@@ -437,7 +438,7 @@
+ }
+
+ //y-pos
+- if ( $.fn.scrollTop )
++ if ($().scrollTop )
+ {
+ wst = $(window).scrollTop();
+ if ( wh < height ) //menu is bigger than the window
+@@ -476,7 +477,7 @@
+ }
+ }
+ //x-pos
+- if ( $.fn.scrollLeft )
++ if ($().scrollLeft )
+ {
+ wsl = $(window).scrollLeft();
+ if ( ww + wsl < posX + width )
+@@ -898,7 +897,7 @@
+ {
+ return this.each(function()
+ {
+- if ( items && items.constructor == Array )
++ if ( items && $.isArray(items) )
+ new $.Menu(this, items, options);
+ else
+ {
+
--- /dev/null
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>jQuery menu plugin demo page</title>
+<link rel="stylesheet" type="text/css" href="style.css" />
+<script src="jsmenu.nocache.js" ></script>
+<script type="text/javascript">
+
+// JsQuery will run this function after it is asynchronously loaded
+onJsQueryLoad = function(){
+ var options = {minWidth: 120, arrowSrc: 'arrow_right.gif', copyClassAttr: true, onClick: function(e, menuItem){
+ alert('you clicked item "' + $(this).text() + '"');
+ }};
+ $('#menuone').menu(options);
+
+ var items = [ {src: 'test', url:'http://www.jquery.com'},
+ {src: ''}, // separator
+ {src: 'test2', subMenu: [ {src: 'sub 1'},
+ {src: 'sub 2', url: 'http://p.sohei.org', target: '_blank'},
+ {src: 'sub 3'}]}];
+ $('#menutwo').menu(options, items);
+ $('#menuthree').menu(options);
+ $('#menufive>img').menu(options, '#menufivelist');
+
+ //creating a menu without items
+ var menu = new $.Menu('#menufour', null, options);
+ //adding items to the menu
+ menu.addItems([
+ new $.MenuItem({src: 'test', url:'http://www.jquery.com'}, options),
+ new $.MenuItem({src: ''}) // separator
+ ]);
+ var itemWithSubmenu = new $.MenuItem({src: 'test2'}, options);
+ //creating a menu with items (as child of itemWithSubmenu)
+ new $.Menu(itemWithSubmenu, [
+ new $.MenuItem({src: 'sub 1'}, options),
+ new $.MenuItem({src: 'sub 2', url: 'http://p.sohei.org', target: '_blank'}, options),
+ new $.MenuItem({src: 'sub 3'}, options)
+ ], options);
+ //adding the submenu to the main menu
+ menu.addItem(itemWithSubmenu);
+}
+
+// If jsQuery or jQuery was already loaded we use the normal way
+if (window.$) {
+ $(document).ready(onJsQueryLoad);
+ onJsQueryLoad = null;
+}
+
+-->
+</script>
+</head>
+<body>
+<div id="header">
+<div class="title">jQuery Menu plugin demo</div>
+<div class="link"><a href="http://p.sohei.org/jquery-plugins/menu">plugin page</a></div>
+</div>
+
+<div class="exa">
+<h1>Available options:</h1>
+ options which affect the menu:
+ <ul>
+ <li><strong>showDelay</strong> - The number of milliseconds to wait before opening the menu after hovering over the target. Default value: 200</li>
+ <li><strong>hideDelay</strong> - The number of milliseconds to wait before closing the menu. Default value: 200</li>
+ <li><strong>hoverOpenDelay</strong> - The number of milliseconds to wait before opening the topmost-menu (root) (without clicking it!). Default value: 0 (disabled!)</li>
+ <li><strong>offsetTop</strong> - The number of pixels to offset the position of the topmost-menu (root) to the top. Default value: 0</li>
+ <li><strong>offsetLeft</strong> - The number of pixels to offset the position of the topmost-menu (root) to the left. Default value: 0</li>
+ <li><strong>minWidth</strong> - The minimal number of pixels of the menus width. Default value: 0</li></li>
+ <li><strong>onOpen</strong> - Callback function which is triggered when a menu is opened. Default value: null</li>
+ <li><strong>onClose</strong> - Callback function which is triggered when a menu is closed. Default value: null</li>
+ </ul>
+ options which affect the menuItems:
+ <ul>
+ <li><strong>onClick</strong> - Callback function which is triggered when a menuItem is clicked. The passed parameters are: the event object and the menuItem instance. Default value: null</li>
+ <li><strong>arrowSrc</strong> - URL of the image to be used as an arrow indicating a submenu. Default value: null (no arrow image!)</li>
+ </ul>
+ options which are only used, when building a menu from HTML markup:
+ <ul>
+ <li><strong>copyClassAttr</strong> - Copies the class attribute of the LI elements to the equivalent menuItems. Default value: false</li>
+ </ul>
+</div>
+
+<div class="exa">
+<h1>Example one:</h1>
+ <ul>
+ <li>create a menubar from an unordered list</li>
+ <li>used on an unordered list, the plugin takes its direct <li>-children, which will be the root items (File, Edit...),
+ and searches each for an <ul>-child, which holds the menu-items (New window, Save, Print...).</li>
+ <li>empty <li>-elements are used as seperators</li>
+ </ul>
+ <div class="codeheader">JavaScript code:</div>
+ <pre name="code" class="JScript">
+ var options = {minWidth: 120, arrowSrc: 'arrow_right.gif', onClick: function(e, menuItem){
+ alert('you clicked item "' + $(this).text() + '"');
+ }};
+ $('#menuone').menu(options);
+ </pre>
+ <div class="codeheader">HTML markup:</div>
+ <pre name="code" class="html">
+ <!-- note: the plugin doesn't need the classes, they're only used for styling! -->
+ <ul id="menuone" class="menu">
+ <li class="menumain">File
+ <ul><li>New window</li>
+ <li></li> <!-- separator -->
+ <li>Save...</li>
+ <li>Print...</li>
+ <li></li> <!-- separator -->
+ <li>Exit</li>
+ </ul>
+ </li>
+ <li class="menumain">Edit
+ <ul><li>Undo</li>
+ <li>Redo</li>
+ <li></li> <!-- separator -->
+ <li>Cut</li>
+ <li>Copy</li>
+ <li>Paste<ul><li>All</li><li>Something</li></ul></li>
+ <li>Delete</li>
+ </ul>
+ </li>
+ <!-- ...and even more... -->
+ </ul>
+ </pre>
+ <div class="resultheader">Result:</div>
+ <div class="result" style="padding:0;">
+ <div style="border-bottom: 1px solid #000;background:#eee;">
+ <ul id="menuone" class="menu">
+ <li class="menumain">File
+ <ul><li>New window</li>
+ <li></li>
+ <li>Save...</li>
+ <li>Print...</li>
+ <li></li>
+ <li>Exit</li>
+ </ul>
+ </li>
+ <li class="menumain">Edit
+ <ul><li>Undo</li>
+ <li>Redo</li>
+ <li></li>
+ <li>Cut</li>
+ <li>Copy</li>
+ <li>Paste<ul><li>All</li><li>Something</li></ul></li>
+ <li>Delete</li>
+ </ul>
+ </li>
+ <li class="menumain">Bookmarks
+ <ul><li>Bookmark manager</li>
+ <li></li>
+ <li>some bookmark</li>
+ <li>another bookmark</li>
+ <li></li>
+ <li>Imported bookmarks
+ <ul><li>bookmark one</li>
+ <li>bookmark two</li>
+ <li>bookmark three</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li class="menumain" style="float:right;">Help
+ <ul><li>Help index</li>
+ <li></li>
+ <li>About...
+ <ul>
+ <li>me</li>
+ <li>you</li>
+ <li>them</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ <div style="clear:both;"></div>
+ </div>
+ <p>..some content..</p>
+ <p>..some content..</p>
+ <p>..some content..</p>
+ </div>
+</div>
+
+<div class="exa">
+<h1>Example two:</h1>
+ <ul>
+ <li>create a menu from javascript and open it when clicking on the element with the id "menutwo"</li>
+ <li>when a second parameter ist passed (items), the plugin will use it as menu content</li>
+ </ul>
+ <div class="codeheader">JavaScript code:</div>
+ <pre name="code" class="JScript">
+ var options = {minWidth: 120, arrowSrc: 'arrow_right.gif'};
+ var items = [ {src: 'test', url:'http://www.jquery.com'},
+ {src: ''}, /* separator */
+ {src: 'test2', subMenu: [ {src: 'sub 1'},
+ {src: 'sub 2', url: 'http://p.sohei.org', target: '_blank'},
+ {src: 'sub 3'}]}];
+ $('#menutwo').menu(options, items);
+ </pre>
+ <div class="codeheader">HTML markup:</div>
+ <pre name="code" class="html">
+ <p><span id="menutwo">Menu Button</span></p>
+ </pre>
+ <div class="resultheader">Result:</div>
+ <div class="result">
+ <p>..some content..</p>
+ <p><span id="menutwo">Menu Button</span></p>
+ <p>..some content..</p>
+ </div>
+</div>
+
+<div class="exa">
+<h1>Example three:</h1>
+ <ul>
+ <li>same as example two, but without passing the items as parameter to the plugin</li>
+ <li>the plugin looks inside the elment for an unordered list, which holds the menu content</li>
+ </ul>
+ <div class="codeheader">JavaScript code:</div>
+ <pre name="code" class="JScript">
+ var options = {minWidth: 120, arrowSrc: 'arrow_right.gif'};
+ $('#menuthree').menu(options);
+ </pre>
+ <div class="codeheader">HTML markup:</div>
+ <pre name="code" class="html">
+ <div id="menuthree">Menu Button
+ <ul>
+ <li><a href="http://www.jquery.com">test</a></li>
+ <li></li> <!-- separator -->
+ <li>test2
+ <ul>
+ <li>sub 1</li>
+ <li><a href="http://p.sohei.org" target="_blank">sub 2</a></li>
+ <li>sub 3</li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </pre>
+ <div class="resultheader">Result:</div>
+ <div class="result">
+ <p>..some content..</p>
+ <div id="menuthree">Menu Button
+ <ul>
+ <li><a href="http://www.jquery.com">test</a></li>
+ <li></li>
+ <li>test2
+ <ul>
+ <li>sub 1</li>
+ <li><a href="http://p.sohei.org" target="_blank">sub 2</a></li>
+ <li>sub 3</li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ <p>..some content..</p>
+ </div>
+</div>
+
+<div class="exa">
+<h1>Example four:</h1>
+ <ul>
+ <li>same (result) as example two, but this time creating the menu by using the $.Menu and $.MenuItem classes and its methods</li>
+ </ul>
+ <div class="codeheader">JavaScript code:</div>
+ <pre name="code" class="JScript">
+ var options = {minWidth: 120, arrowSrc: 'arrow_right.gif'};
+
+ //creating a menu without items
+ var menu = new $.Menu('#menufour', null, options);
+
+ //adding items to the menu
+ menu.addItems([
+ new $.MenuItem({src: 'test', url:'http://www.jquery.com'}, options),
+ new $.MenuItem({src: ''}) /* separator */
+ ]);
+ var itemWithSubmenu = new $.MenuItem({src: 'test2'}, options);
+
+ //creating a menu with items (as child of itemWithSubmenu)
+ new $.Menu(itemWithSubmenu, [
+ new $.MenuItem({src: 'sub 1'}, options),
+ new $.MenuItem({src: 'sub 2', url: 'http://p.sohei.org', target: '_blank'}, options),
+ new $.MenuItem({src: 'sub 3'}, options)
+ ], options);
+
+ //adding the submenu to the main menu
+ menu.addItem(itemWithSubmenu);
+ </pre>
+ <div class="codeheader">HTML markup:</div>
+ <pre name="code" class="html">
+ <p><span id="menufour">Menu Button</span></p>
+ </pre>
+ <div class="resultheader">Result:</div>
+ <div class="result">
+ <p>..some content..</p>
+ <p><span id="menufour">Menu Button</span></p>
+ <p>..some content..</p>
+ </div>
+</div>
+
+<div class="exa">
+<h1>Example five:</h1>
+ <ul>
+ <li>related to example two, the menu items can also be passed as a jquery selector (selecting an <ul>-element!)</li>
+ </ul>
+ <div class="codeheader">JavaScript code:</div>
+ <pre name="code" class="JScript">
+ var options = {minWidth: 120, arrowSrc: 'arrow_right.gif', copyClassAttr: true};
+ $('#menufive>img').menu(options, '#menufivelist');
+ </pre>
+ <div class="codeheader">HTML markup:</div>
+ <pre name="code" class="html">
+ <p id="menufive">Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /></p>
+
+ <ul id="menufivelist" style="display:none;">
+ <li>one</li>
+ <li class="red">two</li>
+ <li class="blue">three</li>
+ <li>four
+ <ul>
+ <li>four.1
+ <ul>
+ <li>four.1.1</li>
+ <li>four.1.2</li>
+ <li>four.1.3</li>
+ </ul>
+ </li>
+ <li>four.2</li>
+ <li>four.3</li>
+ </ul>
+ </li>
+ </ul>
+ </pre>
+ <div class="resultheader">Result:</div>
+ <div class="result">
+ <p>..some content..</p>
+ <p id="menufive">Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /></p>
+ <p>..some content..</p>
+ </div>
+ <ul id="menufivelist" style="display:none;">
+ <li>one</li>
+ <li class="red">two</li>
+ <li class="blue">three</li>
+ <li>four
+ <ul>
+ <li>four.1
+ <ul>
+ <li>four.1.1</li>
+ <li>four.1.2</li>
+ <li>four.1.3</li>
+ </ul>
+ </li>
+ <li>four.2</li>
+ <li>four.3</li>
+ </ul>
+ </li>
+ </ul>
+</div>
+
+</body>
+</html>
--- /dev/null
+body\r
+{\r
+ background-color: #888;\r
+ font-family: verdana, arial;\r
+ margin: 10px;\r
+ font-size: 0.8em;\r
+}\r
+h1\r
+{\r
+ font-size: 1.3em;\r
+}\r
+table\r
+{\r
+ margin: 10px 50px;\r
+ width: 300px;\r
+ border: 1px solid gray;\r
+ border-collapse: collapse;\r
+ border-spacing: 0;\r
+ float: left;\r
+}\r
+thead\r
+{\r
+ background: bisque;\r
+}\r
+tfoot\r
+{\r
+ background: khaki;\r
+ text-align: center;\r
+}\r
+td, th\r
+{\r
+ border: 1px solid gray;\r
+}\r
+pre\r
+{\r
+ background-color: LemonChiffon;\r
+ border: 1px solid gray;\r
+}\r
+#header {\r
+ background-color: #fffff0;\r
+ border: 1px solid #000;\r
+ margin-bottom: 20px;\r
+ padding: 10px;\r
+}\r
+div.title\r
+{\r
+ text-align: center;\r
+ font-size: 1.5em;\r
+ font-weight: bold;\r
+}\r
+div.link\r
+{\r
+ text-align: center;\r
+}\r
+div.clear\r
+{\r
+ clear: both;\r
+}\r
+div.exa\r
+{\r
+ background-color: #fffff0;\r
+ border: 1px solid #000;\r
+ padding: 0 15px;\r
+ margin-bottom: 20px;\r
+}\r
+div.codeheader {\r
+ margin-bottom: -15px;\r
+}\r
+div.resultheader{\r
+ margin-bottom: 5px;\r
+}\r
+div.result{\r
+ background: #fff;\r
+ border: 1px solid #000;\r
+ margin-bottom: 10px;\r
+ padding: 0 10px;\r
+}\r
+html>body div.outerbox\r
+{\r
+ padding: 0 5px 5px 0;\r
+}\r
+html>body div.outerbox div.shadowbox1\r
+{\r
+ position: absolute;\r
+ right: 0;\r
+ bottom: 5px;\r
+ width: 5px;\r
+ height: 100%;\r
+ background: url(myshadow.png) no-repeat right top;\r
+}\r
+html>body div.outerbox div.shadowbox2\r
+{\r
+ position: absolute;\r
+ bottom: 0;\r
+ right: 5px;\r
+ height: 5px;\r
+ width: 100%;\r
+ background: url(myshadow.png) left bottom;\r
+}\r
+html>body div.outerbox div.shadowbox3\r
+{\r
+ position: absolute;\r
+ bottom: 0;\r
+ right: 0;\r
+ height: 5px;\r
+ width: 5px;\r
+ background: url(myshadow.png) no-repeat right bottom;\r
+}\r
+html>body .innerbox\r
+{\r
+ margin: 0;\r
+ display: inherit;\r
+}\r
+\r
+#root-menu-div ul {\r
+ border: 1px solid #000;\r
+}\r
+#root-menu-div li{\r
+ white-space:nowrap;\r
+}\r
+* html #root-menu-div li{\r
+ height: 1.5em; /* fixing ie6 problem */\r
+}\r
+ul.menu,\r
+#root-menu-div ul {\r
+ background-color: #fff;\r
+ list-style: none;\r
+ margin: 0;\r
+ padding: 0;\r
+}\r
+li.menu-separator.active{\r
+ background-color: transparent;\r
+}\r
+li.active {\r
+ background-color: #888;\r
+}\r
+.activetarget{\r
+ background-color: white;\r
+}\r
+\r
+* html div.menu-item {\r
+ display: inline; /* fixes problem in ie6 */\r
+}\r
+\r
+li.menumain {\r
+ float: left;\r
+ padding: 0 10px;\r
+}\r
+div.menu-item {\r
+ padding: 1px 10px 1px 4px;\r
+}\r
+img.menu-item-arrow{\r
+ position: absolute;\r
+ right: 4px;\r
+ top: 8px;\r
+}\r
+li.menu-separator{\r
+ border-bottom: 1px solid #000;\r
+ font-size: 0; /* for ie */\r
+ height: 0;\r
+ line-height: 0; /* for ie */\r
+ margin: 2px 0;\r
+}\r
+li.red {\r
+ color: red;\r
+}\r
+li.blue {\r
+ color: blue;\r
+}\r
+\r
+\r
+\r
+/* syntaxhighlight stuff */\r
+.dp-highlighter\r
+{\r
+ font-family: "Consolas", "Courier New", Courier, mono, serif;\r
+ font-size: 12px;\r
+ background-color: #E7E5DC;\r
+ width: 99%;\r
+ overflow: auto;\r
+ margin: 18px 0 18px 0 !important;\r
+ padding-top: 1px; /* adds a little border on top when controls are hidden */\r
+}\r
+\r
+/* clear styles */\r
+.dp-highlighter ol,\r
+.dp-highlighter ol li,\r
+.dp-highlighter ol li span \r
+{\r
+ margin: 0;\r
+ padding: 0;\r
+ border: none;\r
+}\r
+\r
+.dp-highlighter a,\r
+.dp-highlighter a:hover\r
+{\r
+ background: none;\r
+ border: none;\r
+ padding: 0;\r
+ margin: 0;\r
+}\r
+\r
+.dp-highlighter .bar\r
+{\r
+ padding-left: 45px;\r
+}\r
+\r
+.dp-highlighter.collapsed .bar,\r
+.dp-highlighter.nogutter .bar\r
+{\r
+ padding-left: 0px;\r
+}\r
+\r
+.dp-highlighter ol\r
+{\r
+ list-style: decimal; /* for ie */\r
+ background-color: #fff;\r
+ margin: 0px 0px 1px 45px !important; /* 1px bottom margin seems to fix occasional Firefox scrolling */\r
+ padding: 0px;\r
+ color: #5C5C5C;\r
+}\r
+\r
+.dp-highlighter.nogutter ol,\r
+.dp-highlighter.nogutter ol li\r
+{\r
+ list-style: none !important;\r
+ margin-left: 0px !important;\r
+}\r
+\r
+.dp-highlighter ol li,\r
+.dp-highlighter .columns div\r
+{\r
+ list-style: decimal-leading-zero; /* better look for others, override cascade from OL */\r
+ list-style-position: outside !important;\r
+ border-left: 3px solid #6CE26C;\r
+ background-color: #F8F8F8;\r
+ color: #5C5C5C;\r
+ padding: 0 3px 0 10px !important;\r
+ margin: 0 !important;\r
+ line-height: 14px;\r
+}\r
+\r
+.dp-highlighter.nogutter ol li,\r
+.dp-highlighter.nogutter .columns div\r
+{\r
+ border: 0;\r
+}\r
+\r
+.dp-highlighter .columns\r
+{\r
+ background-color: #F8F8F8;\r
+ color: gray;\r
+ overflow: hidden;\r
+ width: 100%;\r
+}\r
+\r
+.dp-highlighter .columns div\r
+{\r
+ padding-bottom: 5px;\r
+}\r
+\r
+.dp-highlighter ol li.alt\r
+{\r
+ background-color: #FFF;\r
+ color: inherit;\r
+}\r
+\r
+.dp-highlighter ol li span\r
+{\r
+ color: black;\r
+ background-color: inherit;\r
+}\r
+\r
+/* Adjust some properties when collapsed */\r
+\r
+.dp-highlighter.collapsed ol\r
+{\r
+ margin: 0px;\r
+}\r
+\r
+.dp-highlighter.collapsed ol li\r
+{\r
+ display: none;\r
+}\r
+\r
+/* Additional modifications when in print-view */\r
+\r
+.dp-highlighter.printing\r
+{\r
+ border: none;\r
+}\r
+\r
+.dp-highlighter.printing .tools\r
+{\r
+ display: none !important;\r
+}\r
+\r
+.dp-highlighter.printing li\r
+{\r
+ display: list-item !important;\r
+}\r
+\r
+/* Styles for the tools */\r
+\r
+.dp-highlighter .tools\r
+{\r
+ padding: 3px 8px 3px 10px;\r
+ font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif;\r
+ color: silver;\r
+ background-color: #f8f8f8;\r
+ padding-bottom: 10px;\r
+ border-left: 3px solid #6CE26C;\r
+}\r
+\r
+.dp-highlighter.nogutter .tools\r
+{\r
+ border-left: 0;\r
+}\r
+\r
+.dp-highlighter.collapsed .tools\r
+{\r
+ border-bottom: 0;\r
+}\r
+\r
+.dp-highlighter .tools a\r
+{\r
+ font-size: 9px;\r
+ color: #a0a0a0;\r
+ background-color: inherit;\r
+ text-decoration: none;\r
+ margin-right: 10px;\r
+}\r
+\r
+.dp-highlighter .tools a:hover\r
+{\r
+ color: red;\r
+ background-color: inherit;\r
+ text-decoration: underline;\r
+}\r
+\r
+/* About dialog styles */\r
+\r
+.dp-about { background-color: #fff; color: #333; margin: 0px; padding: 0px; }\r
+.dp-about table { width: 100%; height: 100%; font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; }\r
+.dp-about td { padding: 10px; vertical-align: top; }\r
+.dp-about .copy { border-bottom: 1px solid #ACA899; height: 95%; }\r
+.dp-about .title { color: red; background-color: inherit; font-weight: bold; }\r
+.dp-about .para { margin: 0 0 4px 0; }\r
+.dp-about .footer { background-color: #ECEADB; color: #333; border-top: 1px solid #fff; text-align: right; }\r
+.dp-about .close { font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; background-color: #ECEADB; color: #333; width: 60px; height: 22px; }\r
+\r
+/* Language specific styles */\r
+\r
+.dp-highlighter .comment, .dp-highlighter .comments { color: #008200; background-color: inherit; }\r
+.dp-highlighter .string { color: blue; background-color: inherit; }\r
+.dp-highlighter .keyword { color: #069; font-weight: bold; background-color: inherit; }\r
+.dp-highlighter .preprocessor { color: gray; background-color: inherit; }\r
+++ /dev/null
-<module rename-to='dev'>
- <inherits name='com.google.gwt.query.Query' />
-
- <inherits name='org.timepedia.exporter.Exporter' />
- <set-property name="export" value="yes" />
-
- <entry-point class="gwtquery.jsquery.client.JsQuery" />
-</module>
-
+++ /dev/null
-<module rename-to='jsquery'>
- <inherits name='gwtquery.jsquery.JsQuery' />
-
- <!--
- Hack to put code into the jsquery.nocache.js so as $ is available early
- and we can handle the $().ready method which is widely used in jquery pages.
- Otherwise $ wont be available until the async loading of the gwt permutation
- which happens after the page was ready.
- -->
- <define-property name="onload" values="default, foo"/>
- <property-provider name="onload">
- <![CDATA[
- $wnd.JsQuery = {
- onLoadArray: [],
- onLoad: function() {
- for (i in $wnd.JsQuery.onLoadArray)
- $wnd.JsQuery.onLoadArray[i]();
- },
- ready: function(f) {
- $wnd.JsQuery.onLoadArray.push(f);
- }
- };
- $wnd._$_ = $wnd.$;
- $wnd.$ = function() {return $wnd.JsQuery;}
- return 'default';
- ]]>
- </property-provider>
-
- <!-- Minimize JS -->
- <set-property name="compiler.stackMode" value="strip"/>
- <!-- cross-site -->
- <add-linker name="xsiframe"/>
-
-</module>
-
+++ /dev/null
-package gwtquery.jsquery.client;
-
-import gwtquery.jsquery.client.plugins.menu.JsMenu;
-
-import java.util.logging.Logger;
-
-import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.core.client.GWT;
-
-public class JsQuery implements EntryPoint {
-
- public void onModuleLoad() {
- GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
- Logger l = Logger.getLogger("jsQuery");
- public void onUncaughtException(Throwable e) {
- String r = "";
- for (StackTraceElement s :e.getStackTrace()) {
- r += s + "\n";
- }
- l.info(r);
- }
- });
-
- OverlayGQuery.export();
- JsMenu.loadPlugin();
- OverlayGQuery.onLoad();
-
-// testJs();
- }
-
- /**
- * Useful to paste js code here and test in dev mode
- */
- private native static void testJs() /*-{
- var l = @gwtquery.jsquery.client.utils.JsQueryUtils::log(Ljava/lang/Object;);
- window = $wnd;
- document = $doc;
- $ = $wnd.$;
-
- }-*/;
-}
+++ /dev/null
-package gwtquery.jsquery.client;
-
-import gwtquery.jsquery.client.utils.JsQueryUtils;
-
-import org.timepedia.exporter.client.Export;
-import org.timepedia.exporter.client.ExportAfterCreateMethod;
-import org.timepedia.exporter.client.ExportClosure;
-import org.timepedia.exporter.client.ExportInstanceMethod;
-import org.timepedia.exporter.client.ExportJsInitMethod;
-import org.timepedia.exporter.client.ExportOverlay;
-import org.timepedia.exporter.client.ExportPackage;
-import org.timepedia.exporter.client.ExportStaticMethod;
-import org.timepedia.exporter.client.ExporterUtil;
-import org.timepedia.exporter.client.NoExport;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Node;
-import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.query.client.Function;
-import com.google.gwt.query.client.GQuery;
-import com.google.gwt.query.client.GQuery.Offset;
-import com.google.gwt.query.client.Predicate;
-import com.google.gwt.query.client.Properties;
-import com.google.gwt.query.client.js.JsUtils;
-import com.google.gwt.query.client.plugins.Effects;
-import com.google.gwt.query.client.plugins.effects.PropertiesAnimation;
-import com.google.gwt.user.client.Event;
-
-/**
- * Class used to expose GQuery methods and object to Javascript using
- * gwt-exporter annotations.
- *
- * We prefer to overlay the original GQuery object instead of adding
- * the gwt-exporter dependency to the project.
- *
- * Because of the differences between java and js apis, we need to
- * override some methods in order to deal with complex cases.
- *
- */
-@ExportPackage("JsQuery")
-@Export(value="fn", all=false)
-public class OverlayGQuery implements ExportOverlay<GQuery> {
-
- @NoExport
- public static void export() {
- GWT.create(OverlayFunction.class);
- GWT.create(OverlayPredicate.class);
- GWT.create(OverlayGQuery.class);
- }
-
- @NoExport
- public static native void onLoad() /*-{
- $wnd.onJsQueryLoad && $wnd.onJsQueryLoad();
- $wnd.JsQuery && $wnd.JsQuery.onLoad && $wnd.JsQuery.onLoad();
- }-*/;
-
- @ExportPackage("JsQuery")
- @Export("jFunction")
- @ExportClosure()
- protected interface OverlayFunction extends ExportOverlay<Function> {
- public void f();
- public boolean f(Event e);
- public Object f(Element e, int i);
- }
-
- @ExportPackage("JsQuery")
- @Export("jPredicate")
- @ExportClosure()
- protected interface OverlayPredicate extends ExportOverlay<Predicate> {
- public boolean f(Element e, int i);
- }
-
- private OverlayGQuery(){}
-
- /**
- * In js a GQuery object represents a Nodelist.
- * gwt-exporter will use the object returned by get() to wrap
- * the GQuery object
- */
- @ExportJsInitMethod
- public NodeList<Element> get() {return null;}
-
- /**
- * Customized JS code to execute after GQuery has been exported.
- */
- @ExportAfterCreateMethod
- public static native void afterCreate() /*-{
- $ = $wnd.$;
- window = $wnd;
- document = $doc;
- }-*/;
-
- @ExportStaticMethod("$wnd.$")
- public static GQuery $(Object o) {
- return JsQueryUtils.dollar(o);
- }
-
- @ExportStaticMethod("$wnd.$")
- public static GQuery $(String s, Element ctx) {
- return GQuery.$(s, ctx);
- }
-
- @ExportStaticMethod("$wnd.$.extend")
- public static JavaScriptObject extend(Object...objs) {
- return JsQueryUtils.extend(objs);
- }
-
- @ExportStaticMethod("$wnd.$.each")
- public static JavaScriptObject[] each(JavaScriptObject[] objs, Function f) {
- return JsQueryUtils.each(objs, f);
- }
-
- @ExportStaticMethod("$wnd.$.inArray")
- public static int inArray(Object o, Object arr) {
- return JsQueryUtils.inArray(o, arr);
- }
-
- @ExportStaticMethod("$wnd.$.isArray")
- public static boolean isArray(JavaScriptObject o) {
- return JsUtils.isArray(o);
- }
-
- @ExportInstanceMethod
- public static GQuery ready(GQuery g, Function f) {
- f.fe();
- return g;
- }
-
- @ExportInstanceMethod
- // TODO: normally plugins adds new easing functions to jquery.easing array
- public static GQuery animate(GQuery g, Object stringOrProperties, int duration, String easing, Function... funcs) {
- return g.animate(stringOrProperties, duration,
- "linear".equalsIgnoreCase(easing)
- ? PropertiesAnimation.Easing.LINEAR
- : PropertiesAnimation.Easing.SWING, funcs);
- }
-
- @ExportInstanceMethod
- public static Object css(GQuery g, Object o) {
- if (o instanceof String) {
- return g.css((String)o, false);
- } else {
- return ExporterUtil.wrap(g.css((Properties)o));
- }
- }
-
- @ExportInstanceMethod
- public static GQuery css(GQuery g, String k, Object v) {
- return g.css(k, String.valueOf(v));
- }
-
- @ExportInstanceMethod
- public static JavaScriptObject offset(GQuery instance) {
- Offset o = instance.offset();
- return Properties.create("left: " + o.left + ", top:" + o.top);
- }
-
- @ExportInstanceMethod
- public static GQuery unbind(GQuery g, String s, Function o) {
- return g.unbind(s);
- }
-
- public String toString() {return null;}
- public GQuery add(GQuery previousObject) {return null;}
- public GQuery add(String selector) {return null;}
- public GQuery addClass(String... classes) {return null;}
- public GQuery after(GQuery query) {return null;}
- public GQuery after(Node n) {return null;}
- public GQuery after(String html) {return null;}
- public GQuery andSelf() {return null;}
-
-// public GQuery animate(Object stringOrProperties, int duration, Easing easing, Function... funcs) {return null;}
- public GQuery animate(Object stringOrProperties, Function... funcs) {return null;}
- public GQuery animate(Object stringOrProperties, int duration, Function... funcs) {return null;}
-// public GQuery attr(Properties properties) {return null;}
- public String attr(String name) {return null;}
-// public GQuery attr(String key, Function closure) {return null;}
- public GQuery attr(String key, Object value) {return null;}
- public int size() {return 0;}
-
- public GQuery append(GQuery query) {return null;}
- public GQuery append(Node n) {return null;}
- public GQuery append(String html) {return null;}
- public GQuery appendTo(GQuery other) {return null;}
- public GQuery appendTo(Node n) {return null;}
- public GQuery appendTo(String html) {return null;}
- public <T extends GQuery> T as(Class<T> plugin) {return null;}
-
- public GQuery before(GQuery query) {return null;}
- public GQuery before(Node n) {return null;}
- public GQuery before(String html) {return null;}
-// public GQuery bind(int eventbits, Object data, Function... funcs) {return null;}
-// public GQuery bind(String eventType, Object data, Function... funcs) {return null;}
- @ExportInstanceMethod
- public static GQuery bind(GQuery g, String events, Function func) {
- return g.bind(events, null, func);
- }
- public GQuery blur(Function... f) {return null;}
- public GQuery change(Function... f) {return null;}
- public GQuery children() {return null;}
- public GQuery children(String... filters) {return null;}
- public GQuery clearQueue() {return null;}
- public GQuery clone() {return null;}
- public GQuery clearQueue(String queueName) {return null;}
- public GQuery click(Function... f) {return null;}
- public GQuery closest(String selector) {return null;}
-// public JsNamedArray<NodeList<Element>> closest(String[] selectors) {return null;}
-// public JsNamedArray<NodeList<Element>> closest(String[] selectors, Node context) {return null;}
- public GQuery closest(String selector, Node context) {return null;}
- public GQuery contains(String text) {return null;}
- public GQuery contents() {return null;}
-// public GQuery css(Properties properties) {return null;}
-// public String css(String name) {return null;}
-// public String css(String name, boolean force) {return null;}
- public GQuery css(String prop, String val) {return null;}
- public double cur(String prop) {return 0;}
- public double cur(String prop, boolean force) {return 0;}
- public Object data(String name) {return null;}
-// public <T> T data(String name, Class<T> clz) {return null;}
- public GQuery data(String name, Object value) {return null;}
- public GQuery dblclick(Function... f) {return null;}
- public GQuery delay(int milliseconds, Function... f) {return null;}
- public GQuery delay(int milliseconds, String queueName, Function... f) {return null;}
- public GQuery delegate(String selector, String eventType, Function... handlers) {return null;}
- public GQuery delegate(String selector, String eventType, Object data, Function... handlers) {return null;}
- public GQuery delegate(String selector, int eventbits, Function... handlers) {return null;}
- public GQuery delegate(String selector, int eventbits, Object data, Function... handlers) {return null;}
- public GQuery dequeue() {return null;}
- public GQuery dequeue(String queueName) {return null;}
- public GQuery detach() {return null;}
- public GQuery detach(String filter) {return null;}
- public GQuery die() {return null;}
- public GQuery die(String eventName) {return null;}
-// public GQuery die(int eventbits) {return null;}
- public GQuery each(Function... f) {return null;}
- public Element[] elements() {return null;}
- public GQuery empty() {return null;}
-// public GQuery end() {return null;}
- public GQuery eq(int pos) {return null;}
- public GQuery error(Function... f) {return null;}
- public GQuery fadeIn(Function... f) {return null;}
- public GQuery fadeIn(int millisecs, Function... f) {return null;}
- public GQuery fadeOut(Function... f) {return null;}
- public GQuery fadeOut(int millisecs, Function... f) {return null;}
- public Effects fadeToggle(int millisecs, Function... f) {return null;}
- public GQuery filter(Predicate filterFn) {return null;}
-// public GQuery filter(String... filters) {return null;}
- public GQuery find(String... filters) {return null;}
- public GQuery first() {return null;}
- public GQuery focus(Function... f) {return null;}
- public Element get(int i) {return null;}
- public Node getContext() {return null;}
- public GQuery getPreviousObject() {return null;}
- public String getSelector() {return null;}
- public GQuery gt(int pos) {return null;}
- public boolean hasClass(String... classes) {return false;}
- public int height() {return 0;}
- public GQuery height(int height) {return null;}
- public GQuery height(String height) {return null;}
- public GQuery hide() {return null;}
- public GQuery hover(Function fover, Function fout) {return null;}
- public String html() {return null;}
- public GQuery html(String html) {return null;}
- public String id() {return null;}
- public GQuery id(String id) {return null;}
- public int index(Element element) {return 0;}
- public int innerHeight() {return 0;}
- public int innerWidth() {return 0;}
- public GQuery insertAfter(Element elem) {return null;}
- public GQuery insertAfter(GQuery query) {return null;}
- public GQuery insertAfter(String selector) {return null;}
- public GQuery insertBefore(Element item) {return null;}
- public GQuery insertBefore(GQuery query) {return null;}
- public GQuery insertBefore(String selector) {return null;}
- public boolean is(String... filters) {return false;}
- public boolean isEmpty() {return false;}
- public GQuery keydown(Function... f) {return null;}
- public GQuery keydown(int key) {return null;}
- public GQuery keypress(Function... f) {return null;}
- public GQuery keypress(int key) {return null;}
- public GQuery keyup(Function... f) {return null;}
- public GQuery keyup(int key) {return null;}
- public GQuery last() {return null;}
- public int left() {return 0;}
- public int length() {return 0;}
- public GQuery live(String eventName, Function... funcs) {return null;}
-// public GQuery live(int eventbits, Function... funcs) {return null;}
-// public GQuery live(int eventbits, Object data, Function... funcs) {return null;}
- public GQuery live(String eventName, Object data, Function... funcs) {return null;}
-// public GQuery load(Function f) {return null;}
- public GQuery lt(int pos) {return null;}
-// public <W> List<W> map(Function f) {return null;}
- public GQuery mousedown(Function... f) {return null;}
- public GQuery mousemove(Function... f) {return null;}
- public GQuery mouseout(Function... f) {return null;}
- public GQuery mouseover(Function... f) {return null;}
- public GQuery mouseup(Function... f) {return null;}
- public GQuery next() {return null;}
- public GQuery next(String... selectors) {return null;}
- public GQuery nextAll() {return null;}
- public GQuery nextUntil(String selector) {return null;}
- public GQuery not(Element elem) {return null;}
- public GQuery not(GQuery gq) {return null;}
- public GQuery not(String... filters) {return null;}
- public GQuery offsetParent() {return null;}
- public GQuery one(int eventbits, Object data, Function f) {return null;}
- public int outerHeight() {return 0;}
- public int outerHeight(boolean includeMargin) {return 0;}
- public int outerWidth() {return 0;}
- public int outerWidth(boolean includeMargin) {return 0;}
- public GQuery parent() {return null;}
- public GQuery parent(String... filters) {return null;}
- public GQuery parents() {return null;}
- public GQuery parents(String... filters) {return null;}
- public GQuery parentsUntil(String selector) {return null;}
-// public Offset position() {return null;}
- public GQuery prepend(GQuery query) {return null;}
- public GQuery prepend(Node n) {return null;}
- public GQuery prepend(String html) {return null;}
- public GQuery prependTo(GQuery other) {return null;}
- public GQuery prependTo(Node n) {return null;}
- public GQuery prependTo(String html) {return null;}
- public GQuery prev() {return null;}
- public GQuery prev(String... selectors) {return null;}
- public GQuery prevAll() {return null;}
- public GQuery prevUntil(String selector) {return null;}
- public boolean prop(String key) {return false;}
- public GQuery prop(String key, boolean value) {return null;}
- public GQuery prop(String key, Function closure) {return null;}
- public int queue() {return 0;}
- public int queue(String queueName) {return 0;}
- public GQuery queue(Function... f) {return null;}
- public GQuery queue(String queueName, Function... f) {return null;}
- public GQuery remove() {return null;}
- public GQuery remove(String filter) {return null;}
- public GQuery removeAttr(String key) {return null;}
- public GQuery removeClass(String... classes) {return null;}
- public GQuery removeData(String name) {return null;}
- public GQuery replaceAll(Element elem) {return null;}
- public GQuery replaceAll(GQuery target) {return null;}
- public GQuery replaceAll(String selector) {return null;}
- public GQuery replaceWith(Element elem) {return null;}
- public GQuery replaceWith(GQuery target) {return null;}
- public GQuery replaceWith(String html) {return null;}
- public GQuery resize(Function... f) {return null;}
- public void restoreCssAttrs(String... cssProps) {}
- public void resize(Function f) {}
- public void saveCssAttrs(String... cssProps) {}
- public GQuery scroll(Function... f) {return null;}
- public GQuery scrollIntoView() {return null;}
- public GQuery scrollIntoView(boolean ensure) {return null;}
- public int scrollLeft() {return 0;}
- public GQuery scrollLeft(int left) {return null;}
- public GQuery scrollTo(int left, int top) {return null;}
- public int scrollTop() {return 0;}
- public GQuery scrollTop(int top) {return null;}
- public GQuery select() {return null;}
- public GQuery setArray(NodeList<Element> list) {return null;}
- public void setPreviousObject(GQuery previousObject) {}
- public GQuery setSelector(String selector) {return null;}
- public GQuery show() {return null;}
- public GQuery siblings() {return null;}
- public GQuery siblings(String... selectors) {return null;}
- public GQuery slice(int start, int end) {return null;}
- public Effects slideDown(Function... f) {return null;}
- public Effects slideDown(int millisecs, Function... f) {return null;}
- public Effects slideToggle(int millisecs, Function... f) {return null;}
- public Effects slideUp(Function... f) {return null;}
- public Effects slideUp(int millisecs, Function... f) {return null;}
- public GQuery stop() {return null;}
- public GQuery stop(boolean clearQueue) {return null;}
- public GQuery stop(boolean clearQueue, boolean jumpToEnd) {return null;}
- public GQuery submit(Function... funcs) {return null;}
- public String text() {return null;}
- public GQuery text(String txt) {return null;}
- public GQuery toggle() {return null;}
- public GQuery toggle(Function... fn) {return null;}
- public GQuery toggleClass(String... classes) {return null;}
- public GQuery toggleClass(String clz, boolean addOrRemove) {return null;}
- public int top() {return 0;}
- public String toString(boolean pretty) {return null;}
-// public GQuery trigger(int eventbits, int... keys) {return null;}
-// public GQuery unbind(int eventbits) {return null;}
- public GQuery undelegate() {return null;}
- public GQuery undelegate(String selector) {return null;}
- public GQuery undelegate(String selector, String eventName) {return null;}
- public GQuery undelegate(String selector, int eventBit) {return null;}
-// public JsNodeArray unique(NodeList<Element> result) {return null;}
- public GQuery unwrap() {return null;}
- public String val() {return null;}
- public GQuery val(String... values) {return null;}
- public String[] vals() {return null;}
- public boolean isVisible() {return false;}
- public int width() {return 0;}
- public GQuery width(int width) {return null;}
- public GQuery wrap(Element elem) {return null;}
- public GQuery wrap(GQuery query) {return null;}
- public GQuery wrap(String html) {return null;}
- public GQuery wrapAll(Element elem) {return null;}
- public GQuery wrapAll(GQuery query) {return null;}
- public GQuery wrapAll(String html) {return null;}
- public GQuery wrapInner(Element elem) {return null;}
- public GQuery wrapInner(GQuery query) {return null;}
- public GQuery wrapInner(String html) {return null;}
-}
+++ /dev/null
-package gwtquery.jsquery.client.plugins.menu;
-
-/**
- *
- * This class wraps the jquery menu plugin from:
- *
- * http://p.sohei.org/jquery-plugins/menu/
- *
- */
-public abstract class JsMenu {
-
- public static native void loadPlugin() /*-{
- var l = @gwtquery.jsquery.client.utils.JsQueryUtils::log(Ljava/lang/Object;);
- var window = $wnd;
- var document = $doc;
- var jQuery = $wnd.$;
-
-(function($)
-{
- var menus = [], //list of all menus
- visibleMenus = [], //list of all visible menus
- activeMenu = activeItem = null,
- menuDIVElement = $('<div class="menu-div outerbox" style="position:absolute;top:0;left:0;display:none;"><div class="shadowbox1"></div><div class="shadowbox2"></div><div class="shadowbox3"></div></div>')[0],
- menuULElement = $('<ul class="menu-ul innerbox"></ul>')[0],
- menuItemElement = $('<li style="position:relative;"><div class="menu-item"></div></li>')[0],
- arrowElement = $('<img class="menu-item-arrow" />')[0],
- $rootDiv = $('<div id="root-menu-div" style="position:absolute;top:0;left:0;"></div>'), //create main menu div
- defaults = {
- // $.Menu options
- showDelay : 200,
- hideDelay : 200,
- hoverOpenDelay: 0,
- offsetTop : 0,
- offsetLeft : 0,
- minWidth: 0,
- onOpen: null,
- onClose: null,
-
- // $.MenuItem options
- onClick: null,
- arrowSrc: null,
- addExpando: false,
-
- // $.fn.menuFromElement options
- copyClassAttr: false
- };
-
- $(function(){
- $rootDiv.appendTo('body');
- });
-
- $.extend({
- MenuCollection : function(items) {
-
- this.menus = [];
-
- this.init(items);
- }
- });
- $.extend($.MenuCollection, {
- prototype : {
- init : function(items)
- {
- if ( items && items.length )
- {
- for ( var i = 0; i < items.length; i++ )
- {
- this.addMenu(items[i]);
- items[i].menuCollection = this;
- }
- }
- },
- addMenu : function(menu)
- {
- if ( menu instanceof $.Menu )
- this.menus.push(menu);
-
- menu.menuCollection = this;
-
- var self = this;
- $(menu.target).hover(function(){
- if ( menu.visible )
- return;
-
- //when there is an open menu in this collection, hide it and show the new one
- for ( var i = 0; i < self.menus.length; i++ )
- {
- if ( self.menus[i].visible )
- {
- self.menus[i].hide();
- menu.show();
- return;
- }
- }
- }, function(){});
- }
- }
- });
-
- $.extend({
- Menu : function(target, items, options) {
- this.menuItems = []; //all direct child $.MenuItem objects
- this.subMenus = []; //all subMenus from this.menuItems
- this.visible = false;
- this.active = false; //this menu has hover or one of its submenus is open
- this.parentMenuItem = null;
- this.settings = $.extend({}, defaults, options);
- this.target = target;
- this.$eDIV = null;
- this.$eUL = null;
- this.timer = null;
- this.menuCollection = null;
- this.openTimer = null;
-
- this.init();
- if ( items && $.isArray(items) )
- this.addItems(items);
- }
- });
- $.extend($.Menu, {
- checkMouse : function(e)
- {
- var t = e.target;
- //the user clicked on the target of the currenty open menu
- if ( visibleMenus.length && t == visibleMenus[0].target )
- return;
-
- //get the last node before the #root-menu-div
- while ( t.parentNode && t.parentNode != $rootDiv[0] )
- t = t.parentNode;
-
- // FIXME: why do we need a timeout
- setTimeout($.Menu.closeAll, 100);
-
- // FIXME: JsQuery each doesn't work with arrays
- // if ( !$(visibleMenus).filter(function(){ return this.$eDIV[0] == t }).length )
- // {
- // $.Menu.closeAll();
- // }
- return true;
- },
- checkKey : function(e)
- {
- switch ( e.keyCode )
- {
- case 13: //return
- if ( activeItem )
- activeItem.click(e, activeItem.$eLI[0]);
- break;
- case 27: //ESC
- $.Menu.closeAll();
- break;
- case 37: //left
- if ( !activeMenu )
- activeMenu = visibleMenus[0];
- var a = activeMenu;
- if ( a && a.parentMenuItem ) //select the parent menu and close the submenu
- {
- //unbind the events temporary, as we dont want the hoverout event to fire
- var pmi = a.parentMenuItem;
- pmi.$eLI.unbind('mouseout').unbind('mouseover');
- a.hide();
- pmi.hoverIn(true);
- setTimeout(function(){ //bind again..but delay it
- pmi.bindHover();
- });
- }
- else if ( a && a.menuCollection ) //select the previous menu in the collection
- {
- var pos,
- mcm = a.menuCollection.menus;
- if ( (pos = $.inArray(a, mcm)) > -1 )
- {
- if ( --pos < 0 )
- pos = mcm.length - 1;
- $.Menu.closeAll();
- mcm[pos].show();
- mcm[pos].setActive();
- if ( mcm[pos].menuItems.length ) //select the first item
- mcm[pos].menuItems[0].hoverIn(true);
- }
- }
- break;
- case 38: //up
- if ( activeMenu )
- activeMenu.selectNextItem(-1);
- break;
- case 39: //right
- if ( !activeMenu )
- activeMenu = visibleMenus[0];
- var m,
- a = activeMenu,
- asm = activeItem ? activeItem.subMenu : null;
- if ( a )
- {
- if ( asm && asm.menuItems.length ) //select the submenu
- {
- asm.show();
- asm.menuItems[0].hoverIn();
- }
- else if ( (a = a.inMenuCollection()) ) //select the next menu in the collection
- {
- var pos,
- mcm = a.menuCollection.menus;
- if ( (pos = $.inArray(a, mcm)) > -1 )
- {
- if ( ++pos >= mcm.length )
- pos = 0;
- $.Menu.closeAll();
- mcm[pos].show();
- mcm[pos].setActive();
- if ( mcm[pos].menuItems.length ) //select the first item
- mcm[pos].menuItems[0].hoverIn(true);
- }
- }
- }
- break;
- case 40: //down
- if ( !activeMenu )
- {
- if ( visibleMenus.length && visibleMenus[0].menuItems.length )
- visibleMenus[0].menuItems[0].hoverIn();
- }
- else
- activeMenu.selectNextItem();
- break;
- }
- if ( e.keyCode > 36 && e.keyCode < 41 )
- return false; //this will prevent scrolling
- },
- closeAll : function()
- {
- while ( visibleMenus.length )
- visibleMenus[0].hide();
- },
- setDefaults : function(d)
- {
- $.extend(defaults, d);
- },
- prototype : {
-
- init : function()
- {
- var self = this;
- if ( !this.target )
- return;
- else if ( this.target instanceof $.MenuItem )
- {
- this.parentMenuItem = this.target;
- this.target.addSubMenu(this);
- this.target = this.target.$eLI;
- }
-
- menus.push(this);
-
- //use the dom methods instead the ones from jquery (faster)
- this.$eDIV = $(menuDIVElement.cloneNode(1));
- this.$eUL = $(menuULElement.cloneNode(1));
- this.$eDIV[0].appendChild(this.$eUL[0]);
- $rootDiv[0].appendChild(this.$eDIV[0]);
-
- //bind events
- if ( !this.parentMenuItem )
- {
- $(this.target).click(function(e){
- self.onClick(e);
- }).hover(function(e){
- self.setActive();
-
- if ( self.settings.hoverOpenDelay )
- {
- self.openTimer = setTimeout(function(){
- if ( !self.visible )
- self.onClick(e);
- }, self.settings.hoverOpenDelay);
- }
- }, function(){
- if ( !self.visible )
- $(this).removeClass('activetarget');
-
- if ( self.openTimer )
- clearTimeout(self.openTimer);
- });
- }
- else
- {
- this.$eDIV.hover(function(){
- self.setActive();
- }, function(){});
- }
- },
- setActive : function()
- {
- if ( !this.parentMenuItem )
- $(this.target).addClass('activetarget');
- else
- this.active = true;
- },
- addItem : function(item)
- {
- if ( item instanceof $.MenuItem )
- {
- if ( $.inArray(item, this.menuItems) == -1 )
- {
- this.$eUL.append(item.$eLI);
- this.menuItems.push(item);
- item.parentMenu = this;
- if ( item.subMenu )
- this.subMenus.push(item.subMenu);
- }
- }
- else
- {
- this.addItem(new $.MenuItem(item, this.settings));
- }
- },
- addItems : function(items)
- {
- for ( var i = 0; i < items.length; i++ )
- {
- this.addItem(items[i]);
- }
- },
- removeItem : function(item)
- {
- var pos = $.inArray(item, this.menuItems);
- if ( pos > -1 )
- this.menuItems.splice(pos, 1);
- item.parentMenu = null;
- },
- hide : function()
- {
- if ( !this.visible )
- return;
-
- var i,
- pos = $.inArray(this, visibleMenus);
-
- this.$eDIV.hide();
-
- if ( pos >= 0 )
- visibleMenus.splice(pos, 1);
- this.visible = this.active = false;
-
- $(this.target).removeClass('activetarget');
-
- //hide all submenus
- for ( i = 0; i < this.subMenus.length; i++ )
- {
- this.subMenus[i].hide();
- }
-
- //set all items inactive (e.g. remove hover class..)
- for ( i = 0; i < this.menuItems.length; i++ )
- {
- if ( this.menuItems[i].active )
- this.menuItems[i].setInactive();
- }
-
- if ( !visibleMenus.length ) //unbind events when the last menu was closed
- $(document).unbind('mousedown', $.Menu.checkMouse).unbind('keydown', $.Menu.checkKey);
-
- if ( activeMenu == this )
- activeMenu = null;
-
- if ( this.settings.onClose )
- this.settings.onClose.call(this);
- },
- show : function(e)
- {
- if ( this.visible )
- return;
-
- var zi,
- pmi = this.parentMenuItem;
-
- if ( this.menuItems.length ) //show only when it has items
- {
- if ( pmi ) //set z-index
- {
- zi = parseInt(pmi.parentMenu.$eDIV.css('z-index'));
- this.$eDIV.css('z-index', (isNaN(zi) ? 1 : zi + 1));
- }
- this.$eDIV.css({visibility: 'hidden', display:'block'});
-
- //set min-width
- if ( this.settings.minWidth )
- {
- if ( this.$eDIV.width() < this.settings.minWidth )
- this.$eDIV.css('width', this.settings.minWidth);
- }
-
- this.setPosition();
- this.$eDIV.css({display:'none', visibility: ''}).show();
-
- //IEs default width: auto is bad! ie6 and ie7 have are producing different errors.. (7 = 5px shadowbox + 2px border)
- if ( 0) //$.browser.msie )
- this.$eUL.css('width', parseInt($.browser.version) == 6 ? this.$eDIV.width() - 7 : this.$eUL.width());
-
- if ( this.settings.onOpen )
- this.settings.onOpen.call(this);
- }
-
- if ( visibleMenus.length == 0 )
- $(document).bind('mousedown', $.Menu.checkMouse).bind('keydown', $.Menu.checkKey);
-
- this.visible = true;
- visibleMenus.push(this);
- },
- setPosition : function()
- {
- var $t, o, posX, posY,
- pmo, //parent menu offset
- wst, //window scroll top
- wsl, //window scroll left
- ww = $(window).width(),
- wh = $(window).height(),
- pmi = this.parentMenuItem,
- height = this.$eDIV[0].clientHeight,
- width = this.$eDIV[0].clientWidth,
- pheight; //parent height
-
- if ( pmi )
- {
- //position on the right side of the parent menu item
- o = pmi.$eLI.offset();
- posX = o.left + pmi.$eLI.width();
- posY = o.top;
- }
- else
- {
- //position right below the target
- $t = $(this.target);
- o = $t.offset();
-
- posX = o.left + this.settings.offsetLeft;
- posY = o.top + $t.height() + this.settings.offsetTop;
- }
-
- //y-pos
- if ($().scrollTop )
- {
- wst = $(window).scrollTop();
- if ( wh < height ) //menu is bigger than the window
- {
- //position the menu at the top of the visible area
- posY = wst;
- }
- else if ( wh + wst < posY + height ) //outside on the bottom?
- {
- if ( pmi )
- {
- pmo = pmi.parentMenu.$eDIV.offset();
- pheight = pmi.parentMenu.$eDIV[0].clientHeight;
- if ( height <= pheight )
- {
- //bottom position = parentmenu-bottom position
- posY = pmo.top + pheight - height;
- }
- else
- {
- //top position = parentmenu-top position
- posY = pmo.top;
- }
- //still outside on the bottom?
- if ( wh + wst < posY + height )
- {
- //shift the menu upwards till the bottom is visible
- posY -= posY + height - (wh + wst);
- }
- }
- else
- {
- //shift the menu upwards till the bottom is visible
- posY -= posY + height - (wh + wst);
- }
- }
- }
- //x-pos
- if ($().scrollLeft )
- {
- wsl = $(window).scrollLeft();
- if ( ww + wsl < posX + width )
- {
- if ( pmi )
- {
- //display the menu not on the right side but on the left side
- posX -= pmi.$eLI.width() + width;
- //outside on the left now?
- if ( posX < wsl )
- posX = wsl;
- }
- else
- {
- //shift the menu to the left until it fits
- posX -= posX + width - (ww + wsl);
- }
- }
- }
-
- //set position
- this.$eDIV.css({left: posX, top: posY});
- },
- onClick : function(e)
- {
- if ( this.visible )
- {
- this.hide();
- this.setActive(); //the class is removed in the hide() method..add it again
- }
- else
- {
- //close all open menus
- $.Menu.closeAll();
- this.show(e);
- }
- },
- addTimer : function(callback, delay)
- {
- var self = this;
- this.timer = setTimeout(function(){
- callback.call(self);
- self.timer = null;
- }, delay);
- },
- removeTimer : function()
- {
- if ( this.timer )
- {
- clearTimeout(this.timer);
- this.timer = null;
- }
- },
- selectNextItem : function(offset)
- {
- var i, pos = 0,
- mil = this.menuItems.length,
- o = offset || 1;
-
- //get current pos
- for ( i = 0; i < mil; i++ )
- {
- if ( this.menuItems[i].active )
- {
- pos = i;
- break;
- }
- }
- this.menuItems[pos].hoverOut();
-
- do //jump over the separators
- {
- pos += o;
- if ( pos >= mil )
- pos = 0;
- else if ( pos < 0 )
- pos = mil - 1;
- } while ( this.menuItems[pos].separator );
- this.menuItems[pos].hoverIn(true);
- },
- inMenuCollection : function()
- {
- var m = this;
- while ( m.parentMenuItem )
- m = m.parentMenuItem.parentMenu;
- return m.menuCollection ? m : null;
- },
- destroy : function() //delete menu
- {
- var pos, item;
-
- this.hide();
-
- //unbind events
- if ( !this.parentMenuItem )
- $(this.target).unbind('click').unbind('mouseover').unbind('mouseout');
- else
- this.$eDIV.unbind('mouseover').unbind('mouseout');
-
- //destroy all items
- while ( this.menuItems.length )
- {
- item = this.menuItems[0];
- item.destroy();
- delete item;
- }
-
- if ( (pos = $.inArray(this, menus)) > -1 )
- menus.splice(pos, 1);
-
- if ( this.menuCollection )
- {
- if ( (pos = $.inArray(this, this.menuCollection.menus)) > -1 )
- this.menuCollection.menus.splice(pos, 1);
- }
-
- this.$eDIV.remove();
- }
- }
- });
-
- $.extend({
- MenuItem : function(obj, options)
- {
- if ( typeof obj == 'string' )
- obj = {src: obj};
-
- this.src = obj.src || '';
- this.url = obj.url || null;
- this.urlTarget = obj.target || null;
- this.addClass = obj.addClass || null;
- this.data = obj.data || null;
-
- this.$eLI = null;
- this.parentMenu = null;
- this.subMenu = null;
- this.settings = $.extend({}, defaults, options);
- this.active = false;
- this.enabled = true;
- this.separator = false;
-
- this.init();
-
- if ( obj.subMenu )
- new $.Menu(this, obj.subMenu, options);
- }
- });
-
- $.extend($.MenuItem, {
- prototype : {
- init : function()
- {
- var i, isStr,
- src = this.src,
- self = this;
-
- this.$eLI = $(menuItemElement.cloneNode(1));
- if ( this.addClass )
- this.$eLI[0].setAttribute('class', this.addClass);
-
- if ( this.settings.addExpando && this.data )
- this.$eLI[0].menuData = this.data;
-
- if ( src == '' )
- {
- this.$eLI.addClass('menu-separator');
- this.separator = true;
- }
- else
- {
- isStr = typeof src == 'string';
- if ( isStr && this.url ) //create a link node, when we have an url
- src = $('<a href="' + this.url + '"' + (this.urlTarget ? 'target="' + this.urlTarget + '"' : '') + '>' + src + '</a>');
- else if ( isStr || !src.length )
- src = [src];
- //go through the passed DOM-Elements (or jquery objects or text nodes.) and append them to the menus list item
- //this.$eLI.append(this.src) is really slow when having a lot(!!!) of items
- for ( i = 0; i < src.length; i++ )
- {
- if ( typeof src[i] == 'string' )
- {
- //we cant use createTextNode, as html entities won't be displayed correctly (eg. ©)
- elem = document.createElement('span');
- elem.innerHTML = src[i];
- this.$eLI[0].firstChild.appendChild(elem);
- }
- else
- this.$eLI[0].firstChild.appendChild(src[i].cloneNode(1));
- }
- }
-
- this.$eLI.click(function(e){
- self.click(e, this);
- });
- this.bindHover();
- },
- click : function(e, scope)
- {
- if ( this.enabled && this.settings.onClick )
- this.settings.onClick.call(scope, e, this);
- },
- bindHover : function()
- {
- var self = this;
- this.$eLI.hover(function(){
- self.hoverIn();
- }, function(){
- self.hoverOut();
- });
- },
- hoverIn : function(noSubMenu)
- {
- this.removeTimer();
-
- var i,
- pms = this.parentMenu.subMenus,
- pmi = this.parentMenu.menuItems,
- self = this;
-
- //remove the timer from the parent item, when there is one (e.g. to close the menu)
- if ( this.parentMenu.timer )
- this.parentMenu.removeTimer();
-
- if ( !this.enabled )
- return;
-
- //deactivate all menuItems on the same level
- for ( i = 0; i < pmi.length; i++ )
- {
- if ( pmi[i].active )
- pmi[i].setInactive();
- }
-
- this.setActive();
- activeMenu = this.parentMenu;
-
- //are there open submenus on the same level? close them!
- for ( i = 0; i < pms.length; i++ )
- {
- if ( pms[i].visible && pms[i] != this.subMenu && !pms[i].timer ) //close if there is no closetimer running already
- pms[i].addTimer(function(){
- this.hide();
- }, pms[i].settings.hideDelay);
- }
-
- if ( this.subMenu && !noSubMenu )
- {
- //set timeout to show menu
- this.subMenu.addTimer(function(){
- this.show();
- }, this.subMenu.settings.showDelay);
- }
- },
- hoverOut : function()
- {
- this.removeTimer();
-
- if ( !this.enabled )
- return;
-
- if ( !this.subMenu || !this.subMenu.visible )
- this.setInactive();
- },
- removeTimer : function()
- {
- if ( this.subMenu )
- {
- this.subMenu.removeTimer();
- }
- },
- setActive : function()
- {
- this.active = true;
- this.$eLI.addClass('active');
-
- //set the parent menu item active too if necessary
- var pmi = this.parentMenu.parentMenuItem;
- if ( pmi && !pmi.active )
- pmi.setActive();
-
- activeItem = this;
- },
- setInactive : function()
- {
- this.active = false;
- this.$eLI.removeClass('active');
- if ( this == activeItem )
- activeItem = null;
- },
- enable : function()
- {
- this.$eLI.removeClass('disabled');
- this.enabled = true;
- },
- disable : function()
- {
- this.$eLI.addClass('disabled');
- this.enabled = false;
- },
- destroy : function()
- {
- this.removeTimer();
-
- this.$eLI.remove();
-
- //unbind events
- this.$eLI.unbind('mouseover').unbind('mouseout').unbind('click');
- //delete submenu
- if ( this.subMenu )
- {
- this.subMenu.destroy();
- delete this.subMenu;
- }
- this.parentMenu.removeItem(this);
- },
- addSubMenu : function(menu)
- {
- if ( this.subMenu )
- return;
- this.subMenu = menu;
- if ( this.parentMenu && $.inArray(menu, this.parentMenu.subMenus) == -1 )
- this.parentMenu.subMenus.push(menu);
- if ( this.settings.arrowSrc )
- {
- var a = arrowElement.cloneNode(0);
- a.setAttribute('src', this.settings.arrowSrc);
- this.$eLI[0].firstChild.appendChild(a);
- }
- }
- }
- });
-
-
- $.extend($.fn, {
- menuFromElement : function(options, list, bar)
- {
- var createItems = function(ul)
- {
- var menuItems = [],
- subItems,
- menuItem,
- lis, $li, i, subUL, submenu, target,
- classNames = null;
-
- lis = getAllChilds(ul, 'LI');
- for ( i = 0; i < lis.length; i++ )
- {
- subItems = [];
-
- if ( !lis[i].childNodes.length ) //empty item? add separator
- {
- menuItems.push(new $.MenuItem('', options));
- continue;
- }
-
- if ( (subUL = getOneChild(lis[i], 'UL')) )
- {
- subItems = createItems(subUL);
- //remove subUL from DOM
- $(subUL).remove();
- }
-
- //select the target...get the elements inside the li
- $li = $(lis[i]);
- if ( $li[0].childNodes.length == 1 && $li[0].childNodes[0].nodeType == 3 )
- target = $li[0].childNodes[0].nodeValue;
- else
- target = $li[0].childNodes;
-
- if ( options && options.copyClassAttr )
- classNames = $li.attr('class');
-
- //create item
- menuItem = new $.MenuItem({src: target, addClass: classNames}, options);
- menuItems.push(menuItem);
- //add submenu
- if ( subItems.length )
- new $.Menu(menuItem, subItems, options);
-
- }
- return menuItems;
- };
- return this.each(function()
- {
- var ul, m;
- //get the list element
- if ( list || (ul = getOneChild(this, 'UL')) )
- {
- //if a specific list element is used, clone it, as we probably need it more than once
- ul = list ? $(list).clone(true)[0] : ul;
- menuItems = createItems(ul);
- if ( menuItems.length )
- {
- m = new $.Menu(this, menuItems, options);
- if ( bar )
- bar.addMenu(m);
- }
- $(ul).hide();
- }
- });
- },
- menuBarFromUL : function(options)
- {
- return this.each(function()
- {
- var i,
- lis = getAllChilds(this, 'LI');
- if ( lis.length )
- {
- bar = new $.MenuCollection();
- for ( i = 0; i < lis.length; i++ )
- $(lis[i]).menuFromElement(options, null, bar);
- }
- });
- },
- menu : function(options, items)
- {
- return this.each(function()
- {
- if ( items && $.isArray(items) )
- new $.Menu(this, items, options);
- else
- {
- if ( this.nodeName.toUpperCase() == 'UL' )
- $(this).menuBarFromUL(options);
- else
- $(this).menuFromElement(options, items);
- }
- });
- }
- });
-
- //faster than using jquery
- var getOneChild = function(elem, name)
- {
- if ( !elem )
- return null;
-
- var n = elem.firstChild;
- for ( ; n; n = n.nextSibling )
- {
- if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name )
- return n;
- }
- return null;
- };
- //faster than using jquery
- var getAllChilds = function(elem, name)
- {
- if ( !elem )
- return [];
-
- var r = [],
- n = elem.firstChild;
- for ( ; n; n = n.nextSibling )
- {
- if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name )
- r[r.length] = n;
- }
- return r;
- };
-
-})(jQuery);
-
- }-*/;
-}
+++ /dev/null
---- query.menu.js 2012-03-17 21:13:29.000000000 +0100
-+++ JsMenu.java 2012-03-17 21:04:09.000000000 +0100
-@@ -114,7 +113,7 @@
- this.openTimer = null;
-
- this.init();
-- if ( items && items.constructor == Array )
-+ if ( items && $.isArray(items) )
- this.addItems(items);
- }
- });
-@@ -132,11 +129,15 @@
- while ( t.parentNode && t.parentNode != $rootDiv[0] )
- t = t.parentNode;
-
-- //is the found node one of the visible menu elements?
-- if ( !$(visibleMenus).filter(function(){ return this.$eDIV[0] == t }).length )
-- {
-- $.Menu.closeAll();
-- }
-+ // FIXME: why do we need a timeout
-+ setTimeout($.Menu.closeAll, 100);
-+
-+ // FIXME: JsQuery each doesn't work with arrays
-+ // if ( !$(visibleMenus).filter(function(){ return this.$eDIV[0] == t }).length )
-+ // {
-+ // $.Menu.closeAll();
-+ // }
-+ return true;
- },
- checkKey : function(e)
- {
-@@ -395,7 +394,7 @@
- this.$eDIV.css({display:'none', visibility: ''}).show();
-
- //IEs default width: auto is bad! ie6 and ie7 have are producing different errors.. (7 = 5px shadowbox + 2px border)
-- if ( $.browser.msie )
-+ if ( 0) //$.browser.msie )
- this.$eUL.css('width', parseInt($.browser.version) == 6 ? this.$eDIV.width() - 7 : this.$eUL.width());
-
- if ( this.settings.onOpen )
-@@ -437,7 +438,7 @@
- }
-
- //y-pos
-- if ( $.fn.scrollTop )
-+ if ($().scrollTop )
- {
- wst = $(window).scrollTop();
- if ( wh < height ) //menu is bigger than the window
-@@ -476,7 +477,7 @@
- }
- }
- //x-pos
-- if ( $.fn.scrollLeft )
-+ if ($().scrollLeft )
- {
- wsl = $(window).scrollLeft();
- if ( ww + wsl < posX + width )
-@@ -898,7 +897,7 @@
- {
- return this.each(function()
- {
-- if ( items && items.constructor == Array )
-+ if ( items && $.isArray(items) )
- new $.Menu(this, items, options);
- else
- {
-
+++ /dev/null
-package gwtquery.jsquery.client.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Node;
-import com.google.gwt.query.client.Function;
-import com.google.gwt.query.client.GQuery;
-import com.google.gwt.query.client.js.JsCache;
-import com.google.gwt.query.client.js.JsNodeArray;
-import com.google.gwt.query.client.js.JsUtils;
-
-/**
- * These are a set of utility methods needed in jsquery because
- * either they are not in the GQuery core yet, or they are already
- * there but we need to modify their behavior.
- * Most of them should be moved to the GQuery core api.
- *
- */
-public abstract class JsQueryUtils {
-
- private native static String dumpObject(JavaScriptObject o) /*-{
- var s = "";
- for (k in o)
- s += " " + k;
- return s;
- }-*/;
-
- public static GQuery dollar(Object o) {
- if (o instanceof String) {
- return GQuery.$((String) o);
- } else if (o instanceof JavaScriptObject) {
- JavaScriptObject jso = (JavaScriptObject) o;
- if (JsUtils.isFunction(jso)) {
- new JsUtils.JsFunction(jso).fe();
- } else {
- GQuery r = GQuery.$(jso);
- if (!JsUtils.isWindow(jso) && !JsUtils.isElement(jso) && JsUtils.isArray(jso)) {
- JsCache c = jso.cast();
- JsNodeArray elms = JsNodeArray.create();
- for (int i = 0; i < c.length(); i++) {
- Object obj = c.get(i);
- if (obj instanceof Node) {
- elms.addNode((Node) obj);
- }
- }
- r = GQuery.$(elms);
- }
- return r;
- }
- }
- return GQuery.$();
- }
-
- public static GQuery dollar(String s, Element ctx) {
- return GQuery.$(s, ctx);
- }
-
- public static void ready(Function f) {
- f.f();
- }
-
- public static int inArray(Object object, Object array) {
- if (array instanceof List) {
- return ((List<?>)array).indexOf(object);
- } else if (object instanceof JavaScriptObject
- && JsUtils.isElement((JavaScriptObject) object)) {
- return dollar(array).index((Element) object);
- } else if (array instanceof JavaScriptObject
- && JsUtils.isArray((JavaScriptObject) array)) {
- return ((JsCache) array).indexOf(object);
- }
- return -1;
- }
-
- public static JavaScriptObject extend(Object... objs) {
- int i = 0, l = objs.length;
- boolean deep = false;
- JavaScriptObject ctx = null;
- Object target = objs[i];
- if (target instanceof Boolean) {
- deep = (Boolean) target;
- if (l == 1)
- return ctx;
- target = objs[i++];
- }
- if (l - i == 1) {
- i--;
- } else {
- ctx = (JavaScriptObject) target;
- }
-
- for (++i; i < l; i++) {
- if (objs[i] != null) {
- ctx = extendImpl(deep, ctx, objs[i]);
- }
- }
- return ctx;
- }
-
- private static native JavaScriptObject getDefaultPrototype() /*-{
- return $wnd.JsQuery && $wnd.JsQuery.fn
- ? $wnd.JsQuery.fn.prototype
- : null;
- }-*/;
-
- private static native JavaScriptObject extendImpl(boolean deep,
- JavaScriptObject ctx, Object s) /*-{
- var d = ctx ? ctx : $wnd.JsQuery.fn.prototype || {};
- for (k in s) {
- d[k] = s[k];
- if (!ctx)
- $wnd.$[k] = s[k];
- }
- return d;
- }-*/;
-
- public static JavaScriptObject[] each(JavaScriptObject[] objs, Function f) {
- ArrayList<Object> ret = new ArrayList<Object>();
- for (Object o : objs) {
- f.setDataObject(o);
- if (f.fe(null, o)) {
- ret.add(o);
- }
- }
- return ret.toArray(new JavaScriptObject[0]);
- }
-
- public static void log(Object l) {
- System.out.println(l);
- }
-
-}
+++ /dev/null
-<!doctype html>
-<html>
-<head>
-<title>JsQuery</title>
-<script src="dev.nocache.js" ></script>
-</head>
-<body>
- <div id='hello' style='display: none'>Hello</div>
- <script>
- onJsQueryLoad = function(){
- $('#hello').show().attr("width", true);
- $('#hello').fadeOut(1000).queue(2000).text("Hello word").fadeIn();
- }
- if (window.$) {
- $(document).ready(onJsQueryLoad);
- onJsQueryLoad = null;
- }
- </script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>jQuery menu plugin demo page</title>
-<link rel="stylesheet" type="text/css" href="style.css" />
-<script src="../../dev.nocache.js" ></script>
-<script type="text/javascript">
-
-// JsQuery will run this function after it is asynchronously loaded
-onJsQueryLoad = function(){
- var options = {minWidth: 120, arrowSrc: 'arrow_right.gif', copyClassAttr: true, onClick: function(e, menuItem){
- alert('you clicked item "' + $(this).text() + '"');
- }};
- $('#menuone').menu(options);
-
- var items = [ {src: 'test', url:'http://www.jquery.com'},
- {src: ''}, // separator
- {src: 'test2', subMenu: [ {src: 'sub 1'},
- {src: 'sub 2', url: 'http://p.sohei.org', target: '_blank'},
- {src: 'sub 3'}]}];
- $('#menutwo').menu(options, items);
- $('#menuthree').menu(options);
- $('#menufive>img').menu(options, '#menufivelist');
-
- //creating a menu without items
- var menu = new $.Menu('#menufour', null, options);
- //adding items to the menu
- menu.addItems([
- new $.MenuItem({src: 'test', url:'http://www.jquery.com'}, options),
- new $.MenuItem({src: ''}) // separator
- ]);
- var itemWithSubmenu = new $.MenuItem({src: 'test2'}, options);
- //creating a menu with items (as child of itemWithSubmenu)
- new $.Menu(itemWithSubmenu, [
- new $.MenuItem({src: 'sub 1'}, options),
- new $.MenuItem({src: 'sub 2', url: 'http://p.sohei.org', target: '_blank'}, options),
- new $.MenuItem({src: 'sub 3'}, options)
- ], options);
- //adding the submenu to the main menu
- menu.addItem(itemWithSubmenu);
-}
-
-// If jsQuery or jQuery was already loaded we use the normal way
-if (window.$) {
- $(document).ready(onJsQueryLoad);
- onJsQueryLoad = null;
-}
-
--->
-</script>
-</head>
-<body>
-<div id="header">
-<div class="title">jQuery Menu plugin demo</div>
-<div class="link"><a href="http://p.sohei.org/jquery-plugins/menu">plugin page</a></div>
-</div>
-
-<div class="exa">
-<h1>Available options:</h1>
- options which affect the menu:
- <ul>
- <li><strong>showDelay</strong> - The number of milliseconds to wait before opening the menu after hovering over the target. Default value: 200</li>
- <li><strong>hideDelay</strong> - The number of milliseconds to wait before closing the menu. Default value: 200</li>
- <li><strong>hoverOpenDelay</strong> - The number of milliseconds to wait before opening the topmost-menu (root) (without clicking it!). Default value: 0 (disabled!)</li>
- <li><strong>offsetTop</strong> - The number of pixels to offset the position of the topmost-menu (root) to the top. Default value: 0</li>
- <li><strong>offsetLeft</strong> - The number of pixels to offset the position of the topmost-menu (root) to the left. Default value: 0</li>
- <li><strong>minWidth</strong> - The minimal number of pixels of the menus width. Default value: 0</li></li>
- <li><strong>onOpen</strong> - Callback function which is triggered when a menu is opened. Default value: null</li>
- <li><strong>onClose</strong> - Callback function which is triggered when a menu is closed. Default value: null</li>
- </ul>
- options which affect the menuItems:
- <ul>
- <li><strong>onClick</strong> - Callback function which is triggered when a menuItem is clicked. The passed parameters are: the event object and the menuItem instance. Default value: null</li>
- <li><strong>arrowSrc</strong> - URL of the image to be used as an arrow indicating a submenu. Default value: null (no arrow image!)</li>
- </ul>
- options which are only used, when building a menu from HTML markup:
- <ul>
- <li><strong>copyClassAttr</strong> - Copies the class attribute of the LI elements to the equivalent menuItems. Default value: false</li>
- </ul>
-</div>
-
-<div class="exa">
-<h1>Example one:</h1>
- <ul>
- <li>create a menubar from an unordered list</li>
- <li>used on an unordered list, the plugin takes its direct <li>-children, which will be the root items (File, Edit...),
- and searches each for an <ul>-child, which holds the menu-items (New window, Save, Print...).</li>
- <li>empty <li>-elements are used as seperators</li>
- </ul>
- <div class="codeheader">JavaScript code:</div>
- <pre name="code" class="JScript">
- var options = {minWidth: 120, arrowSrc: 'arrow_right.gif', onClick: function(e, menuItem){
- alert('you clicked item "' + $(this).text() + '"');
- }};
- $('#menuone').menu(options);
- </pre>
- <div class="codeheader">HTML markup:</div>
- <pre name="code" class="html">
- <!-- note: the plugin doesn't need the classes, they're only used for styling! -->
- <ul id="menuone" class="menu">
- <li class="menumain">File
- <ul><li>New window</li>
- <li></li> <!-- separator -->
- <li>Save...</li>
- <li>Print...</li>
- <li></li> <!-- separator -->
- <li>Exit</li>
- </ul>
- </li>
- <li class="menumain">Edit
- <ul><li>Undo</li>
- <li>Redo</li>
- <li></li> <!-- separator -->
- <li>Cut</li>
- <li>Copy</li>
- <li>Paste<ul><li>All</li><li>Something</li></ul></li>
- <li>Delete</li>
- </ul>
- </li>
- <!-- ...and even more... -->
- </ul>
- </pre>
- <div class="resultheader">Result:</div>
- <div class="result" style="padding:0;">
- <div style="border-bottom: 1px solid #000;background:#eee;">
- <ul id="menuone" class="menu">
- <li class="menumain">File
- <ul><li>New window</li>
- <li></li>
- <li>Save...</li>
- <li>Print...</li>
- <li></li>
- <li>Exit</li>
- </ul>
- </li>
- <li class="menumain">Edit
- <ul><li>Undo</li>
- <li>Redo</li>
- <li></li>
- <li>Cut</li>
- <li>Copy</li>
- <li>Paste<ul><li>All</li><li>Something</li></ul></li>
- <li>Delete</li>
- </ul>
- </li>
- <li class="menumain">Bookmarks
- <ul><li>Bookmark manager</li>
- <li></li>
- <li>some bookmark</li>
- <li>another bookmark</li>
- <li></li>
- <li>Imported bookmarks
- <ul><li>bookmark one</li>
- <li>bookmark two</li>
- <li>bookmark three</li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="menumain" style="float:right;">Help
- <ul><li>Help index</li>
- <li></li>
- <li>About...
- <ul>
- <li>me</li>
- <li>you</li>
- <li>them</li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- <div style="clear:both;"></div>
- </div>
- <p>..some content..</p>
- <p>..some content..</p>
- <p>..some content..</p>
- </div>
-</div>
-
-<div class="exa">
-<h1>Example two:</h1>
- <ul>
- <li>create a menu from javascript and open it when clicking on the element with the id "menutwo"</li>
- <li>when a second parameter ist passed (items), the plugin will use it as menu content</li>
- </ul>
- <div class="codeheader">JavaScript code:</div>
- <pre name="code" class="JScript">
- var options = {minWidth: 120, arrowSrc: 'arrow_right.gif'};
- var items = [ {src: 'test', url:'http://www.jquery.com'},
- {src: ''}, /* separator */
- {src: 'test2', subMenu: [ {src: 'sub 1'},
- {src: 'sub 2', url: 'http://p.sohei.org', target: '_blank'},
- {src: 'sub 3'}]}];
- $('#menutwo').menu(options, items);
- </pre>
- <div class="codeheader">HTML markup:</div>
- <pre name="code" class="html">
- <p><span id="menutwo">Menu Button</span></p>
- </pre>
- <div class="resultheader">Result:</div>
- <div class="result">
- <p>..some content..</p>
- <p><span id="menutwo">Menu Button</span></p>
- <p>..some content..</p>
- </div>
-</div>
-
-<div class="exa">
-<h1>Example three:</h1>
- <ul>
- <li>same as example two, but without passing the items as parameter to the plugin</li>
- <li>the plugin looks inside the elment for an unordered list, which holds the menu content</li>
- </ul>
- <div class="codeheader">JavaScript code:</div>
- <pre name="code" class="JScript">
- var options = {minWidth: 120, arrowSrc: 'arrow_right.gif'};
- $('#menuthree').menu(options);
- </pre>
- <div class="codeheader">HTML markup:</div>
- <pre name="code" class="html">
- <div id="menuthree">Menu Button
- <ul>
- <li><a href="http://www.jquery.com">test</a></li>
- <li></li> <!-- separator -->
- <li>test2
- <ul>
- <li>sub 1</li>
- <li><a href="http://p.sohei.org" target="_blank">sub 2</a></li>
- <li>sub 3</li>
- </ul>
- </li>
- </ul>
- </div>
- </pre>
- <div class="resultheader">Result:</div>
- <div class="result">
- <p>..some content..</p>
- <div id="menuthree">Menu Button
- <ul>
- <li><a href="http://www.jquery.com">test</a></li>
- <li></li>
- <li>test2
- <ul>
- <li>sub 1</li>
- <li><a href="http://p.sohei.org" target="_blank">sub 2</a></li>
- <li>sub 3</li>
- </ul>
- </li>
- </ul>
- </div>
- <p>..some content..</p>
- </div>
-</div>
-
-<div class="exa">
-<h1>Example four:</h1>
- <ul>
- <li>same (result) as example two, but this time creating the menu by using the $.Menu and $.MenuItem classes and its methods</li>
- </ul>
- <div class="codeheader">JavaScript code:</div>
- <pre name="code" class="JScript">
- var options = {minWidth: 120, arrowSrc: 'arrow_right.gif'};
-
- //creating a menu without items
- var menu = new $.Menu('#menufour', null, options);
-
- //adding items to the menu
- menu.addItems([
- new $.MenuItem({src: 'test', url:'http://www.jquery.com'}, options),
- new $.MenuItem({src: ''}) /* separator */
- ]);
- var itemWithSubmenu = new $.MenuItem({src: 'test2'}, options);
-
- //creating a menu with items (as child of itemWithSubmenu)
- new $.Menu(itemWithSubmenu, [
- new $.MenuItem({src: 'sub 1'}, options),
- new $.MenuItem({src: 'sub 2', url: 'http://p.sohei.org', target: '_blank'}, options),
- new $.MenuItem({src: 'sub 3'}, options)
- ], options);
-
- //adding the submenu to the main menu
- menu.addItem(itemWithSubmenu);
- </pre>
- <div class="codeheader">HTML markup:</div>
- <pre name="code" class="html">
- <p><span id="menufour">Menu Button</span></p>
- </pre>
- <div class="resultheader">Result:</div>
- <div class="result">
- <p>..some content..</p>
- <p><span id="menufour">Menu Button</span></p>
- <p>..some content..</p>
- </div>
-</div>
-
-<div class="exa">
-<h1>Example five:</h1>
- <ul>
- <li>related to example two, the menu items can also be passed as a jquery selector (selecting an <ul>-element!)</li>
- </ul>
- <div class="codeheader">JavaScript code:</div>
- <pre name="code" class="JScript">
- var options = {minWidth: 120, arrowSrc: 'arrow_right.gif', copyClassAttr: true};
- $('#menufive>img').menu(options, '#menufivelist');
- </pre>
- <div class="codeheader">HTML markup:</div>
- <pre name="code" class="html">
- <p id="menufive">Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /></p>
-
- <ul id="menufivelist" style="display:none;">
- <li>one</li>
- <li class="red">two</li>
- <li class="blue">three</li>
- <li>four
- <ul>
- <li>four.1
- <ul>
- <li>four.1.1</li>
- <li>four.1.2</li>
- <li>four.1.3</li>
- </ul>
- </li>
- <li>four.2</li>
- <li>four.3</li>
- </ul>
- </li>
- </ul>
- </pre>
- <div class="resultheader">Result:</div>
- <div class="result">
- <p>..some content..</p>
- <p id="menufive">Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /> - Menu Button <img src="arrowdown.png" /></p>
- <p>..some content..</p>
- </div>
- <ul id="menufivelist" style="display:none;">
- <li>one</li>
- <li class="red">two</li>
- <li class="blue">three</li>
- <li>four
- <ul>
- <li>four.1
- <ul>
- <li>four.1.1</li>
- <li>four.1.2</li>
- <li>four.1.3</li>
- </ul>
- </li>
- <li>four.2</li>
- <li>four.3</li>
- </ul>
- </li>
- </ul>
-</div>
-
-</body>
-</html>
+++ /dev/null
-body\r
-{\r
- background-color: #888;\r
- font-family: verdana, arial;\r
- margin: 10px;\r
- font-size: 0.8em;\r
-}\r
-h1\r
-{\r
- font-size: 1.3em;\r
-}\r
-table\r
-{\r
- margin: 10px 50px;\r
- width: 300px;\r
- border: 1px solid gray;\r
- border-collapse: collapse;\r
- border-spacing: 0;\r
- float: left;\r
-}\r
-thead\r
-{\r
- background: bisque;\r
-}\r
-tfoot\r
-{\r
- background: khaki;\r
- text-align: center;\r
-}\r
-td, th\r
-{\r
- border: 1px solid gray;\r
-}\r
-pre\r
-{\r
- background-color: LemonChiffon;\r
- border: 1px solid gray;\r
-}\r
-#header {\r
- background-color: #fffff0;\r
- border: 1px solid #000;\r
- margin-bottom: 20px;\r
- padding: 10px;\r
-}\r
-div.title\r
-{\r
- text-align: center;\r
- font-size: 1.5em;\r
- font-weight: bold;\r
-}\r
-div.link\r
-{\r
- text-align: center;\r
-}\r
-div.clear\r
-{\r
- clear: both;\r
-}\r
-div.exa\r
-{\r
- background-color: #fffff0;\r
- border: 1px solid #000;\r
- padding: 0 15px;\r
- margin-bottom: 20px;\r
-}\r
-div.codeheader {\r
- margin-bottom: -15px;\r
-}\r
-div.resultheader{\r
- margin-bottom: 5px;\r
-}\r
-div.result{\r
- background: #fff;\r
- border: 1px solid #000;\r
- margin-bottom: 10px;\r
- padding: 0 10px;\r
-}\r
-html>body div.outerbox\r
-{\r
- padding: 0 5px 5px 0;\r
-}\r
-html>body div.outerbox div.shadowbox1\r
-{\r
- position: absolute;\r
- right: 0;\r
- bottom: 5px;\r
- width: 5px;\r
- height: 100%;\r
- background: url(myshadow.png) no-repeat right top;\r
-}\r
-html>body div.outerbox div.shadowbox2\r
-{\r
- position: absolute;\r
- bottom: 0;\r
- right: 5px;\r
- height: 5px;\r
- width: 100%;\r
- background: url(myshadow.png) left bottom;\r
-}\r
-html>body div.outerbox div.shadowbox3\r
-{\r
- position: absolute;\r
- bottom: 0;\r
- right: 0;\r
- height: 5px;\r
- width: 5px;\r
- background: url(myshadow.png) no-repeat right bottom;\r
-}\r
-html>body .innerbox\r
-{\r
- margin: 0;\r
- display: inherit;\r
-}\r
-\r
-#root-menu-div ul {\r
- border: 1px solid #000;\r
-}\r
-#root-menu-div li{\r
- white-space:nowrap;\r
-}\r
-* html #root-menu-div li{\r
- height: 1.5em; /* fixing ie6 problem */\r
-}\r
-ul.menu,\r
-#root-menu-div ul {\r
- background-color: #fff;\r
- list-style: none;\r
- margin: 0;\r
- padding: 0;\r
-}\r
-li.menu-separator.active{\r
- background-color: transparent;\r
-}\r
-li.active {\r
- background-color: #888;\r
-}\r
-.activetarget{\r
- background-color: white;\r
-}\r
-\r
-* html div.menu-item {\r
- display: inline; /* fixes problem in ie6 */\r
-}\r
-\r
-li.menumain {\r
- float: left;\r
- padding: 0 10px;\r
-}\r
-div.menu-item {\r
- padding: 1px 10px 1px 4px;\r
-}\r
-img.menu-item-arrow{\r
- position: absolute;\r
- right: 4px;\r
- top: 8px;\r
-}\r
-li.menu-separator{\r
- border-bottom: 1px solid #000;\r
- font-size: 0; /* for ie */\r
- height: 0;\r
- line-height: 0; /* for ie */\r
- margin: 2px 0;\r
-}\r
-li.red {\r
- color: red;\r
-}\r
-li.blue {\r
- color: blue;\r
-}\r
-\r
-\r
-\r
-/* syntaxhighlight stuff */\r
-.dp-highlighter\r
-{\r
- font-family: "Consolas", "Courier New", Courier, mono, serif;\r
- font-size: 12px;\r
- background-color: #E7E5DC;\r
- width: 99%;\r
- overflow: auto;\r
- margin: 18px 0 18px 0 !important;\r
- padding-top: 1px; /* adds a little border on top when controls are hidden */\r
-}\r
-\r
-/* clear styles */\r
-.dp-highlighter ol,\r
-.dp-highlighter ol li,\r
-.dp-highlighter ol li span \r
-{\r
- margin: 0;\r
- padding: 0;\r
- border: none;\r
-}\r
-\r
-.dp-highlighter a,\r
-.dp-highlighter a:hover\r
-{\r
- background: none;\r
- border: none;\r
- padding: 0;\r
- margin: 0;\r
-}\r
-\r
-.dp-highlighter .bar\r
-{\r
- padding-left: 45px;\r
-}\r
-\r
-.dp-highlighter.collapsed .bar,\r
-.dp-highlighter.nogutter .bar\r
-{\r
- padding-left: 0px;\r
-}\r
-\r
-.dp-highlighter ol\r
-{\r
- list-style: decimal; /* for ie */\r
- background-color: #fff;\r
- margin: 0px 0px 1px 45px !important; /* 1px bottom margin seems to fix occasional Firefox scrolling */\r
- padding: 0px;\r
- color: #5C5C5C;\r
-}\r
-\r
-.dp-highlighter.nogutter ol,\r
-.dp-highlighter.nogutter ol li\r
-{\r
- list-style: none !important;\r
- margin-left: 0px !important;\r
-}\r
-\r
-.dp-highlighter ol li,\r
-.dp-highlighter .columns div\r
-{\r
- list-style: decimal-leading-zero; /* better look for others, override cascade from OL */\r
- list-style-position: outside !important;\r
- border-left: 3px solid #6CE26C;\r
- background-color: #F8F8F8;\r
- color: #5C5C5C;\r
- padding: 0 3px 0 10px !important;\r
- margin: 0 !important;\r
- line-height: 14px;\r
-}\r
-\r
-.dp-highlighter.nogutter ol li,\r
-.dp-highlighter.nogutter .columns div\r
-{\r
- border: 0;\r
-}\r
-\r
-.dp-highlighter .columns\r
-{\r
- background-color: #F8F8F8;\r
- color: gray;\r
- overflow: hidden;\r
- width: 100%;\r
-}\r
-\r
-.dp-highlighter .columns div\r
-{\r
- padding-bottom: 5px;\r
-}\r
-\r
-.dp-highlighter ol li.alt\r
-{\r
- background-color: #FFF;\r
- color: inherit;\r
-}\r
-\r
-.dp-highlighter ol li span\r
-{\r
- color: black;\r
- background-color: inherit;\r
-}\r
-\r
-/* Adjust some properties when collapsed */\r
-\r
-.dp-highlighter.collapsed ol\r
-{\r
- margin: 0px;\r
-}\r
-\r
-.dp-highlighter.collapsed ol li\r
-{\r
- display: none;\r
-}\r
-\r
-/* Additional modifications when in print-view */\r
-\r
-.dp-highlighter.printing\r
-{\r
- border: none;\r
-}\r
-\r
-.dp-highlighter.printing .tools\r
-{\r
- display: none !important;\r
-}\r
-\r
-.dp-highlighter.printing li\r
-{\r
- display: list-item !important;\r
-}\r
-\r
-/* Styles for the tools */\r
-\r
-.dp-highlighter .tools\r
-{\r
- padding: 3px 8px 3px 10px;\r
- font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif;\r
- color: silver;\r
- background-color: #f8f8f8;\r
- padding-bottom: 10px;\r
- border-left: 3px solid #6CE26C;\r
-}\r
-\r
-.dp-highlighter.nogutter .tools\r
-{\r
- border-left: 0;\r
-}\r
-\r
-.dp-highlighter.collapsed .tools\r
-{\r
- border-bottom: 0;\r
-}\r
-\r
-.dp-highlighter .tools a\r
-{\r
- font-size: 9px;\r
- color: #a0a0a0;\r
- background-color: inherit;\r
- text-decoration: none;\r
- margin-right: 10px;\r
-}\r
-\r
-.dp-highlighter .tools a:hover\r
-{\r
- color: red;\r
- background-color: inherit;\r
- text-decoration: underline;\r
-}\r
-\r
-/* About dialog styles */\r
-\r
-.dp-about { background-color: #fff; color: #333; margin: 0px; padding: 0px; }\r
-.dp-about table { width: 100%; height: 100%; font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; }\r
-.dp-about td { padding: 10px; vertical-align: top; }\r
-.dp-about .copy { border-bottom: 1px solid #ACA899; height: 95%; }\r
-.dp-about .title { color: red; background-color: inherit; font-weight: bold; }\r
-.dp-about .para { margin: 0 0 4px 0; }\r
-.dp-about .footer { background-color: #ECEADB; color: #333; border-top: 1px solid #fff; text-align: right; }\r
-.dp-about .close { font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; background-color: #ECEADB; color: #333; width: 60px; height: 22px; }\r
-\r
-/* Language specific styles */\r
-\r
-.dp-highlighter .comment, .dp-highlighter .comments { color: #008200; background-color: inherit; }\r
-.dp-highlighter .string { color: blue; background-color: inherit; }\r
-.dp-highlighter .keyword { color: #069; font-weight: bold; background-color: inherit; }\r
-.dp-highlighter .preprocessor { color: gray; background-color: inherit; }\r
}
</script>
<ul>
- <li><a href="javascript:goTo('dev/JsQuery.html')">JsQuery.html</a></li>
- <li><a href="javascript:goTo('dev/plugins/menu/demo.html')">jquery.menu.html</a></li>
+ <li><a href="javascript:goTo('jsquery/JsQuery.html')">JsQuery.html</a></li>
+ <li><a href="javascript:goTo('jsmenu/demo.html')">jquery.menu.html</a></li>
</ul>
</body>
</html>