Change-Id: I4c852b7f9928e190572876690d5bef1234494a5dtags/8.0.0.alpha1
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* Export-Package attribute, and appends it to the jar's MANIFEST.MF. | * Export-Package attribute, and appends it to the jar's MANIFEST.MF. | ||||
* <p> | * <p> | ||||
* See #3521 for details. | * See #3521 for details. | ||||
* | |||||
* | |||||
* @author magi | * @author magi | ||||
*/ | */ | ||||
public class GeneratePackageExports { | public class GeneratePackageExports { | ||||
* version.<java package>. Searches for the packge and then its parents | * version.<java package>. Searches for the packge and then its parents | ||||
* recursively. Falls back to the "vaadin.version" system property if no | * recursively. Falls back to the "vaadin.version" system property if no | ||||
* other properties are found. | * other properties are found. | ||||
* | |||||
* | |||||
* @param javaPackage | * @param javaPackage | ||||
* The package to determine a version for | * The package to determine a version for | ||||
* @return A version or null if no version has been defined | * @return A version or null if no version has been defined |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Writes a manifest attribute to a temporary buffer. | * Writes a manifest attribute to a temporary buffer. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* Attribute name | * Attribute name | ||||
* @param value | * @param value | ||||
/** | /** | ||||
* Writes the manifest to given JAR file. | * Writes the manifest to given JAR file. | ||||
* | |||||
* | |||||
* The manifest must be created with {@code #writeAttribute(String, String)} | * The manifest must be created with {@code #writeAttribute(String, String)} | ||||
* before calling this write. | * before calling this write. | ||||
* | |||||
* | |||||
* @param jarFilename | * @param jarFilename | ||||
* File name of the JAR in which the manifest is written | * File name of the JAR in which the manifest is written | ||||
* @return 0 on success, nonzero value on error | * @return 0 on success, nonzero value on error |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* Pre-linker that checks for the existence of SASS files in public folders, | * Pre-linker that checks for the existence of SASS files in public folders, | ||||
* compiles them to CSS files with the SassCompiler from Vaadin and adds the CSS | * compiles them to CSS files with the SassCompiler from Vaadin and adds the CSS | ||||
* back into the artifact. | * back into the artifact. | ||||
* | |||||
* | |||||
*/ | */ | ||||
@LinkerOrder(Order.PRE) | @LinkerOrder(Order.PRE) | ||||
@Shardable | @Shardable | ||||
/** | /** | ||||
* Writes the contents of an InputStream out to a file. | * Writes the contents of an InputStream out to a file. | ||||
* | |||||
* | |||||
* @param contents | * @param contents | ||||
* @param tempfile | * @param tempfile | ||||
* @throws IOException | * @throws IOException | ||||
/** | /** | ||||
* Create folder in temporary space on disk. | * Create folder in temporary space on disk. | ||||
* | |||||
* | |||||
* @param partialPath | * @param partialPath | ||||
* @return | * @return | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* GWT generator to build {@link VAcceptCriterionFactory} implementation | * GWT generator to build {@link VAcceptCriterionFactory} implementation | ||||
* dynamically based on {@link AcceptCriterion} annotations available in | * dynamically based on {@link AcceptCriterion} annotations available in | ||||
* classpath. | * classpath. | ||||
* | |||||
* | |||||
*/ | */ | ||||
public class AcceptCriteriaFactoryGenerator extends Generator { | public class AcceptCriteriaFactoryGenerator extends Generator { | ||||
/** | /** | ||||
* Generate source code for WidgetMapImpl | * Generate source code for WidgetMapImpl | ||||
* | |||||
* | |||||
* @param logger | * @param logger | ||||
* Logger object | * Logger object | ||||
* @param context | * @param context |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Returns a list of all setters found in the beanType or its parent class | * Returns a list of all setters found in the beanType or its parent class | ||||
* | |||||
* | |||||
* @param beanType | * @param beanType | ||||
* The type to check | * The type to check | ||||
* @param getters | * @param getters |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Visits Connector classes and check for methods with @OnStateChange | * Visits Connector classes and check for methods with @OnStateChange | ||||
* annotations. | * annotations. | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* {@link AbstractRendererConnector#decode(elemental.json.JsonValue) decode} | * {@link AbstractRendererConnector#decode(elemental.json.JsonValue) decode} | ||||
* method to work without having to implement a "getPresentationType" method. | * method to work without having to implement a "getPresentationType" method. | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* @see WidgetInitVisitor | * @see WidgetInitVisitor | ||||
* | |||||
* | |||||
* @since 7.4 | * @since 7.4 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/** | /** | ||||
* Visit all MANIFEST.MF files in the classpath validating licenses. | * Visit all MANIFEST.MF files in the classpath validating licenses. | ||||
* | |||||
* | |||||
* Return a list of Cval licensed products in order to have enough info to | * Return a list of Cval licensed products in order to have enough info to | ||||
* generate nag messages in the UI. | * generate nag messages in the UI. | ||||
*/ | */ | ||||
/** | /** | ||||
* Set the filter regexp of .jar names which we have to consider. | * Set the filter regexp of .jar names which we have to consider. | ||||
* | |||||
* | |||||
* default is '.*touchkit.*' | * default is '.*touchkit.*' | ||||
*/ | */ | ||||
public CvalAddonsChecker setFilter(String regexp) { | public CvalAddonsChecker setFilter(String regexp) { |
/* | /* | ||||
* Class used for binding the JSON gotten from server. | * Class used for binding the JSON gotten from server. | ||||
* | |||||
* | |||||
* It is not in a separate f le, so as it is easier to copy into any product | * It is not in a separate f le, so as it is easier to copy into any product | ||||
* which does not depend on vaadin core. | * which does not depend on vaadin core. | ||||
* | |||||
* | |||||
* We are using elemental.json in order not to use additional dependency | * We are using elemental.json in order not to use additional dependency | ||||
* like auto-beans, gson, etc. | * like auto-beans, gson, etc. | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* A wrapper for the GWT compiler that runs the compiler in a new thread after | * A wrapper for the GWT compiler that runs the compiler in a new thread after | ||||
* updating the widgetset file. | * updating the widgetset file. | ||||
* | |||||
* | |||||
* This class originally existed to allow circumventing a J2SE 5.0 bug (6316197) | * This class originally existed to allow circumventing a J2SE 5.0 bug (6316197) | ||||
* that prevents setting the stack size for the main thread. | * that prevents setting the stack size for the main thread. | ||||
* | |||||
* | |||||
* This class takes the same command line arguments as the | * This class takes the same command line arguments as the | ||||
* com.google.gwt.dev.Compiler class. | * com.google.gwt.dev.Compiler class. | ||||
* | |||||
* | |||||
* A typical invocation would use e.g. the following arguments | * A typical invocation would use e.g. the following arguments | ||||
* | |||||
* | |||||
* "-war WebContent/VAADIN/widgetsets com.vaadin.DefaultWidgetSet" | * "-war WebContent/VAADIN/widgetsets com.vaadin.DefaultWidgetSet" | ||||
* | |||||
* | |||||
* In addition, larger memory usage settings for the VM should be used, e.g. | * In addition, larger memory usage settings for the VM should be used, e.g. | ||||
* | |||||
* | |||||
* "-Xms256M -Xmx512M -Xss8M" | * "-Xms256M -Xmx512M -Xss8M" | ||||
* | |||||
* | |||||
* The source directory containing widgetset and related classes must be | * The source directory containing widgetset and related classes must be | ||||
* included in the classpath, as well as other relevant JARs. | * included in the classpath, as well as other relevant JARs. | ||||
* | |||||
* | |||||
* @deprecated with Java 6, can use com.google.gwt.dev.Compiler directly (also | * @deprecated with Java 6, can use com.google.gwt.dev.Compiler directly (also | ||||
* in Eclipse plug-in etc.) | * in Eclipse plug-in etc.) | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Utility methods for working with CSS transitions and animations. | * Utility methods for working with CSS transitions and animations. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.3 | * @since 7.3 | ||||
*/ | */ | ||||
/** | /** | ||||
* For internal use only. May be removed or replaced in the future. | * For internal use only. May be removed or replaced in the future. | ||||
* | |||||
* | |||||
* Set the animation-duration CSS property. | * Set the animation-duration CSS property. | ||||
* | |||||
* | |||||
* @param elem | * @param elem | ||||
* the element whose animation-duration to set | * the element whose animation-duration to set | ||||
* @param duration | * @param duration | ||||
/** | /** | ||||
* For internal use only. May be removed or replaced in the future. | * For internal use only. May be removed or replaced in the future. | ||||
* | |||||
* | |||||
* Set the animation-delay CSS property. | * Set the animation-delay CSS property. | ||||
* | |||||
* | |||||
* @param elem | * @param elem | ||||
* the element whose animation-delay to set | * the element whose animation-delay to set | ||||
* @param delay | * @param delay | ||||
var callbackFunc = $entry(function(e) { | var callbackFunc = $entry(function(e) { | ||||
listener.@com.vaadin.client.AnimationUtil.AnimationEndListener::onAnimationEnd(Lcom/google/gwt/dom/client/NativeEvent;)(e); | listener.@com.vaadin.client.AnimationUtil.AnimationEndListener::onAnimationEnd(Lcom/google/gwt/dom/client/NativeEvent;)(e); | ||||
}); | }); | ||||
elem.addEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbackFunc, false); | elem.addEventListener(@com.vaadin.client.AnimationUtil::ANIMATION_END_EVENT_NAME, callbackFunc, false); | ||||
// Store function reference for later removal | // Store function reference for later removal | ||||
if(!elem._vaadin_animationend_callbacks) { | if(!elem._vaadin_animationend_callbacks) { | ||||
elem._vaadin_animationend_callbacks = []; | elem._vaadin_animationend_callbacks = []; | ||||
} | } | ||||
elem._vaadin_animationend_callbacks.push(callbackFunc); | elem._vaadin_animationend_callbacks.push(callbackFunc); | ||||
return callbackFunc; | return callbackFunc; | ||||
}-*/; | }-*/; | ||||
return event.mozAnimationName; | return event.mozAnimationName; | ||||
else if(event.oAnimationName) | else if(event.oAnimationName) | ||||
return event.oAnimationName; | return event.oAnimationName; | ||||
return ""; | return ""; | ||||
}-*/; | }-*/; | ||||
public static native String getAnimationName(ComputedStyle cstyle) | public static native String getAnimationName(ComputedStyle cstyle) | ||||
/*-{ | /*-{ | ||||
var cs = cstyle.@com.vaadin.client.ComputedStyle::computedStyle; | var cs = cstyle.@com.vaadin.client.ComputedStyle::computedStyle; | ||||
if(!cs.getPropertyValue) | if(!cs.getPropertyValue) | ||||
return ""; | return ""; | ||||
if(cs.getPropertyValue("-webkit-animation-name")) | if(cs.getPropertyValue("-webkit-animation-name")) | ||||
return cs.getPropertyValue("-webkit-animation-name"); | return cs.getPropertyValue("-webkit-animation-name"); | ||||
else if(cs.getPropertyValue("animation-name")) | else if(cs.getPropertyValue("animation-name")) | ||||
return cs.getPropertyValue("animation-name"); | return cs.getPropertyValue("animation-name"); | ||||
else if(cs.getPropertyValue("-moz-animation-name")) | else if(cs.getPropertyValue("-moz-animation-name")) | ||||
return cs.getPropertyValue("-moz-animation-name"); | return cs.getPropertyValue("-moz-animation-name"); | ||||
else if(cs.getPropertyValue("-o-animation-name")) | else if(cs.getPropertyValue("-o-animation-name")) | ||||
return cs.getPropertyValue("-o-animation-name"); | return cs.getPropertyValue("-o-animation-name"); | ||||
return ""; | return ""; | ||||
}-*/; | }-*/; | ||||
'MozAnimation': 'animationend', | 'MozAnimation': 'animationend', | ||||
'WebkitAnimation': 'webkitAnimationEnd' | 'WebkitAnimation': 'webkitAnimationEnd' | ||||
} | } | ||||
for(var a in anims){ | for(var a in anims){ | ||||
if( el.style[a] !== undefined ){ | if( el.style[a] !== undefined ){ | ||||
return anims[a]; | return anims[a]; | ||||
'mozAnimation', | 'mozAnimation', | ||||
'webkitAnimation' | 'webkitAnimation' | ||||
] | ] | ||||
for(var i=0; i < anims.length; i++) { | for(var i=0; i < anims.length; i++) { | ||||
if( el.style[anims[i]] !== undefined ){ | if( el.style[anims[i]] !== undefined ){ | ||||
return anims[i]; | return anims[i]; |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Helper class for reading configuration options from the bootstap | * Helper class for reading configuration options from the bootstap | ||||
* javascript | * javascript | ||||
* | |||||
* | |||||
* @since 7.0 | * @since 7.0 | ||||
*/ | */ | ||||
private static class JsoConfiguration extends JavaScriptObject { | private static class JsoConfiguration extends JavaScriptObject { | ||||
* Reads a configuration parameter as a string. Please note that the | * Reads a configuration parameter as a string. Please note that the | ||||
* javascript value of the parameter should also be a string, or else an | * javascript value of the parameter should also be a string, or else an | ||||
* undefined exception may be thrown. | * undefined exception may be thrown. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* name of the configuration parameter | * name of the configuration parameter | ||||
* @return value of the configuration parameter, or <code>null</code> if | * @return value of the configuration parameter, or <code>null</code> if | ||||
* Reads a configuration parameter as a boolean object. Please note that | * Reads a configuration parameter as a boolean object. Please note that | ||||
* the javascript value of the parameter should also be a boolean, or | * the javascript value of the parameter should also be a boolean, or | ||||
* else an undefined exception may be thrown. | * else an undefined exception may be thrown. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* name of the configuration parameter | * name of the configuration parameter | ||||
* @return boolean value of the configuration paramter, or | * @return boolean value of the configuration paramter, or | ||||
* Reads a configuration parameter as an integer object. Please note | * Reads a configuration parameter as an integer object. Please note | ||||
* that the javascript value of the parameter should also be an integer, | * that the javascript value of the parameter should also be an integer, | ||||
* or else an undefined exception may be thrown. | * or else an undefined exception may be thrown. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* name of the configuration parameter | * name of the configuration parameter | ||||
* @return integer value of the configuration paramter, or | * @return integer value of the configuration paramter, or | ||||
* an object with appropriate fields, or else an undefined exception may | * an object with appropriate fields, or else an undefined exception may | ||||
* be thrown when calling this method or when calling methods on the | * be thrown when calling this method or when calling methods on the | ||||
* returned object. | * returned object. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* name of the configuration parameter | * name of the configuration parameter | ||||
* @return error message with the given name, or <code>null</code> if no | * @return error message with the given name, or <code>null</code> if no | ||||
/** | /** | ||||
* Returns a native javascript object containing version information | * Returns a native javascript object containing version information | ||||
* from the server. | * from the server. | ||||
* | |||||
* | |||||
* @return a javascript object with the version information | * @return a javascript object with the version information | ||||
*/ | */ | ||||
private native JavaScriptObject getVersionInfoJSObject() | private native JavaScriptObject getVersionInfoJSObject() | ||||
/** | /** | ||||
* Gets the version of the Vaadin framework used on the server. | * Gets the version of the Vaadin framework used on the server. | ||||
* | |||||
* | |||||
* @return a string with the version | * @return a string with the version | ||||
* | |||||
* | |||||
* @see com.vaadin.server.VaadinServlet#VERSION | * @see com.vaadin.server.VaadinServlet#VERSION | ||||
*/ | */ | ||||
private native String getVaadinVersion() | private native String getVaadinVersion() | ||||
/** | /** | ||||
* Gets the version of the Atmosphere framework. | * Gets the version of the Atmosphere framework. | ||||
* | |||||
* | |||||
* @return a string with the version | * @return a string with the version | ||||
* | |||||
* | |||||
* @see org.atmosphere.util#getRawVersion() | * @see org.atmosphere.util#getRawVersion() | ||||
*/ | */ | ||||
private native String getAtmosphereVersion() | private native String getAtmosphereVersion() | ||||
/** | /** | ||||
* Gets the JS version used in the Atmosphere framework. | * Gets the JS version used in the Atmosphere framework. | ||||
* | |||||
* | |||||
* @return a string with the version | * @return a string with the version | ||||
*/ | */ | ||||
private native String getAtmosphereJSVersion() | private native String getAtmosphereJSVersion() | ||||
/** | /** | ||||
* Wraps a native javascript object containing fields for an error message | * Wraps a native javascript object containing fields for an error message | ||||
* | |||||
* | |||||
* @since 7.0 | * @since 7.0 | ||||
*/ | */ | ||||
public static final class ErrorMessage extends JavaScriptObject { | public static final class ErrorMessage extends JavaScriptObject { | ||||
* Checks whether path info in requests to the server-side service should be | * Checks whether path info in requests to the server-side service should be | ||||
* in a request parameter (named <code>v-resourcePath</code>) or appended to | * in a request parameter (named <code>v-resourcePath</code>) or appended to | ||||
* the end of the service URL. | * the end of the service URL. | ||||
* | |||||
* | |||||
* @see #getServiceUrl() | * @see #getServiceUrl() | ||||
* | |||||
* | |||||
* @return <code>true</code> if path info should be a request parameter; | * @return <code>true</code> if path info should be a request parameter; | ||||
* <code>false</code> if the path info goes after the service URL | * <code>false</code> if the path info goes after the service URL | ||||
*/ | */ | ||||
* Return the name of the parameter used to to send data to the service url. | * Return the name of the parameter used to to send data to the service url. | ||||
* This method should only be called if {@link #useServiceUrlPathParam()} is | * This method should only be called if {@link #useServiceUrlPathParam()} is | ||||
* true. | * true. | ||||
* | |||||
* | |||||
* @since 7.1.6 | * @since 7.1.6 | ||||
* @return The parameter name, by default <code>v-resourcePath</code> | * @return The parameter name, by default <code>v-resourcePath</code> | ||||
*/ | */ | ||||
* {@link #useServiceUrlPathParam()} return <code>true</code>, the requested | * {@link #useServiceUrlPathParam()} return <code>true</code>, the requested | ||||
* path info should be in the <code>v-resourcePath</code> query parameter; | * path info should be in the <code>v-resourcePath</code> query parameter; | ||||
* else the path info should be appended to the end of the URL. | * else the path info should be appended to the end of the URL. | ||||
* | |||||
* | |||||
* @see #useServiceUrlPathParam() | * @see #useServiceUrlPathParam() | ||||
* | |||||
* | |||||
* @return the URL to the server-side service as a string | * @return the URL to the server-side service as a string | ||||
*/ | */ | ||||
public String getServiceUrl() { | public String getServiceUrl() { | ||||
/** | /** | ||||
* Gets the URL of the VAADIN directory on the server. | * Gets the URL of the VAADIN directory on the server. | ||||
* | |||||
* | |||||
* @return the URL of the VAADIN directory | * @return the URL of the VAADIN directory | ||||
*/ | */ | ||||
public String getVaadinDirUrl() { | public String getVaadinDirUrl() { | ||||
/** | /** | ||||
* Gets the initial UIDL from the DOM, if it was provided during the init | * Gets the initial UIDL from the DOM, if it was provided during the init | ||||
* process. | * process. | ||||
* | |||||
* | |||||
* @return | * @return | ||||
*/ | */ | ||||
public String getUIDL() { | public String getUIDL() { | ||||
* instance. The UI id should be included in every request originating from | * instance. The UI id should be included in every request originating from | ||||
* this instance in order to associate the request with the right UI | * this instance in order to associate the request with the right UI | ||||
* instance on the server. | * instance on the server. | ||||
* | |||||
* | |||||
* @return the UI id | * @return the UI id | ||||
*/ | */ | ||||
public int getUIId() { | public int getUIId() { | ||||
/** | /** | ||||
* Starts the application with a given id by reading the configuration | * Starts the application with a given id by reading the configuration | ||||
* options stored by the bootstrap javascript. | * options stored by the bootstrap javascript. | ||||
* | |||||
* | |||||
* @param applicationId | * @param applicationId | ||||
* id of the application to load, this is also the id of the html | * id of the application to load, this is also the id of the html | ||||
* element into which the application should be rendered. | * element into which the application should be rendered. | ||||
/** | /** | ||||
* Gets the configuration object for a specific application from the | * Gets the configuration object for a specific application from the | ||||
* bootstrap javascript. | * bootstrap javascript. | ||||
* | |||||
* | |||||
* @param appId | * @param appId | ||||
* the id of the application to get configuration data for | * the id of the application to get configuration data for | ||||
* @return a native javascript object containing the configuration data | * @return a native javascript object containing the configuration data | ||||
/** | /** | ||||
* Return Atmosphere version. | * Return Atmosphere version. | ||||
* | |||||
* | |||||
* @since 7.4 | * @since 7.4 | ||||
* | |||||
* | |||||
* @return Atmosphere version. | * @return Atmosphere version. | ||||
*/ | */ | ||||
public String getAtmosphereVersion() { | public String getAtmosphereVersion() { | ||||
/** | /** | ||||
* Return Atmosphere JS version. | * Return Atmosphere JS version. | ||||
* | |||||
* | |||||
* @since 7.4 | * @since 7.4 | ||||
* | |||||
* | |||||
* @return Atmosphere JS version. | * @return Atmosphere JS version. | ||||
*/ | */ | ||||
public String getAtmosphereJSVersion() { | public String getAtmosphereJSVersion() { | ||||
* Returns all tags for given class. Tags are used in | * Returns all tags for given class. Tags are used in | ||||
* {@link ApplicationConfiguration} to keep track of different classes and | * {@link ApplicationConfiguration} to keep track of different classes and | ||||
* their hierarchy | * their hierarchy | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
* @param classname | * @param classname | ||||
* name of class which tags we want | * name of class which tags we want | ||||
* Registers that callback that the bootstrap javascript uses to start | * Registers that callback that the bootstrap javascript uses to start | ||||
* applications once the widgetset is loaded and all required information is | * applications once the widgetset is loaded and all required information is | ||||
* available | * available | ||||
* | |||||
* | |||||
* @param widgetsetName | * @param widgetsetName | ||||
* the name of this widgetset | * the name of this widgetset | ||||
*/ | */ | ||||
* adding ?debug parameter to URI. Please note that debug mode is always | * adding ?debug parameter to URI. Please note that debug mode is always | ||||
* disabled if production mode is enabled, but disabling production mode | * disabled if production mode is enabled, but disabling production mode | ||||
* does not automatically enable debug mode. | * does not automatically enable debug mode. | ||||
* | |||||
* | |||||
* @see #isProductionMode() | * @see #isProductionMode() | ||||
* | |||||
* | |||||
* @return true if client side is currently been debugged | * @return true if client side is currently been debugged | ||||
*/ | */ | ||||
public static boolean isDebugMode() { | public static boolean isDebugMode() { | ||||
* Checks if production mode is enabled. When production mode is enabled, | * Checks if production mode is enabled. When production mode is enabled, | ||||
* client-side logging is disabled. There may also be other performance | * client-side logging is disabled. There may also be other performance | ||||
* optimizations. | * optimizations. | ||||
* | |||||
* | |||||
* @since 7.1.2 | * @since 7.1.2 | ||||
* @return <code>true</code> if production mode is enabled; otherwise | * @return <code>true</code> if production mode is enabled; otherwise | ||||
* <code>false</code>. | * <code>false</code>. | ||||
/** | /** | ||||
* Checks whether debug logging should be quiet | * Checks whether debug logging should be quiet | ||||
* | |||||
* | |||||
* @return <code>true</code> if debug logging should be quiet | * @return <code>true</code> if debug logging should be quiet | ||||
*/ | */ | ||||
public static boolean isQuietDebugMode() { | public static boolean isQuietDebugMode() { | ||||
/** | /** | ||||
* Checks whether the widget set version has been sent to the server. It is | * Checks whether the widget set version has been sent to the server. It is | ||||
* sent in the first UIDL request. | * sent in the first UIDL request. | ||||
* | |||||
* | |||||
* @return <code>true</code> if browser information has already been sent | * @return <code>true</code> if browser information has already been sent | ||||
*/ | */ | ||||
public boolean isWidgetsetVersionSent() { | public boolean isWidgetsetVersionSent() { |
* This is the client side communication "engine", managing client-server | * This is the client side communication "engine", managing client-server | ||||
* communication with its server side counterpart | * communication with its server side counterpart | ||||
* com.vaadin.server.VaadinService. | * com.vaadin.server.VaadinService. | ||||
* | |||||
* | |||||
* Client-side connectors receive updates from the corresponding server-side | * Client-side connectors receive updates from the corresponding server-side | ||||
* connector (typically component) as state updates or RPC calls. The connector | * connector (typically component) as state updates or RPC calls. The connector | ||||
* has the possibility to communicate back with its server side counter part | * has the possibility to communicate back with its server side counter part | ||||
* through RPC calls. | * through RPC calls. | ||||
* | |||||
* | |||||
* TODO document better | * TODO document better | ||||
* | |||||
* | |||||
* Entry point classes (widgetsets) define <code>onModuleLoad()</code>. | * Entry point classes (widgetsets) define <code>onModuleLoad()</code>. | ||||
*/ | */ | ||||
public class ApplicationConnection implements HasHandlers { | public class ApplicationConnection implements HasHandlers { | ||||
* A string that, if found in a non-JSON response to a UIDL request, will | * A string that, if found in a non-JSON response to a UIDL request, will | ||||
* cause the browser to refresh the page. If followed by a colon, optional | * cause the browser to refresh the page. If followed by a colon, optional | ||||
* whitespace, and a URI, causes the browser to synchronously load the URI. | * whitespace, and a URI, causes the browser to synchronously load the URI. | ||||
* | |||||
* | |||||
* <p> | * <p> | ||||
* This allows, for instance, a servlet filter to redirect the application | * This allows, for instance, a servlet filter to redirect the application | ||||
* to a custom login page when the session expires. For example: | * to a custom login page when the session expires. For example: | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* <pre> | * <pre> | ||||
* if (sessionExpired) { | * if (sessionExpired) { | ||||
* response.setHeader("Content-Type", "text/html"); | * response.setHeader("Content-Type", "text/html"); | ||||
/** | /** | ||||
* Event triggered when a application is stopped by calling | * Event triggered when a application is stopped by calling | ||||
* {@link ApplicationConnection#setApplicationRunning(false)}. | * {@link ApplicationConnection#setApplicationRunning(false)}. | ||||
* | |||||
* | |||||
* To listen for the event add a {@link ApplicationStoppedHandler} by | * To listen for the event add a {@link ApplicationStoppedHandler} by | ||||
* invoking | * invoking | ||||
* {@link ApplicationConnection#addHandler(ApplicationConnection.ApplicationStoppedEvent.Type, ApplicationStoppedHandler)} | * {@link ApplicationConnection#addHandler(ApplicationConnection.ApplicationStoppedEvent.Type, ApplicationStoppedHandler)} | ||||
* to the {@link ApplicationConnection} | * to the {@link ApplicationConnection} | ||||
* | |||||
* | |||||
* @since 7.1.8 | * @since 7.1.8 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
/** | /** | ||||
* Called when a communication error has occurred. Returning | * Called when a communication error has occurred. Returning | ||||
* <code>true</code> from this method suppresses error handling. | * <code>true</code> from this method suppresses error handling. | ||||
* | |||||
* | |||||
* @param details | * @param details | ||||
* A string describing the error. | * A string describing the error. | ||||
* @param statusCode | * @param statusCode | ||||
* A listener for listening to application stopped events. The listener can | * A listener for listening to application stopped events. The listener can | ||||
* be added to a {@link ApplicationConnection} by invoking | * be added to a {@link ApplicationConnection} by invoking | ||||
* {@link ApplicationConnection#addHandler(ApplicationStoppedEvent.Type, ApplicationStoppedHandler)} | * {@link ApplicationConnection#addHandler(ApplicationStoppedEvent.Type, ApplicationStoppedHandler)} | ||||
* | |||||
* | |||||
* @since 7.1.8 | * @since 7.1.8 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
* Triggered when the {@link ApplicationConnection} marks a previously | * Triggered when the {@link ApplicationConnection} marks a previously | ||||
* running application as stopped by invoking | * running application as stopped by invoking | ||||
* {@link ApplicationConnection#setApplicationRunning(false)} | * {@link ApplicationConnection#setApplicationRunning(false)} | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* the event triggered by the {@link ApplicationConnection} | * the event triggered by the {@link ApplicationConnection} | ||||
*/ | */ | ||||
* called once this application has started (first response received) or | * called once this application has started (first response received) or | ||||
* failed to start. This ensures that the applications are started in order, | * failed to start. This ensures that the applications are started in order, | ||||
* to avoid session-id problems. | * to avoid session-id problems. | ||||
* | |||||
* | |||||
*/ | */ | ||||
public void start() { | public void start() { | ||||
String jsonText = configuration.getUIDL(); | String jsonText = configuration.getUIDL(); | ||||
/** | /** | ||||
* Checks if there is some work to be done on the client side | * Checks if there is some work to be done on the client side | ||||
* | |||||
* | |||||
* @return true if the client has some work to be done, false otherwise | * @return true if the client has some work to be done, false otherwise | ||||
*/ | */ | ||||
private boolean isActive() { | private boolean isActive() { | ||||
return vi; | return vi; | ||||
} | } | ||||
} | } | ||||
client.getProfilingData = $entry(function() { | client.getProfilingData = $entry(function() { | ||||
var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()(); | var smh = ap.@com.vaadin.client.ApplicationConnection::getMessageHandler()(); | ||||
var pd = [ | var pd = [ | ||||
pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime; | pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime; | ||||
return pd; | return pd; | ||||
}); | }); | ||||
client.getElementByPath = $entry(function(id) { | client.getElementByPath = $entry(function(id) { | ||||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPath(Ljava/lang/String;)(id); | return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getElementByPath(Ljava/lang/String;)(id); | ||||
}); | }); | ||||
return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element); | return componentLocator.@com.vaadin.client.componentlocator.ComponentLocator::getPathForElement(Lcom/google/gwt/dom/client/Element;)(element); | ||||
}); | }); | ||||
client.initializing = false; | client.initializing = false; | ||||
$wnd.vaadin.clients[TTAppId] = client; | $wnd.vaadin.clients[TTAppId] = client; | ||||
}-*/; | }-*/; | ||||
* <li><code>vaadin.postRequestHooks</code> is a map of functions which gets | * <li><code>vaadin.postRequestHooks</code> is a map of functions which gets | ||||
* called after each XHR made by vaadin application. Note, that it is | * called after each XHR made by vaadin application. Note, that it is | ||||
* attaching js functions responsibility to create the variable like this: | * attaching js functions responsibility to create the variable like this: | ||||
* | |||||
* | |||||
* <code><pre> | * <code><pre> | ||||
* if(!vaadin.postRequestHooks) {vaadin.postRequestHooks = new Object();} | * if(!vaadin.postRequestHooks) {vaadin.postRequestHooks = new Object();} | ||||
* postRequestHooks.myHook = function(appId) { | * postRequestHooks.myHook = function(appId) { | ||||
* </pre></code> First parameter passed to these functions is the identifier | * </pre></code> First parameter passed to these functions is the identifier | ||||
* of Vaadin application that made the request. | * of Vaadin application that made the request. | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* TODO make this multi-app aware | * TODO make this multi-app aware | ||||
*/ | */ | ||||
private native void initializeClientHooks() | private native void initializeClientHooks() | ||||
/** | /** | ||||
* Requests an analyze of layouts, to find inconsistencies. Exclusively used | * Requests an analyze of layouts, to find inconsistencies. Exclusively used | ||||
* for debugging during development. | * for debugging during development. | ||||
* | |||||
* | |||||
* @deprecated as of 7.1. Replaced by {@link UIConnector#analyzeLayouts()} | * @deprecated as of 7.1. Replaced by {@link UIConnector#analyzeLayouts()} | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
* Sends a request to the server to print details to console that will help | * Sends a request to the server to print details to console that will help | ||||
* the developer to locate the corresponding server-side connector in the | * the developer to locate the corresponding server-side connector in the | ||||
* source code. | * source code. | ||||
* | |||||
* | |||||
* @param serverConnector | * @param serverConnector | ||||
* @deprecated as of 7.1. Replaced by | * @deprecated as of 7.1. Replaced by | ||||
* {@link UIConnector#showServerDebugInfo(ServerConnector)} | * {@link UIConnector#showServerDebugInfo(ServerConnector)} | ||||
/** | /** | ||||
* Checks whether or not the CSS is loaded. By default checks the size of | * Checks whether or not the CSS is loaded. By default checks the size of | ||||
* the loading indicator element. | * the loading indicator element. | ||||
* | |||||
* | |||||
* @return | * @return | ||||
*/ | */ | ||||
protected boolean isCSSLoaded() { | protected boolean isCSSLoaded() { | ||||
/** | /** | ||||
* Shows the communication error notification. | * Shows the communication error notification. | ||||
* | |||||
* | |||||
* @param details | * @param details | ||||
* Optional details. | * Optional details. | ||||
* @param statusCode | * @param statusCode | ||||
* The status code returned for the request | * The status code returned for the request | ||||
* | |||||
* | |||||
*/ | */ | ||||
public void showCommunicationError(String details, int statusCode) { | public void showCommunicationError(String details, int statusCode) { | ||||
getLogger().severe("Communication error: " + details); | getLogger().severe("Communication error: " + details); | ||||
/** | /** | ||||
* Shows the authentication error notification. | * Shows the authentication error notification. | ||||
* | |||||
* | |||||
* @param details | * @param details | ||||
* Optional details. | * Optional details. | ||||
*/ | */ | ||||
/** | /** | ||||
* Shows the session expiration notification. | * Shows the session expiration notification. | ||||
* | |||||
* | |||||
* @param details | * @param details | ||||
* Optional details. | * Optional details. | ||||
*/ | */ | ||||
/** | /** | ||||
* Shows an error notification. | * Shows an error notification. | ||||
* | |||||
* | |||||
* @param details | * @param details | ||||
* Optional details. | * Optional details. | ||||
* @param message | * @param message | ||||
* <p> | * <p> | ||||
* Used by the native "client.isActive" function. | * Used by the native "client.isActive" function. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @return true if deferred commands are (potentially) being executed, false | * @return true if deferred commands are (potentially) being executed, false | ||||
* otherwise | * otherwise | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the loading indicator used by this ApplicationConnection | * Returns the loading indicator used by this ApplicationConnection | ||||
* | |||||
* | |||||
* @return The loading indicator for this ApplicationConnection | * @return The loading indicator for this ApplicationConnection | ||||
*/ | */ | ||||
public VLoadingIndicator getLoadingIndicator() { | public VLoadingIndicator getLoadingIndicator() { | ||||
/** | /** | ||||
* Determines whether or not the loading indicator is showing. | * Determines whether or not the loading indicator is showing. | ||||
* | |||||
* | |||||
* @return true if the loading indicator is visible | * @return true if the loading indicator is visible | ||||
* @deprecated As of 7.1. Use {@link #getLoadingIndicator()} and | * @deprecated As of 7.1. Use {@link #getLoadingIndicator()} and | ||||
* {@link VLoadingIndicator#isVisible()}.isVisible() instead. | * {@link VLoadingIndicator#isVisible()}.isVisible() instead. | ||||
* is true, the update is sent as soon as possible. If immediate is false, | * is true, the update is sent as soon as possible. If immediate is false, | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
* is true, the update is sent as soon as possible. If immediate is false, | * is true, the update is sent as soon as possible. If immediate is false, | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
* is true, the update is sent as soon as possible. If immediate is false, | * is true, the update is sent as soon as possible. If immediate is false, | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
* is true, the update is sent as soon as possible. If immediate is false, | * is true, the update is sent as soon as possible. If immediate is false, | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
* is true, the update is sent as soon as possible. If immediate is false, | * is true, the update is sent as soon as possible. If immediate is false, | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
* is true, the update is sent as soon as possible. If immediate is false, | * is true, the update is sent as soon as possible. If immediate is false, | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
* is true, the update is sent as soon as possible. If immediate is false, | * is true, the update is sent as soon as possible. If immediate is false, | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
* is true, the update is sent as soon as possible. If immediate is false, | * is true, the update is sent as soon as possible. If immediate is false, | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* <p> | * <p> | ||||
* A null array is sent as an empty array. | * A null array is sent as an empty array. | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
* the update will be sent along with the next immediate update. | * the update will be sent along with the next immediate update. | ||||
* <p> | * <p> | ||||
* A null array is sent as an empty array. | * A null array is sent as an empty array. | ||||
* | |||||
* | |||||
* @param paintableId | * @param paintableId | ||||
* the id of the paintable that owns the variable | * the id of the paintable that owns the variable | ||||
* @param variableName | * @param variableName | ||||
/** | /** | ||||
* Does absolutely nothing. Replaced by {@link LayoutManager}. | * Does absolutely nothing. Replaced by {@link LayoutManager}. | ||||
* | |||||
* | |||||
* @param container | * @param container | ||||
* @deprecated As of 7.0, serves no purpose | * @deprecated As of 7.0, serves no purpose | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns false | * Returns false | ||||
* | |||||
* | |||||
* @param paintable | * @param paintable | ||||
* @return false, always | * @return false, always | ||||
* @deprecated As of 7.0, serves no purpose | * @deprecated As of 7.0, serves no purpose | ||||
/** | /** | ||||
* Returns false | * Returns false | ||||
* | |||||
* | |||||
* @param paintable | * @param paintable | ||||
* @return false, always | * @return false, always | ||||
* @deprecated As of 7.0, serves no purpose | * @deprecated As of 7.0, serves no purpose | ||||
/** | /** | ||||
* Get either an existing ComponentConnector or create a new | * Get either an existing ComponentConnector or create a new | ||||
* ComponentConnector with the given type and id. | * ComponentConnector with the given type and id. | ||||
* | |||||
* | |||||
* If a ComponentConnector with the given id already exists, returns it. | * If a ComponentConnector with the given id already exists, returns it. | ||||
* Otherwise creates and registers a new ComponentConnector of the given | * Otherwise creates and registers a new ComponentConnector of the given | ||||
* type. | * type. | ||||
* | |||||
* | |||||
* @param connectorId | * @param connectorId | ||||
* Id of the paintable | * Id of the paintable | ||||
* @param connectorType | * @param connectorType | ||||
* Type of the connector, as passed from the server side | * Type of the connector, as passed from the server side | ||||
* | |||||
* | |||||
* @return Either an existing ComponentConnector or a new ComponentConnector | * @return Either an existing ComponentConnector or a new ComponentConnector | ||||
* of the given type | * of the given type | ||||
*/ | */ | ||||
/** | /** | ||||
* Creates a new ServerConnector with the given type and id. | * Creates a new ServerConnector with the given type and id. | ||||
* | |||||
* | |||||
* Creates and registers a new ServerConnector of the given type. Should | * Creates and registers a new ServerConnector of the given type. Should | ||||
* never be called with the connector id of an existing connector. | * never be called with the connector id of an existing connector. | ||||
* | |||||
* | |||||
* @param connectorId | * @param connectorId | ||||
* Id of the new connector | * Id of the new connector | ||||
* @param connectorType | * @param connectorType | ||||
* Type of the connector, as passed from the server side | * Type of the connector, as passed from the server side | ||||
* | |||||
* | |||||
* @return A new ServerConnector of the given type | * @return A new ServerConnector of the given type | ||||
*/ | */ | ||||
private ServerConnector createAndRegisterConnector(String connectorId, | private ServerConnector createAndRegisterConnector(String connectorId, | ||||
/** | /** | ||||
* Gets a resource that has been pre-loaded via UIDL, such as custom | * Gets a resource that has been pre-loaded via UIDL, such as custom | ||||
* layouts. | * layouts. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* identifier of the resource to get | * identifier of the resource to get | ||||
* @return the resource | * @return the resource | ||||
/** | /** | ||||
* Sets a resource that has been pre-loaded via UIDL, such as custom | * Sets a resource that has been pre-loaded via UIDL, such as custom | ||||
* layouts. | * layouts. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @param name | * @param name | ||||
* identifier of the resource to Set | * identifier of the resource to Set | ||||
/** | /** | ||||
* Singleton method to get instance of app's context menu. | * Singleton method to get instance of app's context menu. | ||||
* | |||||
* | |||||
* @return VContextMenu object | * @return VContextMenu object | ||||
*/ | */ | ||||
public VContextMenu getContextMenu() { | public VContextMenu getContextMenu() { | ||||
/** | /** | ||||
* Gets an {@link Icon} instance corresponding to a URI. | * Gets an {@link Icon} instance corresponding to a URI. | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
* @param uri | * @param uri | ||||
* @return Icon object | * @return Icon object | ||||
* Translates custom protocols in UIDL URI's to be recognizable by browser. | * Translates custom protocols in UIDL URI's to be recognizable by browser. | ||||
* All uri's from UIDL should be routed via this method before giving them | * All uri's from UIDL should be routed via this method before giving them | ||||
* to browser due URI's in UIDL may contain custom protocols like theme://. | * to browser due URI's in UIDL may contain custom protocols like theme://. | ||||
* | |||||
* | |||||
* @param uidlUri | * @param uidlUri | ||||
* Vaadin URI from uidl | * Vaadin URI from uidl | ||||
* @return translated URI ready for browser | * @return translated URI ready for browser | ||||
/** | /** | ||||
* Gets the URI for the current theme. Can be used to reference theme | * Gets the URI for the current theme. Can be used to reference theme | ||||
* resources. | * resources. | ||||
* | |||||
* | |||||
* @return URI to the current theme | * @return URI to the current theme | ||||
*/ | */ | ||||
public String getThemeUri() { | public String getThemeUri() { | ||||
/** | /** | ||||
* Use to notify that the given component's caption has changed; layouts may | * Use to notify that the given component's caption has changed; layouts may | ||||
* have to be recalculated. | * have to be recalculated. | ||||
* | |||||
* | |||||
* @param component | * @param component | ||||
* the Paintable whose caption has changed | * the Paintable whose caption has changed | ||||
* @deprecated As of 7.0.2, has not had any effect for a long time | * @deprecated As of 7.0.2, has not had any effect for a long time | ||||
/** | /** | ||||
* Gets the main view | * Gets the main view | ||||
* | |||||
* | |||||
* @return the main view | * @return the main view | ||||
*/ | */ | ||||
public UIConnector getUIConnector() { | public UIConnector getUIConnector() { | ||||
/** | /** | ||||
* Gets the {@link ApplicationConfiguration} for the current application. | * Gets the {@link ApplicationConfiguration} for the current application. | ||||
* | |||||
* | |||||
* @see ApplicationConfiguration | * @see ApplicationConfiguration | ||||
* @return the configuration for this application | * @return the configuration for this application | ||||
*/ | */ | ||||
* list of events which has server side listeners is updated automatically | * list of events which has server side listeners is updated automatically | ||||
* before the component is updated so the value is correct if called from | * before the component is updated so the value is correct if called from | ||||
* updatedFromUIDL. | * updatedFromUIDL. | ||||
* | |||||
* | |||||
* @param connector | * @param connector | ||||
* The connector to register event listeners for | * The connector to register event listeners for | ||||
* @param eventIdentifier | * @param eventIdentifier | ||||
/** | /** | ||||
* Adds the get parameters to the uri and returns the new uri that contains | * Adds the get parameters to the uri and returns the new uri that contains | ||||
* the parameters. | * the parameters. | ||||
* | |||||
* | |||||
* @param uri | * @param uri | ||||
* The uri to which the parameters should be added. | * The uri to which the parameters should be added. | ||||
* @param extraParams | * @param extraParams | ||||
/** | /** | ||||
* Get VTooltip instance related to application connection | * Get VTooltip instance related to application connection | ||||
* | |||||
* | |||||
* @return VTooltip instance | * @return VTooltip instance | ||||
*/ | */ | ||||
public VTooltip getVTooltip() { | public VTooltip getVTooltip() { | ||||
* this method is now handled by the state change event handler in | * this method is now handled by the state change event handler in | ||||
* AbstractComponentConnector. The only function this method has is to | * AbstractComponentConnector. The only function this method has is to | ||||
* return true if the UIDL is a "cached" update. | * return true if the UIDL is a "cached" update. | ||||
* | |||||
* | |||||
* @param component | * @param component | ||||
* @param uidl | * @param uidl | ||||
* @param manageCaption | * @param manageCaption | ||||
* Schedules a heartbeat request to occur after the configured heartbeat | * Schedules a heartbeat request to occur after the configured heartbeat | ||||
* interval elapses if the interval is a positive number. Otherwise, does | * interval elapses if the interval is a positive number. Otherwise, does | ||||
* nothing. | * nothing. | ||||
* | |||||
* | |||||
* @deprecated as of 7.2, use {@link Heartbeat#schedule()} instead | * @deprecated as of 7.2, use {@link Heartbeat#schedule()} instead | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
* Heartbeat requests are used to inform the server that the client-side is | * Heartbeat requests are used to inform the server that the client-side is | ||||
* still alive. If the client page is closed or the connection lost, the | * still alive. If the client page is closed or the connection lost, the | ||||
* server will eventually close the inactive UI. | * server will eventually close the inactive UI. | ||||
* | |||||
* | |||||
* @deprecated as of 7.2, use {@link Heartbeat#send()} instead | * @deprecated as of 7.2, use {@link Heartbeat#send()} instead | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
/** | /** | ||||
* Sets the delegate that is called whenever a communication error occurrs. | * Sets the delegate that is called whenever a communication error occurrs. | ||||
* | |||||
* | |||||
* @param delegate | * @param delegate | ||||
* the delegate. | * the delegate. | ||||
*/ | */ | ||||
/** | /** | ||||
* Checks if the application is in the {@link ApplicationState#RUNNING} | * Checks if the application is in the {@link ApplicationState#RUNNING} | ||||
* state. | * state. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @return true if the application is in the running state, false otherwise | * @return true if the application is in the running state, false otherwise | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the active connector for focused element in browser. | * Gets the active connector for focused element in browser. | ||||
* | |||||
* | |||||
* @return Connector for focused element or null. | * @return Connector for focused element or null. | ||||
*/ | */ | ||||
private ComponentConnector getActiveConnector() { | private ComponentConnector getActiveConnector() { | ||||
* "initializing" to "running" to "stopped". There is no way for an | * "initializing" to "running" to "stopped". There is no way for an | ||||
* application to go back to a previous state, i.e. a stopped application | * application to go back to a previous state, i.e. a stopped application | ||||
* can never be re-started | * can never be re-started | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @return the current state of this application | * @return the current state of this application | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the server RPC queue for this application | * Gets the server RPC queue for this application | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @return the server RPC queue | * @return the server RPC queue | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the communication error handler for this application | * Gets the communication error handler for this application | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @return the server RPC queue | * @return the server RPC queue | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the (server to client) message handler for this application | * Gets the (server to client) message handler for this application | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @return the message handler | * @return the message handler | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the server rpc manager for this application | * Gets the server rpc manager for this application | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @return the server rpc manager | * @return the server rpc manager | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the (client to server) message sender for this application | * Gets the (client to server) message sender for this application | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @return the message sender | * @return the message sender | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Class used to query information about web browser. | * Class used to query information about web browser. | ||||
* | |||||
* | |||||
* Browser details are detected only once and those are stored in this singleton | * Browser details are detected only once and those are stored in this singleton | ||||
* class. | * class. | ||||
* | |||||
* | |||||
*/ | */ | ||||
public class BrowserInfo { | public class BrowserInfo { | ||||
/** | /** | ||||
* Singleton method to get BrowserInfo object. | * Singleton method to get BrowserInfo object. | ||||
* | |||||
* | |||||
* @return instance of BrowserInfo object | * @return instance of BrowserInfo object | ||||
*/ | */ | ||||
public static BrowserInfo get() { | public static BrowserInfo get() { | ||||
* Returns a string representing the browser in use, for use in CSS | * Returns a string representing the browser in use, for use in CSS | ||||
* classnames. The classnames will be space separated abbreviations, | * classnames. The classnames will be space separated abbreviations, | ||||
* optionally with a version appended. | * optionally with a version appended. | ||||
* | |||||
* | |||||
* Abbreviations: Firefox: ff Internet Explorer: ie Safari: sa Opera: op | * Abbreviations: Firefox: ff Internet Explorer: ie Safari: sa Opera: op | ||||
* | |||||
* | |||||
* Browsers that CSS-wise behave like each other will get the same | * Browsers that CSS-wise behave like each other will get the same | ||||
* abbreviation (this usually depends on the rendering engine). | * abbreviation (this usually depends on the rendering engine). | ||||
* | |||||
* | |||||
* This is quite simple at the moment, more heuristics will be added when | * This is quite simple at the moment, more heuristics will be added when | ||||
* needed. | * needed. | ||||
* | |||||
* | |||||
* Examples: Internet Explorer 6: ".v-ie .v-ie6 .v-ie60", Firefox 3.0.4: | * Examples: Internet Explorer 6: ".v-ie .v-ie6 .v-ie60", Firefox 3.0.4: | ||||
* ".v-ff .v-ff3 .v-ff30", Opera 9.60: ".v-op .v-op9 .v-op960", Opera 10.10: | * ".v-ff .v-ff3 .v-ff30", Opera 9.60: ".v-op .v-op9 .v-op960", Opera 10.10: | ||||
* ".v-op .v-op10 .v-op1010" | * ".v-op .v-op10 .v-op1010" | ||||
* | |||||
* | |||||
* @return | * @return | ||||
*/ | */ | ||||
public String getCSSClass() { | public String getCSSClass() { | ||||
/** | /** | ||||
* Returns the Gecko version if the browser is Gecko based. The Gecko | * Returns the Gecko version if the browser is Gecko based. The Gecko | ||||
* version for Firefox 2 is 1.8 and 1.9 for Firefox 3. | * version for Firefox 2 is 1.8 and 1.9 for Firefox 3. | ||||
* | |||||
* | |||||
* @return The Gecko version or -1 if the browser is not Gecko based | * @return The Gecko version or -1 if the browser is not Gecko based | ||||
*/ | */ | ||||
public float getGeckoVersion() { | public float getGeckoVersion() { | ||||
/** | /** | ||||
* Returns the WebKit version if the browser is WebKit based. The WebKit | * Returns the WebKit version if the browser is WebKit based. The WebKit | ||||
* version returned is the major version e.g., 523. | * version returned is the major version e.g., 523. | ||||
* | |||||
* | |||||
* @return The WebKit version or -1 if the browser is not WebKit based | * @return The WebKit version or -1 if the browser is not WebKit based | ||||
*/ | */ | ||||
public float getWebkitVersion() { | public float getWebkitVersion() { | ||||
/** | /** | ||||
* Indicates whether the browser might require juggling to properly update | * Indicates whether the browser might require juggling to properly update | ||||
* sizes inside elements with overflow: auto. | * sizes inside elements with overflow: auto. | ||||
* | |||||
* | |||||
* @return <code>true</code> if the browser requires the workaround, | * @return <code>true</code> if the browser requires the workaround, | ||||
* otherwise <code>false</code> | * otherwise <code>false</code> | ||||
*/ | */ | ||||
* <p> | * <p> | ||||
* See https://bugs.webkit.org/show_bug.cgi?id=123958 and | * See https://bugs.webkit.org/show_bug.cgi?id=123958 and | ||||
* http://code.google.com/p/chromium/issues/detail?id=316549 | * http://code.google.com/p/chromium/issues/detail?id=316549 | ||||
* | |||||
* | |||||
* @since 7.1.8 | * @since 7.1.8 | ||||
* @return <code>true</code> if the browser requires the workaround, | * @return <code>true</code> if the browser requires the workaround, | ||||
* otherwise <code>false</code> | * otherwise <code>false</code> | ||||
/** | /** | ||||
* Checks if the browser is run on iOS | * Checks if the browser is run on iOS | ||||
* | |||||
* | |||||
* @return true if the browser is run on iOS, false otherwise | * @return true if the browser is run on iOS, false otherwise | ||||
*/ | */ | ||||
public boolean isIOS() { | public boolean isIOS() { | ||||
/** | /** | ||||
* Checks if the browser is run on iOS 6. | * Checks if the browser is run on iOS 6. | ||||
* | |||||
* | |||||
* @since 7.1.1 | * @since 7.1.1 | ||||
* @return true if the browser is run on iOS 6, false otherwise | * @return true if the browser is run on iOS 6, false otherwise | ||||
*/ | */ | ||||
/** | /** | ||||
* Checks if the browser is run on Android | * Checks if the browser is run on Android | ||||
* | |||||
* | |||||
* @return true if the browser is run on Android, false otherwise | * @return true if the browser is run on Android, false otherwise | ||||
*/ | */ | ||||
public boolean isAndroid() { | public boolean isAndroid() { | ||||
/** | /** | ||||
* Checks if the browser is capable of handling scrolling natively or if a | * Checks if the browser is capable of handling scrolling natively or if a | ||||
* touch scroll helper is needed for scrolling. | * touch scroll helper is needed for scrolling. | ||||
* | |||||
* | |||||
* @return true if browser needs a touch scroll helper, false if the browser | * @return true if browser needs a touch scroll helper, false if the browser | ||||
* can handle scrolling natively | * can handle scrolling natively | ||||
*/ | */ | ||||
/** | /** | ||||
* Tests if this is an Android devices with a broken scrollTop | * Tests if this is an Android devices with a broken scrollTop | ||||
* implementation | * implementation | ||||
* | |||||
* | |||||
* @return true if scrollTop cannot be trusted on this device, false | * @return true if scrollTop cannot be trusted on this device, false | ||||
* otherwise | * otherwise | ||||
*/ | */ | ||||
* Note that Internet Explorer 8 and newer will return the document mode so | * Note that Internet Explorer 8 and newer will return the document mode so | ||||
* IE8 rendering as IE7 will return 7. | * IE8 rendering as IE7 will return 7. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @return The major version of the browser. | * @return The major version of the browser. | ||||
*/ | */ | ||||
public int getBrowserMajorVersion() { | public int getBrowserMajorVersion() { | ||||
/** | /** | ||||
* Returns the browser minor version e.g., 5 for Firefox 3.5. | * Returns the browser minor version e.g., 5 for Firefox 3.5. | ||||
* | |||||
* | |||||
* @see #getBrowserMajorVersion() | * @see #getBrowserMajorVersion() | ||||
* | |||||
* | |||||
* @return The minor version of the browser, or -1 if not known/parsed. | * @return The minor version of the browser, or -1 if not known/parsed. | ||||
*/ | */ | ||||
public int getBrowserMinorVersion() { | public int getBrowserMinorVersion() { | ||||
/** | /** | ||||
* Checks if the browser version is newer or equal to the given major+minor | * Checks if the browser version is newer or equal to the given major+minor | ||||
* version. | * version. | ||||
* | |||||
* | |||||
* @param majorVersion | * @param majorVersion | ||||
* The major version to check for | * The major version to check for | ||||
* @param minorVersion | * @param minorVersion |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
private JavaScriptObject rules = null; | private JavaScriptObject rules = null; | ||||
/** | /** | ||||
* | |||||
* | |||||
* @param selector | * @param selector | ||||
* the CSS selector to search for in the stylesheets | * the CSS selector to search for in the stylesheets | ||||
* @param deep | * @param deep | ||||
/*-{ | /*-{ | ||||
if(!$doc.styleSheets) | if(!$doc.styleSheets) | ||||
return null; | return null; | ||||
selector = selector.toLowerCase(); | selector = selector.toLowerCase(); | ||||
var allMatches = []; | var allMatches = []; | ||||
// IE handles imported sheet differently | // IE handles imported sheet differently | ||||
if(deep && sheet.imports && sheet.imports.length > 0) { | if(deep && sheet.imports && sheet.imports.length > 0) { | ||||
for(var i=0; i < sheet.imports.length; i++) { | for(var i=0; i < sheet.imports.length; i++) { | ||||
allMatches.concat(imports); | allMatches.concat(imports); | ||||
} | } | ||||
} | } | ||||
var theRules = new Array(); | var theRules = new Array(); | ||||
if (sheet.cssRules) | if (sheet.cssRules) | ||||
theRules = sheet.cssRules | theRules = sheet.cssRules | ||||
else if (sheet.rules) | else if (sheet.rules) | ||||
theRules = sheet.rules | theRules = sheet.rules | ||||
var j = theRules.length; | var j = theRules.length; | ||||
for(var i=0; i<j; i++) { | for(var i=0; i<j; i++) { | ||||
var r = theRules[i]; | var r = theRules[i]; | ||||
allMatches = allMatches.concat(imports); | allMatches = allMatches.concat(imports); | ||||
} | } | ||||
} | } | ||||
return allMatches; | return allMatches; | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
* Returns a specific property value from this CSS rule. | * Returns a specific property value from this CSS rule. | ||||
* | |||||
* | |||||
* @param propertyName | * @param propertyName | ||||
* camelCase CSS property name | * camelCase CSS property name | ||||
* @return the value of the property as a String | * @return the value of the property as a String |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* An interface used by client-side widgets or paintable parts to receive | * An interface used by client-side widgets or paintable parts to receive | ||||
* updates from the corresponding server-side components in the form of | * updates from the corresponding server-side components in the form of | ||||
* {@link UIDL}. | * {@link UIDL}. | ||||
* | |||||
* | |||||
* Updates can be sent back to the server using the | * Updates can be sent back to the server using the | ||||
* {@link ApplicationConnection#updateVariable()} methods. | * {@link ApplicationConnection#updateVariable()} methods. | ||||
*/ | */ | ||||
/* | /* | ||||
* (non-Javadoc) | * (non-Javadoc) | ||||
* | |||||
* | |||||
* @see com.vaadin.client.VPaintable#getState() | * @see com.vaadin.client.VPaintable#getState() | ||||
*/ | */ | ||||
@Override | @Override | ||||
* Returns <code>true</code> if the width of this paintable is currently | * Returns <code>true</code> if the width of this paintable is currently | ||||
* undefined. If the width is undefined, the actual width of the paintable | * undefined. If the width is undefined, the actual width of the paintable | ||||
* is defined by its contents. | * is defined by its contents. | ||||
* | |||||
* | |||||
* @return <code>true</code> if the width is undefined, else | * @return <code>true</code> if the width is undefined, else | ||||
* <code>false</code> | * <code>false</code> | ||||
*/ | */ | ||||
* Returns <code>true</code> if the height of this paintable is currently | * Returns <code>true</code> if the height of this paintable is currently | ||||
* undefined. If the height is undefined, the actual height of the paintable | * undefined. If the height is undefined, the actual height of the paintable | ||||
* is defined by its contents. | * is defined by its contents. | ||||
* | |||||
* | |||||
* @return <code>true</code> if the height is undefined, else | * @return <code>true</code> if the height is undefined, else | ||||
* <code>false</code> | * <code>false</code> | ||||
*/ | */ | ||||
* Returns <code>true</code> if the width of this paintable is currently | * Returns <code>true</code> if the width of this paintable is currently | ||||
* relative. If the width is relative, the actual width of the paintable is | * relative. If the width is relative, the actual width of the paintable is | ||||
* a percentage of the size allocated to it by its parent. | * a percentage of the size allocated to it by its parent. | ||||
* | |||||
* | |||||
* @return <code>true</code> if the width is undefined, else | * @return <code>true</code> if the width is undefined, else | ||||
* <code>false</code> | * <code>false</code> | ||||
*/ | */ | ||||
* Returns <code>true</code> if the height of this paintable is currently | * Returns <code>true</code> if the height of this paintable is currently | ||||
* relative. If the height is relative, the actual height of the paintable | * relative. If the height is relative, the actual height of the paintable | ||||
* is a percentage of the size allocated to it by its parent. | * is a percentage of the size allocated to it by its parent. | ||||
* | |||||
* | |||||
* @return <code>true</code> if the width is undefined, else | * @return <code>true</code> if the width is undefined, else | ||||
* <code>false</code> | * <code>false</code> | ||||
*/ | */ | ||||
/** | /** | ||||
* Checks if the connector is read only. | * Checks if the connector is read only. | ||||
* | |||||
* | |||||
* @deprecated This belongs in AbstractFieldConnector, see #8514 | * @deprecated This belongs in AbstractFieldConnector, see #8514 | ||||
* @return true | * @return true | ||||
*/ | */ | ||||
/** | /** | ||||
* Return true if parent handles caption, false if the paintable handles the | * Return true if parent handles caption, false if the paintable handles the | ||||
* caption itself. | * caption itself. | ||||
* | |||||
* | |||||
* <p> | * <p> | ||||
* This should always return true and all components should let the parent | * This should always return true and all components should let the parent | ||||
* handle the caption and use other attributes for internal texts in the | * handle the caption and use other attributes for internal texts in the | ||||
* component | * component | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @return true if caption handling is delegated to the parent, false if | * @return true if caption handling is delegated to the parent, false if | ||||
* parent should not be allowed to render caption | * parent should not be allowed to render caption | ||||
*/ | */ | ||||
/** | /** | ||||
* Sets the enabled state of the widget associated to this connector. | * Sets the enabled state of the widget associated to this connector. | ||||
* | |||||
* | |||||
* @param widgetEnabled | * @param widgetEnabled | ||||
* true if the widget should be enabled, false otherwise | * true if the widget should be enabled, false otherwise | ||||
*/ | */ | ||||
* overridden to return <code>true</code> in all situations where this | * overridden to return <code>true</code> in all situations where this | ||||
* method might return a non-empty result. | * method might return a non-empty result. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element to lookup a tooltip for | * The element to lookup a tooltip for | ||||
* @return The tooltip for the element or null if no tooltip is defined for | * @return The tooltip for the element or null if no tooltip is defined for | ||||
* This is only done to optimize performance, so in cases where the status | * This is only done to optimize performance, so in cases where the status | ||||
* is not known, it's safer to return <code>true</code> so that there will | * is not known, it's safer to return <code>true</code> so that there will | ||||
* be a tooltip handler even though it might not be needed in all cases. | * be a tooltip handler even though it might not be needed in all cases. | ||||
* | |||||
* | |||||
* @return <code>true</code> if some part of the component might have a | * @return <code>true</code> if some part of the component might have a | ||||
* tooltip, otherwise <code>false</code> | * tooltip, otherwise <code>false</code> | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Returns a TooltipInfo assosiated with Component. If element is given, | * Returns a TooltipInfo assosiated with Component. If element is given, | ||||
* returns an additional TooltipInfo. | * returns an additional TooltipInfo. | ||||
* | |||||
* | |||||
* @param key | * @param key | ||||
* @return the tooltipInfo | * @return the tooltipInfo | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* <p> | * <p> | ||||
* Note that this method is expensive. Wherever possible, reuse the returned | * Note that this method is expensive. Wherever possible, reuse the returned | ||||
* object. | * object. | ||||
* | |||||
* | |||||
* @param elem | * @param elem | ||||
* the element | * the element | ||||
* @return the computed style | * @return the computed style | ||||
if(elem.nodeType != 1) { | if(elem.nodeType != 1) { | ||||
return {}; | return {}; | ||||
} | } | ||||
if($wnd.document.defaultView && $wnd.document.defaultView.getComputedStyle) { | if($wnd.document.defaultView && $wnd.document.defaultView.getComputedStyle) { | ||||
return $wnd.document.defaultView.getComputedStyle(elem, null); | return $wnd.document.defaultView.getComputedStyle(elem, null); | ||||
} | } | ||||
if(elem.currentStyle) { | if(elem.currentStyle) { | ||||
return elem.currentStyle; | return elem.currentStyle; | ||||
} | } | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* name of the CSS property in camelCase | * name of the CSS property in camelCase | ||||
* @return the value of the property, normalized for across browsers (each | * @return the value of the property, normalized for across browsers (each | ||||
/*-{ | /*-{ | ||||
var cs = this.@com.vaadin.client.ComputedStyle::computedStyle; | var cs = this.@com.vaadin.client.ComputedStyle::computedStyle; | ||||
var elem = this.@com.vaadin.client.ComputedStyle::elem; | var elem = this.@com.vaadin.client.ComputedStyle::elem; | ||||
// Border values need to be checked separately. The width might have a | // Border values need to be checked separately. The width might have a | ||||
// meaningful value even if the border style is "none". In that case the | // meaningful value even if the border style is "none". In that case the | ||||
// value should be 0. | // value should be 0. | ||||
if(borderStyle == "none") | if(borderStyle == "none") | ||||
return "0px"; | return "0px"; | ||||
} | } | ||||
if(cs.getPropertyValue) { | if(cs.getPropertyValue) { | ||||
// Convert name to dashed format | // Convert name to dashed format | ||||
name = name.replace(/([A-Z])/g, "-$1").toLowerCase(); | name = name.replace(/([A-Z])/g, "-$1").toLowerCase(); | ||||
var ret = cs.getPropertyValue(name); | var ret = cs.getPropertyValue(name); | ||||
} else { | } else { | ||||
var ret = cs[name]; | var ret = cs[name]; | ||||
var style = elem.style; | var style = elem.style; | ||||
// From the awesome hack by Dean Edwards | // From the awesome hack by Dean Edwards | ||||
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 | ||||
// If we're not dealing with a regular pixel number | // If we're not dealing with a regular pixel number | ||||
// but a number that has a weird ending, we need to convert it to pixels | // but a number that has a weird ending, we need to convert it to pixels | ||||
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { | if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { | ||||
// Remember the original values | // Remember the original values | ||||
var left = style.left, rsLeft = elem.runtimeStyle.left; | var left = style.left, rsLeft = elem.runtimeStyle.left; | ||||
// Put in the new values to get a computed value out | // Put in the new values to get a computed value out | ||||
elem.runtimeStyle.left = cs.left; | elem.runtimeStyle.left = cs.left; | ||||
style.left = ret || 0; | style.left = ret || 0; | ||||
ret = style.pixelLeft + "px"; | ret = style.pixelLeft + "px"; | ||||
// Revert the changed values | // Revert the changed values | ||||
style.left = left; | style.left = left; | ||||
elem.runtimeStyle.left = rsLeft; | elem.runtimeStyle.left = rsLeft; | ||||
} | } | ||||
} | } | ||||
// Normalize margin values. This is not totally valid, but in most cases | // Normalize margin values. This is not totally valid, but in most cases | ||||
// it is what the user wants to know. | // it is what the user wants to know. | ||||
if(name.indexOf("margin") > -1 && ret == "auto") { | if(name.indexOf("margin") > -1 && ret == "auto") { | ||||
return "0px"; | return "0px"; | ||||
} | } | ||||
// Some browsers return undefined width and height values as "auto", so | // Some browsers return undefined width and height values as "auto", so | ||||
// we need to retrieve those ourselves. | // we need to retrieve those ourselves. | ||||
if (name == "width" && ret == "auto") { | if (name == "width" && ret == "auto") { | ||||
} else if (name == "height" && ret == "auto") { | } else if (name == "height" && ret == "auto") { | ||||
ret = elem.clientHeight + "px"; | ret = elem.clientHeight + "px"; | ||||
} | } | ||||
return ret; | return ret; | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
* Retrieves the given computed property as an integer | * Retrieves the given computed property as an integer | ||||
* | |||||
* | |||||
* Returns 0 if the property cannot be converted to an integer | * Returns 0 if the property cannot be converted to an integer | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the property to retrieve | * the property to retrieve | ||||
* @return the integer value of the property or 0 | * @return the integer value of the property or 0 | ||||
/** | /** | ||||
* Retrieves the given computed property as a double | * Retrieves the given computed property as a double | ||||
* | |||||
* | |||||
* Returns NaN if the property cannot be converted to a double | * Returns NaN if the property cannot be converted to a double | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @param name | * @param name | ||||
* the property to retrieve | * the property to retrieve | ||||
/** | /** | ||||
* Returns the current width from the DOM. | * Returns the current width from the DOM. | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @return the computed width | * @return the computed width | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the current height from the DOM. | * Returns the current height from the DOM. | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @return the computed height | * @return the computed height | ||||
*/ | */ | ||||
/** | /** | ||||
* Takes a String value e.g. "12px" and parses that to Integer 12. | * Takes a String value e.g. "12px" and parses that to Integer 12. | ||||
* | |||||
* | |||||
* @param String | * @param String | ||||
* a value starting with a number | * a value starting with a number | ||||
* @return Integer the value from the string before any non-numeric | * @return Integer the value from the string before any non-numeric | ||||
* characters. If the value cannot be parsed to a number, returns | * characters. If the value cannot be parsed to a number, returns | ||||
* <code>null</code>. | * <code>null</code>. | ||||
* | |||||
* | |||||
* @deprecated Since 7.1.4, the method {@link #parseIntNative(String)} is | * @deprecated Since 7.1.4, the method {@link #parseIntNative(String)} is | ||||
* used internally and this method does not belong in the public | * used internally and this method does not belong in the public | ||||
* API of {@link ComputedStyle}. {@link #parseInt(String)} might | * API of {@link ComputedStyle}. {@link #parseInt(String)} might | ||||
/** | /** | ||||
* Takes a String value e.g. "12px" and parses that to int 12. | * Takes a String value e.g. "12px" and parses that to int 12. | ||||
* | |||||
* | |||||
* <p> | * <p> | ||||
* This method returns 0 for <code>NaN</code>. | * This method returns 0 for <code>NaN</code>. | ||||
* | |||||
* | |||||
* @param String | * @param String | ||||
* a value starting with a number | * a value starting with a number | ||||
* @return int the value from the string before any non-numeric characters. | * @return int the value from the string before any non-numeric characters. | ||||
/** | /** | ||||
* Takes a String value e.g. "12.3px" and parses that to a double, 12.3. | * Takes a String value e.g. "12.3px" and parses that to a double, 12.3. | ||||
* | |||||
* | |||||
* @param String | * @param String | ||||
* a value starting with a number | * a value starting with a number | ||||
* @return the value from the string before any non-numeric characters or | * @return the value from the string before any non-numeric characters or | ||||
/** | /** | ||||
* Returns the sum of the top and bottom border width | * Returns the sum of the top and bottom border width | ||||
* | |||||
* | |||||
* @since 7.5.3 | * @since 7.5.3 | ||||
* @return the sum of the top and bottom border | * @return the sum of the top and bottom border | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the sum of the left and right border width | * Returns the sum of the left and right border width | ||||
* | |||||
* | |||||
* @since 7.5.3 | * @since 7.5.3 | ||||
* @return the sum of the left and right border | * @return the sum of the left and right border | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the sum of the top and bottom padding | * Returns the sum of the top and bottom padding | ||||
* | |||||
* | |||||
* @since 7.5.3 | * @since 7.5.3 | ||||
* @return the sum of the top and bottom padding | * @return the sum of the top and bottom padding | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the sum of the top and bottom padding | * Returns the sum of the top and bottom padding | ||||
* | |||||
* | |||||
* @since 7.5.3 | * @since 7.5.3 | ||||
* @return the sum of the left and right padding | * @return the sum of the left and right padding | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the sum of the top and bottom margin | * Returns the sum of the top and bottom margin | ||||
* | |||||
* | |||||
* @since 7.5.6 | * @since 7.5.6 | ||||
* @return the sum of the top and bottom margin | * @return the sum of the top and bottom margin | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the sum of the top and bottom margin | * Returns the sum of the top and bottom margin | ||||
* | |||||
* | |||||
* @since 7.5.6 | * @since 7.5.6 | ||||
* @return the sum of the left and right margin | * @return the sum of the left and right margin | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* hierarchy. A {@link ConnectorHierarchyChangedEvent} is fired when an update | * hierarchy. A {@link ConnectorHierarchyChangedEvent} is fired when an update | ||||
* from the server has been fully processed and all hierarchy updates have been | * from the server has been fully processed and all hierarchy updates have been | ||||
* completed. | * completed. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.0.0 | * @since 7.0.0 | ||||
* | |||||
* | |||||
*/ | */ | ||||
public class ConnectorHierarchyChangeEvent | public class ConnectorHierarchyChangeEvent | ||||
extends AbstractServerConnectorEvent<ConnectorHierarchyChangeHandler> { | extends AbstractServerConnectorEvent<ConnectorHierarchyChangeHandler> { | ||||
/** | /** | ||||
* Returns a collection of the old children for the connector. This was the | * Returns a collection of the old children for the connector. This was the | ||||
* state before the update was received from the server. | * state before the update was received from the server. | ||||
* | |||||
* | |||||
* @return A collection of old child connectors. Never returns null. | * @return A collection of old child connectors. Never returns null. | ||||
*/ | */ | ||||
public List<ComponentConnector> getOldChildren() { | public List<ComponentConnector> getOldChildren() { | ||||
/** | /** | ||||
* Sets the collection of the old children for the connector. | * Sets the collection of the old children for the connector. | ||||
* | |||||
* | |||||
* @param oldChildren | * @param oldChildren | ||||
* The old child connectors. Must not be null. | * The old child connectors. Must not be null. | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the {@link HasComponentsConnector} for which this event occurred. | * Returns the {@link HasComponentsConnector} for which this event occurred. | ||||
* | |||||
* | |||||
* @return The {@link HasComponentsConnector} whose child collection has | * @return The {@link HasComponentsConnector} whose child collection has | ||||
* changed. Never returns null. | * changed. Never returns null. | ||||
*/ | */ | ||||
* parent connector might not yet have detached a child widget and that | * parent connector might not yet have detached a child widget and that | ||||
* the widget of a removed child might already have been attached by its | * the widget of a removed child might already have been attached by its | ||||
* new parent. | * new parent. | ||||
* | |||||
* | |||||
* @param connectorHierarchyChangeEvent | * @param connectorHierarchyChangeEvent | ||||
* the event with information about the hierarchy change | * the event with information about the hierarchy change | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Returns a {@link ServerConnector} by its id | * Returns a {@link ServerConnector} by its id | ||||
* | |||||
* | |||||
* @param id | * @param id | ||||
* The connector id | * The connector id | ||||
* @return A connector or null if a connector with the given id has not been | * @return A connector or null if a connector with the given id has not been | ||||
/** | /** | ||||
* Returns a {@link ComponentConnector} element by its root element. | * Returns a {@link ComponentConnector} element by its root element. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* Root element of the {@link ComponentConnector} | * Root element of the {@link ComponentConnector} | ||||
* @return A connector or null if a connector with the given id has not been | * @return A connector or null if a connector with the given id has not been | ||||
/** | /** | ||||
* FIXME: What does this even do and why? | * FIXME: What does this even do and why? | ||||
* | |||||
* | |||||
* @param pid | * @param pid | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* Checks if a connector with the given id has been registered. | * Checks if a connector with the given id has been registered. | ||||
* | |||||
* | |||||
* @param connectorId | * @param connectorId | ||||
* The id to check for | * The id to check for | ||||
* @return true if a connector has been registered with the given id, false | * @return true if a connector has been registered with the given id, false | ||||
/** | /** | ||||
* Retrieves the connector whose widget matches the parameter. | * Retrieves the connector whose widget matches the parameter. | ||||
* | |||||
* | |||||
* @param widget | * @param widget | ||||
* The widget | * The widget | ||||
* @return A connector with {@literal widget} as its root widget or null if | * @return A connector with {@literal widget} as its root widget or null if | ||||
* Gets the connector id using a DOM element - the element should be the | * Gets the connector id using a DOM element - the element should be the | ||||
* root element for a connector, otherwise no id will be found. Use | * root element for a connector, otherwise no id will be found. Use | ||||
* {@link #getConnectorId(ServerConnector)} instead whenever possible. | * {@link #getConnectorId(ServerConnector)} instead whenever possible. | ||||
* | |||||
* | |||||
* @see #getConnectorId(ServerConnector) | * @see #getConnectorId(ServerConnector) | ||||
* @param el | * @param el | ||||
* element of the connector whose id is desired | * element of the connector whose id is desired | ||||
/** | /** | ||||
* Gets the main element for the connector with the given id. The reverse of | * Gets the main element for the connector with the given id. The reverse of | ||||
* {@link #getConnectorId(Element)}. | * {@link #getConnectorId(Element)}. | ||||
* | |||||
* | |||||
* @param connectorId | * @param connectorId | ||||
* the id of the widget whose element is desired | * the id of the widget whose element is desired | ||||
* @return the element for the connector corresponding to the id | * @return the element for the connector corresponding to the id | ||||
* This method does not remove the connector from the DOM, but marks the | * This method does not remove the connector from the DOM, but marks the | ||||
* connector so that ApplicationConnection may clean up its references to | * connector so that ApplicationConnection may clean up its references to | ||||
* it. Removing the widget from DOM is component containers responsibility. | * it. Removing the widget from DOM is component containers responsibility. | ||||
* | |||||
* | |||||
* @param connector | * @param connector | ||||
* the connector to remove | * the connector to remove | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets all registered {@link ComponentConnector} instances | * Gets all registered {@link ComponentConnector} instances | ||||
* | |||||
* | |||||
* @return An array of all registered {@link ComponentConnector} instances | * @return An array of all registered {@link ComponentConnector} instances | ||||
* | |||||
* | |||||
* @deprecated As of 7.0.1, use {@link #getComponentConnectorsAsJsArray()} | * @deprecated As of 7.0.1, use {@link #getComponentConnectorsAsJsArray()} | ||||
* for better performance. | * for better performance. | ||||
*/ | */ | ||||
/** | /** | ||||
* @return | * @return | ||||
* | |||||
* | |||||
* @deprecated As of 7.0.1, use {@link #getConnectorsAsJsArray()} for | * @deprecated As of 7.0.1, use {@link #getConnectorsAsJsArray()} for | ||||
* improved performance. | * improved performance. | ||||
*/ | */ | ||||
/** | /** | ||||
* Tests if the widget is the root widget of a {@link ComponentConnector}. | * Tests if the widget is the root widget of a {@link ComponentConnector}. | ||||
* | |||||
* | |||||
* @param widget | * @param widget | ||||
* The widget to test | * The widget to test | ||||
* @return true if the widget is the root widget of a | * @return true if the widget is the root widget of a |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* ContainerResizedListener interface is useful for Widgets that support | * ContainerResizedListener interface is useful for Widgets that support | ||||
* relative sizes and who need some additional sizing logic. | * relative sizes and who need some additional sizing logic. | ||||
* | |||||
* | |||||
* @deprecated As of 7.0, serves no purpose. Use {@link LayoutManager} and its | * @deprecated As of 7.0, serves no purpose. Use {@link LayoutManager} and its | ||||
* methods instead. | * methods instead. | ||||
*/ | */ | ||||
* function on its ancestors that implement NeedsLayout in case their | * function on its ancestors that implement NeedsLayout in case their | ||||
* container has resized. runAnchestorsLayout(HasWidgets parent) function | * container has resized. runAnchestorsLayout(HasWidgets parent) function | ||||
* from Util class may be a good helper for this. | * from Util class may be a good helper for this. | ||||
* | |||||
* | |||||
* @deprecated As of 7.0, this method is never called by the framework. | * @deprecated As of 7.0, this method is never called by the framework. | ||||
* | |||||
* | |||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
public void iLayout(); | public void iLayout(); |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* This class provides date/time parsing services to all components on the | * This class provides date/time parsing services to all components on the | ||||
* client side. | * client side. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd. | * @author Vaadin Ltd. | ||||
* | |||||
* | |||||
*/ | */ | ||||
@SuppressWarnings("deprecation") | @SuppressWarnings("deprecation") | ||||
public class DateTimeService { | public class DateTimeService { | ||||
/** | /** | ||||
* Creates a new date time service with a given locale. | * Creates a new date time service with a given locale. | ||||
* | |||||
* | |||||
* @param locale | * @param locale | ||||
* e.g. fi, en etc. | * e.g. fi, en etc. | ||||
* @throws LocaleNotLoadedException | * @throws LocaleNotLoadedException | ||||
/** | /** | ||||
* Returns the ISO-8601 week number of the given date. | * Returns the ISO-8601 week number of the given date. | ||||
* | |||||
* | |||||
* @param date | * @param date | ||||
* The date for which the week number should be resolved | * The date for which the week number should be resolved | ||||
* @return The ISO-8601 week number for {@literal date} | * @return The ISO-8601 week number for {@literal date} | ||||
* it to the month name since DateTimeFormat.format always uses the current | * it to the month name since DateTimeFormat.format always uses the current | ||||
* locale and will replace the month name wrong if current locale is | * locale and will replace the month name wrong if current locale is | ||||
* different from the locale set for the DateField. | * different from the locale set for the DateField. | ||||
* | |||||
* | |||||
* MMMM is converted into long month name, MMM is converted into short month | * MMMM is converted into long month name, MMM is converted into short month | ||||
* name. '' are added around the name to avoid that DateTimeFormat parses | * name. '' are added around the name to avoid that DateTimeFormat parses | ||||
* the month name as a pattern. | * the month name as a pattern. | ||||
* | |||||
* | |||||
* @param date | * @param date | ||||
* The date to convert | * The date to convert | ||||
* @param formatStr | * @param formatStr | ||||
/** | /** | ||||
* Replaces month names in the entered date with the name in the current | * Replaces month names in the entered date with the name in the current | ||||
* browser locale. | * browser locale. | ||||
* | |||||
* | |||||
* @param enteredDate | * @param enteredDate | ||||
* Date string e.g. "5 May 2010" | * Date string e.g. "5 May 2010" | ||||
* @param formatString | * @param formatString | ||||
/** | /** | ||||
* Parses the given date string using the given format string and the locale | * Parses the given date string using the given format string and the locale | ||||
* set in this DateTimeService instance. | * set in this DateTimeService instance. | ||||
* | |||||
* | |||||
* @param dateString | * @param dateString | ||||
* Date string e.g. "1 February 2010" | * Date string e.g. "1 February 2010" | ||||
* @param formatString | * @param formatString | ||||
* @return A Date object representing the dateString. Never returns null. | * @return A Date object representing the dateString. Never returns null. | ||||
* @throws IllegalArgumentException | * @throws IllegalArgumentException | ||||
* if the parsing fails | * if the parsing fails | ||||
* | |||||
* | |||||
*/ | */ | ||||
public Date parseDate(String dateString, String formatString, | public Date parseDate(String dateString, String formatString, | ||||
boolean lenient) throws IllegalArgumentException { | boolean lenient) throws IllegalArgumentException { |
* there is work scheduled to be executed in the near future and that the | * there is work scheduled to be executed in the near future and that the | ||||
* framework should wait for this work to complete before assuming the UI has | * framework should wait for this work to complete before assuming the UI has | ||||
* reached a steady state. | * reached a steady state. | ||||
* | |||||
* | |||||
* @since 7.3 | * @since 7.3 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
/** | /** | ||||
* Checks whether there are operations pending for this widget or connector | * Checks whether there are operations pending for this widget or connector | ||||
* that must be executed before reaching a steady state. | * that must be executed before reaching a steady state. | ||||
* | |||||
* | |||||
* @returns <code>true</code> iff there are operations pending which must be | * @returns <code>true</code> iff there are operations pending which must be | ||||
* executed before reaching a steady state | * executed before reaching a steady state | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* registration (possibly the same as given, should be store for next update. | * registration (possibly the same as given, should be store for next update. | ||||
* <p> | * <p> | ||||
* Pseudocode what helpers do: | * Pseudocode what helpers do: | ||||
* | |||||
* | |||||
* <pre> | * <pre> | ||||
* | |||||
* | |||||
* if paintable has event listener in UIDL | * if paintable has event listener in UIDL | ||||
* if registration is null | * if registration is null | ||||
* register paintable as as handler for event | * register paintable as as handler for event | ||||
* if registration is not null | * if registration is not null | ||||
* remove the handler from paintable | * remove the handler from paintable | ||||
* return null | * return null | ||||
* | |||||
* | |||||
* | |||||
* | |||||
* </pre> | * </pre> | ||||
*/ | */ | ||||
public class EventHelper { | public class EventHelper { | ||||
/** | /** | ||||
* Adds or removes a focus handler depending on if the connector has focus | * Adds or removes a focus handler depending on if the connector has focus | ||||
* listeners on the server side or not. | * listeners on the server side or not. | ||||
* | |||||
* | |||||
* @param connector | * @param connector | ||||
* The connector to update. Must implement focusHandler. | * The connector to update. Must implement focusHandler. | ||||
* @param handlerRegistration | * @param handlerRegistration | ||||
/** | /** | ||||
* Adds or removes a focus handler depending on if the connector has focus | * Adds or removes a focus handler depending on if the connector has focus | ||||
* listeners on the server side or not. | * listeners on the server side or not. | ||||
* | |||||
* | |||||
* @param connector | * @param connector | ||||
* The connector to update. Must implement focusHandler. | * The connector to update. Must implement focusHandler. | ||||
* @param handlerRegistration | * @param handlerRegistration | ||||
/** | /** | ||||
* Adds or removes a blur handler depending on if the connector has blur | * Adds or removes a blur handler depending on if the connector has blur | ||||
* listeners on the server side or not. | * listeners on the server side or not. | ||||
* | |||||
* | |||||
* @param connector | * @param connector | ||||
* The connector to update. Must implement BlurHandler. | * The connector to update. Must implement BlurHandler. | ||||
* @param handlerRegistration | * @param handlerRegistration | ||||
/** | /** | ||||
* Adds or removes a blur handler depending on if the connector has blur | * Adds or removes a blur handler depending on if the connector has blur | ||||
* listeners on the server side or not. | * listeners on the server side or not. | ||||
* | |||||
* | |||||
* @param connector | * @param connector | ||||
* The connector to update. Must implement BlurHandler. | * The connector to update. Must implement BlurHandler. | ||||
* @param handlerRegistration | * @param handlerRegistration | ||||
* registered previously | * registered previously | ||||
* @param widget | * @param widget | ||||
* The widget which emits blur events | * The widget which emits blur events | ||||
* | |||||
* | |||||
* @return a new registration handler that can be used to unregister the | * @return a new registration handler that can be used to unregister the | ||||
* handler later | * handler later | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* GWT's HasFocus is way too overkill for just receiving focus in simple | * GWT's HasFocus is way too overkill for just receiving focus in simple | ||||
* components. Vaadin uses this interface in addition to GWT's HasFocus to pass | * components. Vaadin uses this interface in addition to GWT's HasFocus to pass | ||||
* focus requests from server to actual ui widgets in browsers. | * focus requests from server to actual ui widgets in browsers. | ||||
* | |||||
* | |||||
* So in to make your server side focusable component receive focus on client | * So in to make your server side focusable component receive focus on client | ||||
* side it must either implement this or HasFocus interface. | * side it must either implement this or HasFocus interface. | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Connector with layout measuring hint. Used to improve granularity of control | * Connector with layout measuring hint. Used to improve granularity of control | ||||
* over child component measurements. | * over child component measurements. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
/** | /** | ||||
* Sets the child measurement hint for this component. | * Sets the child measurement hint for this component. | ||||
* | |||||
* | |||||
* @param hint | * @param hint | ||||
* the value to set | * the value to set | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the current child measurement hint value. | * Returns the current child measurement hint value. | ||||
* | |||||
* | |||||
* @return a ChildLayoutMeasureMode value | * @return a ChildLayoutMeasureMode value | ||||
*/ | */ | ||||
ChildMeasurementHint getChildMeasurementHint(); | ChildMeasurementHint getChildMeasurementHint(); |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Update child components caption, description and error message. | * Update child components caption, description and error message. | ||||
* | |||||
* | |||||
* <p> | * <p> | ||||
* Each component is responsible for maintaining its caption, description | * Each component is responsible for maintaining its caption, description | ||||
* and error message. In most cases components doesn't want to do that and | * and error message. In most cases components doesn't want to do that and | ||||
* those elements reside outside of the component. Because of this layouts | * those elements reside outside of the component. Because of this layouts | ||||
* must provide service for it's childen to show those elements for them. | * must provide service for it's childen to show those elements for them. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @param connector | * @param connector | ||||
* Child component for which service is requested. | * Child component for which service is requested. | ||||
*/ | */ | ||||
* Note that the method {@link ServerConnector#getChildren()} can return a | * Note that the method {@link ServerConnector#getChildren()} can return a | ||||
* larger list of children including both the child components and any | * larger list of children including both the child components and any | ||||
* extensions registered for the connector. | * extensions registered for the connector. | ||||
* | |||||
* | |||||
* @return A collection of child components for this connector. An empty | * @return A collection of child components for this connector. An empty | ||||
* collection if there are no children. Never returns null. | * collection if there are no children. Never returns null. | ||||
*/ | */ | ||||
* {@link ServerConnector#setChildren(List)} and contains only child | * {@link ServerConnector#setChildren(List)} and contains only child | ||||
* components. Both methods are called separately by the framework if the | * components. Both methods are called separately by the framework if the | ||||
* connector implements {@link HasComponentsConnector}. | * connector implements {@link HasComponentsConnector}. | ||||
* | |||||
* | |||||
* @param children | * @param children | ||||
* The new child connectors (components only) | * The new child connectors (components only) | ||||
*/ | */ | ||||
/** | /** | ||||
* Adds a handler that is called whenever the child hierarchy of this | * Adds a handler that is called whenever the child hierarchy of this | ||||
* connector has been updated by the server. | * connector has been updated by the server. | ||||
* | |||||
* | |||||
* @param handler | * @param handler | ||||
* The handler that should be added. | * The handler that should be added. | ||||
* @return A handler registration reference that can be used to unregister | * @return A handler registration reference that can be used to unregister |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* javascript is usually initalized the first time a state change event is | * javascript is usually initalized the first time a state change event is | ||||
* received, but it might in some cases be necessary to make this happen | * received, but it might in some cases be necessary to make this happen | ||||
* earlier. | * earlier. | ||||
* | |||||
* | |||||
* @since 7.4.0 | * @since 7.4.0 | ||||
*/ | */ | ||||
public void ensureJavascriptInited() { | public void ensureJavascriptInited() { | ||||
delete state[key]; | delete state[key]; | ||||
} | } | ||||
} | } | ||||
for(var key in input) { | for(var key in input) { | ||||
if (input.hasOwnProperty(key)) { | if (input.hasOwnProperty(key)) { | ||||
state[key] = input[key]; | state[key] = input[key]; |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Returns the application connection for this layout manager. | * Returns the application connection for this layout manager. | ||||
* | |||||
* | |||||
* @return connection | * @return connection | ||||
*/ | */ | ||||
protected ApplicationConnection getConnection() { | protected ApplicationConnection getConnection() { | ||||
/** | /** | ||||
* Gets the layout manager associated with the given | * Gets the layout manager associated with the given | ||||
* {@link ApplicationConnection}. | * {@link ApplicationConnection}. | ||||
* | |||||
* | |||||
* @param connection | * @param connection | ||||
* the application connection to get a layout manager for | * the application connection to get a layout manager for | ||||
* @return the layout manager associated with the provided application | * @return the layout manager associated with the provided application | ||||
* This causes this layout manager to measure the element in the beginning | * This causes this layout manager to measure the element in the beginning | ||||
* of every layout phase and call the appropriate layout method of the | * of every layout phase and call the appropriate layout method of the | ||||
* managed layout if the size of the element has changed. | * managed layout if the size of the element has changed. | ||||
* | |||||
* | |||||
* @param owner | * @param owner | ||||
* the ManagedLayout that depends on an element | * the ManagedLayout that depends on an element | ||||
* @param element | * @param element | ||||
/** | /** | ||||
* Assigns a measured size to an element. Method defined as protected to | * Assigns a measured size to an element. Method defined as protected to | ||||
* allow separate implementation for IE8. | * allow separate implementation for IE8. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the dom element to attach the measured size to | * the dom element to attach the measured size to | ||||
* @param measuredSize | * @param measuredSize | ||||
/** | /** | ||||
* Gets the measured size for an element. Method defined as protected to | * Gets the measured size for an element. Method defined as protected to | ||||
* allow separate implementation for IE8. | * allow separate implementation for IE8. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element to get measured size for | * The element to get measured size for | ||||
* @param defaultSize | * @param defaultSize | ||||
/** | /** | ||||
* Registers that a ManagedLayout is no longer depending on the size of an | * Registers that a ManagedLayout is no longer depending on the size of an | ||||
* Element. | * Element. | ||||
* | |||||
* | |||||
* @see #registerDependency(ManagedLayout, Element) | * @see #registerDependency(ManagedLayout, Element) | ||||
* | |||||
* | |||||
* @param owner | * @param owner | ||||
* the ManagedLayout no longer depends on an element | * the ManagedLayout no longer depends on an element | ||||
* @param element | * @param element | ||||
* to explicitly cause some layout to be considered in an ongoing layout | * to explicitly cause some layout to be considered in an ongoing layout | ||||
* phase, you should use {@link #setNeedsMeasure(ComponentConnector)} | * phase, you should use {@link #setNeedsMeasure(ComponentConnector)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param layout | * @param layout | ||||
* the managed layout that should be layouted | * the managed layout that should be layouted | ||||
*/ | */ | ||||
* to explicitly cause some layout to be considered in an ongoing layout | * to explicitly cause some layout to be considered in an ongoing layout | ||||
* phase, you should use {@link #setNeedsMeasure(ComponentConnector)} | * phase, you should use {@link #setNeedsMeasure(ComponentConnector)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param layout | * @param layout | ||||
* the managed layout that should be layouted | * the managed layout that should be layouted | ||||
*/ | */ | ||||
* to explicitly cause some layout to be considered in an ongoing layout | * to explicitly cause some layout to be considered in an ongoing layout | ||||
* phase, you should use {@link #setNeedsMeasure(ComponentConnector)} | * phase, you should use {@link #setNeedsMeasure(ComponentConnector)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param layout | * @param layout | ||||
* the managed layout that should be layouted | * the managed layout that should be layouted | ||||
*/ | */ | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* -1 is returned if the element has not been measured. If 0 is returned, it | * -1 is returned if the element has not been measured. If 0 is returned, it | ||||
* might indicate that the element is not attached to the DOM. | * might indicate that the element is not attached to the DOM. | ||||
* <p> | * <p> | ||||
* The value returned by this method is always rounded up. To get the exact | * The value returned by this method is always rounded up. To get the exact | ||||
* outer width, use {@link #getOuterHeightDouble(Element)} | * outer width, use {@link #getOuterHeightDouble(Element)} | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured outer height (including margins, paddings and | * @return the measured outer height (including margins, paddings and | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* -1 is returned if the element has not been measured. If 0 is returned, it | * -1 is returned if the element has not been measured. If 0 is returned, it | ||||
* might indicate that the element is not attached to the DOM. | * might indicate that the element is not attached to the DOM. | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* -1 is returned if the element has not been measured. If 0 is returned, it | * -1 is returned if the element has not been measured. If 0 is returned, it | ||||
* might indicate that the element is not attached to the DOM. | * might indicate that the element is not attached to the DOM. | ||||
* <p> | * <p> | ||||
* The value returned by this method is always rounded up. To get the exact | * The value returned by this method is always rounded up. To get the exact | ||||
* outer width, use {@link #getOuterWidthDouble(Element)} | * outer width, use {@link #getOuterWidthDouble(Element)} | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* -1 is returned if the element has not been measured. If 0 is returned, it | * -1 is returned if the element has not been measured. If 0 is returned, it | ||||
* might indicate that the element is not attached to the DOM. | * might indicate that the element is not attached to the DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured outer width (including margins, paddings and | * @return the measured outer width (including margins, paddings and | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* -1 is returned if the element has not been measured. If 0 is returned, it | * -1 is returned if the element has not been measured. If 0 is returned, it | ||||
* might indicate that the element is not attached to the DOM. | * might indicate that the element is not attached to the DOM. | ||||
* <p> | * <p> | ||||
* The value returned by this method is always rounded up. To get the exact | * The value returned by this method is always rounded up. To get the exact | ||||
* outer width, use {@link #getInnerHeightDouble(Element)} | * outer width, use {@link #getInnerHeightDouble(Element)} | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured inner height (excluding margins, paddings and | * @return the measured inner height (excluding margins, paddings and | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* -1 is returned if the element has not been measured. If 0 is returned, it | * -1 is returned if the element has not been measured. If 0 is returned, it | ||||
* might indicate that the element is not attached to the DOM. | * might indicate that the element is not attached to the DOM. | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* -1 is returned if the element has not been measured. If 0 is returned, it | * -1 is returned if the element has not been measured. If 0 is returned, it | ||||
* might indicate that the element is not attached to the DOM. | * might indicate that the element is not attached to the DOM. | ||||
* <p> | * <p> | ||||
* The value returned by this method is always rounded up. To get the exact | * The value returned by this method is always rounded up. To get the exact | ||||
* outer width, use {@link #getOuterHeightDouble(Element)} | * outer width, use {@link #getOuterHeightDouble(Element)} | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured inner width (excluding margins, paddings and | * @return the measured inner width (excluding margins, paddings and | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* -1 is returned if the element has not been measured. If 0 is returned, it | * -1 is returned if the element has not been measured. If 0 is returned, it | ||||
* might indicate that the element is not attached to the DOM. | * might indicate that the element is not attached to the DOM. | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured border height (top border + bottom border) of the | * @return the measured border height (top border + bottom border) of the | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured padding height (top padding + bottom padding) of the | * @return the measured padding height (top padding + bottom padding) of the | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured border width (left border + right border) of the | * @return the measured border width (left border + right border) of the | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured top border of the element in pixels. | * @return the measured top border of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured left border of the element in pixels. | * @return the measured left border of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured bottom border of the element in pixels. | * @return the measured bottom border of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured right border of the element in pixels. | * @return the measured right border of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured padding width (left padding + right padding) of the | * @return the measured padding width (left padding + right padding) of the | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured top padding of the element in pixels. | * @return the measured top padding of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured left padding of the element in pixels. | * @return the measured left padding of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured bottom padding of the element in pixels. | * @return the measured bottom padding of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured right padding of the element in pixels. | * @return the measured right padding of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured top margin of the element in pixels. | * @return the measured top margin of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured right margin of the element in pixels. | * @return the measured right margin of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured bottom margin of the element in pixels. | * @return the measured bottom margin of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured size for | * the element to get the measured size for | ||||
* @return the measured left margin of the element in pixels. | * @return the measured left margin of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured margin for | * the element to get the measured margin for | ||||
* @return the measured top+bottom margin of the element in pixels. | * @return the measured top+bottom margin of the element in pixels. | ||||
* <li>Elements for which at least one ManagedLayout has registered a | * <li>Elements for which at least one ManagedLayout has registered a | ||||
* dependency | * dependency | ||||
* </ul> | * </ul> | ||||
* | |||||
* | |||||
* A negative number is returned if the element has not been measured. If 0 | * A negative number is returned if the element has not been measured. If 0 | ||||
* is returned, it might indicate that the element is not attached to the | * is returned, it might indicate that the element is not attached to the | ||||
* DOM. | * DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to get the measured margin for | * the element to get the measured margin for | ||||
* @return the measured left+right margin of the element in pixels. | * @return the measured left+right margin of the element in pixels. | ||||
* informing the LayoutManager about what size a component will have, the | * informing the LayoutManager about what size a component will have, the | ||||
* layout propagation can continue directly without first measuring the | * layout propagation can continue directly without first measuring the | ||||
* potentially resized elements. | * potentially resized elements. | ||||
* | |||||
* | |||||
* @param component | * @param component | ||||
* the component for which the size is reported | * the component for which the size is reported | ||||
* @param outerHeight | * @param outerHeight | ||||
* LayoutManager about what size a component will have, the layout | * LayoutManager about what size a component will have, the layout | ||||
* propagation can continue directly without first measuring the potentially | * propagation can continue directly without first measuring the potentially | ||||
* resized elements. | * resized elements. | ||||
* | |||||
* | |||||
* @param component | * @param component | ||||
* the relatively sized component for which the size is reported | * the relatively sized component for which the size is reported | ||||
* @param assignedHeight | * @param assignedHeight | ||||
* LayoutManager about what size a component will have, the layout | * LayoutManager about what size a component will have, the layout | ||||
* propagation can continue directly without first measuring the potentially | * propagation can continue directly without first measuring the potentially | ||||
* resized elements. | * resized elements. | ||||
* | |||||
* | |||||
* @param component | * @param component | ||||
* the relatively sized component for which the size is reported | * the relatively sized component for which the size is reported | ||||
* @param assignedWidth | * @param assignedWidth | ||||
* informing the LayoutManager about what size a component will have, the | * informing the LayoutManager about what size a component will have, the | ||||
* layout propagation can continue directly without first measuring the | * layout propagation can continue directly without first measuring the | ||||
* potentially resized elements. | * potentially resized elements. | ||||
* | |||||
* | |||||
* @param component | * @param component | ||||
* the component for which the size is reported | * the component for which the size is reported | ||||
* @param outerWidth | * @param outerWidth | ||||
* element changes. Adding a listener to an element also ensures that all | * element changes. Adding a listener to an element also ensures that all | ||||
* sizes for that element will be available starting from the next layout | * sizes for that element will be available starting from the next layout | ||||
* phase. | * phase. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element that should be checked for size changes | * the element that should be checked for size changes | ||||
* @param listener | * @param listener | ||||
* Removes an element resize listener from the provided element. This might | * Removes an element resize listener from the provided element. This might | ||||
* cause this LayoutManager to stop tracking the size of the element if no | * cause this LayoutManager to stop tracking the size of the element if no | ||||
* other sources are interested in the size. | * other sources are interested in the size. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to which the element resize listener was | * the element to which the element resize listener was | ||||
* previously added | * previously added | ||||
* {@link #setNeedsMeasureRecursively(ComponentConnector)} instead. | * {@link #setNeedsMeasureRecursively(ComponentConnector)} instead. | ||||
* <p> | * <p> | ||||
* If there is no upcoming layout phase, a new layout phase is scheduled. | * If there is no upcoming layout phase, a new layout phase is scheduled. | ||||
* | |||||
* | |||||
* @param component | * @param component | ||||
* the component whose size might have changed. | * the component whose size might have changed. | ||||
*/ | */ | ||||
* {@link #setNeedsMeasure(ComponentConnector)} instead. | * {@link #setNeedsMeasure(ComponentConnector)} instead. | ||||
* <p> | * <p> | ||||
* If there is no upcoming layout phase, a new layout phase is scheduled. | * If there is no upcoming layout phase, a new layout phase is scheduled. | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
* @param component | * @param component | ||||
* the component at the root of the component hierarchy to | * the component at the root of the component hierarchy to | ||||
/** | /** | ||||
* Checks if there is something waiting for a layout to take place. | * Checks if there is something waiting for a layout to take place. | ||||
* | |||||
* | |||||
* @since 7.5.6 | * @since 7.5.6 | ||||
* @return true if there are connectors waiting for measurement or layout, | * @return true if there are connectors waiting for measurement or layout, | ||||
* false otherwise | * false otherwise |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* element in IE8 seems to make the browser think the element has changed in a | * element in IE8 seems to make the browser think the element has changed in a | ||||
* way that requires a reflow. To work around that, the MeasureData is instead | * way that requires a reflow. To work around that, the MeasureData is instead | ||||
* stored in Map for IE8. | * stored in Map for IE8. | ||||
* | |||||
* | |||||
* This implementation is injected for IE8 by a replace-with definition in the | * This implementation is injected for IE8 by a replace-with definition in the | ||||
* GWT module. | * GWT module. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.0.0 | * @since 7.0.0 | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Date / time etc. localisation service for all widgets. Caches all loaded | * Date / time etc. localisation service for all widgets. Caches all loaded | ||||
* locales as JSONObjects. | * locales as JSONObjects. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd. | * @author Vaadin Ltd. | ||||
* | |||||
* | |||||
*/ | */ | ||||
public class LocaleService { | public class LocaleService { | ||||
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Helper class for constructing a MouseEventDetails object from a | * Helper class for constructing a MouseEventDetails object from a | ||||
* {@link NativeEvent}. | * {@link NativeEvent}. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.0.0 | * @since 7.0.0 | ||||
* | |||||
* | |||||
*/ | */ | ||||
public class MouseEventDetailsBuilder { | public class MouseEventDetailsBuilder { | ||||
/** | /** | ||||
* Construct a {@link MouseEventDetails} object from the given event | * Construct a {@link MouseEventDetails} object from the given event | ||||
* | |||||
* | |||||
* @param evt | * @param evt | ||||
* The event to use as a source for the details | * The event to use as a source for the details | ||||
* @return a MouseEventDetails containing information from the event | * @return a MouseEventDetails containing information from the event | ||||
/** | /** | ||||
* Construct a {@link MouseEventDetails} object from the given event | * Construct a {@link MouseEventDetails} object from the given event | ||||
* | |||||
* | |||||
* @param evt | * @param evt | ||||
* The event to use as a source for the details | * The event to use as a source for the details | ||||
* @param relativeToElement | * @param relativeToElement |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* An interface used by client-side widgets or paintable parts to receive | * An interface used by client-side widgets or paintable parts to receive | ||||
* updates from the corresponding server-side components in the form of | * updates from the corresponding server-side components in the form of | ||||
* {@link UIDL}. | * {@link UIDL}. | ||||
* | |||||
* | |||||
* Updates can be sent back to the server using the | * Updates can be sent back to the server using the | ||||
* {@link ApplicationConnection#updateVariable()} methods. | * {@link ApplicationConnection#updateVariable()} methods. | ||||
*/ | */ |
* Interface for getting data from the {@link Profiler}. | * Interface for getting data from the {@link Profiler}. | ||||
* <p> | * <p> | ||||
* <b>Warning!</b> This interface is most likely to change in the future | * <b>Warning!</b> This interface is most likely to change in the future | ||||
* | |||||
* | |||||
* @since 7.1 | * @since 7.1 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
/** | /** | ||||
* Create a new node with the given name. | * Create a new node with the given name. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
*/ | */ | ||||
public Node(String name) { | public Node(String name) { | ||||
/** | /** | ||||
* Gets the name of the node | * Gets the name of the node | ||||
* | |||||
* | |||||
* @return the name of the node | * @return the name of the node | ||||
*/ | */ | ||||
public String getName() { | public String getName() { | ||||
/** | /** | ||||
* Creates a new child node or retrieves and existing child and updates | * Creates a new child node or retrieves and existing child and updates | ||||
* its total time and hit count. | * its total time and hit count. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the child | * the name of the child | ||||
* @param timestamp | * @param timestamp | ||||
/** | /** | ||||
* Gets the total time spent in this node, including time spent in sub | * Gets the total time spent in this node, including time spent in sub | ||||
* nodes | * nodes | ||||
* | |||||
* | |||||
* @return the total time spent, in milliseconds | * @return the total time spent, in milliseconds | ||||
*/ | */ | ||||
public double getTimeSpent() { | public double getTimeSpent() { | ||||
/** | /** | ||||
* Gets the minimum time spent for one invocation of this node, | * Gets the minimum time spent for one invocation of this node, | ||||
* including time spent in sub nodes | * including time spent in sub nodes | ||||
* | |||||
* | |||||
* @return the time spent for the fastest invocation, in milliseconds | * @return the time spent for the fastest invocation, in milliseconds | ||||
*/ | */ | ||||
public double getMinTimeSpent() { | public double getMinTimeSpent() { | ||||
/** | /** | ||||
* Gets the maximum time spent for one invocation of this node, | * Gets the maximum time spent for one invocation of this node, | ||||
* including time spent in sub nodes | * including time spent in sub nodes | ||||
* | |||||
* | |||||
* @return the time spent for the slowest invocation, in milliseconds | * @return the time spent for the slowest invocation, in milliseconds | ||||
*/ | */ | ||||
public double getMaxTimeSpent() { | public double getMaxTimeSpent() { | ||||
/** | /** | ||||
* Gets the number of times this node has been entered | * Gets the number of times this node has been entered | ||||
* | |||||
* | |||||
* @return the number of times the node has been entered | * @return the number of times the node has been entered | ||||
*/ | */ | ||||
public int getCount() { | public int getCount() { | ||||
/** | /** | ||||
* Gets the total time spent in this node, excluding time spent in sub | * Gets the total time spent in this node, excluding time spent in sub | ||||
* nodes | * nodes | ||||
* | |||||
* | |||||
* @return the total time spent, in milliseconds | * @return the total time spent, in milliseconds | ||||
*/ | */ | ||||
public double getOwnTime() { | public double getOwnTime() { | ||||
/** | /** | ||||
* Gets the child nodes of this node | * Gets the child nodes of this node | ||||
* | |||||
* | |||||
* @return a collection of child nodes | * @return a collection of child nodes | ||||
*/ | */ | ||||
public Collection<Node> getChildren() { | public Collection<Node> getChildren() { | ||||
* Returns time relative to the particular page load time. The value should | * Returns time relative to the particular page load time. The value should | ||||
* not be used directly but rather difference between two values returned by | * not be used directly but rather difference between two values returned by | ||||
* this method should be used to compare measurements. | * this method should be used to compare measurements. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
*/ | */ | ||||
public static double getRelativeTimeMillis() { | public static double getRelativeTimeMillis() { |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Contains size information about a rendered container and its content area. | * Contains size information about a rendered container and its content area. | ||||
* | |||||
* | |||||
* @author Artur Signell | * @author Artur Signell | ||||
* | |||||
* | |||||
*/ | */ | ||||
public class RenderInformation { | public class RenderInformation { | ||||
/** | /** | ||||
* Update the size of the widget. | * Update the size of the widget. | ||||
* | |||||
* | |||||
* @param widget | * @param widget | ||||
* | |||||
* | |||||
* @return true if the size has changed since last update | * @return true if the size has changed since last update | ||||
* @deprecated As of 7.2, call and override {@link #updateSize(Element)} | * @deprecated As of 7.2, call and override {@link #updateSize(Element)} | ||||
* instead | * instead | ||||
/** | /** | ||||
* Update the size of the widget. | * Update the size of the widget. | ||||
* | |||||
* | |||||
* @param widget | * @param widget | ||||
* | |||||
* | |||||
* @return true if the size has changed since last update | * @return true if the size has changed since last update | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
*/ | */ | ||||
public boolean updateSize(Element element) { | public boolean updateSize(Element element) { |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* ResourceLoader lets you dynamically include external scripts and styles on | * ResourceLoader lets you dynamically include external scripts and styles on | ||||
* the page and lets you know when the resource has been loaded. | * the page and lets you know when the resource has been loaded. | ||||
* | |||||
* | |||||
* You can also preload resources, allowing them to get cached by the browser | * You can also preload resources, allowing them to get cached by the browser | ||||
* without being evaluated. This enables downloading multiple resources at once | * without being evaluated. This enables downloading multiple resources at once | ||||
* while still controlling in which order e.g. scripts are executed. | * while still controlling in which order e.g. scripts are executed. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.0.0 | * @since 7.0.0 | ||||
*/ | */ | ||||
/** | /** | ||||
* Creates a new event. | * Creates a new event. | ||||
* | |||||
* | |||||
* @param loader | * @param loader | ||||
* the resource loader that has loaded the resource | * the resource loader that has loaded the resource | ||||
* @param resourceUrl | * @param resourceUrl | ||||
/** | /** | ||||
* Gets the resource loader that has fired this event | * Gets the resource loader that has fired this event | ||||
* | |||||
* | |||||
* @return the resource loader | * @return the resource loader | ||||
*/ | */ | ||||
public ResourceLoader getResourceLoader() { | public ResourceLoader getResourceLoader() { | ||||
/** | /** | ||||
* Gets the absolute url of the loaded resource. | * Gets the absolute url of the loaded resource. | ||||
* | |||||
* | |||||
* @return the absolute url of the loaded resource | * @return the absolute url of the loaded resource | ||||
*/ | */ | ||||
public String getResourceUrl() { | public String getResourceUrl() { | ||||
/** | /** | ||||
* Returns true if the resource has been preloaded, false if it's fully | * Returns true if the resource has been preloaded, false if it's fully | ||||
* loaded | * loaded | ||||
* | |||||
* | |||||
* @see ResourceLoader#preloadResource(String, ResourceLoadListener) | * @see ResourceLoader#preloadResource(String, ResourceLoadListener) | ||||
* | |||||
* | |||||
* @return true if the resource has been preloaded, false if it's fully | * @return true if the resource has been preloaded, false if it's fully | ||||
* loaded | * loaded | ||||
*/ | */ | ||||
* Notifies this ResourceLoadListener that a resource has been loaded. | * Notifies this ResourceLoadListener that a resource has been loaded. | ||||
* Some browsers do not support any way of detecting load errors. In | * Some browsers do not support any way of detecting load errors. In | ||||
* these cases, onLoad will be called regardless of the status. | * these cases, onLoad will be called regardless of the status. | ||||
* | |||||
* | |||||
* @see ResourceLoadEvent | * @see ResourceLoadEvent | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* a resource load event with information about the loaded | * a resource load event with information about the loaded | ||||
* resource | * resource | ||||
* server did not respond. Some browsers do not support any way of | * server did not respond. Some browsers do not support any way of | ||||
* detecting load errors. In these cases, onLoad will be called | * detecting load errors. In these cases, onLoad will be called | ||||
* regardless of the status. | * regardless of the status. | ||||
* | |||||
* | |||||
* @see ResourceLoadEvent | * @see ResourceLoadEvent | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* a resource load event with information about the resource | * a resource load event with information about the resource | ||||
* that could not be loaded. | * that could not be loaded. | ||||
/** | /** | ||||
* Returns the default ResourceLoader | * Returns the default ResourceLoader | ||||
* | |||||
* | |||||
* @return the default ResourceLoader | * @return the default ResourceLoader | ||||
*/ | */ | ||||
public static ResourceLoader get() { | public static ResourceLoader get() { | ||||
* this method when the script is currently loading or already loaded | * this method when the script is currently loading or already loaded | ||||
* doesn't cause the script to be loaded again, but the listener will still | * doesn't cause the script to be loaded again, but the listener will still | ||||
* be notified when appropriate. | * be notified when appropriate. | ||||
* | |||||
* | |||||
* | |||||
* | |||||
* @param scriptUrl | * @param scriptUrl | ||||
* the url of the script to load | * the url of the script to load | ||||
* @param resourceLoadListener | * @param resourceLoadListener | ||||
* this method when the script is currently loading or already loaded | * this method when the script is currently loading or already loaded | ||||
* doesn't cause the script to be loaded again, but the listener will still | * doesn't cause the script to be loaded again, but the listener will still | ||||
* be notified when appropriate. | * be notified when appropriate. | ||||
* | |||||
* | |||||
* | |||||
* | |||||
* @param scriptUrl | * @param scriptUrl | ||||
* url of script to load | * url of script to load | ||||
* @param resourceLoadListener | * @param resourceLoadListener | ||||
/** | /** | ||||
* The current browser supports script.async='false' for maintaining | * The current browser supports script.async='false' for maintaining | ||||
* execution order for dynamically-added scripts. | * execution order for dynamically-added scripts. | ||||
* | |||||
* | |||||
* @return Browser supports script.async='false' | * @return Browser supports script.async='false' | ||||
* @since 7.2.4 | * @since 7.2.4 | ||||
*/ | */ | ||||
* preloaded, it will be present in the browser's cache (provided the HTTP | * preloaded, it will be present in the browser's cache (provided the HTTP | ||||
* headers allow caching), making a subsequent load operation complete | * headers allow caching), making a subsequent load operation complete | ||||
* without having to wait for the resource to be downloaded again. | * without having to wait for the resource to be downloaded again. | ||||
* | |||||
* | |||||
* Calling this method when the resource is currently loading, currently | * Calling this method when the resource is currently loading, currently | ||||
* preloading, already preloaded or already loaded doesn't cause the | * preloading, already preloaded or already loaded doesn't cause the | ||||
* resource to be preloaded again, but the listener will still be notified | * resource to be preloaded again, but the listener will still be notified | ||||
* when appropriate. | * when appropriate. | ||||
* | |||||
* | |||||
* @param url | * @param url | ||||
* the url of the resource to preload | * the url of the resource to preload | ||||
* @param resourceLoadListener | * @param resourceLoadListener | ||||
* Adds an onload listener to the given element, which should be a link or a | * Adds an onload listener to the given element, which should be a link or a | ||||
* script tag. The listener is called whenever loading is complete or an | * script tag. The listener is called whenever loading is complete or an | ||||
* error occurred. | * error occurred. | ||||
* | |||||
* | |||||
* @since 7.3 | * @since 7.3 | ||||
* @param element | * @param element | ||||
* the element to attach a listener to | * the element to attach a listener to | ||||
* Calling this method when the stylesheet is currently loading or already | * Calling this method when the stylesheet is currently loading or already | ||||
* loaded doesn't cause the stylesheet to be loaded again, but the listener | * loaded doesn't cause the stylesheet to be loaded again, but the listener | ||||
* will still be notified when appropriate. | * will still be notified when appropriate. | ||||
* | |||||
* | |||||
* @param stylesheetUrl | * @param stylesheetUrl | ||||
* the url of the stylesheet to load | * the url of the stylesheet to load | ||||
* @param resourceLoadListener | * @param resourceLoadListener | ||||
if (rules === undefined) { | if (rules === undefined) { | ||||
rules = sheet.rules; | rules = sheet.rules; | ||||
} | } | ||||
if (rules === null) { | if (rules === null) { | ||||
// Style sheet loaded, but can't access length because of XSS -> assume there's something there | // Style sheet loaded, but can't access length because of XSS -> assume there's something there | ||||
return 1; | return 1; | ||||
} | } | ||||
// Return length so we can distinguish 0 (probably 404 error) from normal case. | // Return length so we can distinguish 0 (probably 404 error) from normal case. | ||||
return rules.length; | return rules.length; | ||||
} catch (err) { | } catch (err) { |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* Interface implemented by all client side classes that can be communicate with | * Interface implemented by all client side classes that can be communicate with | ||||
* the server. Classes implementing this interface are initialized by the | * the server. Classes implementing this interface are initialized by the | ||||
* framework when needed and have the ability to communicate with the server. | * framework when needed and have the ability to communicate with the server. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.0.0 | * @since 7.0.0 | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets ApplicationConnection instance that created this connector. | * Gets ApplicationConnection instance that created this connector. | ||||
* | |||||
* | |||||
* @return The ApplicationConnection as set by | * @return The ApplicationConnection as set by | ||||
* {@link #doInit(String, ApplicationConnection)} | * {@link #doInit(String, ApplicationConnection)} | ||||
*/ | */ | ||||
* Tests whether the connector is enabled or not. This method checks that | * Tests whether the connector is enabled or not. This method checks that | ||||
* the connector is enabled in context, i.e. if the parent connector is | * the connector is enabled in context, i.e. if the parent connector is | ||||
* disabled, this method must return false. | * disabled, this method must return false. | ||||
* | |||||
* | |||||
* @return true if the connector is enabled, false otherwise | * @return true if the connector is enabled, false otherwise | ||||
*/ | */ | ||||
public boolean isEnabled(); | public boolean isEnabled(); | ||||
/** | /** | ||||
* | |||||
* | |||||
* Called once by the framework to initialize the connector. | * Called once by the framework to initialize the connector. | ||||
* <p> | * <p> | ||||
* Note that the shared state is not yet available at this point nor any | * Note that the shared state is not yet available at this point nor any | ||||
/** | /** | ||||
* For internal use by the framework: returns the registered RPC | * For internal use by the framework: returns the registered RPC | ||||
* implementations for an RPC interface identifier. | * implementations for an RPC interface identifier. | ||||
* | |||||
* | |||||
* TODO interface identifier type or format may change | * TODO interface identifier type or format may change | ||||
* | |||||
* | |||||
* @param rpcInterfaceId | * @param rpcInterfaceId | ||||
* RPC interface identifier: fully qualified interface type name | * RPC interface identifier: fully qualified interface type name | ||||
* @return RPC interface implementations registered for an RPC interface, | * @return RPC interface implementations registered for an RPC interface, | ||||
/** | /** | ||||
* Adds a handler that is called whenever any part of the state has been | * Adds a handler that is called whenever any part of the state has been | ||||
* updated by the server. | * updated by the server. | ||||
* | |||||
* | |||||
* @param handler | * @param handler | ||||
* The handler that should be added. | * The handler that should be added. | ||||
* @return A handler registration reference that can be used to unregister | * @return A handler registration reference that can be used to unregister | ||||
/** | /** | ||||
* Removes a handler that is called whenever any part of the state has been | * Removes a handler that is called whenever any part of the state has been | ||||
* updated by the server. | * updated by the server. | ||||
* | |||||
* | |||||
* @param handler | * @param handler | ||||
* The handler that should be removed. | * The handler that should be removed. | ||||
*/ | */ | ||||
/** | /** | ||||
* Adds a handler that is called whenever the given part of the state has | * Adds a handler that is called whenever the given part of the state has | ||||
* been updated by the server. | * been updated by the server. | ||||
* | |||||
* | |||||
* @param propertyName | * @param propertyName | ||||
* the name of the property for which the handler should be | * the name of the property for which the handler should be | ||||
* called | * called | ||||
/** | /** | ||||
* Removes a handler that is called whenever any part of the state has been | * Removes a handler that is called whenever any part of the state has been | ||||
* updated by the server. | * updated by the server. | ||||
* | |||||
* | |||||
* @param propertyName | * @param propertyName | ||||
* the name of the property for which the handler should be | * the name of the property for which the handler should be | ||||
* called | * called | ||||
/** | /** | ||||
* Sends the given event to all registered handlers. | * Sends the given event to all registered handlers. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* The event to send. | * The event to send. | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the parent of this connector. Can be null for only the root | * Returns the parent of this connector. Can be null for only the root | ||||
* connector. | * connector. | ||||
* | |||||
* | |||||
* @return The parent of this connector, as set by | * @return The parent of this connector, as set by | ||||
* {@link #setParent(ServerConnector)}. | * {@link #setParent(ServerConnector)}. | ||||
*/ | */ | ||||
* Note that calling this method does not fire a | * Note that calling this method does not fire a | ||||
* {@link ConnectorHierarchyChangeEvent}. The event is fired only when the | * {@link ConnectorHierarchyChangeEvent}. The event is fired only when the | ||||
* whole hierarchy has been updated. | * whole hierarchy has been updated. | ||||
* | |||||
* | |||||
* @param parent | * @param parent | ||||
* The new parent of the connector | * The new parent of the connector | ||||
*/ | */ | ||||
* {@link HasComponentsConnector#setChildComponents(List)} and takes both | * {@link HasComponentsConnector#setChildComponents(List)} and takes both | ||||
* extensions and child components. Both methods are called separately by | * extensions and child components. Both methods are called separately by | ||||
* the framework if the connector can have child components. | * the framework if the connector can have child components. | ||||
* | |||||
* | |||||
* @param children | * @param children | ||||
* The new child connectors (extensions and/or components) | * The new child connectors (extensions and/or components) | ||||
*/ | */ | ||||
* Note that the method {@link HasComponentsConnector#getChildComponents()} | * Note that the method {@link HasComponentsConnector#getChildComponents()} | ||||
* can be used to obtain the subset of child connectors that correspond to | * can be used to obtain the subset of child connectors that correspond to | ||||
* components and not extensions. | * components and not extensions. | ||||
* | |||||
* | |||||
* @return A collection of child connectors (components or extensions) for | * @return A collection of child connectors (components or extensions) for | ||||
* this connector. An empty collection if there are no children. | * this connector. An empty collection if there are no children. | ||||
* Never returns null. | * Never returns null. | ||||
/** | /** | ||||
* Gets the current shared state of the connector. | * Gets the current shared state of the connector. | ||||
* | |||||
* | |||||
* Note that state is considered an internal part of the connector. You | * Note that state is considered an internal part of the connector. You | ||||
* should not rely on the state object outside of the connector who owns it. | * should not rely on the state object outside of the connector who owns it. | ||||
* If you depend on the state of other connectors you should use their | * If you depend on the state of other connectors you should use their | ||||
* public API instead of their state object directly. | * public API instead of their state object directly. | ||||
* | |||||
* | |||||
* @since 7.0. | * @since 7.0. | ||||
* @return state The shared state object. Can be any sub type of | * @return state The shared state object. Can be any sub type of | ||||
* {@link SharedState}. Never null. | * {@link SharedState}. Never null. | ||||
/** | /** | ||||
* Checks if an event listener has been registered on the server side for | * Checks if an event listener has been registered on the server side for | ||||
* the given event identifier. | * the given event identifier. | ||||
* | |||||
* | |||||
* @param eventIdentifier | * @param eventIdentifier | ||||
* The identifier for the event | * The identifier for the event | ||||
* @return true if a listener has been registered on the server side, false | * @return true if a listener has been registered on the server side, false |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* | |||||
* | |||||
* @deprecated as of 7.1. This class was mainly used by the old debug console | * @deprecated as of 7.1. This class was mainly used by the old debug console | ||||
* but is retained for now for backwards compatibility. | * but is retained for now for backwards compatibility. | ||||
*/ | */ | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
* | |||||
* | |||||
* @deprecated As of 7.2, call and override {@link #add(Widget, Element)} | * @deprecated As of 7.2, call and override {@link #add(Widget, Element)} | ||||
* instead. | * instead. | ||||
*/ | */ | ||||
/** | /** | ||||
* {@inheritDoc} | * {@inheritDoc} | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
*/ | */ | ||||
@Override | @Override |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Class that enables SuperDevMode using a ?superdevmode parameter in the url. | * Class that enables SuperDevMode using a ?superdevmode parameter in the url. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.0 | * @since 7.0 | ||||
* | |||||
* | |||||
*/ | */ | ||||
public class SuperDevMode { | public class SuperDevMode { | ||||
private native static String getRecompileParameters(String moduleName) | private native static String getRecompileParameters(String moduleName) | ||||
/*-{ | /*-{ | ||||
var prop_map = $wnd.__gwt_activeModules[moduleName].bindings(); | var prop_map = $wnd.__gwt_activeModules[moduleName].bindings(); | ||||
// convert map to URL parameter string | // convert map to URL parameter string | ||||
var props = []; | var props = []; | ||||
for (var key in prop_map) { | for (var key in prop_map) { | ||||
props.push(encodeURIComponent(key) + '=' + encodeURIComponent(prop_map[key])) | props.push(encodeURIComponent(key) + '=' + encodeURIComponent(prop_map[key])) | ||||
} | } | ||||
return props.join('&') + '&'; | return props.join('&') + '&'; | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
* The URL of the code server. The default URL (http://localhost:9876/) will | * The URL of the code server. The default URL (http://localhost:9876/) will | ||||
* be used if this is empty or null. | * be used if this is empty or null. | ||||
* | |||||
* | |||||
* @param serverUrl | * @param serverUrl | ||||
* The url of the code server or null to use the default | * The url of the code server or null to use the default | ||||
* @return true if recompile started, false if we are running in | * @return true if recompile started, false if we are running in | ||||
var mod = $wnd.__gwt_activeModules[moduleName]; | var mod = $wnd.__gwt_activeModules[moduleName]; | ||||
if (!mod) | if (!mod) | ||||
return false; | return false; | ||||
if (mod.superdevmode) { | if (mod.superdevmode) { | ||||
// Running in super dev mode already, it is supported | // Running in super dev mode already, it is supported | ||||
return true; | return true; | ||||
} | } | ||||
return !!mod.canRedirect; | return !!mod.canRedirect; | ||||
}-*/; | }-*/; | ||||
* method returns true. The application will be restarted once compilation | * method returns true. The application will be restarted once compilation | ||||
* is done and then this method will return false. | * is done and then this method will return false. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @return true if a recompile operation has started and the page will be | * @return true if a recompile operation has started and the page will be | ||||
* reloaded once it is done, false if no recompilation will be done. | * reloaded once it is done, false if no recompilation will be done. | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Checks is a message has been defined for the tooltip. | * Checks is a message has been defined for the tooltip. | ||||
* | |||||
* | |||||
* @return true if title or error message is present, false if both are | * @return true if title or error message is present, false if both are | ||||
* empty | * empty | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* Shorthand for getting the attribute named "id", which for Paintables is | * Shorthand for getting the attribute named "id", which for Paintables is | ||||
* the essential paintableId which binds the server side component to the | * the essential paintableId which binds the server side component to the | ||||
* client side widget. | * client side widget. | ||||
* | |||||
* | |||||
* @return the value of the id attribute, if available | * @return the value of the id attribute, if available | ||||
*/ | */ | ||||
public String getId() { | public String getId() { | ||||
* internally and is not needed within | * internally and is not needed within | ||||
* {@link ComponentConnector#updateFromUIDL(UIDL, ApplicationConnection) | * {@link ComponentConnector#updateFromUIDL(UIDL, ApplicationConnection) | ||||
* updateFromUIDL()}. | * updateFromUIDL()}. | ||||
* | |||||
* | |||||
* @return the name for this section | * @return the name for this section | ||||
*/ | */ | ||||
public native String getTag() | public native String getTag() | ||||
/** | /** | ||||
* Gets the named attribute as a String. | * Gets the named attribute as a String. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to get | * the name of the attribute to get | ||||
* @return the attribute value | * @return the attribute value | ||||
/** | /** | ||||
* Gets the names of the attributes available. | * Gets the names of the attributes available. | ||||
* | |||||
* | |||||
* @return the names of available attributes | * @return the names of available attributes | ||||
*/ | */ | ||||
public Set<String> getAttributeNames() { | public Set<String> getAttributeNames() { | ||||
/** | /** | ||||
* Gets the names of variables available. | * Gets the names of variables available. | ||||
* | |||||
* | |||||
* @return the names of available variables | * @return the names of available variables | ||||
*/ | */ | ||||
public Set<String> getVariableNames() { | public Set<String> getVariableNames() { | ||||
/** | /** | ||||
* Gets the named attribute as an int. | * Gets the named attribute as an int. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to get | * the name of the attribute to get | ||||
* @return the attribute value | * @return the attribute value | ||||
/** | /** | ||||
* Gets the named attribute as a long. | * Gets the named attribute as a long. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to get | * the name of the attribute to get | ||||
* @return the attribute value | * @return the attribute value | ||||
/** | /** | ||||
* Gets the named attribute as a float. | * Gets the named attribute as a float. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to get | * the name of the attribute to get | ||||
* @return the attribute value | * @return the attribute value | ||||
/** | /** | ||||
* Gets the named attribute as a double. | * Gets the named attribute as a double. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to get | * the name of the attribute to get | ||||
* @return the attribute value | * @return the attribute value | ||||
/** | /** | ||||
* Gets the named attribute as a boolean. | * Gets the named attribute as a boolean. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to get | * the name of the attribute to get | ||||
* @return the attribute value | * @return the attribute value | ||||
/** | /** | ||||
* Gets the named attribute as a Map of named values (key/value pairs). | * Gets the named attribute as a Map of named values (key/value pairs). | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to get | * the name of the attribute to get | ||||
* @return the attribute Map | * @return the attribute Map | ||||
/** | /** | ||||
* Gets the named attribute as an array of Strings. | * Gets the named attribute as an array of Strings. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to get | * the name of the attribute to get | ||||
* @return the attribute value | * @return the attribute value | ||||
/** | /** | ||||
* Gets the named attribute as an int array. | * Gets the named attribute as an int array. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to get | * the name of the attribute to get | ||||
* @return the attribute value | * @return the attribute value | ||||
/** | /** | ||||
* Get attributes value as string whatever the type is | * Get attributes value as string whatever the type is | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* @return string presentation of attribute | * @return string presentation of attribute | ||||
*/ | */ | ||||
/** | /** | ||||
* Indicates whether or not the named attribute is available. | * Indicates whether or not the named attribute is available. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute to check | * the name of the attribute to check | ||||
* @return true if the attribute is available, false otherwise | * @return true if the attribute is available, false otherwise | ||||
/** | /** | ||||
* Gets the UIDL for the child at the given index. | * Gets the UIDL for the child at the given index. | ||||
* | |||||
* | |||||
* @param i | * @param i | ||||
* the index of the child to get | * the index of the child to get | ||||
* @return the UIDL of the child if it exists | * @return the UIDL of the child if it exists | ||||
/** | /** | ||||
* Gets the child at the given index as a String. | * Gets the child at the given index as a String. | ||||
* | |||||
* | |||||
* @param i | * @param i | ||||
* the index of the child to get | * the index of the child to get | ||||
* @return the String representation of the child if it exists | * @return the String representation of the child if it exists | ||||
* if <code>getTag()</code> returns "color", one would update the widgets | * if <code>getTag()</code> returns "color", one would update the widgets | ||||
* color to reflect the value of the "color" section. | * color to reflect the value of the "color" section. | ||||
* </p> | * </p> | ||||
* | |||||
* | |||||
* @return an iterator for iterating over UIDL children | * @return an iterator for iterating over UIDL children | ||||
*/ | */ | ||||
public Iterator<Object> getChildIterator() { | public Iterator<Object> getChildIterator() { | ||||
/** | /** | ||||
* Checks if the named variable is available. | * Checks if the named variable is available. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable desired | * the name of the variable desired | ||||
* @return true if the variable exists, false otherwise | * @return true if the variable exists, false otherwise | ||||
/** | /** | ||||
* Gets the value of the named variable. | * Gets the value of the named variable. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the value of the variable | * @return the value of the variable | ||||
/** | /** | ||||
* Gets the value of the named variable. | * Gets the value of the named variable. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the value of the variable | * @return the value of the variable | ||||
/** | /** | ||||
* Gets the value of the named variable. | * Gets the value of the named variable. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the value of the variable | * @return the value of the variable | ||||
/** | /** | ||||
* Gets the value of the named variable. | * Gets the value of the named variable. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the value of the variable | * @return the value of the variable | ||||
/** | /** | ||||
* Gets the value of the named variable. | * Gets the value of the named variable. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the value of the variable | * @return the value of the variable | ||||
/** | /** | ||||
* Gets the value of the named variable. | * Gets the value of the named variable. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the value of the variable | * @return the value of the variable | ||||
/** | /** | ||||
* Gets the value of the named variable. | * Gets the value of the named variable. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the value of the variable | * @return the value of the variable | ||||
/** | /** | ||||
* Gets the value of the named String[] variable as a Set of Strings. | * Gets the value of the named String[] variable as a Set of Strings. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the value of the variable | * @return the value of the variable | ||||
/** | /** | ||||
* Gets the value of the named variable. | * Gets the value of the named variable. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the value of the variable | * @return the value of the variable | ||||
/** | /** | ||||
* Returns the number of children. | * Returns the number of children. | ||||
* | |||||
* | |||||
* @return the number of children | * @return the number of children | ||||
*/ | */ | ||||
public native int getChildCount() | public native int getChildCount() | ||||
/** | /** | ||||
* Gets the Paintable with the id found in the named attributes's value. | * Gets the Paintable with the id found in the named attributes's value. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the attribute | * the name of the attribute | ||||
* @return the Paintable referenced by the attribute, if it exists | * @return the Paintable referenced by the attribute, if it exists | ||||
/** | /** | ||||
* Gets the Paintable with the id found in the named variable's value. | * Gets the Paintable with the id found in the named variable's value. | ||||
* | |||||
* | |||||
* @param name | * @param name | ||||
* the name of the variable | * the name of the variable | ||||
* @return the Paintable referenced by the variable, if it exists | * @return the Paintable referenced by the variable, if it exists | ||||
/** | /** | ||||
* Returns the child UIDL by its name. If several child nodes exist with the | * Returns the child UIDL by its name. If several child nodes exist with the | ||||
* given name, the first child UIDL will be returned. | * given name, the first child UIDL will be returned. | ||||
* | |||||
* | |||||
* @param tagName | * @param tagName | ||||
* @return the child UIDL or null if child wit given name was not found | * @return the child UIDL or null if child wit given name was not found | ||||
*/ | */ |
/** | /** | ||||
* Helper method for debugging purposes. | * Helper method for debugging purposes. | ||||
* | |||||
* | |||||
* Stops execution on firefox browsers on a breakpoint. | * Stops execution on firefox browsers on a breakpoint. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#browserDebugger()} | * @deprecated As of 7.4.0, use {@link WidgetUtil#browserDebugger()} | ||||
* instead. | * instead. | ||||
*/ | */ | ||||
* Helper method for a bug fix #14041. For mozilla getKeyCode return 0 for | * Helper method for a bug fix #14041. For mozilla getKeyCode return 0 for | ||||
* space bar (because space is considered as char). If return 0 use | * space bar (because space is considered as char). If return 0 use | ||||
* getCharCode. | * getCharCode. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#getKeyCode(KeyEvent)} | * @deprecated As of 7.4.0, use {@link WidgetUtil#getKeyCode(KeyEvent)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return return key code | * @return return key code | ||||
* @since 7.2.4 | * @since 7.2.4 | ||||
} | } | ||||
/** | /** | ||||
* | |||||
* | |||||
* Returns the topmost element of from given coordinates. | * Returns the topmost element of from given coordinates. | ||||
* | |||||
* | |||||
* TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical | * TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical | ||||
* for vaadin as we scroll div istead of page. | * for vaadin as we scroll div istead of page. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#getElementFromPoint(int, int)} instead. | * {@link WidgetUtil#getElementFromPoint(int, int)} instead. | ||||
* | |||||
* | |||||
* @param x | * @param x | ||||
* @param y | * @param y | ||||
* @return the element at given coordinates | * @return the element at given coordinates | ||||
* This helper method can be called if components size have been changed | * This helper method can be called if components size have been changed | ||||
* outside rendering phase. It notifies components parent about the size | * outside rendering phase. It notifies components parent about the size | ||||
* change so it can react. | * change so it can react. | ||||
* | |||||
* | |||||
* When using this method, developer should consider if size changes could | * When using this method, developer should consider if size changes could | ||||
* be notified lazily. If lazy flag is true, method will save widget and | * be notified lazily. If lazy flag is true, method will save widget and | ||||
* wait for a moment until it notifies parents in chunks. This may vastly | * wait for a moment until it notifies parents in chunks. This may vastly | ||||
* optimize layout in various situation. Example: if component have a lot of | * optimize layout in various situation. Example: if component have a lot of | ||||
* images their onload events may fire "layout phase" many times in a short | * images their onload events may fire "layout phase" many times in a short | ||||
* period. | * period. | ||||
* | |||||
* | |||||
* @param widget | * @param widget | ||||
* @param lazy | * @param lazy | ||||
* run componentSizeUpdated lazyly | * run componentSizeUpdated lazyly | ||||
* | |||||
* | |||||
* @deprecated As of 7.0, use | * @deprecated As of 7.0, use | ||||
* {@link LayoutManager#setNeedsMeasure(ComponentConnector)} | * {@link LayoutManager#setNeedsMeasure(ComponentConnector)} | ||||
* instead | * instead | ||||
/** | /** | ||||
* Converts html entities to text. | * Converts html entities to text. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#escapeHTML(String)} | * @deprecated As of 7.4.0, use {@link WidgetUtil#escapeHTML(String)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param html | * @param html | ||||
* @return escaped string presentation of given html | * @return escaped string presentation of given html | ||||
*/ | */ | ||||
/** | /** | ||||
* Escapes the string so it is safe to write inside an HTML attribute. | * Escapes the string so it is safe to write inside an HTML attribute. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#escapeAttribute(String)} | * @deprecated As of 7.4.0, use {@link WidgetUtil#escapeAttribute(String)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param attribute | * @param attribute | ||||
* The string to escape | * The string to escape | ||||
* @return An escaped version of <literal>attribute</literal>. | * @return An escaped version of <literal>attribute</literal>. | ||||
/** | /** | ||||
* Clones given element as in JavaScript. | * Clones given element as in JavaScript. | ||||
* | |||||
* | |||||
* Deprecate this if there appears similar method into GWT someday. | * Deprecate this if there appears similar method into GWT someday. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#cloneNode(Element, boolean)} instead. | * {@link WidgetUtil#cloneNode(Element, boolean)} instead. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* @param deep | * @param deep | ||||
* clone child tree also | * clone child tree also | ||||
/** | /** | ||||
* Defers the execution of {@link #runWebkitOverflowAutoFix(Element)} | * Defers the execution of {@link #runWebkitOverflowAutoFix(Element)} | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#runWebkitOverflowAutoFixDeferred(Element)} | * {@link WidgetUtil#runWebkitOverflowAutoFixDeferred(Element)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @since 7.2.6 | * @since 7.2.6 | ||||
* @param elem | * @param elem | ||||
* with overflow auto | * with overflow auto | ||||
/** | /** | ||||
* Run workaround for webkits overflow auto issue. | * Run workaround for webkits overflow auto issue. | ||||
* | |||||
* | |||||
* See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462 | * See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462 | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#runWebkitOverflowAutoFix(Element)} instead. | * {@link WidgetUtil#runWebkitOverflowAutoFix(Element)} instead. | ||||
* | |||||
* | |||||
* @param elem | * @param elem | ||||
* with overflow auto | * with overflow auto | ||||
*/ | */ | ||||
* dimension is not specified as relative it will return -1. If the shared | * dimension is not specified as relative it will return -1. If the shared | ||||
* state does not contain width or height specifications this will return | * state does not contain width or height specifications this will return | ||||
* null. | * null. | ||||
* | |||||
* | |||||
* @param state | * @param state | ||||
* @return | * @return | ||||
*/ | */ | ||||
* Checks if a and b are equals using {@link #equals(Object)}. Handles null | * Checks if a and b are equals using {@link #equals(Object)}. Handles null | ||||
* values as well. Does not ensure that objects are of the same type. | * values as well. Does not ensure that objects are of the same type. | ||||
* Assumes that the first object's equals method handle equals properly. | * Assumes that the first object's equals method handle equals properly. | ||||
* | |||||
* | |||||
* @param a | * @param a | ||||
* The first value to compare | * The first value to compare | ||||
* @param b | * @param b | ||||
/** | /** | ||||
* Gets the border-box width for the given element, i.e. element width + | * Gets the border-box width for the given element, i.e. element width + | ||||
* border + padding. Always rounds up to nearest integer. | * border + padding. Always rounds up to nearest integer. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#getRequiredWidth(Element)} | * @deprecated As of 7.4.0, use {@link WidgetUtil#getRequiredWidth(Element)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element to check | * The element to check | ||||
* @return The border-box width for the element | * @return The border-box width for the element | ||||
/** | /** | ||||
* Gets the border-box height for the given element, i.e. element height + | * Gets the border-box height for the given element, i.e. element height + | ||||
* border + padding. Always rounds up to nearest integer. | * border + padding. Always rounds up to nearest integer. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#getRequiredHeight(Element)} instead. | * {@link WidgetUtil#getRequiredHeight(Element)} instead. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element to check | * The element to check | ||||
* @return The border-box height for the element | * @return The border-box height for the element | ||||
/** | /** | ||||
* Detects what is currently the overflow style attribute in given element. | * Detects what is currently the overflow style attribute in given element. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#mayHaveScrollBars(Element)} instead. | * {@link WidgetUtil#mayHaveScrollBars(Element)} instead. | ||||
* | |||||
* | |||||
* @param pe | * @param pe | ||||
* the element to detect | * the element to detect | ||||
* @return true if auto or scroll | * @return true if auto or scroll | ||||
* also returned if "element" is part of its caption. If | * also returned if "element" is part of its caption. If | ||||
* <literal>element</literal> is not part of any child component, null is | * <literal>element</literal> is not part of any child component, null is | ||||
* returned. | * returned. | ||||
* | |||||
* | |||||
* This method returns the deepest nested VPaintableWidget. | * This method returns the deepest nested VPaintableWidget. | ||||
* | |||||
* | |||||
* @param client | * @param client | ||||
* A reference to ApplicationConnection | * A reference to ApplicationConnection | ||||
* @param parent | * @param parent | ||||
/** | /** | ||||
* Will (attempt) to focus the given DOM Element. | * Will (attempt) to focus the given DOM Element. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#focus(Element)} instead. | * @deprecated As of 7.4.0, use {@link WidgetUtil#focus(Element)} instead. | ||||
* | |||||
* | |||||
* @param el | * @param el | ||||
* the element to focus | * the element to focus | ||||
*/ | */ | ||||
/** | /** | ||||
* Helper method to find the nearest parent paintable instance by traversing | * Helper method to find the nearest parent paintable instance by traversing | ||||
* the DOM upwards from given element. | * the DOM upwards from given element. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element to start from | * the element to start from | ||||
*/ | */ | ||||
/** | /** | ||||
* Helper method to find first instance of given Widget type found by | * Helper method to find first instance of given Widget type found by | ||||
* traversing DOM upwards from given element. | * traversing DOM upwards from given element. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#findWidget(Element, Class)} instead. | * {@link WidgetUtil#findWidget(Element, Class)} instead. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element where to start seeking of Widget | * the element where to start seeking of Widget | ||||
* @param class1 | * @param class1 | ||||
/** | /** | ||||
* Force webkit to redraw an element | * Force webkit to redraw an element | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#forceWebkitRedraw(Element)} instead. | * {@link WidgetUtil#forceWebkitRedraw(Element)} instead. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element that should be redrawn | * The element that should be redrawn | ||||
*/ | */ | ||||
* Performs a hack to trigger a re-layout in the IE8. This is usually | * Performs a hack to trigger a re-layout in the IE8. This is usually | ||||
* necessary in cases where IE8 "forgets" to update child elements when they | * necessary in cases where IE8 "forgets" to update child elements when they | ||||
* resize. | * resize. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#forceIE8Redraw(Element)} | * @deprecated As of 7.4.0, use {@link WidgetUtil#forceIE8Redraw(Element)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param e | * @param e | ||||
* The element to perform the hack on | * The element to perform the hack on | ||||
*/ | */ | ||||
* Performs a hack to trigger a re-layout in the IE browser. This is usually | * Performs a hack to trigger a re-layout in the IE browser. This is usually | ||||
* necessary in cases where IE "forgets" to update child elements when they | * necessary in cases where IE "forgets" to update child elements when they | ||||
* resize. | * resize. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#forceIERedraw(Element)} | * @deprecated As of 7.4.0, use {@link WidgetUtil#forceIERedraw(Element)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @since 7.3 | * @since 7.3 | ||||
* @param e | * @param e | ||||
* The element to perform the hack on | * The element to perform the hack on | ||||
/** | /** | ||||
* Detaches and re-attaches the element from its parent. The element is | * Detaches and re-attaches the element from its parent. The element is | ||||
* reattached at the same position in the DOM as it was before. | * reattached at the same position in the DOM as it was before. | ||||
* | |||||
* | |||||
* Does nothing if the element is not attached to the DOM. | * Does nothing if the element is not attached to the DOM. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#detachAttach(Element)} | * @deprecated As of 7.4.0, use {@link WidgetUtil#detachAttach(Element)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element to detach and re-attach | * The element to detach and re-attach | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the index of the childElement within its parent. | * Returns the index of the childElement within its parent. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#getChildElementIndex(Element)} instead. | * {@link WidgetUtil#getChildElementIndex(Element)} instead. | ||||
* | |||||
* | |||||
* @param subElement | * @param subElement | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* Produces a string representation of a method invocation, suitable for | * Produces a string representation of a method invocation, suitable for | ||||
* debug output | * debug output | ||||
* | |||||
* | |||||
* @since 7.5 | * @since 7.5 | ||||
* @param invocation | * @param invocation | ||||
* @return | * @return | ||||
* Temporarily sets the {@code styleProperty} to {@code tempValue} and then | * Temporarily sets the {@code styleProperty} to {@code tempValue} and then | ||||
* resets it to its current value. Used mainly to work around rendering | * resets it to its current value. Used mainly to work around rendering | ||||
* issues in IE (and possibly in other browsers) | * issues in IE (and possibly in other browsers) | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#setStyleTemporarily(Element, String, String)} | * {@link WidgetUtil#setStyleTemporarily(Element, String, String)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The target element | * The target element | ||||
* @param styleProperty | * @param styleProperty | ||||
* A helper method to return the client position from an event. Returns | * A helper method to return the client position from an event. Returns | ||||
* position from either first changed touch (if touch event) or from the | * position from either first changed touch (if touch event) or from the | ||||
* event itself. | * event itself. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#getTouchOrMouseClientX(Event)} instead. | * {@link WidgetUtil#getTouchOrMouseClientX(Event)} instead. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return | * @return | ||||
*/ | */ | ||||
* Find the element corresponding to the coordinates in the passed mouse | * Find the element corresponding to the coordinates in the passed mouse | ||||
* event. Please note that this is not always the same as the target of the | * event. Please note that this is not always the same as the target of the | ||||
* event e.g. if event capture is used. | * event e.g. if event capture is used. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#getElementUnderMouse(NativeEvent)} instead. | * {@link WidgetUtil#getElementUnderMouse(NativeEvent)} instead. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* the mouse event to get coordinates from | * the mouse event to get coordinates from | ||||
* @return the element at the coordinates of the event | * @return the element at the coordinates of the event | ||||
* A helper method to return the client position from an event. Returns | * A helper method to return the client position from an event. Returns | ||||
* position from either first changed touch (if touch event) or from the | * position from either first changed touch (if touch event) or from the | ||||
* event itself. | * event itself. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#getTouchOrMouseClientY(Event)} instead. | * {@link WidgetUtil#getTouchOrMouseClientY(Event)} instead. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return | * @return | ||||
*/ | */ | ||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#getTouchOrMouseClientY(NativeEvent)} | * {@link WidgetUtil#getTouchOrMouseClientY(NativeEvent)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @see #getTouchOrMouseClientY(Event) | * @see #getTouchOrMouseClientY(Event) | ||||
* @param currentGwtEvent | * @param currentGwtEvent | ||||
* @return | * @return | ||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#getTouchOrMouseClientX(NativeEvent)} | * {@link WidgetUtil#getTouchOrMouseClientX(NativeEvent)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @see #getTouchOrMouseClientX(Event) | * @see #getTouchOrMouseClientX(Event) | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the currently focused element. | * Gets the currently focused element. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#getFocusedElement()} | * @deprecated As of 7.4.0, use {@link WidgetUtil#getFocusedElement()} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @return The active element or null if no active element could be found. | * @return The active element or null if no active element could be found. | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
/** | /** | ||||
* Gets the currently focused element for Internet Explorer. | * Gets the currently focused element for Internet Explorer. | ||||
* | |||||
* | |||||
* @return The currently focused element | * @return The currently focused element | ||||
* @deprecated Use #getFocusedElement instead | * @deprecated Use #getFocusedElement instead | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets currently focused element and checks if it's editable | * Gets currently focused element and checks if it's editable | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#isFocusedElementEditable()} instead. | * {@link WidgetUtil#isFocusedElementEditable()} instead. | ||||
* | |||||
* | |||||
* @since 7.4 | * @since 7.4 | ||||
* | |||||
* | |||||
* @return true if focused element is editable | * @return true if focused element is editable | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
* this method checks that this widget nor any of its parents is hidden. Can | * this method checks that this widget nor any of its parents is hidden. Can | ||||
* be e.g used to check whether component should react to some events or | * be e.g used to check whether component should react to some events or | ||||
* not. | * not. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#isAttachedAndDisplayed(Widget)} instead. | * {@link WidgetUtil#isAttachedAndDisplayed(Widget)} instead. | ||||
* | |||||
* | |||||
* @param widget | * @param widget | ||||
* @return true if attached and displayed | * @return true if attached and displayed | ||||
*/ | */ | ||||
/** | /** | ||||
* Scrolls an element into view vertically only. Modified version of | * Scrolls an element into view vertically only. Modified version of | ||||
* Element.scrollIntoView. | * Element.scrollIntoView. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#scrollIntoViewVertically(Element)} instead. | * {@link WidgetUtil#scrollIntoViewVertically(Element)} instead. | ||||
* | |||||
* | |||||
* @param elem | * @param elem | ||||
* The element to scroll into view | * The element to scroll into view | ||||
*/ | */ | ||||
/** | /** | ||||
* Checks if the given event is either a touch event or caused by the left | * Checks if the given event is either a touch event or caused by the left | ||||
* mouse button | * mouse button | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#isTouchEventOrLeftMouseButton(Event)} | * {@link WidgetUtil#isTouchEventOrLeftMouseButton(Event)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return true if the event is a touch event or caused by the left mouse | * @return true if the event is a touch event or caused by the left mouse | ||||
* button, false otherwise | * button, false otherwise | ||||
/** | /** | ||||
* Performs a shallow comparison of the collections. | * Performs a shallow comparison of the collections. | ||||
* | |||||
* | |||||
* @param collection1 | * @param collection1 | ||||
* The first collection | * The first collection | ||||
* @param collection2 | * @param collection2 | ||||
/** | /** | ||||
* Resolve a relative URL to an absolute URL based on the current document's | * Resolve a relative URL to an absolute URL based on the current document's | ||||
* location. | * location. | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use {@link WidgetUtil#getAbsoluteUrl(String)} | * @deprecated As of 7.4.0, use {@link WidgetUtil#getAbsoluteUrl(String)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param url | * @param url | ||||
* a string with the relative URL to resolve | * a string with the relative URL to resolve | ||||
* @return the corresponding absolute URL as a string | * @return the corresponding absolute URL as a string | ||||
/** | /** | ||||
* Sets the selection range of an input element. | * Sets the selection range of an input element. | ||||
* | |||||
* | |||||
* We need this JSNI function to set selection range so that we can use the | * We need this JSNI function to set selection range so that we can use the | ||||
* optional direction attribute to set the anchor to the end and the focus | * optional direction attribute to set the anchor to the end and the focus | ||||
* to the start. This makes Firefox work the same way as other browsers | * to the start. This makes Firefox work the same way as other browsers | ||||
* (#13477) | * (#13477) | ||||
* | |||||
* | |||||
* @deprecated As of 7.4.0, use | * @deprecated As of 7.4.0, use | ||||
* {@link WidgetUtil#setSelectionRange(Element, int, int, String)} | * {@link WidgetUtil#setSelectionRange(Element, int, int, String)} | ||||
* instead. | * instead. | ||||
* | |||||
* | |||||
* @param elem | * @param elem | ||||
* the html input element. | * the html input element. | ||||
* @param pos | * @param pos | ||||
* a string indicating the direction in which the selection was | * a string indicating the direction in which the selection was | ||||
* performed. This may be "forward" or "backward", or "none" if | * performed. This may be "forward" or "backward", or "none" if | ||||
* the direction is unknown or irrelevant. | * the direction is unknown or irrelevant. | ||||
* | |||||
* | |||||
* @since 7.3 | * @since 7.3 | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
* Converts a native {@link JavaScriptObject} into a {@link JsonValue}. This | * Converts a native {@link JavaScriptObject} into a {@link JsonValue}. This | ||||
* is a no-op in GWT code compiled to javascript, but needs some special | * is a no-op in GWT code compiled to javascript, but needs some special | ||||
* handling to work when run in JVM. | * handling to work when run in JVM. | ||||
* | |||||
* | |||||
* @param jso | * @param jso | ||||
* the java script object to represent as json | * the java script object to represent as json | ||||
* @return the json representation | * @return the json representation | ||||
* Converts a {@link JsonValue} into a native {@link JavaScriptObject}. This | * Converts a {@link JsonValue} into a native {@link JavaScriptObject}. This | ||||
* is a no-op in GWT code compiled to javascript, but needs some special | * is a no-op in GWT code compiled to javascript, but needs some special | ||||
* handling to work when run in JVM. | * handling to work when run in JVM. | ||||
* | |||||
* | |||||
* @param jsonValue | * @param jsonValue | ||||
* the json value | * the json value | ||||
* @return a native javascript object representation of the json value | * @return a native javascript object representation of the json value | ||||
/** | /** | ||||
* Convert a {@link JavaScriptObject} into a string representation. | * Convert a {@link JavaScriptObject} into a string representation. | ||||
* | |||||
* | |||||
* @param json | * @param json | ||||
* a JavaScript object to be converted to a string | * a JavaScript object to be converted to a string | ||||
* @return JSON in string representation | * @return JSON in string representation | ||||
/** | /** | ||||
* Parse a string containing JSON into a {@link JavaScriptObject}. | * Parse a string containing JSON into a {@link JavaScriptObject}. | ||||
* | |||||
* | |||||
* @param <T> | * @param <T> | ||||
* the overlay type to expect from the parse | * the overlay type to expect from the parse | ||||
* @param jsonAsString | * @param jsonAsString | ||||
/** | /** | ||||
* Round {@code num} up to {@code exp} decimal positions. | * Round {@code num} up to {@code exp} decimal positions. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
*/ | */ | ||||
public static native double round(double num, int exp) | public static native double round(double num, int exp) | ||||
* appropriate mode set. | * appropriate mode set. | ||||
* | * | ||||
* This version of the method tries to recursively locate such a parent. | * This version of the method tries to recursively locate such a parent. | ||||
* | |||||
* | |||||
* For internal use only. May be removed or replaced in the future. | * For internal use only. May be removed or replaced in the future. | ||||
*/ | */ | ||||
public static boolean shouldSkipMeasurementOfConnector( | public static boolean shouldSkipMeasurementOfConnector( |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Creates a caption that is not linked to a {@link ComponentConnector}. | * Creates a caption that is not linked to a {@link ComponentConnector}. | ||||
* | |||||
* | |||||
* When using this constructor, {@link #getOwner()} returns null. | * When using this constructor, {@link #getOwner()} returns null. | ||||
* | |||||
* | |||||
* @param client | * @param client | ||||
* ApplicationConnection | * ApplicationConnection | ||||
* @deprecated all captions should be associated with a paintable widget and | * @deprecated all captions should be associated with a paintable widget and | ||||
/** | /** | ||||
* Creates a caption for a {@link ComponentConnector}. | * Creates a caption for a {@link ComponentConnector}. | ||||
* | |||||
* | |||||
* @param component | * @param component | ||||
* owner of caption, not null | * owner of caption, not null | ||||
* @param client | * @param client | ||||
/** | /** | ||||
* Updates the caption from UIDL. | * Updates the caption from UIDL. | ||||
* | |||||
* | |||||
* This method may only be called when the caption has an owner - otherwise, | * This method may only be called when the caption has an owner - otherwise, | ||||
* use {@link #updateCaptionWithoutOwner(UIDL, String, boolean, boolean)}. | * use {@link #updateCaptionWithoutOwner(UIDL, String, boolean, boolean)}. | ||||
* | |||||
* | |||||
* @return true if the position where the caption should be placed has | * @return true if the position where the caption should be placed has | ||||
* changed | * changed | ||||
*/ | */ | ||||
/** | /** | ||||
* Checks whether anything in a given state change might cause the caption | * Checks whether anything in a given state change might cause the caption | ||||
* to change. | * to change. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* the state change event to check | * the state change event to check | ||||
* @return <code>true</code> if the caption might have changed; otherwise | * @return <code>true</code> if the caption might have changed; otherwise | ||||
/** | /** | ||||
* Returns Paintable for which this Caption belongs to. | * Returns Paintable for which this Caption belongs to. | ||||
* | |||||
* | |||||
* @return owner Widget | * @return owner Widget | ||||
*/ | */ | ||||
public ComponentConnector getOwner() { | public ComponentConnector getOwner() { | ||||
/** | /** | ||||
* Sets the tooltip that should be shown for the caption | * Sets the tooltip that should be shown for the caption | ||||
* | |||||
* | |||||
* @param tooltipInfo | * @param tooltipInfo | ||||
* The tooltip that should be shown or null if no tooltip should | * The tooltip that should be shown or null if no tooltip should | ||||
* be shown | * be shown | ||||
/** | /** | ||||
* Returns the tooltip that should be shown for the caption | * Returns the tooltip that should be shown for the caption | ||||
* | |||||
* | |||||
* @return The tooltip to show or null if no tooltip should be shown | * @return The tooltip to show or null if no tooltip should be shown | ||||
*/ | */ | ||||
public TooltipInfo getTooltipInfo() { | public TooltipInfo getTooltipInfo() { | ||||
* Sets whether the caption is rendered as HTML. | * Sets whether the caption is rendered as HTML. | ||||
* <p> | * <p> | ||||
* Default is false | * Default is false | ||||
* | |||||
* | |||||
* @param captionAsHtml | * @param captionAsHtml | ||||
* true if the captions are rendered as HTML, false if rendered | * true if the captions are rendered as HTML, false if rendered | ||||
* as plain text | * as plain text | ||||
* Checks whether captions are rendered as HTML. | * Checks whether captions are rendered as HTML. | ||||
* <p> | * <p> | ||||
* Default is false | * Default is false | ||||
* | |||||
* | |||||
* @return true if the captions are rendered as HTML, false if rendered as | * @return true if the captions are rendered as HTML, false if rendered as | ||||
* plain text | * plain text | ||||
*/ | */ | ||||
* <p> | * <p> | ||||
* Uses {@link AbstractComponentState#captionAsHtml} to determine whether to | * Uses {@link AbstractComponentState#captionAsHtml} to determine whether to | ||||
* set the caption as html or plain text | * set the caption as html or plain text | ||||
* | |||||
* | |||||
* @since 7.4 | * @since 7.4 | ||||
* @param captionElement | * @param captionElement | ||||
* the target element | * the target element | ||||
* <p> | * <p> | ||||
* Uses {@link AbstractComponentState#captionAsHtml} to determine whether to | * Uses {@link AbstractComponentState#captionAsHtml} to determine whether to | ||||
* set the caption as html or plain text | * set the caption as html or plain text | ||||
* | |||||
* | |||||
* @since 7.4 | * @since 7.4 | ||||
* @param widget | * @param widget | ||||
* the target widget | * the target widget |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Creates a new caption wrapper panel. | * Creates a new caption wrapper panel. | ||||
* | |||||
* | |||||
* @param toBeWrapped | * @param toBeWrapped | ||||
* paintable that the caption is associated with, not null | * paintable that the caption is associated with, not null | ||||
* @param client | * @param client |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* A helper class to do some client side logging. | * A helper class to do some client side logging. | ||||
* | |||||
* | |||||
* @deprecated as of 7.1, use {@link Logger} from java.util.logging instead. | * @deprecated as of 7.1, use {@link Logger} from java.util.logging instead. | ||||
*/ | */ | ||||
@Deprecated | @Deprecated | ||||
/** | /** | ||||
* Used by ApplicationConfiguration to initialize VConsole. | * Used by ApplicationConfiguration to initialize VConsole. | ||||
* | |||||
* | |||||
* @param console | * @param console | ||||
*/ | */ | ||||
static void setImplementation(VDebugWindow console) { | static void setImplementation(VDebugWindow console) { |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* The owner must be set if the {@link VErrorMessage} is created | * The owner must be set if the {@link VErrorMessage} is created | ||||
* 'stand-alone' (not within a {@link VOverlay}), or theming might not work | * 'stand-alone' (not within a {@link VOverlay}), or theming might not work | ||||
* properly. | * properly. | ||||
* | |||||
* | |||||
* @see VOverlay#setOwner(Widget) | * @see VOverlay#setOwner(Widget) | ||||
* @param owner | * @param owner | ||||
* the owner (creator Widget) | * the owner (creator Widget) | ||||
/** | /** | ||||
* Shows this error message next to given element. | * Shows this error message next to given element. | ||||
* | |||||
* | |||||
* @param indicatorElement | * @param indicatorElement | ||||
* @deprecated As of 7.2, call and override {@link #showAt(Element)} instead | * @deprecated As of 7.2, call and override {@link #showAt(Element)} instead | ||||
*/ | */ | ||||
/** | /** | ||||
* Shows this error message next to given element. | * Shows this error message next to given element. | ||||
* | |||||
* | |||||
* @param indicatorElement | * @param indicatorElement | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
*/ | */ | ||||
public void showAt(Element indicatorElement) { | public void showAt(Element indicatorElement) { |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* {@link #trigger()} is called the indicator moves to its "triggered" state and | * {@link #trigger()} is called the indicator moves to its "triggered" state and | ||||
* then transitions from one state to the next when the timeouts specified using | * then transitions from one state to the next when the timeouts specified using | ||||
* the set*StateDelay methods occur. | * the set*StateDelay methods occur. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.1 | * @since 7.1 | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the delay (in ms) which must pass before the loading indicator | * Returns the delay (in ms) which must pass before the loading indicator | ||||
* moves into the "first" state and is shown to the user | * moves into the "first" state and is shown to the user | ||||
* | |||||
* | |||||
* @return The delay (in ms) until moving into the "first" state. Counted | * @return The delay (in ms) until moving into the "first" state. Counted | ||||
* from when {@link #trigger()} is called. | * from when {@link #trigger()} is called. | ||||
*/ | */ | ||||
/** | /** | ||||
* Sets the delay (in ms) which must pass before the loading indicator moves | * Sets the delay (in ms) which must pass before the loading indicator moves | ||||
* into the "first" state and is shown to the user | * into the "first" state and is shown to the user | ||||
* | |||||
* | |||||
* @param firstDelay | * @param firstDelay | ||||
* The delay (in ms) until moving into the "first" state. Counted | * The delay (in ms) until moving into the "first" state. Counted | ||||
* from when {@link #trigger()} is called. | * from when {@link #trigger()} is called. | ||||
/** | /** | ||||
* Returns the delay (in ms) which must pass before the loading indicator | * Returns the delay (in ms) which must pass before the loading indicator | ||||
* moves to its "second" state. | * moves to its "second" state. | ||||
* | |||||
* | |||||
* @return The delay (in ms) until the loading indicator moves into its | * @return The delay (in ms) until the loading indicator moves into its | ||||
* "second" state. Counted from when {@link #trigger()} is called. | * "second" state. Counted from when {@link #trigger()} is called. | ||||
*/ | */ | ||||
/** | /** | ||||
* Sets the delay (in ms) which must pass before the loading indicator moves | * Sets the delay (in ms) which must pass before the loading indicator moves | ||||
* to its "second" state. | * to its "second" state. | ||||
* | |||||
* | |||||
* @param secondDelay | * @param secondDelay | ||||
* The delay (in ms) until the loading indicator moves into its | * The delay (in ms) until the loading indicator moves into its | ||||
* "second" state. Counted from when {@link #trigger()} is | * "second" state. Counted from when {@link #trigger()} is | ||||
/** | /** | ||||
* Returns the delay (in ms) which must pass before the loading indicator | * Returns the delay (in ms) which must pass before the loading indicator | ||||
* moves to its "third" state. | * moves to its "third" state. | ||||
* | |||||
* | |||||
* @return The delay (in ms) until the loading indicator moves into its | * @return The delay (in ms) until the loading indicator moves into its | ||||
* "third" state. Counted from when {@link #trigger()} is called. | * "third" state. Counted from when {@link #trigger()} is called. | ||||
*/ | */ | ||||
/** | /** | ||||
* Sets the delay (in ms) which must pass before the loading indicator moves | * Sets the delay (in ms) which must pass before the loading indicator moves | ||||
* to its "third" state. | * to its "third" state. | ||||
* | |||||
* | |||||
* @param thirdDelay | * @param thirdDelay | ||||
* The delay (in ms) from the event until changing the loading | * The delay (in ms) from the event until changing the loading | ||||
* indicator into its "third" state. Counted from when | * indicator into its "third" state. Counted from when | ||||
/** | /** | ||||
* Triggers displaying of this loading indicator unless it's already visible | * Triggers displaying of this loading indicator unless it's already visible | ||||
* or scheduled to be shown after a delay. | * or scheduled to be shown after a delay. | ||||
* | |||||
* | |||||
* @since 7.4 | * @since 7.4 | ||||
*/ | */ | ||||
public void ensureTriggered() { | public void ensureTriggered() { | ||||
/** | /** | ||||
* Returns the {@link ApplicationConnection} which uses this loading | * Returns the {@link ApplicationConnection} which uses this loading | ||||
* indicator | * indicator | ||||
* | |||||
* | |||||
* @return The ApplicationConnection for this loading indicator | * @return The ApplicationConnection for this loading indicator | ||||
*/ | */ | ||||
public ApplicationConnection getConnection() { | public ApplicationConnection getConnection() { | ||||
/** | /** | ||||
* Sets the {@link ApplicationConnection} which uses this loading indicator. | * Sets the {@link ApplicationConnection} which uses this loading indicator. | ||||
* Only used internally. | * Only used internally. | ||||
* | |||||
* | |||||
* @param connection | * @param connection | ||||
* The ApplicationConnection for this loading indicator | * The ApplicationConnection for this loading indicator | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns whether or not the loading indicator is showing. | * Returns whether or not the loading indicator is showing. | ||||
* | |||||
* | |||||
* @return true if the loading indicator is visible, false otherwise | * @return true if the loading indicator is visible, false otherwise | ||||
*/ | */ | ||||
public boolean isVisible() { | public boolean isVisible() { | ||||
/** | /** | ||||
* Returns the root element of the loading indicator | * Returns the root element of the loading indicator | ||||
* | |||||
* | |||||
* @return The loading indicator DOM element | * @return The loading indicator DOM element | ||||
*/ | */ | ||||
public com.google.gwt.user.client.Element getElement() { | public com.google.gwt.user.client.Element getElement() { |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* Used to show tooltips; usually used via the singleton in | * Used to show tooltips; usually used via the singleton in | ||||
* {@link ApplicationConnection}. NOTE that #setOwner(Widget)} should be | * {@link ApplicationConnection}. NOTE that #setOwner(Widget)} should be | ||||
* called after instantiating. | * called after instantiating. | ||||
* | |||||
* | |||||
* @see ApplicationConnection#getVTooltip() | * @see ApplicationConnection#getVTooltip() | ||||
*/ | */ | ||||
public VTooltip() { | public VTooltip() { | ||||
/** | /** | ||||
* Show the tooltip with the provided info for assistive devices. | * Show the tooltip with the provided info for assistive devices. | ||||
* | |||||
* | |||||
* @param info | * @param info | ||||
* with the content of the tooltip | * with the content of the tooltip | ||||
*/ | */ | ||||
/** | /** | ||||
* Initialize the tooltip overlay for assistive devices. | * Initialize the tooltip overlay for assistive devices. | ||||
* | |||||
* | |||||
* @param info | * @param info | ||||
* with the content of the tooltip | * with the content of the tooltip | ||||
* @since 7.2.4 | * @since 7.2.4 | ||||
* element we need to clear style width of its parent DIV from old | * element we need to clear style width of its parent DIV from old | ||||
* value (in some strange cases this width=[tooltip MAX_WIDTH] after | * value (in some strange cases this width=[tooltip MAX_WIDTH] after | ||||
* tooltip text has been already updated to new shortly value: | * tooltip text has been already updated to new shortly value: | ||||
* | |||||
* | |||||
* <div class="popupContent"> <div style="width:500px;"> <div | * <div class="popupContent"> <div style="width:500px;"> <div | ||||
* class="v-errormessage" aria-hidden="true" style="display: none;"> | * class="v-errormessage" aria-hidden="true" style="display: none;"> | ||||
* <div class="gwt-HTML"> </div> </div> <div | * <div class="gwt-HTML"> </div> </div> <div | ||||
* class="v-tooltip-text">This is a short tooltip</div> </div> | * class="v-tooltip-text">This is a short tooltip</div> </div> | ||||
* | |||||
* | |||||
* and it leads to error during calculation offsetWidth (it is | * and it leads to error during calculation offsetWidth (it is | ||||
* native GWT method getSubPixelOffsetWidth()) of description | * native GWT method getSubPixelOffsetWidth()) of description | ||||
* element") | * element") | ||||
/** | /** | ||||
* Show a popup containing the currentTooltipInfo | * Show a popup containing the currentTooltipInfo | ||||
* | |||||
* | |||||
*/ | */ | ||||
private void showTooltip() { | private void showTooltip() { | ||||
if (currentTooltipInfo.hasMessage()) { | if (currentTooltipInfo.hasMessage()) { | ||||
* Return the final X-coordinate of the tooltip based on cursor | * Return the final X-coordinate of the tooltip based on cursor | ||||
* position, size of the tooltip, size of the page and necessary | * position, size of the tooltip, size of the page and necessary | ||||
* margins. | * margins. | ||||
* | |||||
* | |||||
* @param offsetWidth | * @param offsetWidth | ||||
* @return The final X-coordinate | * @return The final X-coordinate | ||||
*/ | */ | ||||
* Return the final Y-coordinate of the tooltip based on cursor | * Return the final Y-coordinate of the tooltip based on cursor | ||||
* position, size of the tooltip, size of the page and necessary | * position, size of the tooltip, size of the page and necessary | ||||
* margins. | * margins. | ||||
* | |||||
* | |||||
* @param offsetHeight | * @param offsetHeight | ||||
* @return The final y-coordinate | * @return The final y-coordinate | ||||
* | |||||
* | |||||
*/ | */ | ||||
private int getFinalY(int offsetHeight) { | private int getFinalY(int offsetHeight) { | ||||
int y = 0; | int y = 0; | ||||
* and attached to the DOM well in advance. For this reason both isShowing | * and attached to the DOM well in advance. For this reason both isShowing | ||||
* and isVisible return false positives. We can't override either of them as | * and isVisible return false positives. We can't override either of them as | ||||
* external code may depend on this behavior. | * external code may depend on this behavior. | ||||
* | |||||
* | |||||
* @return boolean | * @return boolean | ||||
*/ | */ | ||||
public boolean isTooltipOpen() { | public boolean isTooltipOpen() { | ||||
/** | /** | ||||
* Locate the tooltip for given element | * Locate the tooltip for given element | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* Element used in search | * Element used in search | ||||
* @return TooltipInfo if connector and tooltip found, null if not | * @return TooltipInfo if connector and tooltip found, null if not | ||||
/** | /** | ||||
* Handle hide event | * Handle hide event | ||||
* | |||||
* | |||||
*/ | */ | ||||
private void handleHideEvent() { | private void handleHideEvent() { | ||||
hideTooltip(); | hideTooltip(); | ||||
/** | /** | ||||
* Displays Tooltip when page is navigated with the keyboard. | * Displays Tooltip when page is navigated with the keyboard. | ||||
* | |||||
* | |||||
* Tooltip is not visible. This makes it possible for assistive devices | * Tooltip is not visible. This makes it possible for assistive devices | ||||
* to recognize the tooltip. | * to recognize the tooltip. | ||||
*/ | */ | ||||
/** | /** | ||||
* Hides Tooltip when the page is navigated with the keyboard. | * Hides Tooltip when the page is navigated with the keyboard. | ||||
* | |||||
* | |||||
* Removes the Tooltip from page to make sure assistive devices don't | * Removes the Tooltip from page to make sure assistive devices don't | ||||
* recognize it by accident. | * recognize it by accident. | ||||
*/ | */ | ||||
/** | /** | ||||
* Connects DOM handlers to widget that are needed for tooltip presentation. | * Connects DOM handlers to widget that are needed for tooltip presentation. | ||||
* | |||||
* | |||||
* @param widget | * @param widget | ||||
* Widget which DOM handlers are connected | * Widget which DOM handlers are connected | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the unique id of the tooltip element. | * Returns the unique id of the tooltip element. | ||||
* | |||||
* | |||||
* @return String containing the unique id of the tooltip, which always has | * @return String containing the unique id of the tooltip, which always has | ||||
* a value | * a value | ||||
*/ | */ | ||||
* Returns the time (in ms) the tooltip should be displayed after an event | * Returns the time (in ms) the tooltip should be displayed after an event | ||||
* that will cause it to be closed (e.g. mouse click outside the component, | * that will cause it to be closed (e.g. mouse click outside the component, | ||||
* key down). | * key down). | ||||
* | |||||
* | |||||
* @return The close timeout (in ms) | * @return The close timeout (in ms) | ||||
*/ | */ | ||||
public int getCloseTimeout() { | public int getCloseTimeout() { | ||||
* Sets the time (in ms) the tooltip should be displayed after an event that | * Sets the time (in ms) the tooltip should be displayed after an event that | ||||
* will cause it to be closed (e.g. mouse click outside the component, key | * will cause it to be closed (e.g. mouse click outside the component, key | ||||
* down). | * down). | ||||
* | |||||
* | |||||
* @param closeTimeout | * @param closeTimeout | ||||
* The close timeout (in ms) | * The close timeout (in ms) | ||||
*/ | */ | ||||
* be used instead of {@link #getOpenDelay()}. The quick open delay is used | * be used instead of {@link #getOpenDelay()}. The quick open delay is used | ||||
* when the tooltip has very recently been shown, is currently hidden but | * when the tooltip has very recently been shown, is currently hidden but | ||||
* about to be shown again. | * about to be shown again. | ||||
* | |||||
* | |||||
* @return The quick open timeout (in ms) | * @return The quick open timeout (in ms) | ||||
*/ | */ | ||||
public int getQuickOpenTimeout() { | public int getQuickOpenTimeout() { | ||||
* should be used instead of {@link #getOpenDelay()}. The quick open delay | * should be used instead of {@link #getOpenDelay()}. The quick open delay | ||||
* is used when the tooltip has very recently been shown, is currently | * is used when the tooltip has very recently been shown, is currently | ||||
* hidden but about to be shown again. | * hidden but about to be shown again. | ||||
* | |||||
* | |||||
* @param quickOpenTimeout | * @param quickOpenTimeout | ||||
* The quick open timeout (in ms) | * The quick open timeout (in ms) | ||||
*/ | */ | ||||
* Returns the time (in ms) that should elapse before a tooltip will be | * Returns the time (in ms) that should elapse before a tooltip will be | ||||
* shown, in the situation when a tooltip has very recently been shown | * shown, in the situation when a tooltip has very recently been shown | ||||
* (within {@link #getQuickOpenDelay()} ms). | * (within {@link #getQuickOpenDelay()} ms). | ||||
* | |||||
* | |||||
* @return The quick open delay (in ms) | * @return The quick open delay (in ms) | ||||
*/ | */ | ||||
public int getQuickOpenDelay() { | public int getQuickOpenDelay() { | ||||
* Sets the time (in ms) that should elapse before a tooltip will be shown, | * Sets the time (in ms) that should elapse before a tooltip will be shown, | ||||
* in the situation when a tooltip has very recently been shown (within | * in the situation when a tooltip has very recently been shown (within | ||||
* {@link #getQuickOpenDelay()} ms). | * {@link #getQuickOpenDelay()} ms). | ||||
* | |||||
* | |||||
* @param quickOpenDelay | * @param quickOpenDelay | ||||
* The quick open delay (in ms) | * The quick open delay (in ms) | ||||
*/ | */ | ||||
* tooltip showing has occurred (e.g. mouse over) before the tooltip is | * tooltip showing has occurred (e.g. mouse over) before the tooltip is | ||||
* shown. If a tooltip has recently been shown, then | * shown. If a tooltip has recently been shown, then | ||||
* {@link #getQuickOpenDelay()} is used instead of this. | * {@link #getQuickOpenDelay()} is used instead of this. | ||||
* | |||||
* | |||||
* @return The open delay (in ms) | * @return The open delay (in ms) | ||||
*/ | */ | ||||
public int getOpenDelay() { | public int getOpenDelay() { | ||||
* tooltip showing has occurred (e.g. mouse over) before the tooltip is | * tooltip showing has occurred (e.g. mouse over) before the tooltip is | ||||
* shown. If a tooltip has recently been shown, then | * shown. If a tooltip has recently been shown, then | ||||
* {@link #getQuickOpenDelay()} is used instead of this. | * {@link #getQuickOpenDelay()} is used instead of this. | ||||
* | |||||
* | |||||
* @param openDelay | * @param openDelay | ||||
* The open delay (in ms) | * The open delay (in ms) | ||||
*/ | */ | ||||
/** | /** | ||||
* Sets the maximum width of the tooltip popup. | * Sets the maximum width of the tooltip popup. | ||||
* | |||||
* | |||||
* @param maxWidth | * @param maxWidth | ||||
* The maximum width the tooltip popup (in pixels) | * The maximum width the tooltip popup (in pixels) | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the maximum width of the tooltip popup. | * Returns the maximum width of the tooltip popup. | ||||
* | |||||
* | |||||
* @return The maximum width the tooltip popup (in pixels) | * @return The maximum width the tooltip popup (in pixels) | ||||
*/ | */ | ||||
public int getMaxWidth() { | public int getMaxWidth() { |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* the License. | * the License. | ||||
*/ | */ | ||||
/** | /** | ||||
* | |||||
* | |||||
*/ | */ | ||||
package com.vaadin.client; | package com.vaadin.client; | ||||
/** | /** | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* | |||||
* | |||||
* @deprecated as of 7.1. This class was mainly used by the old debug console | * @deprecated as of 7.1. This class was mainly used by the old debug console | ||||
* but is retained for now for backwards compatibility. | * but is retained for now for backwards compatibility. | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* the License. | * the License. | ||||
*/ | */ | ||||
/** | /** | ||||
* | |||||
* | |||||
*/ | */ | ||||
package com.vaadin.client; | package com.vaadin.client; | ||||
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Abstract class mapping between {@link ComponentConnector} instances and their | * Abstract class mapping between {@link ComponentConnector} instances and their | ||||
* instances. | * instances. | ||||
* | |||||
* | |||||
* A concrete implementation of this class is generated by WidgetMapGenerator or | * A concrete implementation of this class is generated by WidgetMapGenerator or | ||||
* one of its subclasses during widgetset compilation. | * one of its subclasses during widgetset compilation. | ||||
*/ | */ | ||||
/** | /** | ||||
* Create a new instance of a connector based on its type. | * Create a new instance of a connector based on its type. | ||||
* | |||||
* | |||||
* @param classType | * @param classType | ||||
* {@link ComponentConnector} class to instantiate | * {@link ComponentConnector} class to instantiate | ||||
* @return new instance of the connector | * @return new instance of the connector | ||||
/** | /** | ||||
* Return the connector class to use for a fully qualified server side | * Return the connector class to use for a fully qualified server side | ||||
* component class name. | * component class name. | ||||
* | |||||
* | |||||
* @param fullyqualifiedName | * @param fullyqualifiedName | ||||
* fully qualified name of the server side component class | * fully qualified name of the server side component class | ||||
* @return component connector class to use | * @return component connector class to use | ||||
/** | /** | ||||
* Return the connector classes to load after the initial widgetset load and | * Return the connector classes to load after the initial widgetset load and | ||||
* start. | * start. | ||||
* | |||||
* | |||||
* @return component connector class to load after the initial widgetset | * @return component connector class to load after the initial widgetset | ||||
* loading | * loading | ||||
*/ | */ | ||||
* Make sure the code for a (deferred or lazy) component connector type has | * Make sure the code for a (deferred or lazy) component connector type has | ||||
* been loaded, triggering the load and waiting for its completion if | * been loaded, triggering the load and waiting for its completion if | ||||
* necessary. | * necessary. | ||||
* | |||||
* | |||||
* @param classType | * @param classType | ||||
* component connector class | * component connector class | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Create an uninitialized connector that best matches given UIDL. The | * Create an uninitialized connector that best matches given UIDL. The | ||||
* connector must implement {@link ServerConnector}. | * connector must implement {@link ServerConnector}. | ||||
* | |||||
* | |||||
* @param tag | * @param tag | ||||
* connector type tag for the connector to create | * connector type tag for the connector to create | ||||
* @param conf | * @param conf | ||||
* the application configuration to use when creating the | * the application configuration to use when creating the | ||||
* connector | * connector | ||||
* | |||||
* | |||||
* @return New uninitialized and unregistered connector that can paint given | * @return New uninitialized and unregistered connector that can paint given | ||||
* UIDL. | * UIDL. | ||||
*/ | */ | ||||
* Due its nature, GWT does not support dynamic classloading. To bypass this | * Due its nature, GWT does not support dynamic classloading. To bypass this | ||||
* limitation, widgetset must have function that returns Class by its fully | * limitation, widgetset must have function that returns Class by its fully | ||||
* qualified name. | * qualified name. | ||||
* | |||||
* | |||||
* @param tag | * @param tag | ||||
* @param applicationConfiguration | * @param applicationConfiguration | ||||
* @return | * @return |
/** | /** | ||||
* Helper method for debugging purposes. | * Helper method for debugging purposes. | ||||
* | |||||
* | |||||
* Stops execution on firefox browsers on a breakpoint. | * Stops execution on firefox browsers on a breakpoint. | ||||
* | |||||
* | |||||
*/ | */ | ||||
public static native void browserDebugger() | public static native void browserDebugger() | ||||
/*-{ | /*-{ | ||||
/** | /** | ||||
* Redirects the browser to the given url or refreshes the page if url is | * Redirects the browser to the given url or refreshes the page if url is | ||||
* null | * null | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @param url | * @param url | ||||
* The url to redirect to or null to refresh | * The url to redirect to or null to refresh | ||||
* Helper method for a bug fix #14041. For mozilla getKeyCode return 0 for | * Helper method for a bug fix #14041. For mozilla getKeyCode return 0 for | ||||
* space bar (because space is considered as char). If return 0 use | * space bar (because space is considered as char). If return 0 use | ||||
* getCharCode. | * getCharCode. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return return key code | * @return return key code | ||||
* @since 7.2.4 | * @since 7.2.4 | ||||
} | } | ||||
/** | /** | ||||
* | |||||
* | |||||
* Returns the topmost element of from given coordinates. | * Returns the topmost element of from given coordinates. | ||||
* | |||||
* | |||||
* TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical | * TODO fix crossplat issues clientX vs pageX. See quircksmode. Not critical | ||||
* for vaadin as we scroll div istead of page. | * for vaadin as we scroll div istead of page. | ||||
* | |||||
* | |||||
* @param x | * @param x | ||||
* @param y | * @param y | ||||
* @return the element at given coordinates | * @return the element at given coordinates | ||||
/** | /** | ||||
* Converts html entities to text. | * Converts html entities to text. | ||||
* | |||||
* | |||||
* @param html | * @param html | ||||
* @return escaped string presentation of given html | * @return escaped string presentation of given html | ||||
*/ | */ | ||||
/** | /** | ||||
* Escapes the string so it is safe to write inside an HTML attribute. | * Escapes the string so it is safe to write inside an HTML attribute. | ||||
* | |||||
* | |||||
* @param attribute | * @param attribute | ||||
* The string to escape | * The string to escape | ||||
* @return An escaped version of <literal>attribute</literal>. | * @return An escaped version of <literal>attribute</literal>. | ||||
/** | /** | ||||
* Clones given element as in JavaScript. | * Clones given element as in JavaScript. | ||||
* | |||||
* | |||||
* Deprecate this if there appears similar method into GWT someday. | * Deprecate this if there appears similar method into GWT someday. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* @param deep | * @param deep | ||||
* clone child tree also | * clone child tree also | ||||
/** | /** | ||||
* Defers the execution of {@link #runWebkitOverflowAutoFix(Element)} | * Defers the execution of {@link #runWebkitOverflowAutoFix(Element)} | ||||
* | |||||
* | |||||
* @since 7.2.6 | * @since 7.2.6 | ||||
* @param elem | * @param elem | ||||
* with overflow auto | * with overflow auto | ||||
/** | /** | ||||
* Run workaround for webkits overflow auto issue. | * Run workaround for webkits overflow auto issue. | ||||
* | |||||
* | |||||
* See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462 | * See: our bug #2138 and https://bugs.webkit.org/show_bug.cgi?id=21462 | ||||
* | |||||
* | |||||
* @param elem | * @param elem | ||||
* with overflow auto | * with overflow auto | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the border-box width for the given element, i.e. element width + | * Gets the border-box width for the given element, i.e. element width + | ||||
* border + padding. Always rounds up to nearest integer. | * border + padding. Always rounds up to nearest integer. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element to check | * The element to check | ||||
* @return The border-box width for the element | * @return The border-box width for the element | ||||
/** | /** | ||||
* Gets the border-box width for the given element, i.e. element width + | * Gets the border-box width for the given element, i.e. element width + | ||||
* border + padding. | * border + padding. | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @param element | * @param element | ||||
* The element to check | * The element to check | ||||
/** | /** | ||||
* Gets the border-box height for the given element, i.e. element height + | * Gets the border-box height for the given element, i.e. element height + | ||||
* border + padding. Always rounds up to nearest integer. | * border + padding. Always rounds up to nearest integer. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element to check | * The element to check | ||||
* @return The border-box height for the element | * @return The border-box height for the element | ||||
/** | /** | ||||
* Gets the border-box height for the given element, i.e. element height + | * Gets the border-box height for the given element, i.e. element height + | ||||
* border + padding. | * border + padding. | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @param element | * @param element | ||||
* The element to check | * The element to check | ||||
* <p> | * <p> | ||||
* In case the browser doesn't support bounding rectangles, the returned | * In case the browser doesn't support bounding rectangles, the returned | ||||
* value is the offset width. | * value is the offset width. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element of which to calculate the width | * the element of which to calculate the width | ||||
* @return the width of the element | * @return the width of the element | ||||
* <p> | * <p> | ||||
* In case the browser doesn't support bounding rectangles, the returned | * In case the browser doesn't support bounding rectangles, the returned | ||||
* value is the offset width. | * value is the offset width. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element of which to calculate the width | * the element of which to calculate the width | ||||
* @return the subpixel-accurate width of the element | * @return the subpixel-accurate width of the element | ||||
* <p> | * <p> | ||||
* In case the browser doesn't support bounding rectangles, the returned | * In case the browser doesn't support bounding rectangles, the returned | ||||
* value is the offset height. | * value is the offset height. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element of which to calculate the height | * the element of which to calculate the height | ||||
* @return the height of the element | * @return the height of the element | ||||
* <p> | * <p> | ||||
* In case the browser doesn't support bounding rectangles, the returned | * In case the browser doesn't support bounding rectangles, the returned | ||||
* value is the offset height. | * value is the offset height. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element of which to calculate the height | * the element of which to calculate the height | ||||
* @return the subpixel-accurate height of the element | * @return the subpixel-accurate height of the element | ||||
/** | /** | ||||
* Detects what is currently the overflow style attribute in given element. | * Detects what is currently the overflow style attribute in given element. | ||||
* | |||||
* | |||||
* @param pe | * @param pe | ||||
* the element to detect | * the element to detect | ||||
* @return true if auto or scroll | * @return true if auto or scroll | ||||
* A simple helper method to detect "computed style" (aka style sheets + | * A simple helper method to detect "computed style" (aka style sheets + | ||||
* element styles). Values returned differ a lot depending on browsers. | * element styles). Values returned differ a lot depending on browsers. | ||||
* Always be very careful when using this. | * Always be very careful when using this. | ||||
* | |||||
* | |||||
* @param el | * @param el | ||||
* the element from which the style property is detected | * the element from which the style property is detected | ||||
* @param p | * @param p | ||||
com.google.gwt.dom.client.Element el, String p) | com.google.gwt.dom.client.Element el, String p) | ||||
/*-{ | /*-{ | ||||
try { | try { | ||||
if (el.currentStyle) { | if (el.currentStyle) { | ||||
// IE | // IE | ||||
return el.currentStyle[p]; | return el.currentStyle[p]; | ||||
} catch (e) { | } catch (e) { | ||||
return ""; | return ""; | ||||
} | } | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
* Will (attempt) to focus the given DOM Element. | * Will (attempt) to focus the given DOM Element. | ||||
* | |||||
* | |||||
* @param el | * @param el | ||||
* the element to focus | * the element to focus | ||||
*/ | */ | ||||
try { | try { | ||||
el.focus(); | el.focus(); | ||||
} catch (e) { | } catch (e) { | ||||
} | } | ||||
}-*/; | }-*/; | ||||
* {@code C} or null, depending on whether the class parameter matches. This | * {@code C} or null, depending on whether the class parameter matches. This | ||||
* may also be the case with other Composite-like classes that hijack the | * may also be the case with other Composite-like classes that hijack the | ||||
* event handling of their child widget(s). | * event handling of their child widget(s). | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* the element where to start seeking of Widget | * the element where to start seeking of Widget | ||||
* @param class1 | * @param class1 | ||||
/** | /** | ||||
* Force webkit to redraw an element | * Force webkit to redraw an element | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element that should be redrawn | * The element that should be redrawn | ||||
*/ | */ | ||||
* Performs a hack to trigger a re-layout in the IE8. This is usually | * Performs a hack to trigger a re-layout in the IE8. This is usually | ||||
* necessary in cases where IE8 "forgets" to update child elements when they | * necessary in cases where IE8 "forgets" to update child elements when they | ||||
* resize. | * resize. | ||||
* | |||||
* | |||||
* @param e | * @param e | ||||
* The element to perform the hack on | * The element to perform the hack on | ||||
*/ | */ | ||||
* Performs a hack to trigger a re-layout in the IE browser. This is usually | * Performs a hack to trigger a re-layout in the IE browser. This is usually | ||||
* necessary in cases where IE "forgets" to update child elements when they | * necessary in cases where IE "forgets" to update child elements when they | ||||
* resize. | * resize. | ||||
* | |||||
* | |||||
* @since 7.3 | * @since 7.3 | ||||
* @param e | * @param e | ||||
* The element to perform the hack on | * The element to perform the hack on | ||||
/** | /** | ||||
* Detaches and re-attaches the element from its parent. The element is | * Detaches and re-attaches the element from its parent. The element is | ||||
* reattached at the same position in the DOM as it was before. | * reattached at the same position in the DOM as it was before. | ||||
* | |||||
* | |||||
* Does nothing if the element is not attached to the DOM. | * Does nothing if the element is not attached to the DOM. | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The element to detach and re-attach | * The element to detach and re-attach | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the index of the childElement within its parent. | * Returns the index of the childElement within its parent. | ||||
* | |||||
* | |||||
* @param subElement | * @param subElement | ||||
* @return | * @return | ||||
*/ | */ | ||||
* Temporarily sets the {@code styleProperty} to {@code tempValue} and then | * Temporarily sets the {@code styleProperty} to {@code tempValue} and then | ||||
* resets it to its current value. Used mainly to work around rendering | * resets it to its current value. Used mainly to work around rendering | ||||
* issues in IE (and possibly in other browsers) | * issues in IE (and possibly in other browsers) | ||||
* | |||||
* | |||||
* @param element | * @param element | ||||
* The target element | * The target element | ||||
* @param styleProperty | * @param styleProperty | ||||
* A helper method to return the client position from an event. Returns | * A helper method to return the client position from an event. Returns | ||||
* position from either first changed touch (if touch event) or from the | * position from either first changed touch (if touch event) or from the | ||||
* event itself. | * event itself. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return | * @return | ||||
*/ | */ | ||||
* Find the element corresponding to the coordinates in the passed mouse | * Find the element corresponding to the coordinates in the passed mouse | ||||
* event. Please note that this is not always the same as the target of the | * event. Please note that this is not always the same as the target of the | ||||
* event e.g. if event capture is used. | * event e.g. if event capture is used. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* the mouse event to get coordinates from | * the mouse event to get coordinates from | ||||
* @return the element at the coordinates of the event | * @return the element at the coordinates of the event | ||||
* A helper method to return the client position from an event. Returns | * A helper method to return the client position from an event. Returns | ||||
* position from either first changed touch (if touch event) or from the | * position from either first changed touch (if touch event) or from the | ||||
* event itself. | * event itself. | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return | * @return | ||||
*/ | */ | ||||
} | } | ||||
/** | /** | ||||
* | |||||
* | |||||
* @see #getTouchOrMouseClientY(Event) | * @see #getTouchOrMouseClientY(Event) | ||||
* @param currentGwtEvent | * @param currentGwtEvent | ||||
* @return | * @return | ||||
/** | /** | ||||
* @see #getTouchOrMouseClientX(Event) | * @see #getTouchOrMouseClientX(Event) | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return | * @return | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the currently focused element. | * Gets the currently focused element. | ||||
* | |||||
* | |||||
* @return The active element or null if no active element could be found. | * @return The active element or null if no active element could be found. | ||||
*/ | */ | ||||
public native static Element getFocusedElement() | public native static Element getFocusedElement() | ||||
if ($wnd.document.activeElement) { | if ($wnd.document.activeElement) { | ||||
return $wnd.document.activeElement; | return $wnd.document.activeElement; | ||||
} | } | ||||
return null; | return null; | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
* Gets currently focused element and checks if it's editable | * Gets currently focused element and checks if it's editable | ||||
* | |||||
* | |||||
* @since 7.4 | * @since 7.4 | ||||
* | |||||
* | |||||
* @return true if focused element is editable | * @return true if focused element is editable | ||||
*/ | */ | ||||
public static boolean isFocusedElementEditable() { | public static boolean isFocusedElementEditable() { | ||||
* this method checks that this widget nor any of its parents is hidden. Can | * this method checks that this widget nor any of its parents is hidden. Can | ||||
* be e.g used to check whether component should react to some events or | * be e.g used to check whether component should react to some events or | ||||
* not. | * not. | ||||
* | |||||
* | |||||
* @param widget | * @param widget | ||||
* @return true if attached and displayed | * @return true if attached and displayed | ||||
*/ | */ | ||||
/** | /** | ||||
* Scrolls an element into view vertically only. Modified version of | * Scrolls an element into view vertically only. Modified version of | ||||
* Element.scrollIntoView. | * Element.scrollIntoView. | ||||
* | |||||
* | |||||
* @param elem | * @param elem | ||||
* The element to scroll into view | * The element to scroll into view | ||||
*/ | */ | ||||
/*-{ | /*-{ | ||||
var top = elem.offsetTop; | var top = elem.offsetTop; | ||||
var height = elem.offsetHeight; | var height = elem.offsetHeight; | ||||
if (elem.parentNode != elem.offsetParent) { | if (elem.parentNode != elem.offsetParent) { | ||||
top -= elem.parentNode.offsetTop; | top -= elem.parentNode.offsetTop; | ||||
} | } | ||||
var cur = elem.parentNode; | var cur = elem.parentNode; | ||||
while (cur && (cur.nodeType == 1)) { | while (cur && (cur.nodeType == 1)) { | ||||
if (top < cur.scrollTop) { | if (top < cur.scrollTop) { | ||||
if (top + height > cur.scrollTop + cur.clientHeight) { | if (top + height > cur.scrollTop + cur.clientHeight) { | ||||
cur.scrollTop = (top + height) - cur.clientHeight; | cur.scrollTop = (top + height) - cur.clientHeight; | ||||
} | } | ||||
var offsetTop = cur.offsetTop; | var offsetTop = cur.offsetTop; | ||||
if (cur.parentNode != cur.offsetParent) { | if (cur.parentNode != cur.offsetParent) { | ||||
offsetTop -= cur.parentNode.offsetTop; | offsetTop -= cur.parentNode.offsetTop; | ||||
} | } | ||||
top += offsetTop - cur.scrollTop; | top += offsetTop - cur.scrollTop; | ||||
cur = cur.parentNode; | cur = cur.parentNode; | ||||
} | } | ||||
/** | /** | ||||
* Checks if the given event is either a touch event or caused by the left | * Checks if the given event is either a touch event or caused by the left | ||||
* mouse button | * mouse button | ||||
* | |||||
* | |||||
* @param event | * @param event | ||||
* @return true if the event is a touch event or caused by the left mouse | * @return true if the event is a touch event or caused by the left mouse | ||||
* button, false otherwise | * button, false otherwise | ||||
/** | /** | ||||
* Resolve a relative URL to an absolute URL based on the current document's | * Resolve a relative URL to an absolute URL based on the current document's | ||||
* location. | * location. | ||||
* | |||||
* | |||||
* @param url | * @param url | ||||
* a string with the relative URL to resolve | * a string with the relative URL to resolve | ||||
* @return the corresponding absolute URL as a string | * @return the corresponding absolute URL as a string | ||||
/** | /** | ||||
* Sets the selection range of an input element. | * Sets the selection range of an input element. | ||||
* | |||||
* | |||||
* We need this JSNI function to set selection range so that we can use the | * We need this JSNI function to set selection range so that we can use the | ||||
* optional direction attribute to set the anchor to the end and the focus | * optional direction attribute to set the anchor to the end and the focus | ||||
* to the start. This makes Firefox work the same way as other browsers | * to the start. This makes Firefox work the same way as other browsers | ||||
* (#13477) | * (#13477) | ||||
* | |||||
* | |||||
* @param elem | * @param elem | ||||
* the html input element. | * the html input element. | ||||
* @param pos | * @param pos | ||||
* a string indicating the direction in which the selection was | * a string indicating the direction in which the selection was | ||||
* performed. This may be "forward" or "backward", or "none" if | * performed. This may be "forward" or "backward", or "none" if | ||||
* the direction is unknown or irrelevant. | * the direction is unknown or irrelevant. | ||||
* | |||||
* | |||||
* @since 7.3 | * @since 7.3 | ||||
*/ | */ | ||||
public native static void setSelectionRange(Element elem, int pos, | public native static void setSelectionRange(Element elem, int pos, | ||||
/** | /** | ||||
* JavaScript hack to prevent text selection in various browsers. | * JavaScript hack to prevent text selection in various browsers. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @param e | * @param e | ||||
* element for enabling or disabling text selection | * element for enabling or disabling text selection | ||||
/** | /** | ||||
* JavaScript hack to clear text selection in various browsers. | * JavaScript hack to clear text selection in various browsers. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
*/ | */ | ||||
public native static void clearTextSelection() | public native static void clearTextSelection() | ||||
/** | /** | ||||
* Compares two double values with the error margin of | * Compares two double values with the error margin of | ||||
* {@link #PIXEL_EPSILON} (i.e. {@value #PIXEL_EPSILON}) | * {@link #PIXEL_EPSILON} (i.e. {@value #PIXEL_EPSILON}) | ||||
* | |||||
* | |||||
* @param num1 | * @param num1 | ||||
* the first value for which to compare equality | * the first value for which to compare equality | ||||
* @param num2 | * @param num2 | ||||
* the second value for which to compare equality | * the second value for which to compare equality | ||||
* @since 7.4 | * @since 7.4 | ||||
* | |||||
* | |||||
* @return true if the values are considered equals; false otherwise | * @return true if the values are considered equals; false otherwise | ||||
*/ | */ | ||||
public static boolean pixelValuesEqual(final double num1, | public static boolean pixelValuesEqual(final double num1, | ||||
* Wrap a css size value and its unit and translate back and forth to the | * Wrap a css size value and its unit and translate back and forth to the | ||||
* string representation.<br/> | * string representation.<br/> | ||||
* Eg. 50%, 123px, ... | * Eg. 50%, 123px, ... | ||||
* | |||||
* | |||||
* @since 7.2.6 | * @since 7.2.6 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
/** | /** | ||||
* Gets the unit value by its type. | * Gets the unit value by its type. | ||||
* | |||||
* | |||||
* @param type | * @param type | ||||
* the type of the unit as found in the style. | * the type of the unit as found in the style. | ||||
* @return the unit value. | * @return the unit value. | ||||
/** | /** | ||||
* Parse the size from string format to {@link CssSize}. | * Parse the size from string format to {@link CssSize}. | ||||
* | |||||
* | |||||
* @param s | * @param s | ||||
* the size as string. | * the size as string. | ||||
* @return a {@link CssSize} object. | * @return a {@link CssSize} object. | ||||
/** | /** | ||||
* Creates a {@link CssSize} using a value and its measurement unit. | * Creates a {@link CssSize} using a value and its measurement unit. | ||||
* | |||||
* | |||||
* @param value | * @param value | ||||
* the value. | * the value. | ||||
* @param unit | * @param unit | ||||
/** | /** | ||||
* Gets the value for this css size. | * Gets the value for this css size. | ||||
* | |||||
* | |||||
* @return the value. | * @return the value. | ||||
*/ | */ | ||||
public float getValue() { | public float getValue() { | ||||
/** | /** | ||||
* Gets the measurement unit for this css size. | * Gets the measurement unit for this css size. | ||||
* | |||||
* | |||||
* @return the unit. | * @return the unit. | ||||
*/ | */ | ||||
public Unit getUnit() { | public Unit getUnit() { | ||||
/** | /** | ||||
* Check whether the two sizes are equals. | * Check whether the two sizes are equals. | ||||
* | |||||
* | |||||
* @param cssSize1 | * @param cssSize1 | ||||
* the first size to compare. | * the first size to compare. | ||||
* @param cssSize2 | * @param cssSize2 | ||||
* <p> | * <p> | ||||
* The value is determined using computed style when available and | * The value is determined using computed style when available and | ||||
* calculated otherwise. | * calculated otherwise. | ||||
* | |||||
* | |||||
* @since 7.5.0 | * @since 7.5.0 | ||||
* @param element | * @param element | ||||
* the element to measure | * the element to measure | ||||
* <p> | * <p> | ||||
* The value is determined using computed style when available and | * The value is determined using computed style when available and | ||||
* calculated otherwise. | * calculated otherwise. | ||||
* | |||||
* | |||||
* @since 7.5.0 | * @since 7.5.0 | ||||
* @param element | * @param element | ||||
* the element to measure | * the element to measure | ||||
* <p> | * <p> | ||||
* The value is determined using computed style when available and | * The value is determined using computed style when available and | ||||
* calculated otherwise. | * calculated otherwise. | ||||
* | |||||
* | |||||
* @since 7.5.0 | * @since 7.5.0 | ||||
* @param element | * @param element | ||||
* the element to measure | * the element to measure | ||||
* <p> | * <p> | ||||
* The value is determined using computed style when available and | * The value is determined using computed style when available and | ||||
* calculated otherwise. | * calculated otherwise. | ||||
* | |||||
* | |||||
* @since 7.5.0 | * @since 7.5.0 | ||||
* @param element | * @param element | ||||
* the element to measure | * the element to measure | ||||
* <p> | * <p> | ||||
* The value is determined using computed style when available and | * The value is determined using computed style when available and | ||||
* calculated otherwise. | * calculated otherwise. | ||||
* | |||||
* | |||||
* @since 7.5.0 | * @since 7.5.0 | ||||
* @param element | * @param element | ||||
* the element to measure | * the element to measure | ||||
* <p> | * <p> | ||||
* The value is determined using computed style when available and | * The value is determined using computed style when available and | ||||
* calculated otherwise. | * calculated otherwise. | ||||
* | |||||
* | |||||
* @since 7.5.0 | * @since 7.5.0 | ||||
* @param element | * @param element | ||||
* the element to measure | * the element to measure | ||||
} | } | ||||
var heightWithoutBorder = cloneElement.offsetHeight; | var heightWithoutBorder = cloneElement.offsetHeight; | ||||
parentElement.removeChild(cloneElement); | parentElement.removeChild(cloneElement); | ||||
return heightWithBorder - heightWithoutBorder; | return heightWithBorder - heightWithoutBorder; | ||||
} | } | ||||
}-*/; | }-*/; | ||||
/** | /** | ||||
* Rounds the given size up to a value which the browser will accept. | * Rounds the given size up to a value which the browser will accept. | ||||
* | |||||
* | |||||
* Safari/WebKit uses 1/64th of a pixel to enable using integer math | * Safari/WebKit uses 1/64th of a pixel to enable using integer math | ||||
* (http://trac.webkit.org/wiki/LayoutUnit). | * (http://trac.webkit.org/wiki/LayoutUnit). | ||||
* | |||||
* | |||||
* Firefox uses 1/60th of a pixel because it is divisible by three | * Firefox uses 1/60th of a pixel because it is divisible by three | ||||
* (https://bugzilla.mozilla.org/show_bug.cgi?id=1070940) | * (https://bugzilla.mozilla.org/show_bug.cgi?id=1070940) | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @param size | * @param size | ||||
* the value to round | * the value to round | ||||
/** | /** | ||||
* Rounds the given size down to a value which the browser will accept. | * Rounds the given size down to a value which the browser will accept. | ||||
* | |||||
* | |||||
* Safari/WebKit uses 1/64th of a pixel to enable using integer math | * Safari/WebKit uses 1/64th of a pixel to enable using integer math | ||||
* (http://trac.webkit.org/wiki/LayoutUnit). | * (http://trac.webkit.org/wiki/LayoutUnit). | ||||
* | |||||
* | |||||
* Firefox uses 1/60th of a pixel because it is divisible by three | * Firefox uses 1/60th of a pixel because it is divisible by three | ||||
* (https://bugzilla.mozilla.org/show_bug.cgi?id=1070940) | * (https://bugzilla.mozilla.org/show_bug.cgi?id=1070940) | ||||
* | |||||
* | |||||
* IE9+ uses 1/100th of a pixel | * IE9+ uses 1/100th of a pixel | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @param size | * @param size | ||||
* the value to round | * the value to round | ||||
/** | /** | ||||
* Returns the factor used by browsers to round subpixel values | * Returns the factor used by browsers to round subpixel values | ||||
* | |||||
* | |||||
* @since 7.5.1 | * @since 7.5.1 | ||||
* @return the factor N used by the browser when storing subpixels as X+Y/N | * @return the factor N used by the browser when storing subpixels as X+Y/N | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* <p> | * <p> | ||||
* If there is no state variable with the provided name, the widgetset | * If there is no state variable with the provided name, the widgetset | ||||
* compilation will fail. | * compilation will fail. | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
public @interface OnStateChange { | public @interface OnStateChange { | ||||
/** | /** | ||||
* Defines a list of property names to listen for. | * Defines a list of property names to listen for. | ||||
* | |||||
* | |||||
* @return an array of property names, should contain at least one item | * @return an array of property names, should contain at least one item | ||||
*/ | */ | ||||
public String[] value(); | public String[] value(); |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Sends this event to the given handler. | * Sends this event to the given handler. | ||||
* | |||||
* | |||||
* @param handler | * @param handler | ||||
* The handler to dispatch. | * The handler to dispatch. | ||||
*/ | */ |
/** | /** | ||||
* The default {@link PushConnection} implementation that uses Atmosphere for | * The default {@link PushConnection} implementation that uses Atmosphere for | ||||
* handling the communication channel. | * handling the communication channel. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.1 | * @since 7.1 | ||||
*/ | */ | ||||
/* | /* | ||||
* (non-Javadoc) | * (non-Javadoc) | ||||
* | |||||
* | |||||
* @see | * @see | ||||
* com.vaadin.client.communication.PushConnection#init(ApplicationConnection | * com.vaadin.client.communication.PushConnection#init(ApplicationConnection | ||||
* , Map<String, String>, CommunicationErrorHandler) | * , Map<String, String>, CommunicationErrorHandler) | ||||
/** | /** | ||||
* Called whenever a server push connection is established (or | * Called whenever a server push connection is established (or | ||||
* re-established). | * re-established). | ||||
* | |||||
* | |||||
* @param response | * @param response | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
*/ | */ | ||||
protected void onConnect(AtmosphereResponse response) { | protected void onConnect(AtmosphereResponse response) { | ||||
/* | /* | ||||
* (non-Javadoc) | * (non-Javadoc) | ||||
* | |||||
* | |||||
* @see com.vaadin.client.communication.PushConenction#disconnect() | * @see com.vaadin.client.communication.PushConenction#disconnect() | ||||
*/ | */ | ||||
@Override | @Override | ||||
/** | /** | ||||
* Called if the push connection fails. Atmosphere will automatically retry | * Called if the push connection fails. Atmosphere will automatically retry | ||||
* the connection until successful. | * the connection until successful. | ||||
* | |||||
* | |||||
*/ | */ | ||||
protected void onError(AtmosphereResponse response) { | protected void onError(AtmosphereResponse response) { | ||||
state = State.DISCONNECTED; | state = State.DISCONNECTED; | ||||
JavaScriptObject config) | JavaScriptObject config) | ||||
/*-{ | /*-{ | ||||
var self = this; | var self = this; | ||||
config.url = uri; | config.url = uri; | ||||
config.onOpen = $entry(function(response) { | config.onOpen = $entry(function(response) { | ||||
self.@com.vaadin.client.communication.AtmospherePushConnection::onOpen(*)(response); | self.@com.vaadin.client.communication.AtmospherePushConnection::onOpen(*)(response); | ||||
config.onClientTimeout = $entry(function(request) { | config.onClientTimeout = $entry(function(request) { | ||||
self.@com.vaadin.client.communication.AtmospherePushConnection::onClientTimeout(*)(request); | self.@com.vaadin.client.communication.AtmospherePushConnection::onClientTimeout(*)(request); | ||||
}); | }); | ||||
return $wnd.vaadinPush.atmosphere.subscribe(config); | return $wnd.vaadinPush.atmosphere.subscribe(config); | ||||
}-*/; | }-*/; | ||||
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Interface for handling problems and other events which occur during | * Interface for handling problems and other events which occur during | ||||
* communication with the server. | * communication with the server. | ||||
* | |||||
* | |||||
* The handler is responsible for handling any problem in XHR, heartbeat and | * The handler is responsible for handling any problem in XHR, heartbeat and | ||||
* push connections in a way it sees fit. The default implementation is | * push connections in a way it sees fit. The default implementation is | ||||
* {@link DefaultConnectionStateHandler}. | * {@link DefaultConnectionStateHandler}. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
/** | /** | ||||
* Called when an exception occurs during a {@link Heartbeat} request | * Called when an exception occurs during a {@link Heartbeat} request | ||||
* | |||||
* | |||||
* @param request | * @param request | ||||
* The heartbeat request | * The heartbeat request | ||||
* @param exception | * @param exception | ||||
/** | /** | ||||
* Called when a heartbeat request returns a status code other than OK (200) | * Called when a heartbeat request returns a status code other than OK (200) | ||||
* | |||||
* | |||||
* @param request | * @param request | ||||
* The heartbeat request | * The heartbeat request | ||||
* @param response | * @param response | ||||
* result in the push connection trying a fallback connection method, trying | * result in the push connection trying a fallback connection method, trying | ||||
* to reconnect to the server or might just be an indication that the | * to reconnect to the server or might just be an indication that the | ||||
* connection was intentionally closed ("unsubscribe"), | * connection was intentionally closed ("unsubscribe"), | ||||
* | |||||
* | |||||
* @param pushConnection | * @param pushConnection | ||||
* The push connection which was closed | * The push connection which was closed | ||||
* @param response | * @param response | ||||
/** | /** | ||||
* Called when a client side timeout occurs before a push connection to the | * Called when a client side timeout occurs before a push connection to the | ||||
* server completes. | * server completes. | ||||
* | |||||
* | |||||
* The client side timeout causes a disconnection of the push connection and | * The client side timeout causes a disconnection of the push connection and | ||||
* no reconnect will be attempted after this method is called, | * no reconnect will be attempted after this method is called, | ||||
* | |||||
* | |||||
* @param pushConnection | * @param pushConnection | ||||
* The push connection which timed out | * The push connection which timed out | ||||
* @param response | * @param response | ||||
/** | /** | ||||
* Called when a fatal error fatal error occurs in the push connection. | * Called when a fatal error fatal error occurs in the push connection. | ||||
* | |||||
* | |||||
* The push connection will not try to recover from this situation itself | * The push connection will not try to recover from this situation itself | ||||
* and typically the problem handler should not try to do automatic recovery | * and typically the problem handler should not try to do automatic recovery | ||||
* either. The cause can be e.g. maximum number of reconnection attempts | * either. The cause can be e.g. maximum number of reconnection attempts | ||||
* have been reached, neither the selected transport nor the fallback | * have been reached, neither the selected transport nor the fallback | ||||
* transport can be used or similar. | * transport can be used or similar. | ||||
* | |||||
* | |||||
* @param pushConnection | * @param pushConnection | ||||
* The push connection where the error occurred | * The push connection where the error occurred | ||||
* @param response | * @param response | ||||
/** | /** | ||||
* Called when the push connection has lost the connection to the server and | * Called when the push connection has lost the connection to the server and | ||||
* will proceed to try to re-establish the connection | * will proceed to try to re-establish the connection | ||||
* | |||||
* | |||||
* @param pushConnection | * @param pushConnection | ||||
* The push connection which will be reconnected | * The push connection which will be reconnected | ||||
*/ | */ | ||||
/** | /** | ||||
* Called when the push connection to the server has been established. | * Called when the push connection to the server has been established. | ||||
* | |||||
* | |||||
* @param pushConnection | * @param pushConnection | ||||
* The push connection which was established | * The push connection which was established | ||||
*/ | */ | ||||
/** | /** | ||||
* Called when the required push script could not be loaded | * Called when the required push script could not be loaded | ||||
* | |||||
* | |||||
* @param resourceUrl | * @param resourceUrl | ||||
* The URL which was used for loading the script | * The URL which was used for loading the script | ||||
*/ | */ | ||||
/** | /** | ||||
* Called when an exception occurs during an XmlHttpRequest request to the | * Called when an exception occurs during an XmlHttpRequest request to the | ||||
* server. | * server. | ||||
* | |||||
* | |||||
* @param xhrConnectionError | * @param xhrConnectionError | ||||
* An event containing what was being sent to the server and what | * An event containing what was being sent to the server and what | ||||
* exception occurred | * exception occurred | ||||
/** | /** | ||||
* Called when invalid content (not JSON) was returned from the server as | * Called when invalid content (not JSON) was returned from the server as | ||||
* the result of an XmlHttpRequest request | * the result of an XmlHttpRequest request | ||||
* | |||||
* | |||||
* @param communicationProblemEvent | * @param communicationProblemEvent | ||||
* An event containing what was being sent to the server and what | * An event containing what was being sent to the server and what | ||||
* was returned | * was returned | ||||
/** | /** | ||||
* Called when invalid status code (not 200) was returned by the server as | * Called when invalid status code (not 200) was returned by the server as | ||||
* the result of an XmlHttpRequest. | * the result of an XmlHttpRequest. | ||||
* | |||||
* | |||||
* @param communicationProblemEvent | * @param communicationProblemEvent | ||||
* An event containing what was being sent to the server and what | * An event containing what was being sent to the server and what | ||||
* was returned | * was returned | ||||
/** | /** | ||||
* Called when a message is to be sent to the server through the push | * Called when a message is to be sent to the server through the push | ||||
* channel but the push channel is not connected | * channel but the push channel is not connected | ||||
* | |||||
* | |||||
* @param payload | * @param payload | ||||
* The payload to send to the server | * The payload to send to the server | ||||
*/ | */ | ||||
/** | /** | ||||
* Called when invalid content (not JSON) was pushed from the server through | * Called when invalid content (not JSON) was pushed from the server through | ||||
* the push connection | * the push connection | ||||
* | |||||
* | |||||
* @param communicationProblemEvent | * @param communicationProblemEvent | ||||
* An event containing what was being sent to the server and what | * An event containing what was being sent to the server and what | ||||
* was returned | * was returned |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Client side serializer/deserializer for java.util.Date | * Client side serializer/deserializer for java.util.Date | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* <p> | * <p> | ||||
* Handles permanent errors by showing a critical system notification to the | * Handles permanent errors by showing a critical system notification to the | ||||
* user | * user | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
/** | /** | ||||
* Checks if this type is of higher priority than the given type | * Checks if this type is of higher priority than the given type | ||||
* | |||||
* | |||||
* @param type | * @param type | ||||
* the type to compare to | * the type to compare to | ||||
* @return true if this type has higher priority than the given type, | * @return true if this type has higher priority than the given type, | ||||
/** | /** | ||||
* Checks if we are currently trying to reconnect | * Checks if we are currently trying to reconnect | ||||
* | |||||
* | |||||
* @return true if we have noted a problem and are trying to re-establish | * @return true if we have noted a problem and are trying to re-establish | ||||
* server connection, false otherwise | * server connection, false otherwise | ||||
*/ | */ | ||||
/** | /** | ||||
* Returns the connection this handler is connected to | * Returns the connection this handler is connected to | ||||
* | |||||
* | |||||
* @return the connection for this handler | * @return the connection for this handler | ||||
*/ | */ | ||||
protected ApplicationConnection getConnection() { | protected ApplicationConnection getConnection() { | ||||
* Called whenever an error occurs in communication which should be handled | * Called whenever an error occurs in communication which should be handled | ||||
* by showing the reconnect dialog and retrying communication until | * by showing the reconnect dialog and retrying communication until | ||||
* successful again | * successful again | ||||
* | |||||
* | |||||
* @param type | * @param type | ||||
* The type of failure detected | * The type of failure detected | ||||
* @param payload | * @param payload | ||||
/** | /** | ||||
* Called after a problem occurred. | * Called after a problem occurred. | ||||
* | |||||
* | |||||
* This method is responsible for re-sending the payload to the server (if | * This method is responsible for re-sending the payload to the server (if | ||||
* not null) or re-send a heartbeat request at some point | * not null) or re-send a heartbeat request at some point | ||||
* | |||||
* | |||||
* @param payload | * @param payload | ||||
* the payload that did not reach the server, null if the problem | * the payload that did not reach the server, null if the problem | ||||
* was detected by a heartbeat | * was detected by a heartbeat | ||||
/** | /** | ||||
* Re-sends the payload to the server (if not null) or re-sends a heartbeat | * Re-sends the payload to the server (if not null) or re-sends a heartbeat | ||||
* request immediately | * request immediately | ||||
* | |||||
* | |||||
* @param payload | * @param payload | ||||
* the payload that did not reach the server, null if the problem | * the payload that did not reach the server, null if the problem | ||||
* was detected by a heartbeat | * was detected by a heartbeat | ||||
/** | /** | ||||
* Called when we should give up trying to reconnect and let the user decide | * Called when we should give up trying to reconnect and let the user decide | ||||
* how to continue | * how to continue | ||||
* | |||||
* | |||||
*/ | */ | ||||
protected void giveUp() { | protected void giveUp() { | ||||
reconnectionCause = null; | reconnectionCause = null; | ||||
/** | /** | ||||
* Checks if the reconnect dialog is visible to the user | * Checks if the reconnect dialog is visible to the user | ||||
* | |||||
* | |||||
* @return true if the user can see the dialog, false otherwise | * @return true if the user can see the dialog, false otherwise | ||||
*/ | */ | ||||
protected boolean isDialogVisible() { | protected boolean isDialogVisible() { | ||||
/** | /** | ||||
* Gets the text to show in the reconnect dialog after giving up (reconnect | * Gets the text to show in the reconnect dialog after giving up (reconnect | ||||
* limit reached) | * limit reached) | ||||
* | |||||
* | |||||
* @param reconnectAttempt | * @param reconnectAttempt | ||||
* The number of the current reconnection attempt | * The number of the current reconnection attempt | ||||
* @return The text to show in the reconnect dialog after giving up | * @return The text to show in the reconnect dialog after giving up | ||||
/** | /** | ||||
* Gets the text to show in the reconnect dialog | * Gets the text to show in the reconnect dialog | ||||
* | |||||
* | |||||
* @param reconnectAttempt | * @param reconnectAttempt | ||||
* The number of the current reconnection attempt | * The number of the current reconnection attempt | ||||
* @return The text to show in the reconnect dialog | * @return The text to show in the reconnect dialog |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* The default implementation of the reconnect dialog | * The default implementation of the reconnect dialog | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
public interface DiffJSONSerializer<T> extends JSONSerializer<T> { | public interface DiffJSONSerializer<T> extends JSONSerializer<T> { | ||||
/** | /** | ||||
* Update the target object in place based on the passed JSON data. | * Update the target object in place based on the passed JSON data. | ||||
* | |||||
* | |||||
* @param target | * @param target | ||||
* @param jsonValue | * @param jsonValue | ||||
* @param connection | * @param connection |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Handles sending of heartbeats to the server and reacting to the response | * Handles sending of heartbeats to the server and reacting to the response | ||||
* | |||||
* | |||||
* @since 7.2 | * @since 7.2 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
/** | /** | ||||
* Initializes the heartbeat for the given application connection | * Initializes the heartbeat for the given application connection | ||||
* | |||||
* | |||||
* @param connection | * @param connection | ||||
* the connection | * the connection | ||||
*/ | */ | ||||
/** | /** | ||||
* Changes the heartbeatInterval in runtime and applies it. | * Changes the heartbeatInterval in runtime and applies it. | ||||
* | |||||
* | |||||
* @param heartbeatInterval | * @param heartbeatInterval | ||||
* new interval in seconds. | * new interval in seconds. | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* <p> | * <p> | ||||
* This is the client side interface, see | * This is the client side interface, see | ||||
* com.vaadin.server.communication.JSONSerializer for the server side interface. | * com.vaadin.server.communication.JSONSerializer for the server side interface. | ||||
* | |||||
* | |||||
* @since 7.0 | * @since 7.0 | ||||
*/ | */ | ||||
public interface JSONSerializer<T> { | public interface JSONSerializer<T> { | ||||
* Creates and deserializes an object received from the server. Must be | * Creates and deserializes an object received from the server. Must be | ||||
* compatible with {@link #serialize(Object, ApplicationConnection)} and | * compatible with {@link #serialize(Object, ApplicationConnection)} and | ||||
* also with the server side JsonCodec.encode method. | * also with the server side JsonCodec.encode method. | ||||
* | |||||
* | |||||
* @param type | * @param type | ||||
* the type to deserialize | * the type to deserialize | ||||
* @param jsonValue | * @param jsonValue | ||||
* JSON map from property name to property value | * JSON map from property name to property value | ||||
* @param connection | * @param connection | ||||
* the application connection providing the context | * the application connection providing the context | ||||
* | |||||
* | |||||
* @return A deserialized object | * @return A deserialized object | ||||
*/ | */ | ||||
T deserialize(Type type, JsonValue jsonValue, | T deserialize(Type type, JsonValue jsonValue, | ||||
* Serialize the given object into JSON. Must be compatible with | * Serialize the given object into JSON. Must be compatible with | ||||
* {@link #deserialize(Type, JsonValue, ApplicationConnection)} and also | * {@link #deserialize(Type, JsonValue, ApplicationConnection)} and also | ||||
* with the server side JsonCodec.decodeCustomType method. | * with the server side JsonCodec.decodeCustomType method. | ||||
* | |||||
* | |||||
* @param value | * @param value | ||||
* The object to serialize | * The object to serialize | ||||
* @param connection | * @param connection |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* A {@link MethodInvocation} that originates from JavaScript. This means that | * A {@link MethodInvocation} that originates from JavaScript. This means that | ||||
* there might not be any type information available on the client. | * there might not be any type information available on the client. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.0.0 | * @since 7.0.0 | ||||
*/ | */ |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
/** | /** | ||||
* Encoder for converting RPC parameters and other values to JSON for transfer | * Encoder for converting RPC parameters and other values to JSON for transfer | ||||
* between the client and the server. | * between the client and the server. | ||||
* | |||||
* | |||||
* Currently, basic data types as well as Map, String[] and Object[] are | * Currently, basic data types as well as Map, String[] and Object[] are | ||||
* supported, where maps and Object[] can contain other supported data types. | * supported, where maps and Object[] can contain other supported data types. | ||||
* | |||||
* | |||||
* TODO extensible type support | * TODO extensible type support | ||||
* | |||||
* | |||||
* @since 7.0 | * @since 7.0 | ||||
*/ | */ | ||||
public class JsonEncoder { | public class JsonEncoder { | ||||
/** | /** | ||||
* Encode a value to a JSON representation for transport from the client to | * Encode a value to a JSON representation for transport from the client to | ||||
* the server. | * the server. | ||||
* | |||||
* | |||||
* @param value | * @param value | ||||
* value to convert | * value to convert | ||||
* @param connection | * @param connection | ||||
/** | /** | ||||
* Returns the transport type for the given value. Only returns a transport | * Returns the transport type for the given value. Only returns a transport | ||||
* type for internally handled values. | * type for internally handled values. | ||||
* | |||||
* | |||||
* @param value | * @param value | ||||
* The value that should be transported | * The value that should be transported | ||||
* @return One of the JsonEncode.VTYPE_ constants or null if the value | * @return One of the JsonEncode.VTYPE_ constants or null if the value |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* A MessageHandler is responsible for handling all incoming messages (JSON) | * A MessageHandler is responsible for handling all incoming messages (JSON) | ||||
* from the server (state changes, RPCs and other updates) and ensuring that the | * from the server (state changes, RPCs and other updates) and ensuring that the | ||||
* connectors are updated accordingly. | * connectors are updated accordingly. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
* has not yet been rendered (or that your browser is very fast). -1 means | * has not yet been rendered (or that your browser is very fast). -1 means | ||||
* that the browser does not support the performance.timing feature used to | * that the browser does not support the performance.timing feature used to | ||||
* get this measurement. | * get this measurement. | ||||
* | |||||
* | |||||
* Note: also used for tracking whether the first UIDL has been handled | * Note: also used for tracking whether the first UIDL has been handled | ||||
*/ | */ | ||||
private int bootstrapTime = 0; | private int bootstrapTime = 0; | ||||
/** | /** | ||||
* Sets the application connection this instance is connected to. Called | * Sets the application connection this instance is connected to. Called | ||||
* internally by the framework. | * internally by the framework. | ||||
* | |||||
* | |||||
* @param connection | * @param connection | ||||
* the application connection this instance is connected to | * the application connection this instance is connected to | ||||
*/ | */ | ||||
/** | /** | ||||
* Handles a received UIDL JSON text, parsing it, and passing it on to the | * Handles a received UIDL JSON text, parsing it, and passing it on to the | ||||
* appropriate handlers, while logging timing information. | * appropriate handlers, while logging timing information. | ||||
* | |||||
* | |||||
* @param jsonText | * @param jsonText | ||||
* The JSON to handle | * The JSON to handle | ||||
*/ | */ | ||||
/** | /** | ||||
* Sends the state change events created while updating the state | * Sends the state change events created while updating the state | ||||
* information. | * information. | ||||
* | |||||
* | |||||
* This must be called after hierarchy change listeners have been | * This must be called after hierarchy change listeners have been | ||||
* called. At least caption updates for the parent are strange if | * called. At least caption updates for the parent are strange if | ||||
* fired from state change listeners and thus calls the parent | * fired from state change listeners and thus calls the parent | ||||
* BEFORE the parent is aware of the child (through a | * BEFORE the parent is aware of the child (through a | ||||
* ConnectorHierarchyChangedEvent) | * ConnectorHierarchyChangedEvent) | ||||
* | |||||
* | |||||
* @param pendingStateChangeEvents | * @param pendingStateChangeEvents | ||||
* The events to send | * The events to send | ||||
*/ | */ | ||||
* Updates the connector hierarchy and returns a list of events that | * Updates the connector hierarchy and returns a list of events that | ||||
* should be fired after update of the hierarchy and the state is | * should be fired after update of the hierarchy and the state is | ||||
* done. | * done. | ||||
* | |||||
* | |||||
* @param json | * @param json | ||||
* The JSON containing the hierarchy information | * The JSON containing the hierarchy information | ||||
* @return A collection of events that should be fired when update | * @return A collection of events that should be fired when update | ||||
/** | /** | ||||
* Updates the hierarchy for a connector | * Updates the hierarchy for a connector | ||||
* | |||||
* | |||||
* @param connectorId | * @param connectorId | ||||
* the id of the connector to update | * the id of the connector to update | ||||
* @param childConnectorIds | * @param childConnectorIds | ||||
/** | /** | ||||
* This method can be used to postpone rendering of a response for a short | * This method can be used to postpone rendering of a response for a short | ||||
* period of time (e.g. to avoid the rendering process during animation). | * period of time (e.g. to avoid the rendering process during animation). | ||||
* | |||||
* | |||||
* @param lock | * @param lock | ||||
*/ | */ | ||||
public void suspendReponseHandling(Object lock) { | public void suspendReponseHandling(Object lock) { | ||||
/** | /** | ||||
* Resumes the rendering process once all locks have been removed. | * Resumes the rendering process once all locks have been removed. | ||||
* | |||||
* | |||||
* @param lock | * @param lock | ||||
*/ | */ | ||||
public void resumeResponseHandling(Object lock) { | public void resumeResponseHandling(Object lock) { | ||||
/** | /** | ||||
* Finds the next pending UIDL message and handles it (next pending is | * Finds the next pending UIDL message and handles it (next pending is | ||||
* decided based on the server id) | * decided based on the server id) | ||||
* | |||||
* | |||||
* @return true if a message was handled, false otherwise | * @return true if a message was handled, false otherwise | ||||
*/ | */ | ||||
private boolean handlePendingMessages() { | private boolean handlePendingMessages() { | ||||
* server is received. | * server is received. | ||||
* <p> | * <p> | ||||
* The initial id when no request has yet been processed is -1. | * The initial id when no request has yet been processed is -1. | ||||
* | |||||
* | |||||
* @return an id identifying the response | * @return an id identifying the response | ||||
*/ | */ | ||||
public int getLastSeenServerSyncId() { | public int getLastSeenServerSyncId() { | ||||
/** | /** | ||||
* Gets the token (aka double submit cookie) that the server uses to protect | * Gets the token (aka double submit cookie) that the server uses to protect | ||||
* against Cross Site Request Forgery attacks. | * against Cross Site Request Forgery attacks. | ||||
* | |||||
* | |||||
* @return the CSRF token string | * @return the CSRF token string | ||||
*/ | */ | ||||
public String getCsrfToken() { | public String getCsrfToken() { | ||||
* operations are not allowed when the internal state of the application | * operations are not allowed when the internal state of the application | ||||
* might be in an inconsistent state because some state changes have been | * might be in an inconsistent state because some state changes have been | ||||
* applied but others not. This includes running layotus. | * applied but others not. This includes running layotus. | ||||
* | |||||
* | |||||
* @return <code>true</code> if the internal state might be inconsistent | * @return <code>true</code> if the internal state might be inconsistent | ||||
* because changes are being processed; <code>false</code> if the | * because changes are being processed; <code>false</code> if the | ||||
* state should be consistent | * state should be consistent | ||||
/** | /** | ||||
* Checks if the first UIDL has been handled | * Checks if the first UIDL has been handled | ||||
* | |||||
* | |||||
* @return true if the initial UIDL has already been processed, false | * @return true if the initial UIDL has already been processed, false | ||||
* otherwise | * otherwise | ||||
*/ | */ | ||||
/** | /** | ||||
* Strips the JSON wrapping from the given json string with wrapping. | * Strips the JSON wrapping from the given json string with wrapping. | ||||
* | |||||
* | |||||
* If the given string is not wrapped as expected, returns null | * If the given string is not wrapped as expected, returns null | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @param jsonWithWrapping | * @param jsonWithWrapping | ||||
* the JSON received from the server | * the JSON received from the server | ||||
/** | /** | ||||
* Unwraps and parses the given JSON, originating from the server | * Unwraps and parses the given JSON, originating from the server | ||||
* | |||||
* | |||||
* @param jsonText | * @param jsonText | ||||
* the json from the server | * the json from the server | ||||
* @return A parsed ValueMap or null if the input could not be parsed (or | * @return A parsed ValueMap or null if the input could not be parsed (or | ||||
/** | /** | ||||
* Parse the given wrapped JSON, received from the server, to a ValueMap | * Parse the given wrapped JSON, received from the server, to a ValueMap | ||||
* | |||||
* | |||||
* @param wrappedJsonText | * @param wrappedJsonText | ||||
* the json, wrapped as done by the server | * the json, wrapped as done by the server | ||||
* @return a ValueMap, or null if the wrapping was incorrect or json could | * @return a ValueMap, or null if the wrapping was incorrect or json could |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* <p> | * <p> | ||||
* Internally uses {@link XhrConnection} and/or {@link PushConnection} for | * Internally uses {@link XhrConnection} and/or {@link PushConnection} for | ||||
* delivering messages, depending on the application configuration. | * delivering messages, depending on the application configuration. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
*/ | */ | ||||
/** | /** | ||||
* Sends all pending method invocations (server RPC and legacy variable | * Sends all pending method invocations (server RPC and legacy variable | ||||
* changes) to the server. | * changes) to the server. | ||||
* | |||||
* | |||||
*/ | */ | ||||
private void doSendInvocationsToServer() { | private void doSendInvocationsToServer() { | ||||
/** | /** | ||||
* Makes an UIDL request to the server. | * Makes an UIDL request to the server. | ||||
* | |||||
* | |||||
* @param reqInvocations | * @param reqInvocations | ||||
* Data containing RPC invocations and all related information. | * Data containing RPC invocations and all related information. | ||||
* @param extraParams | * @param extraParams | ||||
/** | /** | ||||
* Sends an asynchronous or synchronous UIDL request to the server using the | * Sends an asynchronous or synchronous UIDL request to the server using the | ||||
* given URI. | * given URI. | ||||
* | |||||
* | |||||
* @param uri | * @param uri | ||||
* The URI to use for the request. May includes GET parameters | * The URI to use for the request. May includes GET parameters | ||||
* @param payload | * @param payload | ||||
/** | /** | ||||
* Sets the status for the push connection. | * Sets the status for the push connection. | ||||
* | |||||
* | |||||
* @param enabled | * @param enabled | ||||
* <code>true</code> to enable the push connection; | * <code>true</code> to enable the push connection; | ||||
* <code>false</code> to disable the push connection. | * <code>false</code> to disable the push connection. | ||||
/** | /** | ||||
* Runs possibly registered client side post request hooks. This is expected | * Runs possibly registered client side post request hooks. This is expected | ||||
* to be run after each uidl request made by Vaadin application. | * to be run after each uidl request made by Vaadin application. | ||||
* | |||||
* | |||||
* @param appId | * @param appId | ||||
*/ | */ | ||||
public static native void runPostRequestHooks(String appId) | public static native void runPostRequestHooks(String appId) | ||||
/** | /** | ||||
* If on Liferay and logged in, ask the client side session management | * If on Liferay and logged in, ask the client side session management | ||||
* JavaScript to extend the session duration. | * JavaScript to extend the session duration. | ||||
* | |||||
* | |||||
* Otherwise, Liferay client side JavaScript will explicitly expire the | * Otherwise, Liferay client side JavaScript will explicitly expire the | ||||
* session even though the server side considers the session to be active. | * session even though the server side considers the session to be active. | ||||
* See ticket #8305 for more information. | * See ticket #8305 for more information. | ||||
/** | /** | ||||
* Indicates whether or not there are currently active UIDL requests. Used | * Indicates whether or not there are currently active UIDL requests. Used | ||||
* internally to sequence requests properly, seldom needed in Widgets. | * internally to sequence requests properly, seldom needed in Widgets. | ||||
* | |||||
* | |||||
* @return true if there are active requests | * @return true if there are active requests | ||||
*/ | */ | ||||
public boolean hasActiveRequest() { | public boolean hasActiveRequest() { | ||||
/** | /** | ||||
* Returns a human readable string representation of the method used to | * Returns a human readable string representation of the method used to | ||||
* communicate with the server. | * communicate with the server. | ||||
* | |||||
* | |||||
* @return A string representation of the current transport type | * @return A string representation of the current transport type | ||||
*/ | */ | ||||
public String getCommunicationMethodName() { | public String getCommunicationMethodName() { | ||||
/** | /** | ||||
* Used internally to update what the server expects | * Used internally to update what the server expects | ||||
* | |||||
* | |||||
* @param clientToServerMessageId | * @param clientToServerMessageId | ||||
* the new client id to set | * the new client id to set | ||||
* @param force | * @param force |
/* | /* | ||||
* Copyright 2000-2014 Vaadin Ltd. | * Copyright 2000-2014 Vaadin Ltd. | ||||
* | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | * 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 | * use this file except in compliance with the License. You may obtain a copy of | ||||
* the License at | * the License at | ||||
* | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||||
* receive UIDL messages from the server (either asynchronously or as a response | * receive UIDL messages from the server (either asynchronously or as a response | ||||
* to a UIDL request.) Delegates the UIDL handling to the | * to a UIDL request.) Delegates the UIDL handling to the | ||||
* {@link ApplicationConnection}. | * {@link ApplicationConnection}. | ||||
* | |||||
* | |||||
* @author Vaadin Ltd | * @author Vaadin Ltd | ||||
* @since 7.1 | * @since 7.1 | ||||
*/ | */ | ||||
/** | /** | ||||
* Two-phase construction to allow using GWT.create(). | * Two-phase construction to allow using GWT.create(). | ||||
* | |||||
* | |||||
* @param connection | * @param connection | ||||
* The ApplicationConnection | * The ApplicationConnection | ||||
*/ | */ | ||||
* <p> | * <p> | ||||
* This method must not be called if the push connection is not | * This method must not be called if the push connection is not | ||||
* bidirectional (if {@link #isBidirectional()} returns false) | * bidirectional (if {@link #isBidirectional()} returns false) | ||||
* | |||||
* | |||||
* @param payload | * @param payload | ||||
* the payload to push | * the payload to push | ||||
* @throws IllegalStateException | * @throws IllegalStateException | ||||
* if this connection is not active | * if this connection is not active | ||||
* | |||||
* | |||||
* @see #isActive() | * @see #isActive() | ||||
*/ | */ | ||||
public void push(JsonObject payload); | public void push(JsonObject payload); | ||||
* Checks whether this push connection is in a state where it can push | * Checks whether this push connection is in a state where it can push | ||||
* messages to the server. A connection is active until | * messages to the server. A connection is active until | ||||
* {@link #disconnect(Command)} has been called. | * {@link #disconnect(Command)} has been called. | ||||
* | |||||
* | |||||
* @return <code>true</code> if this connection can accept new messages; | * @return <code>true</code> if this connection can accept new messages; | ||||
* <code>false</code> if this connection is disconnected or | * <code>false</code> if this connection is disconnected or | ||||
* disconnecting. | * disconnecting. | ||||
* After this method has been called, {@link #isActive()} returns | * After this method has been called, {@link #isActive()} returns | ||||
* <code>false</code>. Calling this method for a connection that is no | * <code>false</code>. Calling this method for a connection that is no | ||||
* longer active will throw an exception. | * longer active will throw an exception. | ||||
* | |||||
* | |||||
* @param command | * @param command | ||||
* callback command invoked when the connection has been properly | * callback command invoked when the connection has been properly | ||||
* disconnected | * disconnected | ||||
/** | /** | ||||
* Returns a human readable string representation of the transport type used | * Returns a human readable string representation of the transport type used | ||||
* to communicate with the server. | * to communicate with the server. | ||||
* | |||||
* | |||||
* @since 7.1 | * @since 7.1 | ||||
* @return A human readable string representation of the transport type | * @return A human readable string representation of the transport type | ||||
*/ | */ | ||||
* Checks whether this push connection should be used for communication in | * Checks whether this push connection should be used for communication in | ||||
* both directions or if an XHR should be used for client to server | * both directions or if an XHR should be used for client to server | ||||
* communication. | * communication. | ||||
* | |||||
* | |||||
* A bidirectional push connection must be able to reliably inform about its | * A bidirectional push connection must be able to reliably inform about its | ||||
* connection state. | * connection state. | ||||
* | |||||
* | |||||
* @since 7.6 | * @since 7.6 | ||||
* @return true if the push connection should be used for messages in both | * @return true if the push connection should be used for messages in both | ||||
* directions, false if it should only be used for server to client | * directions, false if it should only be used for server to client |