BrightSide Workbench Full Report + Source Code
ImageSelector.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.zkoss.image;
19 
20 import java.io.File;
21 import org.amic.util.file.FileSelector;
22 import org.turro.elephant.context.ElephantContext;
23 
28 public class ImageSelector extends FileSelector {
29 
30  private String webPath;
31 
32  public ImageSelector(String path, String regexp) {
33  super(ElephantContext.getRealPath(path), regexp);
34  this.webPath = path;
35  }
36 
37  public String getRootPath() {
39  }
40 
41  public String getImage(int index) {
42  File file = getFile(index);
43  if(file != null) {
44  return webPath + "/" + file.getName();
45  }
46  return null;
47  }
48 
49  public String getNextImage() {
50  File file = getNextFile();
51  if(file != null) {
52  return webPath + "/" + file.getName();
53  }
54  return null;
55  }
56 
57  public String getPreviousImage() {
58  File file = getPreviousFile();
59  if(file != null) {
60  return webPath + "/" + file.getName();
61  }
62  return null;
63  }
64 
65 }
ImageSelector(String path, String regexp)