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
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
final String urlAccount = information.getAccountURL();
@ -164,7 +170,7 @@ public class StatisticsPanel extends Composite {
mainPanel.add(userImage);
// feeds
final StatisticWidget feeds = new StatisticWidget();
final StatisticWidget feeds = new StatisticWidget(isRoot);
feeds.setHeader(POSTS_LABEL);
if(isRoot)
@ -182,7 +188,7 @@ public class StatisticsPanel extends Composite {
mainPanel.add(feeds);
// likes & comments
final StatisticWidget likesAndComments = new StatisticWidget();
final StatisticWidget likesAndComments = new StatisticWidget(isRoot);
likesAndComments.setHeader(LIKES_COMMENTS_LABEL);
if(isRoot)
@ -199,8 +205,8 @@ public class StatisticsPanel extends Composite {
mainPanel.add(likesAndComments);
// the storage and the profile strength(only in root)
final StatisticWidget storage = new StatisticWidget();
final StatisticWidget profileStrength = new StatisticWidget();
final StatisticWidget storage = new StatisticWidget(isRoot);
final StatisticWidget profileStrength = new StatisticWidget(isRoot);
if(isRoot){

View File

@ -1,10 +1,12 @@
package org.gcube.portlet.user.userstatisticsportlet.client.ui;
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.UiField;
import com.google.gwt.user.client.ui.Composite;
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.Widget;
@ -21,14 +23,23 @@ public class StatisticWidget extends Composite{
interface StatisticWidgetUiBinder extends UiBinder<Widget, StatisticWidget> {
}
@UiField
HTMLPanel container;
@UiField
Label header; //i.e., FEEDS, LIKES ..
@UiField
FlowPanel containerValues;
public StatisticWidget() {
public StatisticWidget(boolean isRoot) {
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) {
@ -38,17 +49,16 @@ public class StatisticWidget extends Composite{
public void appendToPanel(Widget w) {
this.containerValues.add(w);
}
public void removeFromPanel(Widget w){
this.containerValues.remove(w);
}
public void clearPanelValues(){
this.containerValues.clear();
}
public void setToolTip(String tooltip){
this.setTitle(tooltip);
}
}

View File

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

View File

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