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.uibinder.client.UiHandler;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
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.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.Label;
|
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 DELETE_ATTACHMENT = "Delete this attachment?";
|
||||||
private static final String RETRY_TO_UPLOAD = "Retry to upload this attachment on the server.";
|
private static final String RETRY_TO_UPLOAD = "Retry to upload this attachment on the server.";
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel attachmentContainer;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTML deleteAttachment;
|
HTML deleteAttachment;
|
||||||
|
@ -150,5 +154,11 @@ public class AttachmentPreviewer extends Composite {
|
||||||
|
|
||||||
attachmentResult.add(retryButton);
|
attachmentResult.add(retryButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeAttachmentWidth(int newWidth, Unit unit){
|
||||||
|
|
||||||
|
attachmentContainer.getElement().getStyle().setWidth(newWidth, unit);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
background-image: none;
|
background-image: none;
|
||||||
border: 1px solid #DDD;
|
border: 1px solid #DDD;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
width: 278px;
|
width: 579px;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
width: 200px
|
width: 200px
|
||||||
}
|
}
|
||||||
</ui:style>
|
</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:Image styleName="{style.image-preview}" ui:field="imagePreview"></g:Image>
|
||||||
<g:VerticalPanel styleName="{style.attach-result}">
|
<g:VerticalPanel styleName="{style.attach-result}">
|
||||||
<g:Label ui:field="fileNameLabel" styleName="{style.label-style}"></g:Label>
|
<g:Label ui:field="fileNameLabel" styleName="{style.label-style}"></g:Label>
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package org.gcube.portlets.user.shareupdates.client.view;
|
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.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
|
* This panel will contain the attachments/previews
|
||||||
* @author Massimiliano Assante at ISTI CNR
|
* @author Massimiliano Assante at ISTI CNR
|
||||||
|
@ -11,4 +14,31 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
*/
|
*/
|
||||||
public class Placeholder extends FlowPanel {
|
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.");
|
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
|
// create temp view of the attached file and add to the previewer
|
||||||
final AttachmentPreviewer atPrev = new AttachmentPreviewer(fileName, attachedDefaultImageUrl, preview, this);
|
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
|
// disable the submit button till we know the result of the upload process
|
||||||
submitButton.setEnabled(false);
|
submitButton.setEnabled(false);
|
||||||
|
@ -777,7 +750,7 @@ public class ShareUpdateForm extends Composite {
|
||||||
atPrev.setImagePreview(result.getImageUrls().get(0));
|
atPrev.setImagePreview(result.getImageUrls().get(0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
preview.add(atPrev);
|
preview.add(atPrev);
|
||||||
|
|
||||||
// enable checkbox to save in workspace if it's the case
|
// 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"
|
<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: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">
|
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">
|
<g:HTMLPanel ui:field="mainPanel">
|
||||||
<table class="share-updates-table">
|
<table class="share-updates-table">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="share-updates-photo-cell">
|
<td class="share-updates-photo-cell">
|
||||||
<g:Image styleName="share-updates-member-photo"
|
<g:Image styleName="share-updates-member-photo" url=""
|
||||||
url="" ui:field="avatarImage" />
|
ui:field="avatarImage" />
|
||||||
</td>
|
</td>
|
||||||
<td class="share-updates-cell">
|
<td class="share-updates-cell">
|
||||||
<div id="supercontainer">
|
<div id="supercontainer">
|
||||||
|
@ -24,7 +29,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<j:UploadProgressPanel ui:field="uploadProgress"></j:UploadProgressPanel>
|
<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>
|
<m:SaveInWorkspaceBox ui:field="saveInWorkspaceCheckbox"></m:SaveInWorkspaceBox>
|
||||||
<table class="share-updates-table">
|
<table class="share-updates-table">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -39,9 +44,10 @@
|
||||||
<g:ListBox styleName="wizardListbox" ui:field="notifyListbox"
|
<g:ListBox styleName="wizardListbox" ui:field="notifyListbox"
|
||||||
visible="false" />
|
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"
|
<b:Button ui:field="submitButton" type="INFO" width="52px"
|
||||||
text="Share" visible="false" />
|
text="Share" visible="false" />
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
</b:Fieldset>
|
</b:Fieldset>
|
||||||
</b:Form>
|
</b:Form>
|
||||||
|
|
Loading…
Reference in New Issue