Refining portlet design
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@112345 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
702eea8852
commit
98f4fac6ba
|
@ -1,15 +1,20 @@
|
|||
package org.gcube.portlets.user.joinvre.client.ui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.joinvre.shared.VRE;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.AnchorElement;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
|
@ -22,25 +27,59 @@ public class DisplayVRE extends Composite {
|
|||
|
||||
private static DisplayVREUiBinder uiBinder = GWT.create(DisplayVREUiBinder.class);
|
||||
|
||||
public static final String vreDefault = GWT.getModuleBaseURL() + "../images/vre-default.png";
|
||||
public static final String loading = GWT.getModuleBaseURL() + "../images/vre-image-loader.gif";
|
||||
public static final String vreDefaultImage = GWT.getModuleBaseURL() + "../images/vre-default.png";
|
||||
public static final String loadingImage = GWT.getModuleBaseURL() + "../images/vre-image-loader.gif";
|
||||
|
||||
public static final String REQUEST_ACCESS = "Request Access";
|
||||
public static final String FREE_ACCESS = "Free Access";
|
||||
|
||||
|
||||
@UiField HTMLPanel mainPanel;
|
||||
@UiField Image vreImage;
|
||||
@UiField AnchorElement vreName;
|
||||
@UiField Label vreName;
|
||||
@UiField HTMLPanel vreCategories;
|
||||
@UiField Button joinButton;
|
||||
|
||||
public DisplayVRE(VRE vre) {
|
||||
Widget widget = uiBinder.createAndBindUi(this);
|
||||
vreImage.setUrl(loadingImage);
|
||||
|
||||
vreImage.setUrl(loading);
|
||||
mainPanel.addStyleName("profile-section");
|
||||
|
||||
vreImage.setUrl(vre.getImageURL());
|
||||
if(vre.getImageURL().compareTo("")!=0){
|
||||
vreImage.setUrl(vre.getImageURL());
|
||||
}else{
|
||||
vreImage.setUrl(vreDefaultImage);
|
||||
}
|
||||
|
||||
vreImage.setTitle(vre.getName());
|
||||
vreImage.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// TODO Show Description
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
vreName.setTitle(vre.getName());
|
||||
vreName.setHref(vre.getFriendlyURL());
|
||||
vreName.setInnerText(vre.getName());
|
||||
vreName.setText(vre.getName());
|
||||
|
||||
List<String> categories = vre.getCategories();
|
||||
for(int i=0; i<categories.size(); i++){
|
||||
vreCategories.add(new Label(categories.get(i)));
|
||||
if(i!=categories.size()-1){
|
||||
vreCategories.add(new Label(","));
|
||||
}
|
||||
}
|
||||
|
||||
if(vre.isUponRequest()){
|
||||
joinButton.setText(REQUEST_ACCESS);
|
||||
}else{
|
||||
joinButton.setText(FREE_ACCESS);
|
||||
joinButton.setStyleName("freeAccessButton", true);
|
||||
}
|
||||
joinButton.setStyleName("joinButton", true);
|
||||
|
||||
|
||||
initWidget(widget);
|
||||
}
|
||||
|
@ -48,7 +87,7 @@ public class DisplayVRE extends Composite {
|
|||
public void showError(String message) {
|
||||
Window.alert("Failure: " + message);
|
||||
vreImage.setSize("100px", "100px");
|
||||
vreImage.setUrl(vreDefault);
|
||||
vreImage.setUrl(vreDefaultImage);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,8 +9,11 @@
|
|||
ui:field="vreImage" />
|
||||
</div>
|
||||
<div class="vreDetails">
|
||||
<a href="" styleName="vreName" ui:field="vreName"></a>
|
||||
<g:Label ui:field="vreName" styleName="vreName" />
|
||||
<g:HTMLPanel ui:field="vreCategories" styleName="vreCategories" />
|
||||
<g:Button ui:field="joinButton" />
|
||||
</div>
|
||||
|
||||
</g:HTMLPanel>
|
||||
|
||||
</ui:UiBinder>
|
|
@ -84,10 +84,16 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
|||
if (isWithinPortal()) {
|
||||
|
||||
|
||||
} else {
|
||||
vres.add(new VRE(0, "devsec", "devsec VRE", "", "", "/group/devsec", UserBelonging.NOT_BELONGING, false));
|
||||
vres.add(new VRE(0, "devVRE", "devVRE VRE", "", "", "/group/devVRE", UserBelonging.NOT_BELONGING, false));
|
||||
vres.add(new VRE(0, "devmode", "devmode VRE", "", "", "/group/devmode", UserBelonging.NOT_BELONGING, true));
|
||||
} else {
|
||||
List<String> devsecCategories = new ArrayList<String>();
|
||||
devsecCategories.add("Development");
|
||||
vres.add(new VRE(0, "devsec", "devsec VRE", "", "", "/group/devsec", devsecCategories, UserBelonging.NOT_BELONGING, false));
|
||||
List<String> devVRECategories = new ArrayList<String>(devsecCategories);
|
||||
devVRECategories.add("Sailing");
|
||||
vres.add(new VRE(1, "devVRE", "devVRE VRE", "", "", "/group/devVRE", devVRECategories, UserBelonging.NOT_BELONGING, false));
|
||||
List<String> devmodeategories = new ArrayList<String>(devsecCategories);
|
||||
devmodeategories.add("Climbing");
|
||||
vres.add(new VRE(2, "devmode", "devmode VRE", "", "", "/group/devmode", devmodeategories, UserBelonging.NOT_BELONGING, true));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_log.error("Error in server get all contacts ", e);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.portlets.user.joinvre.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
|
||||
|
@ -8,8 +9,10 @@ import java.io.Serializable;
|
|||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VRE extends ResearchEnvironment implements Serializable, Comparable<VRE> {
|
||||
private boolean uponRequest;
|
||||
private long id;
|
||||
|
||||
protected boolean uponRequest;
|
||||
protected long id;
|
||||
protected List<String> categories;
|
||||
|
||||
public VRE() {
|
||||
super();
|
||||
|
@ -17,20 +20,23 @@ public class VRE extends ResearchEnvironment implements Serializable, Comparable
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param vreName
|
||||
* @param description
|
||||
* @param imageURL
|
||||
* @param vomsGroupName
|
||||
* @param friendlyURL
|
||||
* @param categories
|
||||
* @param userBelonging
|
||||
* @param uponRequest
|
||||
*/
|
||||
public VRE(long id, String vreName, String description, String imageURL,
|
||||
String vomsGroupName, String friendlyURL,
|
||||
String vomsGroupName, String friendlyURL, List<String> categories,
|
||||
UserBelonging userBelonging, boolean uponRequest) {
|
||||
super(vreName, description, imageURL, vomsGroupName, friendlyURL, userBelonging);
|
||||
this.uponRequest = uponRequest;
|
||||
this.id = id;
|
||||
this.categories = categories;
|
||||
}
|
||||
|
||||
public boolean isUponRequest() {
|
||||
|
@ -40,7 +46,6 @@ public class VRE extends ResearchEnvironment implements Serializable, Comparable
|
|||
this.uponRequest = uponRequest;
|
||||
}
|
||||
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -49,6 +54,21 @@ public class VRE extends ResearchEnvironment implements Serializable, Comparable
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the categories
|
||||
*/
|
||||
public List<String> getCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param categories the categories to set
|
||||
*/
|
||||
public void setCategories(List<String> categories) {
|
||||
this.categories = categories;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VRE [getName()=" + getName()
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
border-radius: 6px !important;
|
||||
-moz-border-radius: 6px !important;
|
||||
-webkit-border-radius: 6px !important;
|
||||
border: 1px solid #DBDBDB;
|
||||
border: 1px solid #9b9b9b;
|
||||
}
|
||||
|
||||
.frame {
|
||||
|
@ -17,49 +17,54 @@
|
|||
border-radius: 6px !important;
|
||||
-moz-border-radius: 6px !important;
|
||||
-webkit-border-radius: 6px !important;
|
||||
border: 1px solid #DBDBDB;
|
||||
}
|
||||
|
||||
.vreImage {
|
||||
padding: 5px;
|
||||
border: 1px solid #E6E6E6;
|
||||
width: 180px;
|
||||
height: 175px;
|
||||
border: 1px solid #9b9b9b;
|
||||
}
|
||||
|
||||
.vreImageDetails {
|
||||
width: 200px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.vreImage {
|
||||
border: 1px solid #9b9b9b;
|
||||
border-radius: 6px !important;
|
||||
-moz-border-radius: 6px !important;
|
||||
-webkit-border-radius: 6px !important;
|
||||
width: 198px;
|
||||
height: 198px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.vreDetails {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
a.vreName {
|
||||
color: #444444;
|
||||
font-size: 15px;
|
||||
.vreName {
|
||||
color: #225f97;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
a.vreName, a.vreName:visited {
|
||||
padding: 2px 0;
|
||||
cursor: pointer;
|
||||
cursor: hand;
|
||||
font-size: 16x;
|
||||
text-decoration: none;
|
||||
color: #3B5998;
|
||||
}
|
||||
|
||||
a.vreName:hover {
|
||||
opacity: 0.8;
|
||||
font-size: 16x;
|
||||
text-decoration: underline;
|
||||
.vreCategories {
|
||||
margin: 4px 0px;
|
||||
font-size: 14px;
|
||||
color: #9b9b9b;
|
||||
line-height: 14px;
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.vreCategories > * {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.vreDescription {
|
||||
font-size: 13px;
|
||||
color: #444444;
|
||||
line-height: 16px;
|
||||
.joinButton {
|
||||
width: 100%;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.freeAccessButton {
|
||||
background-color: #47a447 !important;
|
||||
color: #FFF !important;
|
||||
}
|
Loading…
Reference in New Issue