added hide image checkbox and its handler
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@90121 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e941506d7b
commit
72d0ecccb4
|
@ -3,9 +3,9 @@ package org.gcube.portlets.user.shareupdates.client.form;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Visibility;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
|
@ -13,7 +13,9 @@ import com.google.gwt.user.client.ui.HorizontalPanel;
|
|||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
|
||||
public class ImageSwitcher extends Composite{
|
||||
public class ImageSwitcher extends Composite {
|
||||
|
||||
public static final String blank_image_url = GWT.getModuleBaseURL() + "../images/white-grad.gif";
|
||||
|
||||
private ArrayList<String> imageUrls;
|
||||
private VerticalPanel mainPanel = new VerticalPanel();
|
||||
|
@ -23,6 +25,8 @@ public class ImageSwitcher extends Composite{
|
|||
private HTML label = new HTML("1 of 1");
|
||||
private HTML next = new HTML(" >> ");
|
||||
private int currentIndex = 0;
|
||||
|
||||
private boolean visible = true;
|
||||
|
||||
public ImageSwitcher() {
|
||||
super();
|
||||
|
@ -30,21 +34,21 @@ public class ImageSwitcher extends Composite{
|
|||
mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
mainPanel.setPixelSize(100, 100);
|
||||
mainPanel.add(image);
|
||||
|
||||
|
||||
controlPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
controlPanel.add(prev);
|
||||
controlPanel.add(label);
|
||||
controlPanel.add(next);
|
||||
|
||||
mainPanel.add(controlPanel);
|
||||
|
||||
|
||||
prev.setStyleName("small-text-arrow");
|
||||
label.setStyleName("small-text");
|
||||
next.setStyleName("small-text-arrow");
|
||||
|
||||
|
||||
|
||||
|
||||
initWidget(mainPanel);
|
||||
|
||||
|
||||
next.addClickHandler(new ClickHandler() {
|
||||
public void onClick(ClickEvent event) {
|
||||
if (imageUrls != null && currentIndex < imageUrls.size()) {
|
||||
|
@ -54,7 +58,7 @@ public class ImageSwitcher extends Composite{
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
prev.addClickHandler(new ClickHandler() {
|
||||
public void onClick(ClickEvent event) {
|
||||
if (imageUrls != null && currentIndex > 0) {
|
||||
|
@ -66,8 +70,8 @@ public class ImageSwitcher extends Composite{
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected void setImages(ArrayList<String> imageUrls) {
|
||||
this.imageUrls = imageUrls;
|
||||
if (imageUrls.size() == 0) {
|
||||
|
@ -83,13 +87,29 @@ public class ImageSwitcher extends Composite{
|
|||
enableSwitch(imageUrls);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void enableSwitch(ArrayList<String> imageUrls) {
|
||||
label.setHTML("1 of " + imageUrls.size());
|
||||
currentIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
protected String getSelectedImageURL() {
|
||||
if (!visible)
|
||||
image.setUrl(blank_image_url);
|
||||
return image.getUrl();
|
||||
}
|
||||
/**
|
||||
* because i don't want it to me removed from DOM
|
||||
*/
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
if (visible) {
|
||||
image.getElement().getStyle().setVisibility(Visibility.VISIBLE);
|
||||
controlPanel.getElement().getStyle().setVisibility(Visibility.VISIBLE);
|
||||
}
|
||||
else {
|
||||
image.getElement().getStyle().setVisibility(Visibility.HIDDEN);
|
||||
controlPanel.getElement().getStyle().setVisibility(Visibility.HIDDEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,20 @@ public class LinkPreviewer extends Composite {
|
|||
private ShareUpdateForm parent;
|
||||
|
||||
private LinkPreview toShow;
|
||||
|
||||
@UiField HTML closeImage;
|
||||
@UiField ImageSwitcher switcher;
|
||||
|
||||
@UiField
|
||||
HTML titleArea;
|
||||
@UiField
|
||||
HTML urlText;
|
||||
@UiField
|
||||
HTML descText;
|
||||
@UiField
|
||||
CheckBox hideCheckBox;
|
||||
@UiField
|
||||
CheckBox hideImageCheckBox;
|
||||
|
||||
public LinkPreviewer(ShareUpdateForm parent, LinkPreview toShow) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
@ -39,17 +53,8 @@ public class LinkPreviewer extends Composite {
|
|||
switcher.setImages(toShow.getImageUrls());
|
||||
}
|
||||
|
||||
@UiField HTML closeImage;
|
||||
@UiField ImageSwitcher switcher;
|
||||
|
||||
@UiField
|
||||
HTML titleArea;
|
||||
@UiField
|
||||
HTML urlText;
|
||||
@UiField
|
||||
HTML descText;
|
||||
@UiField
|
||||
CheckBox hideCheckBox;
|
||||
|
||||
|
||||
|
||||
public ImageSwitcher getSwitcher() {
|
||||
return switcher;
|
||||
|
@ -60,6 +65,11 @@ public class LinkPreviewer extends Composite {
|
|||
parent.cancelPreview();
|
||||
}
|
||||
|
||||
@UiHandler("hideImageCheckBox")
|
||||
void onHideImageClick(ClickEvent e) {
|
||||
switcher.setVisible(!hideImageCheckBox.getValue());
|
||||
}
|
||||
|
||||
@UiHandler("hideCheckBox")
|
||||
void onClick(ClickEvent e) {
|
||||
descText.setVisible(!hideCheckBox.getValue());
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<div class="link-desc">
|
||||
<g:HTML styleName="" ui:field="descText" />
|
||||
<div class="hide-description">
|
||||
<g:CheckBox ui:field="hideImageCheckBox">Hide Image</g:CheckBox>
|
||||
<g:CheckBox ui:field="hideCheckBox">Hide Description</g:CheckBox>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -18,9 +18,6 @@ import org.jsonmaker.gwt.client.Jsonizer;
|
|||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.dom.client.Style.FontStyle;
|
||||
import com.google.gwt.dom.client.Style.FontWeight;
|
||||
import com.google.gwt.dom.client.Style.TextDecoration;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
|
@ -29,7 +26,6 @@ import com.google.gwt.user.client.Window;
|
|||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
|
@ -55,6 +51,7 @@ public class ShareUpdateForm extends Composite {
|
|||
public static final String loading = GWT.getModuleBaseURL() + "../images/avatarLoader.gif";
|
||||
public static final String avatar_default = GWT.getModuleBaseURL() + "../images/Avatar_default.png";
|
||||
|
||||
|
||||
private static ShareUpdateFormUiBinder uiBinder = GWT
|
||||
.create(ShareUpdateFormUiBinder.class);
|
||||
|
||||
|
|
|
@ -113,8 +113,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
|||
if (user == null) {
|
||||
_log.warn("USER IS NULL setting test.user and Running OUTSIDE PORTAL");
|
||||
user = "test.user";
|
||||
// user = "massimiliano.assante";
|
||||
// SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
|
||||
user = "massimiliano.assante";
|
||||
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube/devsec/devVRE");
|
||||
withinPortal = false;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue