Fixed right-margin property for statistics' container

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/user-statistics@122133 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-01-07 15:48:36 +00:00
parent 1714814055
commit 25f393fb7a
4 changed files with 40 additions and 17 deletions

View File

@ -145,6 +145,12 @@ public class StatisticsPanel extends Composite {
// set the style for the user image // set the style for the user image
userImage.setStyleName("user-image"); userImage.setStyleName("user-image");
// set the right margin according isRoot variable value
if(isRoot)
userImage.addStyleName("user-image-margin-right-root");
else
userImage.addStyleName("user-image-margin-right-vre");
// set url to change avatar // set url to change avatar
final String urlAccount = information.getAccountURL(); final String urlAccount = information.getAccountURL();
@ -164,7 +170,7 @@ public class StatisticsPanel extends Composite {
mainPanel.add(userImage); mainPanel.add(userImage);
// feeds // feeds
final StatisticWidget feeds = new StatisticWidget(); final StatisticWidget feeds = new StatisticWidget(isRoot);
feeds.setHeader(POSTS_LABEL); feeds.setHeader(POSTS_LABEL);
if(isRoot) if(isRoot)
@ -182,7 +188,7 @@ public class StatisticsPanel extends Composite {
mainPanel.add(feeds); mainPanel.add(feeds);
// likes & comments // likes & comments
final StatisticWidget likesAndComments = new StatisticWidget(); final StatisticWidget likesAndComments = new StatisticWidget(isRoot);
likesAndComments.setHeader(LIKES_COMMENTS_LABEL); likesAndComments.setHeader(LIKES_COMMENTS_LABEL);
if(isRoot) if(isRoot)
@ -199,8 +205,8 @@ public class StatisticsPanel extends Composite {
mainPanel.add(likesAndComments); mainPanel.add(likesAndComments);
// the storage and the profile strength(only in root) // the storage and the profile strength(only in root)
final StatisticWidget storage = new StatisticWidget(); final StatisticWidget storage = new StatisticWidget(isRoot);
final StatisticWidget profileStrength = new StatisticWidget(); final StatisticWidget profileStrength = new StatisticWidget(isRoot);
if(isRoot){ if(isRoot){

View File

@ -1,10 +1,12 @@
package org.gcube.portlet.user.userstatisticsportlet.client.ui; package org.gcube.portlet.user.userstatisticsportlet.client.ui;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.uibinder.client.UiBinder; 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.user.client.ui.Composite; import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
@ -21,14 +23,23 @@ public class StatisticWidget extends Composite{
interface StatisticWidgetUiBinder extends UiBinder<Widget, StatisticWidget> { interface StatisticWidgetUiBinder extends UiBinder<Widget, StatisticWidget> {
} }
@UiField
HTMLPanel container;
@UiField @UiField
Label header; //i.e., FEEDS, LIKES .. Label header; //i.e., FEEDS, LIKES ..
@UiField @UiField
FlowPanel containerValues; FlowPanel containerValues;
public StatisticWidget() { public StatisticWidget(boolean isRoot) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
//Set the right margin of this widget according to where the portlet is currently deployed.
if(isRoot)
container.getElement().getStyle().setMarginRight(10.0, Unit.PX);
else
container.getElement().getStyle().setMarginRight(5.0, Unit.PX);
} }
public void setHeader(String header) { public void setHeader(String header) {
@ -38,17 +49,16 @@ public class StatisticWidget extends Composite{
public void appendToPanel(Widget w) { public void appendToPanel(Widget w) {
this.containerValues.add(w); this.containerValues.add(w);
} }
public void removeFromPanel(Widget w){ public void removeFromPanel(Widget w){
this.containerValues.remove(w); this.containerValues.remove(w);
} }
public void clearPanelValues(){ public void clearPanelValues(){
this.containerValues.clear(); this.containerValues.clear();
} }
public void setToolTip(String tooltip){ public void setToolTip(String tooltip){
this.setTitle(tooltip); this.setTitle(tooltip);
} }
} }

View File

@ -3,7 +3,6 @@
xmlns:g="urn:import:com.google.gwt.user.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style> <ui:style>
.statistic-container { .statistic-container {
margin-right: 10px;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
} }
@ -23,7 +22,7 @@
} }
</ui:style> </ui:style>
<g:HTMLPanel styleName="{style.statistic-container}"> <g:HTMLPanel styleName="{style.statistic-container}" ui:field="container">
<g:Label styleName="{style.statistic-header}" ui:field="header" /> <g:Label styleName="{style.statistic-header}" ui:field="header" />
<g:FlowPanel ui:field="containerValues"> <g:FlowPanel ui:field="containerValues">
<!-- Content goes here --> <!-- Content goes here -->

View File

@ -12,16 +12,24 @@
.user-image { .user-image {
align: left; align: left;
height: 50px; height: 70px;
width: auto; width: auto;
border: 1px solid #e6e6e6; border-radius: 6px;
padding: 2px; padding: 2px;
color: #FFF; color: #FFF;
margin-right: 12px;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
} }
.user-image-margin-right-vre {
margin-right: 5px;
}
.user-image-margin-right-root {
margin-right: 10px;
}
.user-image-editable:hover { .user-image-editable:hover {
cursor: pointer; cursor: pointer;
} }
@ -39,14 +47,14 @@
.statistic-value { .statistic-value {
color: #0084B4 !important; color: #0084B4 !important;
font-size: 15px; font-size: 14px;
text-align: center; text-align: center;
vertical-align: bottom; vertical-align: bottom;
} }
.statistic-value-inline { .statistic-value-inline {
color: #0084B4 !important; color: #0084B4 !important;
font-size: 15px; font-size: 14px;
text-align: center; text-align: center;
vertical-align: bottom; vertical-align: bottom;
display: inline-block; display: inline-block;
@ -64,7 +72,7 @@
margin: auto auto; margin: auto auto;
} }
.alert-icon-center{ .alert-icon-center {
display: block; display: block;
margin: auto auto; margin: auto auto;
} }