|
|
|
@ -3,6 +3,7 @@ import com.google.gwt.core.shared.GWT;
|
|
|
|
|
import com.google.gwt.dom.client.Style.Unit;
|
|
|
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
|
|
import com.google.gwt.user.client.Window;
|
|
|
|
|
import com.google.gwt.user.client.ui.Anchor;
|
|
|
|
|
import com.google.gwt.user.client.ui.FlowPanel;
|
|
|
|
|
import com.google.gwt.user.client.ui.SimplePanel;
|
|
|
|
@ -17,7 +18,7 @@ import com.google.gwt.user.client.ui.WidgetCollection;
|
|
|
|
|
public class Placeholder extends FlowPanel {
|
|
|
|
|
|
|
|
|
|
private static final String SHOW_OTHER_ATTACHMENTS_LABEL = "Show All";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if we need to show more attachments
|
|
|
|
|
private boolean appendShowMoreLabel;
|
|
|
|
|
|
|
|
|
@ -32,7 +33,13 @@ public class Placeholder extends FlowPanel {
|
|
|
|
|
// check the size
|
|
|
|
|
int size = listOfChildren.size();
|
|
|
|
|
|
|
|
|
|
if(size % 2 == 0){
|
|
|
|
|
// look at NewsFeed.css ...
|
|
|
|
|
if(Window.getClientWidth() <= 1128){
|
|
|
|
|
|
|
|
|
|
add((Widget)atPrev);
|
|
|
|
|
atPrev.changeAttachmentWidth(92, Unit.PCT);
|
|
|
|
|
}
|
|
|
|
|
else 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");
|
|
|
|
@ -61,17 +68,17 @@ public class Placeholder extends FlowPanel {
|
|
|
|
|
public void appendShowMoreLabel(){
|
|
|
|
|
|
|
|
|
|
if(appendShowMoreLabel){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final WidgetCollection listOfChildren = this.getChildren();
|
|
|
|
|
|
|
|
|
|
final SimplePanel sp = new SimplePanel();
|
|
|
|
|
sp.setStyleName("centered");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final Anchor showMoreAttachments = new Anchor(SHOW_OTHER_ATTACHMENTS_LABEL);
|
|
|
|
|
showMoreAttachments.setTitle("Show all the attached files");
|
|
|
|
|
showMoreAttachments.setStyleName("link");
|
|
|
|
|
sp.add(showMoreAttachments);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showMoreAttachments.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|