Changed layout for attachments
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@122320 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1ff6ca4b94
commit
376967c223
|
@ -10,6 +10,7 @@ import com.google.gwt.uibinder.client.UiField;
|
|||
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.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
|
@ -35,6 +36,9 @@ public class AttachmentPreviewer extends Composite {
|
|||
|
||||
//private static final String DELETE_ATTACHMENT = "Delete this attachment?";
|
||||
private static final String RETRY_TO_UPLOAD = "Retry to upload this attachment on the server.";
|
||||
|
||||
@UiField
|
||||
HTMLPanel attachmentContainer;
|
||||
|
||||
@UiField
|
||||
HTML deleteAttachment;
|
||||
|
@ -150,5 +154,11 @@ public class AttachmentPreviewer extends Composite {
|
|||
|
||||
attachmentResult.add(retryButton);
|
||||
}
|
||||
|
||||
public void changeAttachmentWidth(int newWidth, Unit unit){
|
||||
|
||||
attachmentContainer.getElement().getStyle().setWidth(newWidth, unit);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
background-image: none;
|
||||
border: 1px solid #DDD;
|
||||
border-radius: 4px;
|
||||
width: 278px;
|
||||
width: 579px;
|
||||
margin: 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@
|
|||
width: 200px
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel styleName="{style.container-style}">
|
||||
<g:HTMLPanel styleName="{style.container-style}" ui:field="attachmentContainer">
|
||||
<g:Image styleName="{style.image-preview}" ui:field="imagePreview"></g:Image>
|
||||
<g:VerticalPanel styleName="{style.attach-result}">
|
||||
<g:Label ui:field="fileNameLabel" styleName="{style.label-style}"></g:Label>
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package org.gcube.portlets.user.shareupdates.client.view;
|
||||
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.user.client.ui.WidgetCollection;
|
||||
/**
|
||||
* This panel will contain the attachments/previews
|
||||
* @author Massimiliano Assante at ISTI CNR
|
||||
|
@ -11,4 +14,31 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
|||
*/
|
||||
public class Placeholder extends FlowPanel {
|
||||
|
||||
/**
|
||||
* Modified version of the add method.
|
||||
*/
|
||||
public void add(AttachmentPreviewer atPrev){
|
||||
|
||||
WidgetCollection listOfChildren = this.getChildren();
|
||||
|
||||
// check the size
|
||||
int size = listOfChildren.size();
|
||||
|
||||
GWT.log("Size is " + size);
|
||||
|
||||
if(size % 2 == 0){
|
||||
// in this case the next attachment we are going to add remains with the same width
|
||||
add((Widget)atPrev);
|
||||
GWT.log("added without changing size");
|
||||
}
|
||||
else{
|
||||
// we need to change the length of the last element added and of this new one
|
||||
((AttachmentPreviewer) listOfChildren.get(size -1)).changeAttachmentWidth(278, Unit.PX);
|
||||
atPrev.changeAttachmentWidth(278, Unit.PX);
|
||||
|
||||
// add it finally
|
||||
add((Widget)atPrev);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -247,33 +247,6 @@ public class ShareUpdateForm extends Composite {
|
|||
GWT.log("Drag and drop not supported.");
|
||||
|
||||
}
|
||||
|
||||
// ClientFeed notification = new ClientFeed();
|
||||
// //Subscribe to message and associate subsequent receptions with custom subscriber data
|
||||
// try {
|
||||
// pageBusAdapter.PageBusSubscribe("org.gcube.portal.databook.shared", null, null, notification, (Jsonizer)GWT.create(ClientFeedJsonizer.class));
|
||||
// }
|
||||
// catch (PageBusAdapterException e1) {
|
||||
// GWT.log(e1.toString());
|
||||
// }
|
||||
//
|
||||
// pageBusAdapter.addPageBusSubscriptionCallbackListener(new PageBusListener() {
|
||||
// public void onPageBusSubscriptionCallback(PageBusEvent event) {
|
||||
// // translate JavaScript message contents and subscriber data to their Java equivalents
|
||||
// try {
|
||||
//
|
||||
// GWT.log("Receiving...");
|
||||
// ClientFeed feed = (ClientFeed)event.getMessage((Jsonizer)GWT.create(ClientFeedJsonizer.class));
|
||||
// GWT.log("Received client feed " + feed);
|
||||
//
|
||||
// } catch (PageBusAdapterException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// public String getName() {
|
||||
// return null;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -668,7 +641,7 @@ public class ShareUpdateForm extends Composite {
|
|||
|
||||
// create temp view of the attached file and add to the previewer
|
||||
final AttachmentPreviewer atPrev = new AttachmentPreviewer(fileName, attachedDefaultImageUrl, preview, this);
|
||||
preview.add(atPrev);
|
||||
//preview.add(atPrev);
|
||||
|
||||
// disable the submit button till we know the result of the upload process
|
||||
submitButton.setEnabled(false);
|
||||
|
@ -777,7 +750,7 @@ public class ShareUpdateForm extends Composite {
|
|||
atPrev.setImagePreview(result.getImageUrls().get(0));
|
||||
|
||||
}
|
||||
|
||||
|
||||
preview.add(atPrev);
|
||||
|
||||
// enable checkbox to save in workspace if it's the case
|
||||
|
|
|
@ -2,12 +2,17 @@
|
|||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:m="urn:import:org.gcube.portlets.user.shareupdates.client.view"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:j="urn:import:org.gcube.portlets.widgets.fileupload.client.view">
|
||||
<ui:style>
|
||||
.attachment-container {
|
||||
width: 600px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="mainPanel">
|
||||
<table class="share-updates-table">
|
||||
<tr>
|
||||
<td class="share-updates-photo-cell">
|
||||
<g:Image styleName="share-updates-member-photo"
|
||||
url="" ui:field="avatarImage" />
|
||||
<g:Image styleName="share-updates-member-photo" url=""
|
||||
ui:field="avatarImage" />
|
||||
</td>
|
||||
<td class="share-updates-cell">
|
||||
<div id="supercontainer">
|
||||
|
@ -24,7 +29,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
<j:UploadProgressPanel ui:field="uploadProgress"></j:UploadProgressPanel>
|
||||
<m:Placeholder ui:field="preview"></m:Placeholder>
|
||||
<m:Placeholder ui:field="preview" styleName="{style.attachment-container}"></m:Placeholder>
|
||||
<m:SaveInWorkspaceBox ui:field="saveInWorkspaceCheckbox"></m:SaveInWorkspaceBox>
|
||||
<table class="share-updates-table">
|
||||
<tr>
|
||||
|
@ -39,9 +44,10 @@
|
|||
<g:ListBox styleName="wizardListbox" ui:field="notifyListbox"
|
||||
visible="false" />
|
||||
|
||||
<b:Button ui:field="attachButton" icon="UPLOAD_ALT" visible="false" />
|
||||
<b:Button ui:field="attachButton" icon="UPLOAD_ALT"
|
||||
visible="false" />
|
||||
<b:Button ui:field="submitButton" type="INFO" width="52px"
|
||||
text="Share" visible="false" />
|
||||
text="Share" visible="false" />
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
|
|
Loading…
Reference in New Issue