BrightSide Workbench Full Report + Source Code
All Classes Namespaces Files Functions Variables Pages
org.turro.file.action.GalleryAction Class Reference
Inheritance diagram for org.turro.file.action.GalleryAction:
Collaboration diagram for org.turro.file.action.GalleryAction:

Public Member Functions

 GalleryAction (FolderFile ff)
 
String getLabel ()
 
String getImage ()
 
Object doAction ()
 
boolean refreshParent ()
 
boolean refreshSelf ()
 
boolean isClientSide ()
 

Detailed Description

Author
Lluis Turró Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 36 of file GalleryAction.java.

Constructor & Destructor Documentation

◆ GalleryAction()

org.turro.file.action.GalleryAction.GalleryAction ( FolderFile  ff)

Definition at line 40 of file GalleryAction.java.

40  {
41  this.ff = ff;
42  }

Member Function Documentation

◆ doAction()

Object org.turro.file.action.GalleryAction.doAction ( )

Implements org.turro.file.action.FileAction.

Definition at line 55 of file GalleryAction.java.

55  {
56  try {
57  File thumbs = new File(ff.getFile().getAbsolutePath() + "/thumbs");
58  Properties props = ff.getProperties();
59  if (!thumbs.exists()) {
60  thumbs.mkdirs();
61  // Images
62  for (File file : ff.getFile().listFiles(new FilenameFilter() {
63  @Override
64  public boolean accept(File dir, String name) {
65  return !name.endsWith(".properties") && name.contains(".") && name.matches(".*\\.(jpg|jpeg|png|gif|tif)");
66  }
67  })) {
68  for (int i = 0; i < 20; i++) {
69  String command = props.getProperty("cmdimg" + i, null);
70  if (command != null) {
71  String thumbName = file.getName();
72  thumbName = thumbName.substring(0, thumbName.lastIndexOf(".")) + ".png";
73  new ShellExecutor().execute(command.replaceAll("#file", file.getAbsolutePath()).replaceAll("#thumb", thumbs.getAbsolutePath() + "/" + thumbName));
74  }
75  }
76  }
77  // Videos
78  for (File file : ff.getFile().listFiles(new FilenameFilter() {
79  @Override
80  public boolean accept(File dir, String name) {
81  return !name.endsWith(".properties") && name.contains(".") && name.matches(".*\\.(avi|mpeg|mpg|vob|divx)");
82  }
83  })) {
84  for (int i = 0; i < 20; i++) {
85  String command = props.getProperty("cmdvid" + i, null);
86  if (command != null) {
87  String flvName = file.getAbsolutePath();
88  flvName = flvName.substring(0, flvName.lastIndexOf(".")) + ".flv";
89  new ShellExecutor().execute(command.replaceAll("#file", file.getAbsolutePath()).replaceAll("#flv", flvName));
90  }
91  }
92  }
93  // Flvs
94  for (File file : ff.getFile().listFiles(new FilenameFilter() {
95  @Override
96  public boolean accept(File dir, String name) {
97  return !name.endsWith(".properties") && name.contains(".") && name.matches(".*\\.(flv)");
98  }
99  })) {
100  for (int i = 0; i < 20; i++) {
101  String command = props.getProperty("cmdflv" + i, null);
102  if (command != null) {
103  String thumbName = file.getName();
104  thumbName = thumbName.substring(0, thumbName.lastIndexOf(".")) + ".png";
105  new ShellExecutor().execute(command.replaceAll("#file", file.getAbsolutePath()).replaceAll("#thumb", thumbs.getAbsolutePath() + "/" + thumbName));
106  }
107  }
108  }
109  for (File file : thumbs.listFiles(new FilenameFilter() {
110  @Override
111  public boolean accept(File dir, String name) {
112  return name.endsWith(".png");
113  }
114  })) {
115  for (int i = 0; i < 20; i++) {
116  String command = props.getProperty("cmdthumb" + i, null);
117  if (command != null) {
118  new ShellExecutor().execute(command.replaceAll("#thumb", file.getAbsolutePath()));
119  }
120  }
121  }
122  }
123  } catch (FileNotFoundException ex) {
124  Logger.getLogger(GalleryAction.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
125  } catch (IOException ex) {
126  Logger.getLogger(GalleryAction.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
127  }
128  return null;
129  }
Here is the call graph for this function:

◆ getImage()

String org.turro.file.action.GalleryAction.getImage ( )

Implements org.turro.file.action.FileAction.

Definition at line 50 of file GalleryAction.java.

50  {
51  return "/_zul/images/gallery.png";
52  }

◆ getLabel()

String org.turro.file.action.GalleryAction.getLabel ( )

Implements org.turro.file.action.FileAction.

Definition at line 45 of file GalleryAction.java.

45  {
46  return I_.get("Create a gallery");
47  }
Here is the call graph for this function:

◆ isClientSide()

boolean org.turro.file.action.GalleryAction.isClientSide ( )

Implements org.turro.file.action.FileAction.

Definition at line 142 of file GalleryAction.java.

142  {
143  return false;
144  }

◆ refreshParent()

boolean org.turro.file.action.GalleryAction.refreshParent ( )

Implements org.turro.file.action.FileAction.

Definition at line 132 of file GalleryAction.java.

132  {
133  return false;
134  }

◆ refreshSelf()

boolean org.turro.file.action.GalleryAction.refreshSelf ( )

Implements org.turro.file.action.FileAction.

Definition at line 137 of file GalleryAction.java.

137  {
138  return true;
139  }

The documentation for this class was generated from the following file: