aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin/ui/IconGenerator.java
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2016-09-15 14:07:18 +0300
committerAleksi Hietanen <aleksi@vaadin.com>2016-09-21 07:51:29 +0000
commit2a0cbd3bdbebaa25b44a096ae3ac6462a408d92d (patch)
tree60a758a7a2b2f3918f26cc0c8980a58044b01643 /server/src/main/java/com/vaadin/ui/IconGenerator.java
parent79132bcb6d498322ce8cb0f554658f96b13b29d9 (diff)
downloadvaadin-framework-2a0cbd3bdbebaa25b44a096ae3ac6462a408d92d.tar.gz
vaadin-framework-2a0cbd3bdbebaa25b44a096ae3ac6462a408d92d.zip
Move ItemIconProvider out of ComboBox, rename to IconGenerator
Change-Id: I884a52c75b3be5573cf6634f211d72d09de69d80
Diffstat (limited to 'server/src/main/java/com/vaadin/ui/IconGenerator.java')
-rw-r--r--server/src/main/java/com/vaadin/ui/IconGenerator.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/IconGenerator.java b/server/src/main/java/com/vaadin/ui/IconGenerator.java
new file mode 100644
index 0000000000..41f11dad81
--- /dev/null
+++ b/server/src/main/java/com/vaadin/ui/IconGenerator.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2016 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.ui;
+
+import java.io.Serializable;
+import java.util.function.Function;
+
+import com.vaadin.server.Resource;
+
+/**
+ * A callback interface for generating icons for an item.
+ *
+ * @param <T>
+ * item type for which the icon is generated
+ */
+@FunctionalInterface
+public interface IconGenerator<T> extends Function<T, Resource>, Serializable {
+
+ /**
+ * Gets an icon resource for the {@code item}.
+ *
+ * @param item
+ * the item for which to generate an icon for
+ * @return the generated icon resource
+ */
+ @Override
+ public Resource apply(T item);
+} \ No newline at end of file