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