ActivityWidget now contains only buttons, there is no longer need to have an icon and a label for each statistic

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/user-statistics@131825 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-09-27 10:05:56 +00:00
parent 80861705d0
commit 0f4b2deae1
5 changed files with 45 additions and 80 deletions

View File

@ -35,7 +35,6 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
/**
* Panel to show received user's statistics
*
@ -359,8 +358,10 @@ public class StatisticsPanel extends Composite {
appendAlertIcon(storage);
}else{
storage.clearPanelValues();
Label storageValue = new Label(spaceInUse);
storageValue.setStyleName("statistic-value");
Button storageValue = new Button();
storageValue.setType(ButtonType.LINK);
storageValue.setText(spaceInUse);
storageValue.addStyleName("buttons-statistics-disabled-events");
storage.appendToPanel(storageValue);
}
}
@ -386,9 +387,10 @@ public class StatisticsPanel extends Composite {
// clear panel
profileStrength.clearPanelValues();
final Label profileStrengthLabel = new Label(profileStrengthInt + "%");
profileStrengthLabel.setStyleName("statistic-value");
Button profileStrengthLabel = new Button();
profileStrengthLabel.setType(ButtonType.LINK);
profileStrengthLabel.setText(profileStrengthInt + "%");
profileStrengthLabel.addStyleName("buttons-statistics-disabled-events");
profileStrength.appendToPanel(profileStrengthLabel);
// in case too low information within the user profile
@ -461,14 +463,12 @@ public class StatisticsPanel extends Composite {
if(isRoot || isProfilePage)
activityDone.setPosts(
formattedNumbers(postsBean.getFeedsNumber()),
TOOLTIP_POSTS_DONE,
TOOLTIP_POSTS_DONE + " (" + postsBean.getFeedsNumber() + ")",
ShowUserStatisticAction.POSTS_MADE_BY_USER,
information.getCurrentPageLanding());
else
activityDone.setPosts(
formattedNumbers(postsBean.getFeedsNumber()),
TOOLTIP_POSTS_DONE,
TOOLTIP_POSTS_DONE_VRE + " (" + postsBean.getFeedsNumber() + ")",
ShowUserStatisticAction.POSTS_MADE_BY_USER,
information.getCurrentPageLanding());
@ -479,14 +479,12 @@ public class StatisticsPanel extends Composite {
if(isRoot || isProfilePage)
activityDone.setLikes(
formattedNumbers(postsBean.getLikesMade()),
TOOLTIP_LIKES_DONE,
TOOLTIP_LIKES_DONE + " (" + postsBean.getLikesMade() + ")",
ShowUserStatisticAction.LIKES_MADE_BY_USER,
information.getCurrentPageLanding());
else
activityDone.setLikes(
formattedNumbers(postsBean.getLikesMade()),
TOOLTIP_LIKES_DONE_VRE,
TOOLTIP_LIKES_DONE_VRE + " (" + postsBean.getLikesMade() + ")",
ShowUserStatisticAction.LIKES_MADE_BY_USER,
information.getCurrentPageLanding());
@ -494,14 +492,12 @@ public class StatisticsPanel extends Composite {
if(isRoot || isProfilePage)
activityDone.setComments(
formattedNumbers(postsBean.getCommentsMade()),
TOOLTIP_REPLIES_DONE,
TOOLTIP_REPLIES_DONE + " (" + postsBean.getCommentsMade() + ")",
ShowUserStatisticAction.COMMENTS_MADE_BY_USER,
information.getCurrentPageLanding());
else
activityDone.setComments(
formattedNumbers(postsBean.getCommentsMade()),
TOOLTIP_REPLIES_DONE_VRE,
TOOLTIP_REPLIES_DONE_VRE +" (" + postsBean.getCommentsMade() + ")",
ShowUserStatisticAction.COMMENTS_MADE_BY_USER,
information.getCurrentPageLanding());
@ -518,14 +514,12 @@ public class StatisticsPanel extends Composite {
if(isRoot || isProfilePage)
activityGot.setLikes(
formattedNumbers(postsBean.getLikesReceived()),
TOOLTIP_LIKES_GOT,
TOOLTIP_LIKES_GOT+ " (" + postsBean.getLikesReceived() + ")",
ShowUserStatisticAction.LIKES_GOT_BY_USER,
information.getCurrentPageLanding());
else
activityGot.setLikes(
formattedNumbers(postsBean.getLikesReceived()),
TOOLTIP_LIKES_GOT_VRE,
TOOLTIP_LIKES_GOT_VRE + " (" + postsBean.getLikesReceived() + ")",
ShowUserStatisticAction.LIKES_GOT_BY_USER,
information.getCurrentPageLanding());
@ -535,14 +529,12 @@ public class StatisticsPanel extends Composite {
if(isRoot || isProfilePage)
activityGot.setComments(
formattedNumbers(postsBean.getCommentsReceived()),
TOOLTIP_REPLIES_GOT,
TOOLTIP_REPLIES_GOT + " (" + postsBean.getCommentsReceived() + ")",
ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
information.getCurrentPageLanding());
else
activityGot.setComments(
formattedNumbers(postsBean.getCommentsReceived()),
TOOLTIP_REPLIES_GOT_VRE,
TOOLTIP_REPLIES_GOT_VRE + " (" + postsBean.getCommentsReceived() + ")",
ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
information.getCurrentPageLanding());
@ -643,14 +635,12 @@ public class StatisticsPanel extends Composite {
if(isRoot)
activityDone.setPosts(
formattedNumbers(numberOfWrittenFeeds),
TOOLTIP_POSTS_DONE,
TOOLTIP_POSTS_DONE + " (" + numberOfWrittenFeeds + ")",
ShowUserStatisticAction.POSTS_MADE_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
else
activityDone.setPosts(
formattedNumbers(numberOfWrittenFeeds),
TOOLTIP_POSTS_DONE,
TOOLTIP_POSTS_DONE_VRE + " (" + numberOfWrittenFeeds + ")",
ShowUserStatisticAction.POSTS_MADE_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
@ -683,14 +673,12 @@ public class StatisticsPanel extends Composite {
if(isRoot)
activityDone.setPosts(
formattedNumbers(numberOfWrittenFeeds),
TOOLTIP_POSTS_DONE,
TOOLTIP_POSTS_DONE + " (" + numberOfWrittenFeeds + ")",
ShowUserStatisticAction.POSTS_MADE_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
else
activityDone.setPosts(
formattedNumbers(numberOfWrittenFeeds),
TOOLTIP_POSTS_DONE,
TOOLTIP_POSTS_DONE_VRE + " (" + numberOfWrittenFeeds + ")",
ShowUserStatisticAction.POSTS_MADE_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
@ -721,14 +709,13 @@ public class StatisticsPanel extends Composite {
if(isRoot)
activityGot.setLikes(
formattedNumbers(numberOfLikesGot),
TOOLTIP_LIKES_GOT,
TOOLTIP_LIKES_GOT + " (" + numberOfLikesGot + ")",
ShowUserStatisticAction.LIKES_GOT_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
else
activityGot.setLikes(
formattedNumbers(numberOfLikesGot),
TOOLTIP_LIKES_GOT_VRE,
TOOLTIP_LIKES_GOT_VRE + " (" + numberOfLikesGot + ")",
ShowUserStatisticAction.LIKES_GOT_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
@ -762,14 +749,12 @@ public class StatisticsPanel extends Composite {
if(isRoot)
activityGot.setLikes(
formattedNumbers(numberOfLikesGot),
TOOLTIP_LIKES_GOT,
TOOLTIP_LIKES_GOT + " (" + numberOfLikesGot + ")",
ShowUserStatisticAction.LIKES_GOT_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
else
activityGot.setLikes(
formattedNumbers(numberOfLikesGot),
TOOLTIP_LIKES_GOT_VRE,
TOOLTIP_LIKES_GOT_VRE + " (" + numberOfLikesGot + ")",
ShowUserStatisticAction.LIKES_GOT_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
@ -802,14 +787,12 @@ public class StatisticsPanel extends Composite {
if(isRoot)
activityGot.setComments(
formattedNumbers(numberOfCommentsGot),
TOOLTIP_REPLIES_GOT,
TOOLTIP_REPLIES_GOT + " (" + numberOfCommentsGot + ")",
ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
else
activityGot.setComments(
formattedNumbers(numberOfCommentsGot),
TOOLTIP_REPLIES_GOT_VRE,
TOOLTIP_REPLIES_GOT_VRE + " (" + numberOfCommentsGot + ")",
ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
@ -842,14 +825,12 @@ public class StatisticsPanel extends Composite {
if(isRoot)
activityGot.setComments(
formattedNumbers(numberOfCommentsGot),
TOOLTIP_REPLIES_GOT,
TOOLTIP_REPLIES_GOT + " (" + numberOfCommentsGot + ")",
ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());
else
activityGot.setComments(
formattedNumbers(numberOfCommentsGot),
TOOLTIP_REPLIES_GOT_VRE,
TOOLTIP_REPLIES_GOT_VRE + " (" + numberOfCommentsGot + ")",
ShowUserStatisticAction.COMMENTS_GOT_BY_USER,
informationBeanRetrieved.getCurrentPageLanding());

View File

@ -5,14 +5,12 @@ import org.gcube.portlet.user.userstatisticsportlet.client.events.ShowFeedsRelat
import com.github.gwtbootstrap.client.ui.Button;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Cursor;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
public class ActivityWidget extends Composite {
@ -32,21 +30,12 @@ public class ActivityWidget extends Composite {
@UiField
Button postsButton;
@UiField
Label likesValue;
@UiField
Label commentsValue;
@UiField
Label postsValue;
private HandlerManager busEvents;
public ActivityWidget() {
initWidget(uiBinder.createAndBindUi(this));
// set styles
commentsButton.addStyleName("buttons-statistics-style");
likesButton.addStyleName("buttons-statistics-style");
@ -61,17 +50,14 @@ public class ActivityWidget extends Composite {
* @param actionToTakeOnClick
* @param landingPage
*/
public void setComments(String value, String tipIcon, String tipValue, final ShowUserStatisticAction actionToTakeOnClick, final String landingPage){
public void setComments(String value, String tipValue, final ShowUserStatisticAction actionToTakeOnClick, final String landingPage){
commentsButton.setTitle(tipIcon);
commentsValue.setText(value);
commentsValue.setTitle(tipValue);
commentsButton.setText(value);
commentsButton.setTitle(tipValue);
if(busEvents != null && actionToTakeOnClick != null){
commentsValue.getElement().getStyle().setCursor(Cursor.POINTER);
commentsValue.addStyleName("statistic-value-underline");
commentsValue.addClickHandler(new ClickHandler() {
commentsButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
@ -82,9 +68,8 @@ public class ActivityWidget extends Composite {
});
}
// set to visible
commentsValue.setVisible(true);
commentsButton.setVisible(true);
}
@ -96,17 +81,14 @@ public class ActivityWidget extends Composite {
* @param actionToTakeOnClick
* @param landingPage
*/
public void setLikes(String value, String tipIcon, String tipValue, final ShowUserStatisticAction actionToTakeOnClick, final String landingPage){
public void setLikes(String value, String tipValue, final ShowUserStatisticAction actionToTakeOnClick, final String landingPage){
likesButton.setTitle(tipIcon);
likesValue.setText(value);
likesValue.setTitle(tipValue);
likesButton.setText(value);
likesButton.setTitle(tipValue);
if(busEvents != null && actionToTakeOnClick != null){
likesValue.getElement().getStyle().setCursor(Cursor.POINTER);
likesValue.addStyleName("statistic-value-underline");
likesValue.addClickHandler(new ClickHandler() {
likesButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
@ -117,12 +99,11 @@ public class ActivityWidget extends Composite {
});
}
// set to visible
likesValue.setVisible(true);
likesButton.setVisible(true);
}
/**
* Set posts information
* @param value
@ -131,17 +112,14 @@ public class ActivityWidget extends Composite {
* @param actionToTakeOnClick
* @param landingPage
*/
public void setPosts(String value, String tipIcon, String tipValue, final ShowUserStatisticAction actionToTakeOnClick, final String landingPage){
public void setPosts(String value, String tipValue, final ShowUserStatisticAction actionToTakeOnClick, final String landingPage){
postsButton.setTitle(tipIcon);
postsValue.setText(value);
postsValue.setTitle(tipValue);
postsButton.setText(value);
postsButton.setTitle(tipValue);
if(busEvents != null && actionToTakeOnClick != null){
postsValue.getElement().getStyle().setCursor(Cursor.POINTER);
postsValue.addStyleName("statistic-value-underline");
postsValue.addClickHandler(new ClickHandler() {
postsButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
@ -152,9 +130,8 @@ public class ActivityWidget extends Composite {
});
}
// set to visible
postsValue.setVisible(true);
postsButton.setVisible(true);
}

View File

@ -10,14 +10,13 @@
}
</ui:style>
<g:HTMLPanel>
<b:Button ui:field="postsButton" icon="SHARE_ALT" type="LINK" visible="false"></b:Button>
<g:Label styleName="{style.statistic-value}" ui:field="postsValue"
visible="false"></g:Label>
<b:Button ui:field="likesButton" icon="THUMBS_UP_ALT" type="LINK" visible="false"></b:Button>
<g:Label styleName="{style.statistic-value}" ui:field="likesValue"
visible="false"></g:Label>
<b:Button ui:field="commentsButton" icon="COMMENTS" type="LINK" visible="false"></b:Button>
<g:Label styleName="{style.statistic-value}" ui:field="commentsValue"
visible="false"></g:Label>
<g:HorizontalPanel>
<b:Button ui:field="postsButton" icon="SHARE_ALT" type="LINK"
visible="false"></b:Button>
<b:Button ui:field="likesButton" icon="THUMBS_UP_ALT" type="LINK"
visible="false"></b:Button>
<b:Button ui:field="commentsButton" icon="COMMENTS" type="LINK"
visible="false"></b:Button>
</g:HorizontalPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -3,11 +3,12 @@
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.statistic-container {
display: inline-block;
vertical-align: top;
display: inline-block;
height: 60px;
width: auto;
margin-right: 2%;
margin-top: 3px;
}
.statistic-header {
@ -23,13 +24,17 @@
text-align: center;
vertical-align: text-top;
}
.container-values-style {
text-align: center;
}
</ui:style>
<g:HTMLPanel styleName="{style.statistic-container}"
ui:field="container">
<b:Popover ui:field="popover">
<g:Label styleName="{style.statistic-header}" ui:field="header" />
</b:Popover>
<g:FlowPanel ui:field="containerValues">
<g:FlowPanel ui:field="containerValues" styleName="{style.container-values-style}">
<!-- Content goes here -->
</g:FlowPanel>
</g:HTMLPanel>

View File

@ -78,6 +78,9 @@
}
.buttons-statistics-style {
pointer-events: none;
padding: 2px 3px !important;
}
.buttons-statistics-disabled-events {
pointer-events: none !important;
}