You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/05/07 20:29:25 UTC
svn commit: r772736 - in /incubator/pivot/trunk/wtk/src/pivot/wtk:
ActivityIndicator.java ActivityIndicatorListener.java
skin/ActivityIndicatorSkin.java skin/terra/TerraActivityIndicatorSkin.java
skin/terra/TerraTheme.java
Author: gbrown
Date: Thu May 7 18:29:15 2009
New Revision: 772736
URL: http://svn.apache.org/viewvc?rev=772736&view=rev
Log:
Add ActivityIndicator component, abstract skin class, and stub Terra skin.
Added:
incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicator.java
incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicatorListener.java
incubator/pivot/trunk/wtk/src/pivot/wtk/skin/ActivityIndicatorSkin.java
incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java
Modified:
incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTheme.java
Added: incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicator.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicator.java?rev=772736&view=auto
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicator.java (added)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicator.java Thu May 7 18:29:15 2009
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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 pivot.wtk;
+
+import pivot.util.ListenerList;
+
+/**
+ * Component representing an activity indicator.
+ *
+ * @author gbrown
+ */
+public class ActivityIndicator extends Component {
+ private static class ActivityIndicatorListenerList extends ListenerList<ActivityIndicatorListener>
+ implements ActivityIndicatorListener {
+ public void activeChanged(ActivityIndicator activityIndicator) {
+ for (ActivityIndicatorListener listener : this) {
+ listener.activeChanged(activityIndicator);
+ }
+ }
+ }
+
+ private boolean active;
+
+ private ActivityIndicatorListenerList activityIndicatorListeners = new ActivityIndicatorListenerList();
+
+ public ActivityIndicator() {
+ installSkin(ActivityIndicator.class);
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ if (this.active != active) {
+ this.active = active;
+ activityIndicatorListeners.activeChanged(this);
+ }
+ }
+
+ public ListenerList<ActivityIndicatorListener> getActivityIndicatorListeners() {
+ return activityIndicatorListeners;
+ }
+}
Added: incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicatorListener.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicatorListener.java?rev=772736&view=auto
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicatorListener.java (added)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/ActivityIndicatorListener.java Thu May 7 18:29:15 2009
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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 pivot.wtk;
+
+public interface ActivityIndicatorListener {
+ /**
+ * Called when an activity indicator's active state has changed.
+ *
+ * @param activityIndicator
+ */
+ public void activeChanged(ActivityIndicator activityIndicator);
+}
Added: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/ActivityIndicatorSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/ActivityIndicatorSkin.java?rev=772736&view=auto
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/ActivityIndicatorSkin.java (added)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/ActivityIndicatorSkin.java Thu May 7 18:29:15 2009
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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 pivot.wtk.skin;
+
+import pivot.wtk.ActivityIndicator;
+import pivot.wtk.ActivityIndicatorListener;
+import pivot.wtk.Component;
+
+/**
+ * Abstract base class for activity indicator skins.
+ *
+ * @author gbrown
+ */
+public abstract class ActivityIndicatorSkin extends ComponentSkin
+ implements ActivityIndicatorListener {
+ @Override
+ public void install(Component component) {
+ super.install(component);
+
+ ActivityIndicator activityIndicator = (ActivityIndicator)component;
+ activityIndicator.getActivityIndicatorListeners().add(this);
+ }
+
+ @Override
+ public void uninstall() {
+ ActivityIndicator activityIndicator = (ActivityIndicator)getComponent();
+ activityIndicator.getActivityIndicatorListeners().remove(this);
+
+ super.uninstall();
+ }
+
+ public void layout() {
+ // No-op
+ }
+}
Added: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java?rev=772736&view=auto
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java (added)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java Thu May 7 18:29:15 2009
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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 pivot.wtk.skin.terra;
+
+import java.awt.Graphics2D;
+
+import pivot.wtk.ActivityIndicator;
+import pivot.wtk.skin.ActivityIndicatorSkin;
+
+public class TerraActivityIndicatorSkin extends ActivityIndicatorSkin {
+ public int getPreferredWidth(int height) {
+ return 128;
+ }
+
+ public int getPreferredHeight(int width) {
+ return 128;
+ }
+
+ public void paint(Graphics2D graphics) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void activeChanged(ActivityIndicator activityIndicator) {
+ // TODO
+ }
+}
Modified: incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTheme.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTheme.java?rev=772736&r1=772735&r2=772736&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTheme.java (original)
+++ incubator/pivot/trunk/wtk/src/pivot/wtk/skin/terra/TerraTheme.java Thu May 7 18:29:15 2009
@@ -27,6 +27,7 @@
import pivot.serialization.JSONSerializer;
import pivot.serialization.SerializationException;
import pivot.wtk.Accordion;
+import pivot.wtk.ActivityIndicator;
import pivot.wtk.Alert;
import pivot.wtk.ApplicationContext;
import pivot.wtk.Border;
@@ -141,6 +142,7 @@
}
componentSkinMap.put(Accordion.class, TerraAccordionSkin.class);
+ componentSkinMap.put(ActivityIndicator.class, TerraActivityIndicatorSkin.class);
componentSkinMap.put(Alert.class, TerraAlertSkin.class);
componentSkinMap.put(Border.class, TerraBorderSkin.class);
componentSkinMap.put(Checkbox.class, TerraCheckboxSkin.class);