You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2016/06/16 16:28:45 UTC

[1/2] isis git commit: Regarding Blob/Clob: Allow to set file-extension filter for client-side file-open-dialog.

Repository: isis
Updated Branches:
  refs/heads/ISIS-1446_pr-47 [created] 684431275


Regarding Blob/Clob: Allow to set file-extension filter for client-side file-open-dialog.

HTML file input tags allow for the client-side file-open-dialog to filter for specific file types *.xyz via the <input ... accept=".xyz"/> attribute.

Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/82c1d198
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/82c1d198
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/82c1d198

Branch: refs/heads/ISIS-1446_pr-47
Commit: 82c1d198a473ca813e45285a9aea4772f94c5d03
Parents: cbb4c4c
Author: Andi Huber <ho...@gmx.at>
Authored: Sun May 22 10:32:47 2016 +0200
Committer: Andi Huber <ho...@gmx.at>
Committed: Sun May 22 10:32:47 2016 +0200

----------------------------------------------------------------------
 .../isisapplib/IsisBlobOrClobPanelAbstract.java | 37 +++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/82c1d198/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java
index 03ced44..9a7588c 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java
@@ -26,6 +26,7 @@ import java.util.List;
 import javax.activation.MimeType;
 import javax.imageio.ImageIO;
 
+import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -239,7 +240,8 @@ public abstract class IsisBlobOrClobPanelAbstract<T extends NamedWithMimeType> e
     private void updateRegularFormComponents(final InputFieldVisibility visibility) {
         MarkupContainer formComponent = (MarkupContainer) getComponentForRegular();
         formComponent.get(ID_SCALAR_VALUE).setVisible(visibility == InputFieldVisibility.VISIBLE);
-
+        
+        addAcceptFilterTo(formComponent.get(ID_SCALAR_VALUE));
         fileNameLabel = updateFileNameLabel(ID_FILE_NAME, formComponent);
 
         updateClearLink(visibility);
@@ -256,6 +258,39 @@ public abstract class IsisBlobOrClobPanelAbstract<T extends NamedWithMimeType> e
         }
     }
 
+	/**
+	 * Just a demo! <br/>
+	 * Fetches the desired filter from e.g. <br/><br/> 
+	 * {@code @ParameterLayout(named="File", describedAs=".xlsx")} 
+	 * @return the desired accept filter 
+	 */
+	private String getAcceptFilter(){
+		return scalarModel.getDescribedAs();
+	}
+	
+	/**
+	 * HTML file input tags allow for the client-side file-open-dialog 
+	 * to filter for specific file types *.xyz via the {@code<input ... accept=".xyz"/>}
+	 * attribute.  
+	 * @param component 
+	 * @param filter should be of the form "file_extension|audio/*|video/*|image/*|media_type"
+	 * @see <a href="http://www.w3schools.com/tags/att_input_accept.asp">http://www.w3schools.com</a>
+	 */
+	private void addAcceptFilterTo(Component component){
+		final String filter = getAcceptFilter();
+		if(filter==null || filter.isEmpty())
+			return; // ignore
+		class AcceptAttributeModel extends Model<String> {
+			private static final long serialVersionUID = 1L;
+			@Override
+			public String getObject() {
+				return filter;
+			}
+		}
+		component.add(new AttributeModifier("accept", new AcceptAttributeModel()));
+	}
+
+
     private Label updateFileNameLabel(String idFileName, MarkupContainer formComponent) {
         class FileNameModel extends Model<String> {
             private static final long serialVersionUID = 1L;


[2/2] isis git commit: Merge branch 'master' of https://github.com/hobrom/isis into ISIS-1446_pr-47

Posted by da...@apache.org.
Merge branch 'master' of https://github.com/hobrom/isis into ISIS-1446_pr-47


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/68443127
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/68443127
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/68443127

Branch: refs/heads/ISIS-1446_pr-47
Commit: 684431275160d556122787af5e0b9f1e0308d63a
Parents: 6bf180f 82c1d19
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Jun 16 17:26:25 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Jun 16 17:26:25 2016 +0100

----------------------------------------------------------------------
 .../isisapplib/IsisBlobOrClobPanelAbstract.java | 37 +++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/68443127/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisBlobOrClobPanelAbstract.java
----------------------------------------------------------------------