Aenigma / ActionMockup

Other
1 stars 0 forks source link

selective table printing idea #29

Open jackal390iv opened 10 years ago

jackal390iv commented 10 years ago

best way i can think to do selected jtable printing is to create a new jtable based on the users selection/highlight, then send the new jtable to ReportPrinter when the call is made (instead of sending the whole jtable) using a simple if/else statement.

jackal390iv commented 10 years ago

however I don't see an easy way to do selective prints outside of the jtable (why would you want to anyways...)

Aenigma commented 10 years ago

yes this should work fine. Take a look in here. You should be able to use that JTable. The GUI code has been untested for a while, though, so may experience some difficulties.

jackal390iv commented 10 years ago

I could also combine 2/3 of the printing classes if you want (like you asked me about earlier) However there may be large empty gaps in the prints (unused variables) and I'm unsure if jasperreports is even capable of that without erroring out from missing TitleText's

jackal390iv commented 10 years ago

I tried to combine the jtable's before and it glitched/errored out but I'm unsure if regular parameters handle the same way...

Aenigma commented 10 years ago

if you want to do it quickly, you should be able to use just the stuff in here.

You could do something like:

// setup
BeanTableModelFactory btf;
btf = new BeanTableModelFactory(new BeanUtilsBean());

btf.registerConverter(new CustomMoneyConverter(), CustomMoney.class);
btf.registerConverter(new InstantConverter(), Instant.class);

// actual code starts here
BeanTableModel btm = btf.get(Driver.class);

Collection<Driver> drivers = new ArrayList<>();

/* add stuff to collection */

btm.setResources(drivers)
JTable mytbl = new JTable();
mytbl.setModel(btm);

/* process JTable to Jasper */