A case is( )if it is the caseroo...

Here’s my list:
Digital not IT
more than Javascript over Java
JSON more than XML
Python more than PHP
Ruby even more than Rails
German more than French
Mandarin more than German
more than Scrum
more than perfection
Agile much more than PRINCE2
In fact, agile rather than any specific methodology
Inquisitiveness rather than idealism
Curating more than collecting
Content design more than SEO
User needs not requirements
User research not instinct
Making more than writing
Doing more than talking
more than tin
Data not patents
Open not closed
While there’s value in (some of) the things on the right, I value the things on the left more.
Suggestions from other lovely people:
@fantasticlife: , ,
@frankieroberto: ,
John Willshire has an entire book about
September 11, 2014 |
| Comments Off
I made a bike light indicator system out of a , a
rechargeable battery and .
It starts off with the central front LEDs lit up bright white, and pressing the button on the BlinkyTape switches between steads/left/right indicator modes.
The PowerMonkey is a simple little 5v rechargeable battery, with a variety of adaptors for charging various phones etc. It makes an ideal portable power source for the BlinkyTape.
Here’s a video of it in action.
And I’ve put
online too.
I’ve also been experimenting with using the
to do some light painting.
Lots more fun to have here.
August 22, 2014 | , ,
I finally found a way to make
less boring.
I spent a week posting and responding to comments using carefully selected quotes from .
I gave each one the same background (crimson denim) and I dropped the initial capital on each one in an effort to make the quotes slightly less formal.
Catcher in the Rye is a classic, and full of brilliant angst ridden quotes that are indistinguishable from most of what’s on Secret anyway.
Finding relevant quotes to use in replies was fun.
Sometimes it worked better than others.
Some that I expected to work really well didn’t get any replies at all. I expect I need more friends using Secret to make this work really well.
I gradually started to use more obvious quotes and eventually got spotted.
I had lots of replies from people who seemed to take them at face value though. And unless you knew the book well, why wouldn’t you?
One anonymous friend was horrified at Holden’s use of English.
Holden’s attitude to women and sex isn’t all that great, let’s be honest.
I’m glad someone called him on it in the comments.
August 1, 2014 | , ,
Here’s my custom controller and display for .
Last year, after seeing , I was suitably inspired. I wanted to build a simple physical device to control launch/stage, throttle, landing gear, lights, and maybe some custom stages. I knocked up a quick hack just to get a feel for how well it worked, using cardboard, a handful of switches I already had lying around, and a
development board which can act as a USB keyboard.
Using a simple controller with physical switches and buttons as alternatives to keyboard keys was fun to use, but I was soon annoyed every time my hands had to go across to the keyboard – and especially the mouse – when checking things like radar altimeter, periapsis, time to apoapsis etc.
I soon wanted not just switches but screens and dials I could glance at. I especially knew I needed a physical radar altimeter. (Landing safely is hard!) What I needed was a way to get the data out of KSP.
Ideally, I thought, someone would have written a KSP plugin to give me easy access to live data about velocity, altitude, fuel levels, periapsis apoapsis, time to periapsis and apoapsis, height from terrain, velocity, surface speed, vertical speed, sensor data etc. Ideally something simple, lightweight, readable by a hacky little program that could pass the data on through USB serial to the controller.
I was really looking for a CSV or JSON plugin for KSP. It took a bit of digging to find it, and I feared I might have to write it, but I was delighted to find the
which adds a nice simple JSON API to KSP and has a fully featured web interface built on that API. I don’t use the web interface but the JSON API is great. Getting live data out of KSP and into Ruby was a nice moment.
Now I had an approach that I knew would work, I started putting together a wishlist of parts and putting together a si a rough sketch of what components I wanted where.
Having seen various voltmeter clock projects I knew I wanted to use an analog output on an Arduino to have it display live data about altitude, fuel, velocity etc.
So I started playing with LCD screens and voltmeters to work out how to display different things simultaneously.
Next I went shopping for a good range of switches
A higher fidelity prototype came next, with holes punched in the cardboard where I thought the switches screens and meters needed to be. At this stage, I learned a lot about what felt comfortable, and moved a few things around.
Starting to put it all together.
The displays all go in to the base
Feels satisfying already
Testing the displays
Preparing to drill the holes
Drilled and Dremelled
Everything in place
Source code
for creating key presses from switches
for controlling LCD screen and voltmeters
Beginnings of a
for passing values from the Telemachus plugin to the Arduino
Components
Telemachus plugin –
Teensy USB development board – the
is rather cute. . NB: uses 3.3v rather than 5v, making it unable to control the LCD screen or voltmeters I used. I ended up using both a Teensy and an Arduino but there are lots of alternative approaches.
Small volt panel meters –
are quite widely available, fairly cheap, and and are only 44mm2. Plus are compatible with this lovely .
LCD screen – I went for
rather helpful
Large toggle switch with cover guard – there are a few out there, but I tried
which has an LED in the switch and has a pleasingly chunky feel. It’s slightly counterintuitive to wire up though, and
were really helpful.
Key switch –
is a bit flimsy. I’d like something a bit more satisfying. (Incidentally, I also badly want to build something War Games like with two that have to be turned simultaneously.)
Switch with LED ring – . Two contacts closed when pushed, two contacts for the LED.
Red mushroom emergency switch – I went for
which I use to kill the throttle
Coloured momentary push switches – I like
available in a few colours
Small momentary (on)-off-(on) toggle switches –
I had lying around
which works nicely on the 3.3v Teensy and apparently the Arduino too.
I’ve subsequently seen
which I now very badly want to make for my son / self.
August 1, 2014 | , ,
| Comments Off
Here’s how I used to carry my pen:
Here’s how I do it now:
So much better. .
December 13, 2013 | ,
| Comments Off
I’ve been using
app of choice for quite a long time now. In addition to , I’ve also been fiddling around with the tags.
And here are all of my tags and their shortcuts.
Mark Twain suggested that we “eat a live frog in the morning and nothing worse will happen to you for the rest of the day.” During my daily review I try to pick out the one thing I really don’t want to do but really should do first.
Of the priority tags, the only one I use a lot is the high priority tag (the little red circle) to help me spot the urgent/important stuff.
Although I spent far too long making this look pretty, it was really just whittling while I was . Rather than tagging things according to the project (which Things handles anyway) or type of activity (which isn’t very helpful), I’m finding it useful to be able to pick out actions according to the situation and tools I have to hand. What can I do while I’m on the train? If I’m in the mood to make some phone calls, what do I need to do? What can I do that will only take 5 minutes? That sort of thing.
Tagging be people and agendas is useful too. In preparing for regular meetings, or time with certain people, it’s great to be able to quickly pull out relevant things that I need to cover.
There are some ‘Waiting for…’ tags too, useful when something has been delegated but still needs to be kept an eye on. Having different flavours means I can check the ‘chase’ ones daily and the others less frequently (usually weekly, at the moment).
You’ll also notice that absolutely everything has a keyboard shortcut. When I’m using a computer, and I mean really using a computer, I don’t like to switch between using keyboard and trackpad and I always want to be able to everything I can with keyboard shortcuts. For example: tagging actions without having to skip a beat.
December 13, 2013 | ,
| Comments Off
I’ve been using
for a while for tracking projects and next actions with the goal of . I wanted something to help me pay attention to the things I need to get done, and decided that a physical representation of daily progress would be an interesting thing to try.
The hardware build was really easy. More of a bodging together of components than anything. I dremelled out the back of the voltmeter to create a bit more room, fitted it to a small enclosure box, and squeezed the dev board into the remaining space, with the ground pin and an analog output connected to the voltmeter.
The code is pretty straightforward. The Teensy runs
that listens for lines of text via the USB serial port and simply sets the output of the voltmeter to whatever percentage value arrives. At this stage I’ve got a simple multi-purpose percentage meter controlled trivially over USB.
that listens for changes to the Things app, works out how many of the tasks in the ‘Today’ screen have been marked as completed today, and sends that percentage to the USB serial port. It’s like a physical progress bar for things I want to get done today. A done dial for life.
I’m going to try it for a while and see how it works. There are probably lots of other things that a progress meter would help with too.
Components:
November 29, 2013 | , , ,
The lovely folks at
sent me a couple of shiny new toys to review.
First, the .
As always with these Lightspeed choppers, you get a good selection of extra bits in the box, including two rotor blades and two tail rotors. With this one, you also get an 2 GB micro SD card
which needs to be slotted into the camera so it can store the photos and videos, and a USB micro SD card reader for transferring the files to a computer.
This is a slightly larger version of the original Lightspeed i-Helicopter. Making room for the underslung camera by raising the height of the skids.
Obviously, the eye catching new feature here is the camera. The picture quality, at 680×480 (with 25 frames per second for video) is far from HD, but it’s not terrible either.
How does it fly? It’s what you’d expect from a 3 channel coaxial helicopter. Up, down, forward, back, turn left, turn right. Lots of fun as a first helicopter, though frustrating if you’ve used 4 channel RC choppers (which add the freedom to also strafe or ‘crab’ left + right). It’s definitely sturdy enough, and by dropping the power before a crash landing (to protect the blades) it’ll take a lot of punishment indoors. I’ve crashed it, a lot, with no ill effects. It’s not really designed for outdoor flight, thought I’m very tempted to try it (on a very still day) if only to get some impressive footage of flying outside.
The box boasts that the Copter Controller app is “compatible with iPhone iPod iPad” but warns you to “check website for Android compatibility”. Pleasingly, , it works on a wide range of devices.
quite long charging time (~45-50 minutes charging for ~6-7 minutes flight time)
the same USB cable has to be used to charge the chopper and the transmitter separately. If both are flat you’ll be waiting for a while before you can fly
lack of tactile feedback on the remote (i.e. your phone/tablet) means you’re looking down at the app a lot, especially to control the throttle. The controls for taking photos and video is a bit small and fiddly on small screen too.
doesn’t live stream video to the app (though for this money you might not expect that)
cute little lightweight camera lets you capture in-flight photos and video
nice selection of spares (and a screwdriver) in the box
comes with a 2 GB micro SD card and (impressively) a USB micro SD card reader
Copter Controller app is pretty good and the motion control is fun once you get the hang of it
good app support for both iOS and Android
Second, I also got a chance to play with the new .
Have I ever mentioned that I love quadrocopters? Opening this box was super exciting.
It comes preassembled, obviously. Small and light but sturdy. It fits neatly in the palm of my hand.
It comes with spares for all four blades, not one but two batteries, and a USB charger which can charge either one battery at a time or both batteries at once.
Compared to the older,
I reviewed last year, this one is a lot smaller. Having flown both, I think that for this sort of toy, bigger isn’t always better.
This new smaller model is a lot more fun to fly indoors. It needs less room to manoeuvre, it feels less scary to crash it into furniture and it feels really nimble and powerful.
The large arrow on the case, the colour of the blades (red = front, black = read) and the colour of the LEDs (blue = front, red = rear for some reason) all help know which way it’s facing.
The remote has an adjustable
sensitivity setting. 20%, 40%, 60%, 80%, useful when gaining confidence and moving and turning more and more quickly. The 100% setting (which makes the remote controller screen change colour from blue to orange so you see it at a glance) is not really a further 20% of sensitivity, but rather moves the device into full on insanity mode and unlocks the ability to flip the drone.
while I love the futuristic-angered-hornet noise, my wife is not a massive fan of the sound
not yet convinced about the 100% sensitivity mode. Maybe I just need more practice to understand what’s going on, but the hardware assisted flips, while fun, don’t feel entirely under my control
so fast! Really powerful for such a small beast
not bad charging times (~30 minutes charging for ~9 minutes flight time)
two batteries and ability to charge them at the same time or charge one while flying the other means more flying, less waiting around
really sturdy little frame doesn’t mind being dropped (which is handy, as I crash it a lot). Silicone base makes for a softer landing and reduces the scary rattling when making a controlled crash-landing
2.4Ghz radio controller allows for control over a long distance and multiple devices in the same place
apparently copes well outdoors if the wind isn’t too bad. I can believe it (it’s rather powerful), though haven’t tried it yet
Both are good, but of the two, this is definitely the one I’d recommend. Easily the most fun remote controlled toy I’ve tried (and my collation is getting pretty good) and the one I’ll be most excited to master. Of , this and the 4 channel V911 helicopter are probably the best value and most exciting.
November 25, 2013 | , , ,
| Comments Off
While installing a new stove, we wanted somewhere to store and dry logs. Handily, our garden shed was half rotten. Chopping it up and leaving the good half (with re-designed sides to let the air circulate) was a fun afternoon. Almost as satisfying as stacking the shed ready for winter.
August 17, 2013 |
| Comments Off
Earlier this year, we bought six 5+ x 10″ x 1″ planks from . After seasoning them for two months stacked up in the garage, plus a further month in the house, they were ready to sand and wax.
A bit of work, but a whole lot cheaper (and more fun) than buying finished oak shelves.
The shelves form part of a some work we’ve been doing in our living room including .
All cosy and ready for winter.
August 17, 2013 |
| Comments Off
&Subscribe
&Elsewhere Online
Other places I've done things
You'll Also Like
Recent Posts
Categories
Select Category
advertising&&(6)
arduino&&(3)
augmented reality&&(1)
books&&(18)
comedy&&(10)
conferences&&(84)
culture&&(110)
currentcost&&(2)
dreams&&(5)
email&&(2)
family&&(13)
films&&(5)
fortnotes&&(13)
fun&&(114)
games&&(25)
geek&&(100)
graphics&&(7)
hacks&&(8)
haircut&&(2)
hangovercast&&(5)
home&&(65)
I made this&&(7)
iceland&&(9)
interesting&&(4)
life&&(114)
magazine&&(1)
MeeTimer hacking&&(2)
microprinter&&(3)
midi guitar&&(4)
mobile&&(1)
moving on&&(3)
music&&(30)
music I made&&(1)
news&&(17)
photography&&(31)
politics&&(4)
power&&(1)
presentations&&(27)
rails&&(4)
reading&&(24)
readinglist&&(19)
reviews&&(5)
socialmedia&&(12)
stickers&&(2)
sxsw08&&(11)
sxsw09&&(3)
tangible interfaces&&(4)
tech&&(66)
television&&(22)
tools&&(7)
toys&&(24)
travel&&(49)
twitter&&(26)
video&&(2)
virtual worlds&&(42)
warcraft&&(1)
weeknotes&&(3)
where’s roo?&&(61)
wimbledon&&(3)
work&&(94)
x is the new y&&(2)
You’ll Also Like&&(106)
Select Month
September 2014
August 2014
December 2013
November 2013
August 2013
February 2013
November 2012
October 2012
September 2012
April 2012
March 2012
February 2012
January 2012
December 2011
October 2011
August 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
August 2010
February 2010
January 2010
November 2009
October 2009
September 2009
August 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
February 2006
August 2005
December 2004
October 2004
March 2004
October 2003
August 2002
September 2001
August 2001
January 2001
December 2000
November 2000
October 2000
August 2000
The posts in this blog are licensed under a
Powered by
design by .
The postings on this site are my own and don't necessarily represent my employer's positions, strategies or opinions.Chapter&11.&Web MVC Add-OnChapter&11.&Web MVC Add-On
The Web MVC add-ons allow you to conveniently scaffold Spring
MVC controllers and JSP(X) views for an existing domain model. Currently
this domain model is derived from the Roo supported JPA integration through
the entity jpa and related field commands. As shown in the
the Web MVC
scaffolding can deliver a fully functional Web frontend to your domain
model. The following features are included:
Automatic update of JSPX view artifacts reflecting changes in the
domain model
A fully customizable set JSP of tags is provided, all tags are XML
only (no tag-backing Java source code is required)
Tags offer integration with the
Ajax toolkit for
client-side validation, date pickers, tool tips, filtering selects
Automatic URL rewriting to provide best-practice RESTful
Integration of
templating framework to allow for structural customization
of the Web user interface
Use of cascading stylesheets to allow for visual customization of
the Web user interface
Use of Spring MVC themeing support to dynamically adjust Web user
interface by changing CSS
Internationalization of complete Web UI is supported by simply
adding new message bundles (6+ languages are already suppprted)
Pagination integration for large datasets
Client- and server-side validation based on JSR 303 constraints
defined in the domain layer
Generated controllers offer best-practice use of Spring framework
MVC support
The following sections will offer further details about available
commands to generate Web MVC artifacts and also the new JSP(X)
round-tripping model introduced in Roo 1.1.
11.1.&Controller commands
The Web MVC addon offers a number of commands to generate and
maintain various Web artifacts:
~.Person roo& web mvc setupThe
first time the
command is executed Roo will install all artifacts
required for the Web UI.
~.Person roo& web mvc scaffold --class com.foo.web.PersonControllerThe
controller scaffold command will create a Spring MVC controller for
the Person entity with the following method signatures:
As you can see Roo implements a number of methods to
offer a RESTful MVC frontend to your domain layer. All of these
methods can be found in the PersonController_Roo_Controller.aj ITD.
Feel free to push-in any (or all) of these methods to change default
behaviour implemented by Roo.
command offers a number of optional attributes which
let you refine the way paths are managed and which methods should be
generated in the controller. The --disallowedOperations attribute helps you
refine which methods should not be generated in the scaffolded Roo
controller. If you want to prevent several methods from being
generated provide a comma-separated list (i.e.: --disallowedOperations
delete,update,create). You can also specify which methods should be
generated and which not in the PersonController.java source:
@RooWebScaffold(path = "people", formBackingObject = Person.class, create = false,
update = false, delete = false)
@RequestMapping("/people")
@Controller
public class PersonController {}If you don't define a custom
path Roo will use the plural representation of the simple name of the
form backing entity (in our case 'people'). If you wish you can define
more complex custom paths like /public/people or
/my/special/person/uri (try to to stick to REST patterns if you can
though). A good use case for creating controllers which map to custom
paths is security. You can, for example create two controllers for the
Person entity. One with the default path (/people) for public access
(possibly with delete, and update functionality disabled) and one for
admin access (/admin/people). This way you can easily secure the
/admin/* path with the Spring Security addon.
roo& web mvc all --package ~.webThe
provides a convenient way to quickly generate Web MVC controllers for
all JPA entities Roo can find in your project. You need to specify the
--package attribute to define a
package where these controllers should be generated. While the web mvc
all command is convenient, it does not give you the same level of
control compared to the
roo& web mvc controller --class com.foo.web.CarController --preferredMapping /public/car
Created SRC_MAIN_JAVA/com/foo/web/CarController.java
Created SRC_MAIN_WEBAPP/WEB-INF/views/public/car
Created SRC_MAIN_WEBAPP/WEB-INF/views/public/car/index.jspx
Managed SRC_MAIN_WEBAPP/WEB-INF/i18n/application.properties
Managed SRC_MAIN_WEBAPP/WEB-INF/views/menu.jspx
Created SRC_MAIN_WEBAPP/WEB-INF/views/public/car/views.xml
The web mvc controller command is different from the other
two controller commands shown above. It does not
generate an ITD with update, create, delete and other methods to
integrate with a specific form backing entity. Instead, this command
will create a simple controller to help you get started for developing
a custom functionality by stubbing a simple
get(), post() and
index() method inside the controller:
@RequestMapping("/public/car/**")
@Controller
public class CarController {
@RequestMapping
public void get(ModelMap modelMap, HttpServletRequest request,
HttpServletResponse response) {
@RequestMapping(method = RequestMethod.POST, value = "{id}")
public void post(@PathVariable Long id, ModelMap modelMap, HttpServletRequest request,
HttpServletResponse response) {
@RequestMapping
public String index() {
return "public/car/index";
In addition, this controller is registered in the Web MVC
menu and the application Tiles definition. Furthermore, a simple view
(under WEB-INF/views/public/car/index.jspx).
roo& web mvc finder add --class ~.web.PersonController --formBackingType ~.domain.PersonThe
command used from the Roo shell will introdroduce the
@RooWebFinder annotation into the
specified target type.
roo& web mvc finder allThe
command used from the Roo shell will introdroduce the
@RooWebFinder annotations to all
existing controllers which have a form backing type that offers
dynamic finders.
11.2.&Application Conversion Service
Whenever a controller is created for the first time in an
application, Roo will also install an application-wide ConversionService
and configure it for use in webmvc-config.xml as follows:
&mvc:annotation-driven conversion-service="applicationConversionService"/&
&bean id="applicationConversionService" class="com.springsource.vote.web.ApplicationConversionServiceFactoryBean"/&
Spring MVC uses the ConversionService when it needs to convert
between two objects types -- e.g. Date and String. To become more familiar
with its features we recommend that you review the (brief) sections on
"Type Conversion" and "Field Formatting" in the Spring Framework
documentation.
The ApplicationConversionServiceFactoryBean is a Roo-managed Java
class and it looks like this:
@RooConversionService
public class ApplicationConversionServiceFactoryBean extends FormattingConversionServiceFactoryBean {
protected void installFormatters(FormatterRegistry registry) {
super.installFormatters(registry);
// Register application converters and formatters
As the comment indicates you can use the installFormatters() method
to register any Converters and Formatters you wish to add. In addition to
that Roo will automatically maintain an ITD with Converter registrations
for every associated entity that needs to be displayed somewhere in a
view. A typical use case is where entities from a many-to-one association
need to be displayed in one of the JSP views. Rather than using the
toString() method for that, a Converter defines the formatting logic for
how to present the associated entity as a String.
In some cases you may wish to customize how a specific entity is
formatted as a String in JSP views. For example suppose we have an entity
called Vote. To customize how it is displayed in the JSP views add a
method like this:
@RooConversionService
public class ApplicationConversionServiceFactoryBean extends FormattingConversionServiceFactoryBean {
public Converter&Vote, String& getVoteConverter() {
return new Converter&Vote, String&() {
public String convert(Vote source) {
return new StringBuilder().append(
source.getIp()).append(" ").append(source.getRegistered()).toString();
At this point Roo will notice that the addition of the method and
will remove it from the ITD much like overriding the toString() method in
a Roo entity works.
Note, in some cases you may create a form backing entity which does
not contain any suitable fields for conversion. For example, the entity
may only contain a field indicating a relationship to another entity (i.e.
type one-to-one or one-to-many). Since Roo does not use these fields for
its generated converters it will simply omit the creation of a converter
for such form backing entities. In these cases you may have to provide
your own custom converter to convert from your entity to a suitable String
representation in order to prevent potential converter exceptions.
11.3.&JSP Views
As mentioned in the previous section, Roo copies a number of static
artifacts into the target project after issuing the controller command for
the first time. These artifacts include Cascading Style Sheets, images,
definitions, JSP files, message property files, a complete tag library and
a web.xml file. These artifacts are arranged in different folders which is
best illustrated in the following picture:
The i18n folder contains translations of the Web UI. The
messages_XX.properties files are static resources (which will never be
adjusted after the initial installation) which contain commonly used
literals which are part of the Web UI. The application.properties file
will be managed by Roo to contain application-specific literals. New types
or fields added to the domain layer will result in new key/value
combinations being added to this file. If you wish to translate the values
generated by Roo in the application.properties file, just create a copy of
this file and rename it to application_XX.properties (where XX represents
your language abbreviation).
Roo uses XML compliant JSP files (JSPX) instead of the more common
JSP format to allow round-tripping of views based on changes in the domain
layer of your project. Not all jspx files in the target project are
managed by Roo after the initial installation (although future addons may
choose to do so). Typically jspx files in sub folders under WEB-INF/views
are maintained in addition to the menu.jspx.
Here is an example of a typical roo managed jspx file (i.e.:
WEB-INF/views/people/update.jspx):
&?xml version="1.0" encoding="UTF-8" standalone="no"?&
&div xmlns:field="urn:jsptagdir:/WEB-INF/tags/form/fields"
xmlns:form="urn:jsptagdir:/WEB-INF/tags/form"
xmlns:jsp="/JSP/Page" version="2.0"&
&jsp:output omit-xml-declaration="yes"/&
&form:update id="fu_com_foo_Person" modelAttribute="person" path="/people"
z="3lX+WZW4CQVBb7OlvB0AvdgbGRQ="&
&field:datetime dateTimePattern="${person_birthday_date_format}" field="birthDay"
id="c_com_foo_Person_birthDay" z="dXnEoWaz4rI4CKD9mlz+clbSUP4="/&
&field:select field="car" id="c_com_foo_Person_car" itemValue="id" items="${cars}"
path="/cars" z="z2LA3LvNKRO9OISmZurGjEczHkc="/&
&field:select field="cars" id="c_com_foo_Person_cars" itemValue="id" items="${cars}"
multiple="true" path="/cars" z="c0rdAISxzHsNvJPFfAmEEGz2LU4="/&
&/form:update&
&/div&You will notice that this file is fairly concise
compared to a normal jsp file. This is due to the extensive use of the tag
library which Roo has installed in your project in the WEB-INF/tags
folder. Each tag offeres a number of attributes which can be used to
customize the appearance / behaviour of the tag - please use code
completion in your favourite editor to review the options or take a peek
into the actual tags.
All tags are completely self-reliant to provide their functionality
(there are no Java sources needed to implement specific behaviour of any
tag). This should make it very easy to customize the behaviour of the
default tags without any required knowledge of traditional Java JSP tag
development. You are free to customize the contents of the Roo provided
tag library to suit your own requirements. You could even offer your
customized tag library as a new addon which other Roo users could install
to replace the default Roo provided tag library.
Most tags have a few common attributes which adhere with Roo
conventions to support round-tripping of the jspx artifacts. The following
rules should be considered if you wish to customize tags or jspx files in
a Roo managed project:
The id attribute is used by Roo to find existing elements and
also to determine message labels used as part of the tag
implementation. Changing a tag identifier will result in another
element being generated by Roo when the Roo shell is active.
Roo provided tags are registered in the root element of the jspx
document and are assigned a namespace. You should be able to see
element and attribute code completion when using a modern IDE (i.e.
SpringSource Tool Suite)
The z attribute represents a hash key for a given element (see a
detailed discussion of the hash key attribute in the paragraph
The hash key attribute is important for Roo because it helps
determining if a user has altered a Roo managed element. This is the
secret to round-trip support for JSPX files, as you can edit anything at
any time yet Roo will be able to merge in changes to the JSPX
successfully. The hash key shown in the "z" attribute is calculated as
shown in the following table:
The hash code thus allows Roo to determine if the element is in its
"original" Roo form, or if the user has modified it in some way. If a user
changes an element, the hash code will not match and this indicates to Roo
that the user has customized that specific element. Once Roo has detected
such an event, Roo will change the "z" attribute value to "user-managed".
This helps clarify to the user that Roo has adopted a "hands off" approach
to that element and it's entirely the user's responsibility to maintain.
If the user wishes for Roo to take responsibility for the management of a
"user-managed" element once again, he or she can simply change the value
of "z" to "?". When Roo sees this, it will replace the questionmark
character with a calculated hash code. This simple mechanism allows Roo to
easily round trip JSPX files without interfering with manual changes
performed by the user. It represents a significant enhancement from Roo
1.0 where a file was entirely user managed or entirely Roo managed.
Roo will order fields used in forms in the same sequence they appear
in the domain object. The user can freely change the sequence of form
elements without interfering with Roo's round tripping approach (Roo will
honour user chosen element sequences as long as it can detect individual
elements by their id).
The user can nest Roo managed elements in in any structure he wishes
without interfering with Roo jspx round tripping. For example elements can
be enclosed by HTML div or span tags to change visual or structural
appearance of a page.
Most default tags installed by Roo have a render attribute which is
of boolean type. This allows users to completely disable the rendering of
a given tag (and potential sub tags). This is useful in cases where you
don't wish individual fields in a form to be presented to the user but
rather have them autopopulated through other means (i.e. input
type="hidden"). The value of the render attribute can also be calculated
dynamically through the Spring Expression Language (SpEL) or normal JSP
expression language. The generated create.jspx in Roo application
demonstrates this.
Scaffolding of JPA reference
relationships
The Roo JSP addon will read JSR 303 (bean validation API)
annotations found in a form-backing object. The following convention is
applied for the generation of create and update (and finder)
forms:* As mentioned above, Roo does not scaffold a HTML form
element for the 'one' side of a @OneToMany relationship. To make this
relationship work, you need to provide a @ManyToOne annotated field on the
opposite side:
field set --fieldName students --type com.foo.domain.Person --class com.foo.domain.School --cardinality ONE_TO_MANY
field reference --fieldName school --type com.foo.domain.School --class com.foo.domain.Person --cardinality MANY_TO_ONE
In case a field is annotated with @Pattern, the regular
expression is passed on to the tag library where it may be applied through
the use of the JS framework of choice.
Automatic Scaffolding of dynamic
Roo will attempt to scaffold Spring MVC JSP views for all dynamic
finders registered in the form backing object. This is done by using the
Due to file name length restrictions by many file systems (see )
Roo can only generate JSP views for finders which have 244 characters or
less (including folders). If the finder name is longer than 244 characters
Roo will silently skip the generation of jsp view artifacts for the
dynamic finder in question). More detail can be found in ticket .

我要回帖

更多关于 if it is the case 的文章

 

随机推荐