Skip to content
Snippets Groups Projects
Commit e36bb537 authored by helene ortiz's avatar helene ortiz
Browse files

fix bug: when attached files directory does not exist, it was not

created
fix bug: chat shell was not correctly refreshed
parent ca1869bc
No related branches found
Tags 4.3.24
No related merge requests found
......@@ -48,6 +48,7 @@ public class ChatFileManager {
public static String[] EXTENSIONS;
public static String[] NAMES;
public final static String ALL = ".*";
public final static String TXT = ".txt";
public final static String PNG = ".png";
public final static String JPG = ".jpg";
......@@ -67,8 +68,8 @@ public class ChatFileManager {
private static ChatFileManager instance = null;
private ChatFileManager() {
EXTENSIONS = new String[] {"*" + JPG, "*" + PDF, "*" + PNG, "*" + TXT};
NAMES = new String[] {"JPG files", "PDF files", "PNG files" , "Text Files"};
EXTENSIONS = new String[] {"*" + ALL, "*" + JPG, "*" + PDF, "*" + PNG, "*" + TXT};
NAMES = new String[] {"All files", "JPG files", "PDF files", "PNG files" , "Text Files"};
}
public static ChatFileManager getInstance() {
......@@ -134,6 +135,9 @@ public class ChatFileManager {
public boolean uploadFile(String absoluteFileName) {
// First of all create target directory
ResourceManager.getInstance().createDirectory(getDirectoryPath(), String.valueOf(ExperimentData.getInstance().getProposalId()));
try {
String fileName = absoluteFileName.substring(absoluteFileName.lastIndexOf(ConfigManager.FILE_SEPARATOR)+1);
String fileExtension = fileName.substring(fileName.lastIndexOf("."));
......
......@@ -66,6 +66,7 @@ public abstract class Chat implements ChatEventListener, ICanvasClickListener {
for (ChatEvent event : messages) {
addEvent(event);
}
refresh();
}
}
......@@ -89,6 +90,7 @@ public abstract class Chat implements ChatEventListener, ICanvasClickListener {
public void onChatEvent(ChatEvent event) {
if (!event.comesFromMe()) {
addEvent(event);
refresh();
}
}
......@@ -104,5 +106,6 @@ public abstract class Chat implements ChatEventListener, ICanvasClickListener {
protected abstract void init();
protected abstract void addEvent(ChatEvent event);
public abstract void clear();
public abstract void refresh();
}
\ No newline at end of file
......@@ -177,6 +177,7 @@ public class SWTChat extends Chat {
ChatEvent event = new ChatEvent(getSender(), message);
ChatFileManager.getInstance().addChat(event);
addEvent(event);
refresh();
}
// Empty post area after each post
postAreaText.setText("");
......@@ -419,6 +420,7 @@ public class SWTChat extends Chat {
}
ChatFileManager.getInstance().addChat(attachedEvent);
addEvent(attachedEvent);
refresh();
}
}
} else if (listenerId.startsWith(THUMBNAIL_ID)) {
......@@ -447,4 +449,10 @@ public class SWTChat extends Chat {
}
}
}
@Override
public void refresh() {
chatShell.layout(true, true);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment