[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #HPK-487615]: possible workaround for "unnamed" layout models



Hi Jon-

> TomW tells me that patches are much preferred to inquiry
> notifications. Believe me, I know the feeling. Anyway...

That would be better.

> If you open up the layout model editor, go to "File>New", and then opt
> to save off a layout model with an empty name, you should get an
> ArrayIndexOutOfBoundsException from
> ucar.unidata.ui.symbol.StationModelCanvas.makeStationModelMenuItems.
> 
> In the attached code I simply override ResourceManager's "doNew"
> method to provide a default name in the JTextField that gets shown,
> and if the input is "bad" (somehow null or an empty string), return
> the default name.
> 
> I had another workaround that altered GuiUtils so that
> showOkCancelDialog(...) could take an "allowEmpty" boolean param and
> would disable the "ok" button if allowEmpty==false, but I'm a bit wary
> of how it might affect existing code (or if that's even the right
> method for it)... let me know if I should send that stuff instead!

A resource name should never be blank, so I updated ResoureManager.doNew() to 
handle a blank name better.  I also modified the StationModelCanvas to pass in 
a default name ("model") so at least that would keep people from accidently 
hitting OK with a blank name.  They would have to manually remove the default.

Don

Ticket Details
===================
Ticket ID: HPK-487615
Department: Support IDV
Priority: Normal
Status: Open