diff options
author | John Ahlroos <john@vaadin.com> | 2012-08-31 14:22:26 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2012-08-31 14:23:03 +0300 |
commit | dc8bc6119c1bd019600559db552ec26b4db2ec54 (patch) | |
tree | 3d83f592737c9ed3610c62025a788ed689ac2e62 /server/src/com | |
parent | 01646b14df5708e50e4eb031ec5b4f0da4ab5d15 (diff) | |
download | vaadin-framework-dc8bc6119c1bd019600559db552ec26b4db2ec54.tar.gz vaadin-framework-dc8bc6119c1bd019600559db552ec26b4db2ec54.zip |
More state getter removal
Diffstat (limited to 'server/src/com')
-rw-r--r-- | server/src/com/vaadin/server/AbstractUIProvider.java | 70 | ||||
-rw-r--r-- | server/src/com/vaadin/server/DefaultUIProvider.java | 102 | ||||
-rw-r--r-- | server/src/com/vaadin/server/UIProvider.java | 58 | ||||
-rw-r--r-- | server/src/com/vaadin/ui/AbstractMedia.java | 32 | ||||
-rw-r--r-- | server/src/com/vaadin/ui/JavaScript.java | 6 |
5 files changed, 134 insertions, 134 deletions
diff --git a/server/src/com/vaadin/server/AbstractUIProvider.java b/server/src/com/vaadin/server/AbstractUIProvider.java index 07b95fc713..f383368d91 100644 --- a/server/src/com/vaadin/server/AbstractUIProvider.java +++ b/server/src/com/vaadin/server/AbstractUIProvider.java @@ -1,35 +1,35 @@ -/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server;
-
-import com.vaadin.Application;
-import com.vaadin.ui.UI;
-
-public abstract class AbstractUIProvider implements UIProvider {
-
- @Override
- public UI instantiateUI(Application application, Class<? extends UI> type,
- WrappedRequest request) {
- try {
- return type.newInstance();
- } catch (InstantiationException e) {
- throw new RuntimeException("Could not instantiate root class", e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException("Could not access root class", e);
- }
- }
-}
+/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.server; + +import com.vaadin.Application; +import com.vaadin.ui.UI; + +public abstract class AbstractUIProvider implements UIProvider { + + @Override + public UI instantiateUI(Application application, Class<? extends UI> type, + WrappedRequest request) { + try { + return type.newInstance(); + } catch (InstantiationException e) { + throw new RuntimeException("Could not instantiate root class", e); + } catch (IllegalAccessException e) { + throw new RuntimeException("Could not access root class", e); + } + } +} diff --git a/server/src/com/vaadin/server/DefaultUIProvider.java b/server/src/com/vaadin/server/DefaultUIProvider.java index 913402c89f..d4490b1642 100644 --- a/server/src/com/vaadin/server/DefaultUIProvider.java +++ b/server/src/com/vaadin/server/DefaultUIProvider.java @@ -1,51 +1,51 @@ -/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server;
-
-import com.vaadin.Application;
-import com.vaadin.UIRequiresMoreInformationException;
-import com.vaadin.ui.UI;
-
-public class DefaultUIProvider extends AbstractUIProvider {
-
- @Override
- public Class<? extends UI> getUIClass(Application application,
- WrappedRequest request) throws UIRequiresMoreInformationException {
- Object uiClassNameObj = application
- .getProperty(Application.UI_PARAMETER);
-
- if (uiClassNameObj instanceof String) {
- String uiClassName = uiClassNameObj.toString();
-
- ClassLoader classLoader = request.getDeploymentConfiguration()
- .getClassLoader();
- if (classLoader == null) {
- classLoader = getClass().getClassLoader();
- }
- try {
- Class<? extends UI> uiClass = Class.forName(uiClassName, true,
- classLoader).asSubclass(UI.class);
-
- return uiClass;
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Could not find UI class", e);
- }
- }
-
- return null;
- }
-}
+/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.server; + +import com.vaadin.Application; +import com.vaadin.UIRequiresMoreInformationException; +import com.vaadin.ui.UI; + +public class DefaultUIProvider extends AbstractUIProvider { + + @Override + public Class<? extends UI> getUIClass(Application application, + WrappedRequest request) throws UIRequiresMoreInformationException { + Object uiClassNameObj = application + .getProperty(Application.UI_PARAMETER); + + if (uiClassNameObj instanceof String) { + String uiClassName = uiClassNameObj.toString(); + + ClassLoader classLoader = request.getDeploymentConfiguration() + .getClassLoader(); + if (classLoader == null) { + classLoader = getClass().getClassLoader(); + } + try { + Class<? extends UI> uiClass = Class.forName(uiClassName, true, + classLoader).asSubclass(UI.class); + + return uiClass; + } catch (ClassNotFoundException e) { + throw new RuntimeException("Could not find UI class", e); + } + } + + return null; + } +} diff --git a/server/src/com/vaadin/server/UIProvider.java b/server/src/com/vaadin/server/UIProvider.java index f262a3e225..890809fdd5 100644 --- a/server/src/com/vaadin/server/UIProvider.java +++ b/server/src/com/vaadin/server/UIProvider.java @@ -1,29 +1,29 @@ -/*
- * Copyright 2011 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server;
-
-import com.vaadin.Application;
-import com.vaadin.UIRequiresMoreInformationException;
-import com.vaadin.ui.UI;
-
-public interface UIProvider {
- public Class<? extends UI> getUIClass(Application application,
- WrappedRequest request) throws UIRequiresMoreInformationException;
-
- public UI instantiateUI(Application application, Class<? extends UI> type,
- WrappedRequest request);
-}
+/* + * Copyright 2011 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.server; + +import com.vaadin.Application; +import com.vaadin.UIRequiresMoreInformationException; +import com.vaadin.ui.UI; + +public interface UIProvider { + public Class<? extends UI> getUIClass(Application application, + WrappedRequest request) throws UIRequiresMoreInformationException; + + public UI instantiateUI(Application application, Class<? extends UI> type, + WrappedRequest request); +} diff --git a/server/src/com/vaadin/ui/AbstractMedia.java b/server/src/com/vaadin/ui/AbstractMedia.java index 3f59b070b7..219413974b 100644 --- a/server/src/com/vaadin/ui/AbstractMedia.java +++ b/server/src/com/vaadin/ui/AbstractMedia.java @@ -56,8 +56,8 @@ public abstract class AbstractMedia extends AbstractComponent { } private void clearSources() { - getState().getSources().clear(); - getState().getSourceTypes().clear(); + getState().sources.clear(); + getState().sourceTypes.clear(); } /** @@ -71,10 +71,10 @@ public abstract class AbstractMedia extends AbstractComponent { */ public void addSource(Resource source) { if (source != null) { - List<URLReference> sources = getState().getSources(); + List<URLReference> sources = getState().sources; sources.add(new ResourceReference(source, this, Integer .toString(sources.size()))); - getState().getSourceTypes().add(source.getMIMEType()); + getState().sourceTypes.add(source.getMIMEType()); } } @@ -83,7 +83,7 @@ public abstract class AbstractMedia extends AbstractComponent { WrappedResponse response, String path) throws IOException { Matcher matcher = Pattern.compile("(\\d+)(/.*)?").matcher(path); if (matcher.matches()) { - List<URLReference> sources = getState().getSources(); + List<URLReference> sources = getState().sources; int sourceIndex = Integer.parseInt(matcher.group(1)); @@ -128,7 +128,7 @@ public abstract class AbstractMedia extends AbstractComponent { */ public List<Resource> getSources() { ArrayList<Resource> sources = new ArrayList<Resource>(); - for (URLReference ref : getState().getSources()) { + for (URLReference ref : getState().sources) { sources.add(((ResourceReference) ref).getResource()); } return sources; @@ -140,14 +140,14 @@ public abstract class AbstractMedia extends AbstractComponent { * @param showControls */ public void setShowControls(boolean showControls) { - getState().setShowControls(showControls); + getState().showControls = showControls; } /** * @return true if the browser is to show native media controls. */ public boolean isShowControls() { - return getState().isShowControls(); + return getState().showControls; } /** @@ -162,7 +162,7 @@ public abstract class AbstractMedia extends AbstractComponent { * @param altText */ public void setAltText(String altText) { - getState().setAltText(altText); + getState().altText = altText; } /** @@ -170,7 +170,7 @@ public abstract class AbstractMedia extends AbstractComponent { * HTML5. */ public String getAltText() { - return getState().getAltText(); + return getState().altText; } /** @@ -180,7 +180,7 @@ public abstract class AbstractMedia extends AbstractComponent { * @param htmlContentAllowed */ public void setHtmlContentAllowed(boolean htmlContentAllowed) { - getState().setHtmlContentAllowed(htmlContentAllowed); + getState().htmlContentAllowed = htmlContentAllowed; } /** @@ -188,7 +188,7 @@ public abstract class AbstractMedia extends AbstractComponent { * be rendered as HTML. */ public boolean isHtmlContentAllowed() { - return getState().isHtmlContentAllowed(); + return getState().htmlContentAllowed; } /** @@ -198,14 +198,14 @@ public abstract class AbstractMedia extends AbstractComponent { * @param autoplay */ public void setAutoplay(boolean autoplay) { - getState().setAutoplay(autoplay); + getState().autoplay = autoplay; } /** * @return true if the media is set to automatically start playback. */ public boolean isAutoplay() { - return getState().isAutoplay(); + return getState().autoplay; } /** @@ -214,14 +214,14 @@ public abstract class AbstractMedia extends AbstractComponent { * @param muted */ public void setMuted(boolean muted) { - getState().setMuted(muted); + getState().muted = muted; } /** * @return true if the audio is muted. */ public boolean isMuted() { - return getState().isMuted(); + return getState().muted; } /** diff --git a/server/src/com/vaadin/ui/JavaScript.java b/server/src/com/vaadin/ui/JavaScript.java index f3e8564fab..f9324ba321 100644 --- a/server/src/com/vaadin/ui/JavaScript.java +++ b/server/src/com/vaadin/ui/JavaScript.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2011 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not @@ -93,7 +93,7 @@ public class JavaScript extends AbstractExtension { */ public void addFunction(String name, JavaScriptFunction function) { functions.put(name, function); - getState().getNames().add(name); + getState().names.add(name); } /** @@ -109,7 +109,7 @@ public class JavaScript extends AbstractExtension { */ public void removeFunction(String name) { functions.remove(name); - getState().getNames().remove(name); + getState().names.remove(name); } /** |