001package gwt.material.design.client.base;
002
003/*
004 * #%L
005 * GwtMaterial
006 * %%
007 * Copyright (C) 2015 GwtMaterialDesign
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import com.google.gwt.resources.client.ImageResource;
024import gwt.material.design.client.constants.IconType;
025
026import java.io.Serializable;
027
028/***
029 * Its an object provided for search component, it uses a keyword and link to be redirected after search.
030 */
031public class SearchObject implements Serializable {
032
033    private ImageResource resource;
034    private String imageUrl;
035    private IconType icon;
036    private String keyword;
037    private String link = "";
038    private Object o;
039
040    public SearchObject() {}
041
042    /**
043     * Provides a search result with icon
044     * @param icon
045     * @param keyword
046     * @param link
047     */
048    public SearchObject(IconType icon, String keyword, String link) {
049        this.icon = icon;
050        this.keyword = keyword;
051        this.link = link;
052    }
053
054    /**
055     * Provides a search result with plain text
056     * @param keyword
057     * @param link
058     * @param o
059     */
060    public SearchObject(String keyword, String link, Object o) {
061        this.keyword = keyword;
062        this.link = link;
063        this.o = o;
064    }
065
066    public SearchObject(Object o, String link, String keyword, IconType icon) {
067        this.o = o;
068        this.link = link;
069        this.keyword = keyword;
070        this.icon = icon;
071    }
072
073    /**
074     * Plain search only, you may need to add searchfinish callback instead of redirecting
075     * to any links.
076     * @param icon
077     * @param keyword
078     */
079    public SearchObject(IconType icon, String keyword) {
080        this.icon = icon;
081        this.keyword = keyword;
082    }
083
084    /**
085     * Search result with image resource component and link
086     * @param resource
087     * @param keyword
088     * @param link
089     */
090    public SearchObject(ImageResource resource, String keyword, String link) {
091        this.resource = resource;
092        this.keyword = keyword;
093        this.link = link;
094    }
095
096    /**
097     * Search result with image resource without link , you may require to use Search Finish callback to apply your search
098     * @param resource
099     * @param keyword
100     */
101    public SearchObject(ImageResource resource, String keyword) {
102        this.resource = resource;
103        this.keyword = keyword;
104    }
105
106    /**
107     * Search result with image url component and link
108     * @param imageUrl
109     * @param keyword
110     * @param link
111     */
112    public SearchObject(String imageUrl, String keyword, String link) {
113        this.imageUrl = imageUrl;
114        this.keyword = keyword;
115        this.link = link;
116    }
117
118    /**
119     * Search result with image url without link , you may require to use Search Finish callback to apply your search
120     * @param imageUrl
121     * @param keyword
122     */
123    public SearchObject(String imageUrl, String keyword) {
124        this.imageUrl = imageUrl;
125        this.keyword = keyword;
126    }
127
128    public String getKeyword() {
129        return keyword;
130    }
131
132    public void setKeyword(String keyword) {
133        this.keyword = keyword;
134    }
135
136    public String getLink() {
137        return link;
138    }
139
140    public void setLink(String link) {
141        this.link = link;
142    }
143
144    public Object getO() {
145        return o;
146    }
147
148    public void setO(Object o) {
149        this.o = o;
150    }
151
152    public IconType getIcon() {
153        return icon;
154    }
155
156    public void setIcon(IconType icon) {
157        this.icon = icon;
158    }
159
160    public ImageResource getResource() {
161        return resource;
162    }
163
164    public void setResource(ImageResource resource) {
165        this.resource = resource;
166    }
167
168    public String getImageUrl() {
169        return imageUrl;
170    }
171
172    public void setImageUrl(String imageUrl) {
173        this.imageUrl = imageUrl;
174    }
175}