fixed bug allowing to set unread messeages already unread
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/message-conversations@182160 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fd855668cf
commit
7f439d7eb5
|
@ -18,6 +18,7 @@ import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.uibinder.client.UiHandler;
|
import com.google.gwt.uibinder.client.UiHandler;
|
||||||
import com.google.gwt.user.client.Random;
|
import com.google.gwt.user.client.Random;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ public class MessageItem extends Composite {
|
||||||
@UiField MaterialDropDown dd;
|
@UiField MaterialDropDown dd;
|
||||||
|
|
||||||
MessagesResources images = GWT.create(MessagesResources.class);
|
MessagesResources images = GWT.create(MessagesResources.class);
|
||||||
|
|
||||||
|
|
||||||
public MessageItem(final ConvMessage m, MaterialCollection parentCollection, ApplicationView ap, boolean sent) {
|
public MessageItem(final ConvMessage m, MaterialCollection parentCollection, ApplicationView ap, boolean sent) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
@ -74,9 +75,10 @@ public class MessageItem extends Composite {
|
||||||
attachmentsIcon.setVisibility(Visibility.VISIBLE);
|
attachmentsIcon.setVisibility(Visibility.VISIBLE);
|
||||||
if (!sent && !m.isRead())
|
if (!sent && !m.isRead())
|
||||||
item.addStyleName("unread-message");
|
item.addStyleName("unread-message");
|
||||||
if (sent)
|
if (sent || !myMessage.isRead()) {
|
||||||
dd.remove(0); //remove the option to set unread if the message is sent
|
dd.remove(0); //remove the option to set unread if the message is sent
|
||||||
|
}
|
||||||
|
|
||||||
if (m.getOwner().getAvatarURL() == null || m.getOwner().getAvatarURL().compareTo("")== 0) {
|
if (m.getOwner().getAvatarURL() == null || m.getOwner().getAvatarURL().compareTo("")== 0) {
|
||||||
if (sent)
|
if (sent)
|
||||||
avatarImage.setResource(
|
avatarImage.setResource(
|
||||||
|
@ -98,7 +100,7 @@ public class MessageItem extends Composite {
|
||||||
timeLabel.setText(Utils.getFormatteDate(m.getDate()));
|
timeLabel.setText(Utils.getFormatteDate(m.getDate()));
|
||||||
if (sent)
|
if (sent)
|
||||||
item.setBackgroundColor(Color.WHITE);
|
item.setBackgroundColor(Color.WHITE);
|
||||||
|
|
||||||
//because on tablet and on mobile cause problems
|
//because on tablet and on mobile cause problems
|
||||||
if (!Utils.isMobile()) {
|
if (!Utils.isMobile()) {
|
||||||
item.addMouseOverHandler(new MouseOverHandler() {
|
item.addMouseOverHandler(new MouseOverHandler() {
|
||||||
|
@ -149,14 +151,18 @@ public class MessageItem extends Composite {
|
||||||
dd.setActivator(activator);
|
dd.setActivator(activator);
|
||||||
messageActionIcon.setActivates(activator);
|
messageActionIcon.setActivates(activator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@UiHandler("setUnreadButton")
|
@UiHandler("setUnreadButton")
|
||||||
void onSetUnread(ClickEvent e) {
|
void onSetUnread(ClickEvent e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
ap.setMessageUnread(myMessage, this.sent);
|
if (myMessage.isRead()) {
|
||||||
myMessage.setRead(false);
|
ap.setMessageUnread(myMessage, this.sent);
|
||||||
item.addStyleName("unread-message");
|
myMessage.setRead(false);
|
||||||
|
item.addStyleName("unread-message");
|
||||||
|
} else {
|
||||||
|
Window.alert("Message is marked as unread already.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doDelete(String subject) {
|
private void doDelete(String subject) {
|
||||||
|
@ -187,7 +193,7 @@ public class MessageItem extends Composite {
|
||||||
if (Utils.isMobile())
|
if (Utils.isMobile())
|
||||||
ap.hideSidePanel();
|
ap.hideSidePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideMessageMenu() {
|
public void hideMessageMenu() {
|
||||||
messageActionIcon.setVisible(false);
|
messageActionIcon.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue