Jump to content
We've recently updated our Privacy Statement, available here ×

GoncaloSete

Members
  • Posts

    10
  • Joined

  • Last visited

GoncaloSete's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Hi I'm trying to find the configuration file (if there is one...) that indicates the default values for the properties in the image. I would like to add a textfield to a report that always has, for instance, "markup" = "styled". /uploads/projects/ireport/ireport_properties.png Where can I find this configuration file or how can I do this in another way? Thanks, Gonçalo
  2. Well, I reverse engineered the jasperreports code and found out a (potentially dirty) solution. I will share with you, even if I feel like talking to myself. Your scriptlet class should extend and implement the classes below. In your jasperreports_extension.properties define the following line:net.sf.jasperreports.extension.registry.factory.scriptlet=com.alert.pfh.reports.business.MyScriplet Of course you should separate your Scriptlet class from the Factory class. That what I've done. Cheers Code: Code:private static final ExtensionsRegistry scriptletExtensionsRegistry = new ExtensionsRegistry(){ public List getExtensions(Class extensionType){ if(ScriptletFactory.class.equals(extensionType)){ return Collections.singletonList(new MyScriplet()); } return null; } }; public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties){ return scriptletExtensionsRegistry; } Post Edited by GoncaloSete at 10/06/2009 08:11
  3. Hi again I found that there is this JRFillDataset class that loads a default scriptlet if none is defined in the report. Is there a way of doing this with "Extensions"? Thank you Code:/** * Creates the scriptlets. * * @return the scriptlets list * @throws JRException */ protected List createScriptlets(Map parameterValues) throws JRException { ScriptletFactoryContext context = new ScriptletFactoryContext(parameterValues); scriptlets = new ArrayList(); List factories = ExtensionsEnvironment.getExtensionsRegistry().getExtensions(ScriptletFactory.class); for (Iterator it = factories.iterator(); it.hasNext();) { ScriptletFactory factory = (ScriptletFactory)it.next(); List tmpScriptlets = factory.getScriplets(context); if (tmpScriptlets != null) { scriptlets.addAll(tmpScriptlets); } } if (scriptlets.size() == 0) { scriptlets.add(0, new JRDefaultScriptlet()); } return scriptlets; }
  4. Hi I'm not sure I understood, but here's how you can print an element in PageHeader only once Print When Expression -> $V{PAGE_NUMBER}.intValue() == 1 However, the behaviour you want can be achieved with the Title band.
  5. Hi! I've searched the forum for a subject like this, but I couldn't find one thread. I have a Master report and several subreports and I want them all to share the same scriptlet class. The first solution I came up with was: parameters.put(JRParameter.REPORT_SCRIPTLET, new MyScriptlet()); but this only applies MyScriptlet to the master report. Every other subreport continue to have JRDefaultScriptlet instantiated. My challenge is to avoid passing the built-in parameter REPORT_SCRIPTLET to all subreports. In the future, I might have several more and I wouldn't like to worry about passing it all the time. Is there a way of defining that the default scriptlet is MyScriptlet? (instead of JRDefaultScriptlet) Thanks in advance Gonçalo
  6. Actually I've tried that already and it doesn't work. I've also tried setting the ireport.properties as "read-only" but the iReport manages to overwrite this file at some point... I hope the next version of iReport solves this severe bug.
  7. Does anybody know how to answer @regispires? I have the exact same problem. Thanks
  8. Hi I was looking for a similar answer. I have a lot of IDs which are going to be used in the query parameter. Example: SELECT * FROM episode WHERE id_episode = $P{ID_EPISODE} AND id_film = $P{ID_FILM}. What I wanted to do is to load all those parameters in a Java HashMap object and send it to the report. HashMap m = new HashMap(); m.put("ID_EPISODE",idEpisode); m.put("ID_FILM",idFilm); // send m as a parameter to the report reportParameter.put("ID_HASHMAP",m); Then the report would have a ID_HASHMAP parameter and I would simply have to reformulate the SQL query to: SELECT * FROM episode WHERE id_episode = $P{ID_HASHMAP}.get("ID_EPISODE") AND id_film = $P{ID_HASHMAP}.get("ID_FILM"). But this doesn't seem to work...Can anybody give me a hint on this? Thanks, Gonçalo
×
×
  • Create New...