Changeset 7758
- Timestamp:
- Nov 27, 2019, 12:58:04 PM (3 years ago)
- Location:
- trunk/src/clients/web/net/sf/basedb/clients/web/extensions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/DynamicActionAttributeSupport.java
r6626 r7758 21 21 package net.sf.basedb.clients.web.extensions; 22 22 23 import java.util.HashMap; 23 24 import java.util.Iterator; 25 import java.util.Map; 26 27 import org.apache.commons.collections4.iterators.IteratorChain; 24 28 25 29 import net.sf.basedb.util.extensions.Action; … … 39 43 private Iterator<DynamicActionAttribute> dynamicAttributes; 40 44 private DynamicActionAttributes source; 45 private Map<String, DynamicActionAttribute> moreAttributes; 46 41 47 42 48 /** … … 83 89 it = source.getDynamicActionAttributes(); 84 90 } 91 if (moreAttributes != null) 92 { 93 if (it != null) 94 { 95 it = new IteratorChain<>(it, moreAttributes.values().iterator()); 96 } 97 else 98 { 99 it = moreAttributes.values().iterator(); 100 } 101 } 85 102 return it; 86 103 } … … 96 113 this.source = source; 97 114 } 115 116 /** 117 Adds a dynamic attribute to the action. The name should be unique or it will overwrite any 118 existing attribute. Attributes that are set via this method are merged with attributes 119 that are set via {@link #setDynamicActionAttributesSource(DynamicActionAttributes)}. 120 Duplicates are not removed in this case. 121 @since 3.16 122 */ 123 public void setDynamicAttribute(String name, Object value) 124 { 125 if (moreAttributes == null) moreAttributes = new HashMap<String, DynamicActionAttribute>(); 126 moreAttributes.put(name, new DynamicActionAttribute(name, value == null ? null : value.toString())); 127 } 98 128 99 129 } -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/fileviewer/ViewAndDownloadActionFactory.java
r7757 r7758 44 44 String bytes = Values.formatBytes(f.getSize(), 1); 45 45 46 // TODO -- we are lacking a simple way to add data-* attributes so the icons are not linked47 48 46 ButtonBean view = new ButtonBean(); 49 47 view.setVisible(true); … … 51 49 view.setTitle("View the contents of this file (" + bytes + ")"); 52 50 view.setIcon(jspContext.getRoot()+"/images/view.png"); 51 view.setDynamicAttribute("data-file-id", f.getId()); 52 view.setDynamicAttribute("data-auto-init", "view-file"); 53 53 54 54 ButtonBean download = new ButtonBean(); … … 57 57 download.setTitle("Download the contents of this file (" + bytes + ")"); 58 58 download.setIcon(jspContext.getRoot()+"/images/download.png"); 59 download.setDynamicAttribute("data-file-id", f.getId()); 60 download.setDynamicAttribute("data-auto-init", "download-file"); 59 61 60 62 actions = new ButtonAction[] { view, download };
Note: See TracChangeset
for help on using the changeset viewer.