Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osw-web 0.7 add Chiness localization #8

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
84bd0bf
changes for commenting
lfaggioli Aug 24, 2010
f19a738
fix for displaying comments in the web console
lfaggioli Aug 30, 2010
95d6399
fix for displaying comments in the web console
lfaggioli Aug 30, 2010
934287a
limited the length of comment otherwise the gui hangs
lfaggioli Aug 31, 2010
7121952
increased comment length to 256 chars
lfaggioli Aug 31, 2010
a019d27
default OSW theme
lfaggioli Aug 31, 2010
bdcf20d
Merge remote branch 'lfaggioli/0.7' into 0.7
Sep 3, 2010
26e5b90
changes according the new AtomDomWriter
lfaggioli Sep 5, 2010
2c8ceea
small adjustments after merging with luca's repo
Sep 6, 2010
bac6235
more small adjustments
Sep 6, 2010
28d9f23
added a task to monitor status when posting a comment
Sep 8, 2010
f2c396c
handling of comments notifications improved. Seems to work across dif…
Sep 17, 2010
e0c774a
changed task bar messages for comments
Sep 20, 2010
bcfe36c
changes to use the in-memory model of the replies to update the UI up…
Sep 22, 2010
bd61f16
changes to refactor commenting
Oct 20, 2010
95568a1
initial pom
duck1123 Nov 4, 2010
234b25f
ignore target, semantic.cache, and WEB-INF/lib
duck1123 Sep 6, 2010
683ae08
move files into default locations for maven
duck1123 Nov 4, 2010
14c0609
remove osw-lib-java from list of dependencies
duck1123 Nov 9, 2010
5dc0dc6
update to the pom to reference the artifactory hosted at vodafonernd
Nov 15, 2010
72c1fcf
changes to support in-band registration
Nov 16, 2010
b0378b4
modified gitignore
Nov 16, 2010
a389c15
Merge branch 'commentingrefactor' into 0.7
Nov 16, 2010
6aacf54
adding French Local provided by Nicolas Derive
Nov 16, 2010
30e3b11
added corrections to the French Localization for single quotes which …
Nov 16, 2010
957e9e1
added Italian Localization provided by Luca Faggioli
Nov 16, 2010
f0b99bd
Added missing elements for Localization related to new features.
Nov 16, 2010
679ba67
add Chiness localization support
sevenearly Nov 21, 2010
ca260b5
add Chiness localization support
sevenearly Nov 21, 2010
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
handling of comments notifications improved. Seems to work across dif…
…ferent servers
dcheng committed Sep 17, 2010

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit f2c396cc93ecbb09fb12925a6b9e80ae6d89aa82
Original file line number Diff line number Diff line change
@@ -23,17 +23,20 @@
*/
package org.onesocialweb.gwt.client.ui.widget.activity;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.onesocialweb.gwt.client.i18n.UserInterfaceText;
import org.onesocialweb.gwt.client.task.DefaultTaskInfo;
import org.onesocialweb.gwt.client.task.TaskMonitor;
import org.onesocialweb.gwt.client.task.TaskInfo.Status;
import org.onesocialweb.gwt.client.task.TaskMonitor;
import org.onesocialweb.gwt.client.ui.widget.StyledLabel;
import org.onesocialweb.gwt.service.Stream;
import org.onesocialweb.gwt.service.StreamEvent;
import org.onesocialweb.gwt.service.StreamEvent.Type;
import org.onesocialweb.gwt.util.Observer;
import org.onesocialweb.model.activity.ActivityEntry;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.FlowPanel;
@@ -44,6 +47,8 @@ public abstract class AbstractActivityPanel<T> extends FlowPanel {
// internationalization
private UserInterfaceText uiText = (UserInterfaceText) GWT.create(UserInterfaceText.class);

List<String> expandedItems= new ArrayList<String>();

protected Stream<T> model;

private DefaultTaskInfo task;
@@ -52,6 +57,10 @@ public abstract class AbstractActivityPanel<T> extends FlowPanel {

private StyledLabel msg = new StyledLabel("message",
uiText.NoActivitiesAvailable());

public void addExpanded(String activityId){
expandedItems.add(activityId);
}

public void setModel(Stream<T> model) {
this.model = model;
@@ -71,7 +80,8 @@ public void setUpdating(boolean shouldUpdate) {
update = shouldUpdate;
}

protected abstract Widget render(T item);
protected abstract Widget render(T item, boolean expand);


protected void repaint() {
clear();
@@ -104,25 +114,70 @@ protected void repaint() {

private void showItem(T item) {
remove(msg);
Widget w = render(item);
Widget w = render(item, false);
if (w != null) {
insert(render(item), 0);
insert(render(item, false), 0);
}
}

private void removeItem(T item){

int index=getIndex(item);
remove(index);
}

private void commentItem(T item){

int index=getIndex(item);
remove(index);
ActivityEntry entry = (ActivityEntry) item;
ActivityItemView previous = (ActivityItemView) this.getWidget(index);
Widget w;
if (expandedItems.contains(entry.getId()))
w= render(item, true);
else
w= render(item, false);
insert(w, index);
}

private int getIndex(T item){
ActivityEntry entry = (ActivityEntry)item;
Iterator<Widget> it= this.iterator();
int index=0;

while (it.hasNext()){
ActivityItemView w =(ActivityItemView)it.next();
if (w.getActivity().getId().equals(entry.getId())){
break;
}
index++;
}
return index;
}


private class StreamListener implements Observer<StreamEvent<T>> {

@Override
public void handleEvent(StreamEvent<T> event) {
if (update) {
/*if (update) { */
if (event.getType().equals(Type.added)) {
for (T item : event.getItems()) {
showItem(item);
}
} else {
}else if (event.getType().equals(Type.replied)) {
for (T item : event.getItems()) {
commentItem(item);
}
}else if (event.getType().equals(Type.removed)){
for (T item : event.getItems()) {
removeItem(item);
}
}
else {
repaint();
}
}
// }
}

}
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@ public void onFailure() {
public void onSuccess(Object result) {
task.complete("", Status.succes);
enable();
panel.repaint();
//panel.repaint();
setVisible(false);
}
});
Original file line number Diff line number Diff line change
@@ -41,7 +41,6 @@
import org.onesocialweb.gwt.service.RequestCallback;
import org.onesocialweb.gwt.service.RosterEvent;
import org.onesocialweb.gwt.service.RosterItem;
import org.onesocialweb.gwt.service.Stream;
import org.onesocialweb.gwt.service.RosterItem.Presence;
import org.onesocialweb.gwt.util.Observer;
import org.onesocialweb.model.acl.AclAction;
@@ -106,10 +105,14 @@ public class ActivityItemView extends FlowPanel implements MouseOverHandler,
protected final StyledFlowPanel replieswrapper = new StyledFlowPanel("author-wrapper");
private String recipientActivityID = null;
private boolean commentNotification = false;

private boolean expanded;



public ActivityItemView(final ActivityEntry activity) {
public ActivityItemView(final ActivityEntry activity, boolean expand) {


this.expanded=expand;
this.activity = activity;

// add the mouseOver handlers
@@ -247,12 +250,21 @@ public void onClick(ClickEvent event) {
if(activity.hasReplies()) {
final StyledLabel repliesLabel = new StyledLabel("replies-link", "Comments: " +
activity.getRepliesLink().getCount());

if (expand){
commentPanel.compose(activity);
replieswrapper.add(commentPanel);
repliesLabel.setVisible(false);
}

repliesLabel.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
commentPanel.compose(activity);
replieswrapper.add(commentPanel);
repliesLabel.setVisible(false);
AbstractActivityPanel parent =(AbstractActivityPanel) getParent();
parent.addExpanded(activity.getId());
//setExpanded(true);
}
});

@@ -264,7 +276,10 @@ public void onClick(ClickEvent event) {
public void onClick(ClickEvent event) {
commentPanel.compose(activity);
replieswrapper.add(commentPanel);
repliesLabel.setVisible(false);
repliesLabel.setVisible(false);
AbstractActivityPanel parent =(AbstractActivityPanel) getParent();
parent.addExpanded(activity.getId());
//setExpanded(true);
}
});

@@ -458,6 +473,15 @@ private void addComment(String status, String authorName, String avatarUri,
private void showAttachments() {
// addPhotoAttachment("http://www.iwatchstuff.com/2008/05/30/emily-the-strange-movie.jpg");
}

public boolean isExpanded() {
return expanded;
}


public void setExpanded(boolean expanded) {
this.expanded = expanded;
}

private void addPictureAttachment(ActivityObject object) {

Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public class FeedItemView extends ActivityItemView {


public FeedItemView(ActivityEntry activity) {
super(activity);
super(activity, false);

//prevent users to post comments
replieswrapper.clear();
Original file line number Diff line number Diff line change
@@ -41,8 +41,8 @@ public FeedPanel() {
}

@Override
protected Widget render(final ActivityEntry activityEntry) {
ActivityItemView sa = new ActivityItemView(activityEntry);
protected Widget render(final ActivityEntry activityEntry, boolean expand) {
ActivityItemView sa = new ActivityItemView(activityEntry, expand);
sa.setButtonHandler(new ActivityButtonHandler() {
public void handleShow(int top, ActivityItemView sa) {

Original file line number Diff line number Diff line change
@@ -92,15 +92,15 @@ public void updateActivityReplies(String activityId) {
}

@Override
protected Widget render(final ActivityEntry activityEntry) {
protected Widget render(final ActivityEntry activityEntry, boolean expand) {

if (activityEntry.getId()==null)
return null;

if (activityEntry.getActor()==null)
return null;

ActivityItemView sa = new ActivityItemView(activityEntry);
ActivityItemView sa = new ActivityItemView(activityEntry, expand);
sa.setButtonHandler(new ActivityButtonHandler() {
public void handleShow(int top, ActivityItemView sa) {

Original file line number Diff line number Diff line change
@@ -62,12 +62,12 @@ public void addNewReplies() {
items.removeAll(toBeRemoved);
for (ActivityEntry item : items) {

Widget w = render(item);
Widget w = render(item, false);
if (w != null) {
if(getWidgetCount() == 0) {
insert(render(item), 0);
insert(render(item, false), 0);
} else {
insert(render(item), getWidgetCount());
insert(render(item, false), getWidgetCount());
}
}
}
@@ -76,7 +76,7 @@ public void addNewReplies() {


@Override
protected Widget render(ActivityEntry activityEntry) {
protected Widget render(ActivityEntry activityEntry, boolean expand) {
ActivityItemView sa = new ReplyItemView(activityEntry);

sa.setButtonHandler(new ActivityButtonHandler() {
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public class ReplyItemView extends ActivityItemView {


public ReplyItemView(ActivityEntry activity) {
super(activity);
super(activity, false);

//prevent users to post comments
replieswrapper.clear();
Original file line number Diff line number Diff line change
@@ -298,7 +298,7 @@ public void onSuccess(ActivityEntry result) {


replies.setModel(service.getReplies(parentActivity));
replies.repaint();
replies.repaint();
buttonUpdate.setEnabled(true);

}
13 changes: 10 additions & 3 deletions war/OswClient.html
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
<title>OneSocialWeb</title>

<link type="text/css" rel="stylesheet" href="standard.css">
<link type="text/css" rel="stylesheet" href="themes/vfrnd/OswClient.css">
<link type="text/css" rel="stylesheet" href="themes/osw/OswClient.css">

</head>

@@ -27,7 +27,7 @@
var preferences = {

// It is easy to change the styling of this client, just point this variable to another theme folder
theme_folder: "themes/vfrnd/",
theme_folder: "themes/osw/",

// What name to use when presenting this service to the user
service_name: "Onesocialweb",
@@ -47,7 +47,14 @@
file_retrieval_endpoint: "http://osw.vodafonernd.com/file",

// If true, we may do a bit more of logging
developer_mode: "true"
developer_mode: "true",


// If true, allows registration on this server
registration_allowed: "true",

// If true, allows registration on this server only via a registration code
registration_code: "true"
};
</script>