When Builders Aren't...

Why do none of the FooBuilder classes implement javafx.util.Builder? In particular, I'm confused as to how to work with the FXMLLoader.setBuilderFactory() method. I would expect that give something like this:
public class MyLabelBuilderExt<B extends LabelBuilderExt<B>> extends LabelBuilder<B> {
    public LabelBuilderExt<B> styleClasses(String classes) {
        styleClass(Array.asList(classes.split(",")));
        return this;
public class BuilderFactoryExt implements BuilderFactory {
    private JavaFXBuilderFactory defaultFactory = new JavaFXBuilderFactory();
    @Override
    public Builder<?> getBuilder(Class<?> aClass) {
        if (Label.class.equals(aClass)) {
            return new MyLabelBuilderExt();
        return defaultFactory.getBuilder(aClass);
}then the following should work:
FXMLLoader loader = new FXMLLoader();
loader.setBuilderFactory(new BuilderFactoryExt());but obviously it fails, because MyLabelBuilderExt cannot be cast to Builder. Easy, just add the required implements clause, no other changes are needed as it already has all of the necessary methods, but it still fails when I try to use it in FXML as it says that the styleClasses property cannot be found.
Does anybody have an example of creating a custom builder and using it from FXML that they'd be willing to share?

Hi,
This issue is currently being tracked here:
http://javafx-jira.kenai.com/browse/RT-14875
Here's an example of a builder factory that produces Label builders. I used a similar example in my recent talk on FXML at JavaOne:
package examples.fxml.builder;
import javafx.fxml.JavaFXBuilderFactory;
import javafx.scene.control.Label;
import javafx.util.Builder;
import javafx.util.BuilderFactory;
public class ExampleBuilderFactory implements BuilderFactory {
    private JavaFXBuilderFactory defaultBuilderFactory = new JavaFXBuilderFactory();
    @Override
    public Builder<?> getBuilder(Class<?> type) {
        return (type == Label.class) ? new LabelBuilder() : defaultBuilderFactory.getBuilder(type);
package examples.fxml.builder;
import javafx.scene.control.Label;
import javafx.util.Builder;
public class LabelBuilder implements Builder<Label> {
    private String text = "";
    public String getText() {
        return text;
    public void setText(String text) {
        this.text = text;
    @Override
    public Label build() {
        Label label = new Label();
        label.setText(text);
        return label;
}Here's an example app you can use to test the builder factory:
package examples.fxml.builder;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Label;
public class BuilderExample {
    public static void main(String[] args) throws Exception {
        Label label = FXMLLoader.load(BuilderExample.class.getResource("builder_example.fxml"),
            null, new ExampleBuilderFactory());
        System.out.println(label.getText());
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<Label text="Hello World!"/>Hope this helps,
Greg

Similar Messages

  • My iPod touch is having a little issue with the volume. When I plug in my headphones the volume works fine. When there aren't any headphones plugged in, no sound comes out from my iPod. When I go to turn up the volume, it still says headphones. Any tips?

    My iPod touch is having a little issue with the volume. When I plug in my headphones the volume works fine. When there aren't any headphones plugged in, no sound comes out from my iPod. When I go to turn up the volume, it still says headphones. I tried restarting it a few times, nothing worked. I looked up many tutorials, and still nothing did the trick. Any tips?

    - Try cleaning out/blowing out the headphone jack. Try inserting/removing the plug a dozen times or so.
    Try the following to rule out a software problem
    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup
    - Restore to factory settings/new iPod.
    - Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack.
    Apple Retail Store - Genius Bar
    Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price                  
    A third-party place like the following will replace the jack for less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the jack yourself
    iPod Touch Repair – iFixit

  • ITunes Match is having errors d/l songs to my iPhone 4s. Then I can't delete them, and it says some songs are playing when they aren't. I've restored my iPhone, same issue.

    iTunes Match is having errors d/l songs to my iPhone 4s. Then I can't delete them, and it says some songs are playing when they aren't. I've restored my iPhone, same issue.

    According to this article  Using iPhone on an airplane  you should be able to listen to music with Airplay Mode enabled.
    Make sure you have Music switched on in Settings > Store or your music won't download via Wi-Fi.

  • Itouch thinks headphones are connected when they aren't

    My itouch (2nd gen)connects well to headphones, but when I remove the headphones it thinks they are still connected. I've tried restarting, resetting, and restoring already. The volume control buttons work, but come up saying there are headphones in when there aren't. The headphone jack is clean too. Anyone have any ideas???

    I have the same problem. Have tried inserting removing headphones multiple times, looking for debris, the water damage indicator is still white, reboot, restore, etc. Still the iPod thinks that the headphones are always attached when they are not.
    This is very frustrating, as it seems many are having this same issue. My iPod Touch is just a little over a year old, and I have taken care of it. It's disappointing that the answer seems to be bad hardware on Apples part.

  • Apps bouncing in the dock when they aren't opened in Mavericks

    Why are applications bouncing in the dock when they aren't open.  I've had this happen with two different applications.  The only way to stop it is to do a restart, which seems like overkill.

    Intel-based Macs: Resetting the System Management Controller (SMC)

  • How do i install kodak hero 7.1 printer drivers when they aren't from a recognised developer

    i have a macbook pro running mountain lion and im trying toconnect it to a kodak hero 7.1. however when i try to install the driver software my macbook won't let me because it says that the software is from an unrecognised developer. It says that this is set in my security preferences but i cant find these to change the option

    You can hold down the control key while selecting the icon and then select 'Open' from the drop-down menu. You'll be prompted asking if you're sure you want to open the app. Select yes (or 'allow' - I don't recall exactly) and you'll have a one-time-only use of the app.
    Clinton

  • Why won't illustrator Cs5 allow me to copy and paste layers when they aren't locked?

    I am working on a project and when I try to copy and paste unlocked layers to paste them in to another image it doesn't paste. The only thing it pastes is the text unformatted. I tried resetting the settings by removing the setting file to see if I can set Illustrator back to square one and it isn't working. See Picture for before (copy) and After (paste)
    Before
    http://i.imgur.com/rqJhc.jpg
    After
    http://i.imgur.com/FN0jA.jpg
    I am also using windows 8 on a pc. I would say it was the OS but it was working fine untill yesterday. I am begging for help on this. It is really ruining my work flow today.
    Thanks for any help you can give.

    I just opened the document "san_jan_email.ai" and this is what i see:
    i didn't try to copy and past yet, cause the document it seems fine, have you fixed it? otherwise i can say another stupid thing, i dont know if it's cause the document is too "heavy" for your computer? have you seen if you are not going out of ram or of some hard disk space? at first i could thinking about resetting the settings in Illustrator but since you just said that you already did it, and also that you tried with a CS6 copy, i think it's not that the case.
    edit: i tried to copy and paste as well, for me it's working.

  • Zen Micro Charger - for times when you aren't near a power source for day

    Hi All ... now this may seem like a strange request and i'm not sure whether it would be possible but here goes..
    As a traveller around the world there is many the time when i am away from a power source for a number of days maybe 5. This means i would either have to carry alot of precharged batteries around or to find another way to charge up my Micro battery/s.
    With this in mind i was thinking ... could i use any other method to charge my battery (being as there is no power source available .. including a laptop) So could i build a solar panel of some description ? Could i create a charger using Ordinary Alkaline batterys ... Any suggestions?
    I'll probably have to buy 5 or more batteries in the end .. but it was just a thought.
    Thanks in advance for any ideas you may have.

    interesting topic, other then camping, i can't see a time, for me at least, where this would be relevant, but a solar charger sounds like an interesting idea none the less. this is the time i bring along my minidisc player that uses AA batteries of which i have an infinite supply :smileyvery-happy: Other then that, i have this tire inflater that has a built in recharable 2v battery. the nice thing about it is it has a cigarette lighter type DC jack on it. i haven't tried it to charge but i'm sure if you got a DC - USB charger it could work (on a camping type expedition that is, you wouldn't want to drag it onto a train)
    which brings me to another point, why is is that most portable players have to use some proprietary battery format? i know that SIZE is prolly the *biggest* reason but i just don't understand why you can't build a small player that runs on something standard like AA or AAAs. i don't mind having an extra battery around but at $40 or so per battery, there ain't no way i'm buying like 5 or 6 batteries. sheesh!
    Message Edited by steveski on 03-02-2005 08:54 PM

  • Sizing a logo for a client, when they aren't sure of intended usage

    Hello,
    Can anyone tell me a good "rule of thumb" when designing a logo for someone who isn't sure what size that they would want to use that logo in the future? If they don't know what print size they may want (business card size or larger sign size) - what size is best to give them AND if they don't know what web size they need, what size is good to give them where they have room to resize? What format is best, Ai? or pdf?
    This is especially a concern if the logo is made in Photoshop. Any suggestions on standard sizing or standard practice in this case ? Gratitude in advance - K-

    Generally I would save the logo at any size that fits on a letter size sheet of paper so that the client can easily print it on nearly any desktop printer as is. If you are submitting an Illustrator *.ai or EPS file without any linked or embedded bitmap images, then you don't need to worry about the final size in its various applications, because it will scale without loss of resolution. It can be used for a business card or a billboard.
    If it's done in Photoshop, then you may want to start with a master file that has enough ppi resolution to suit the logo's biggest size of application. Then you or the client can downsample from there. (But since we're in an Illustrator forum and not a Photoshop forum, I'll show my Illustrator bias here and recommend using Illustrator for logo work whenever possible ;-)
    Always handy to give a client a PDF and JPEG version in addition to the .ai and/or .eps files in case they don't have Illustrator or a Postscript printer.
    Others may have standard practices to suggest.

  • ARDAgent and AppleVNCServer.bundle - when they *aren't* benign

    So... yeah.  I'm well aware that pretty much any discussion of these two denizens of /System/Library/CoreServices/RemoteManagement are considered benign and unworthy of note by pretty much any standard, and that Apple has a technote that says to ignore any permissions difficulties associated with them.  But I've got a computer that won't let me use mouse or keyboard until I've logged into it remotely... either that, or put it to sleep/woken it up/put it to sleep/woken it up four or five times in a row.  Please read on.
    The computer is a Mac Pro 3.2GHz 8-core that *was* running 10.6.8.  I installed security update 2012-002 a few days ago and the computer became impossibly slow to start up.  It's an audio computer running Pro Tools and a few other things and I was eager to blame EuCon for the issue but it's been disabled since morning and the problem persists.  Anyway.  Reset SMC, reset PRAM, reset VRAM, no dice.  Computer still impossibly slow to restart, and as an added bonus, it would wake up and ignore the mouse and keyboard.  But not how you'd expect.
    When I move the mouse, the pointer on the screen cruises around.  And when I hit caps lock, the caps lock light comes on.  But I can't click on anything, the scroll wheel doesn't work, and I can't type.  The computer knows they're there, it just won't acknowledge them.  However, when I screenshare into it I can type and click on things no problem.  Close out of screensharing and half the time, the computer lets me use the mouse and keyboard again.  The other half of the time, no dice.  So it became a tedious game - wake the computer up with another computer, get on with life, do stuff, reboot (it's got an after-market wireless card that was working fine before 2012-002 but now drops out at sporadic intervals until reboot), wait several minutes for the computer to wake up, screenshare into it, etc.
    Most interestingly, the computer would wake up with one monitor showing a background and the other showing blue.  Or both showing blue.  HOWEVER: under screen sharing, the desktop is normal and things can be selected as normal.  Sleep the computer and wake it up, maybe one of the monitors comes back, maybe the other one doesn't.  Maybe they both do.
    So, okay.  2012-002 definitely hosed the computer and it's probably time to install Lion anyway.  So I install 10.7.2 (I saved the install file).  Things go swimmingly, except for the fact that it now wakes up ignoring the mouse and keyboard as before, every time.  I tried disabling remote desktop in preferences and then repairing permissions as suggested elsewhere on discussions.apple.com only to forget to enable them before restarting and then spending a panicked 15 minutes bumping the power button at 30 second intervals attempting to get my mouse and keyboard back.  It's back now, but I was nearly locked out of the computer.
    I even tried overwriting /System/Library/CoreServices/RemoteManagement with the folder from another computer running Lion.  Disk Utility ran through and changed the owner on every file, then when I verified permissions, it decided that they were all wrong for the entire bundle again.
    I know that this folder is supposed to be benign and any permissions errors thrown up by it supposedly ignorable but I gotta tell ya - when you can't use your computer AT ALL until you VNC into it, you begin to wonder if maybe the conventional wisdom isn't always right.
    QUESTION 1:  Is there any way to get a clean install of /System/Library/CoreServices/RemoteManagement so that I can fix things?  I'm beginning to wonder if part of my problem is that all my computers are/were linked up via MobileMe and now they're *all* corrupt.
    QUESTION 2: Considering remote management is definitely an essential of my workflow, is there any way to deal with this problem *without* disabling remote management?
    QUESTION 3: HELP
    (I guess that wasn't quite a question, but you get the point)
    Sincere thanks,
    Seth

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of this exercise is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login. Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode* and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    *Note: If FileVault is enabled under Mac OS X 10.7 or later, you can’t boot in safe mode.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Podcasts keep synching even when podcasts aren't selected to sync

    Help?
    I have podcasts in my iTunes that I have checked, so I can listen to them on my iPhone, BUT they keep synching with my 80gig iPod even though I have unchecked "sync podcasts" in the tabs when my iPod syncs.
    I restored my iPod and it keeps happening. I'm guessing that somehow these podcasts are in one of my nearly 100 playlists. However, shouldn't unchecking "sync podcasts" override them from being synched even if they are in a playlist? It used to until the last two iTunes updates.

    Er...it says the question is answered, but there's only one post in the thread...
    This is my first post, so let me know if I'm missing something...sorry, thanks!
    Anyhow, I'm having precisely the same problem - 80Gb iPod and 8Gb iPhone 3g.
    My podcasts keep syncing to my iPod, even though I've unchecked sync podcasts. (I've currently got 'sync all unplayed episodes', but I've still got the same problem of getting everything on the iPod.)

  • c:choose and c:when tags aren't working....

    I have created a page that allows the user to change their password if they want. I am requiring they enter their current password and then the new password twice. When they click the submit button it will validate in the background that all passwords match and there are no mistakes... But if there are mistakes I want to set a variable to true then on my .jsp page use the <c:choose> and <c:when> tags to check if the variable is set to true and if it is have a message appear on the page saying it didnt work and to try again. Here's my code for the .jsp page:
                <c:choose>
                    <c:when test="${ChangePasswordAction.showError == true}">
                        Your request to change your password was unsuccessful. Please try again!<br />
                    </c:when>
                    <c:otherwise>
                        Your request to change your password was successful. An email has been sent to your primary email address.<br />
                    </c:otherwise>
                </c:choose>Any suggestions will help!! Thanks

    Remember EL doesn't refer to java variables or classes. It uses the attributes in page, request, session and application scopes.
    Is ChangePasswordAction an attribute in scope somewhere?
    Does it have a "isShowError()" or "getShowError" method to reveal error as a boolean attribute?

  • Alarms app that work when they aren't open?

    I don't know if this is the right place to ask this, but I am looking for an alarm app I can use (besides Apple's) that works even when it isn't open and I am doing something else on the phone. Most apps I've seen only work when they are open, but I am looking for one that can work when it's closed. Thanks!

    Try restoring your iPod via iTunes.  First from backup and it the problem persists restore to factory defaults.
    If still a problem make an appointment at the Genius Bar of an Apple store since it is likely that your have a hardware problem.

  • Text/imessages sending between phones on the same plan when they aren't supposed to

    Recently, the text/imessages between my mom, dad, and sisters phones have all been sending to eachother when there was no intention to.  I do not know where this problem originated we have not strayed from our normal functions with the phones.  Just tonight my sister texted me from her phone and it showed up under my father's phone number.  This only happens between our four phones which are all on the same plan. None of us have received any messages from anyone else in eachother's phones.  I can't find any support saying if it is an icloud problem or a problem through verizon.  If anyone has experienced anything like this and found a way to fix it any advice would be greatly appreciated.  It isn't a large inconvenience but it is very confusing for all of us.

    This happens when multiple devices use the same Apple ID for iMessage.  To fix this you have two choices:
    On all but one of the phones go to Settings>Messages>Send & Receive, tap the ID, sign out, then sign back in with a different ID (so they are all using a different Apple ID for iMessage).  Note: you can still share the same ID for purchasing in Settings>iTunes & App Stores; or
    On all of the phones go to Settings>Messages>Send & Receive and uncheck the email address(es) shown under "You can be reached by iMessage at".  Also uncheck any phone numbers listed that do not belong to the phone in question.

  • 2008 MacBook Pro Reads DVD-Rs as blank (when they aren't)

    Hello!
    It seems as though my poor little MacBook Pro is having problems reading DVDs.
    For a while it simply wouldn't read DVDs at all - it would whirr and spit them back out. After repeatedly putting the DVDs back into the machine, however, it does EVENTUALLY read and play them on the 4th or 5th try. Thus, that problem is only relatively minor.
    More problematic, however, is that the optical drive reads all DVD-Rs and DVD-RWs as blank, even when they are clearly not. Instead, it gives me the window that says "You inserted a blank DVD. Choose an action from the pop-up menu or click ignore."
    The DVD-RWs, however, are, again, not blank. Other Macs - older MacBooks - read and play them fine, so it's clearly not a disk compatibility issue.
    I tried restarting, resetting the SMC, blowing air into the optical drive (albeit rather amateurishly) and re-inserting the DVD-RW multiple times, all to no avail.
    Does this mean I need a new optical drive?

    Same problem I have. Using Titanium 10 the drive wrote to a blank disc fine (Verbatim DV-R) but when I put the same disc back in it's name says "Blank CD" rather than the "Test Disc" I named it and says it's recordable. Happens with professional (installation discs) as well. Discs read fine on my MacBook.

Maybe you are looking for