The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » SwingLabs

Thread: SwingXSet3 ...

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 15 - Last Post: Apr 15, 2008 2:06 AM by: Kleopatra
Kleopatra
SwingXSet3 ...
Posted: Apr 10, 2008 2:57 AM
  Click to reply to this thread Reply


... not yet <g> But just a some days ago I stumbled across the fact that
SwingSet3 is formally a sub-project of SwingLabs (unbelievably that it
lived there for 14 months without anybody noticing ;-)

And it's really cute. One cool part of it is a package named CodeView:
it allows to view the code files _and_ highlight pre-tagged labelled
snippets _and_ navigate across those. We might consider to switch
swinglabs-demos over to use that. Didn't explore yet how much work that
would be (nor the legal ramifications, licence looks okay to my naive eyes)

Couldn't resist to do the table part swingx style (and unwrapping a
couple of rough edges in the swingx renderer/highlighter realm) - which
worked out nicely but is resting in my local workspace. There are other
parts that would be great to re-do in SwingX (like f.i. the DemoSelector
which looks like it could be much simplified by using
JXCollapsiblePanel) for showing off <g> Especially now, with FX stealing
the show (and resources ;-)

Raw thoughts only ...

Cheers
Jeanette





---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


Kleopatra
Re: SwingXSet3 ...
Posted: Apr 10, 2008 7:08 AM   in response to: Kleopatra
  Click to reply to this thread Reply

Kleopatra schrieb:
> There are other parts that would be great to re-do in SwingX (like
> f.i. the DemoSelector which looks like it could be much simplified by
> using JXCollapsiblePanel) for showing off <g>

woow .. that was really fun: not going as low-level as the collapsible
but use standard SwingX building blocks like JXTaskPane/Container and
Hyperlinks (code attached in case anybody want to play with it into the
swingset3, couldn't resist). What's missing are the NimbusAddons,
volunteers?

Enjoy
Jeanette

/**
 * Quick shot playing with TaskPane/Container instead of rolling its own.
 *
 */
public class DemoSelector extends AbstractBean {
 
    private Demo selectedDemo;
    private Map<String, JXTaskPane> categoryMap;
   
    public JComponent getSelectorComponent(List<Demo> demoSet) {
        JXTaskPaneContainer container = new JXTaskPaneContainer();
        for (Demo demo : demoSet) {
            String category = demo.getCategory();
            JXTaskPane taskPane = getTaskPane(category);
            if (taskPane == null) {
                taskPane = createTaskPane(demo);
                addTaskPane(taskPane, category);
                container.add(taskPane);
            }
            addDemo(taskPane, demo);
        }
        JScrollPane pane = new JScrollPane(container);
        return pane;
    }
   
    private void addDemo(JXTaskPane taskPane, Demo demo) {
        DemoAction action = new DemoAction(demo);
        taskPane.add(new JXHyperlink(action));
    }
 
    private void addTaskPane(JXTaskPane taskPane, String category) {
        if (categoryMap ==  null) {
            categoryMap = new HashMap<String, JXTaskPane>();
        }
        categoryMap.put(category, taskPane);
    }
 
    private JXTaskPane createTaskPane(Demo demo) {
        JXTaskPane taskPane = new JXTaskPane();
        taskPane.setTitle(demo.getCategory());
        return taskPane;
    }
 
    private JXTaskPane getTaskPane(String category) {
        if (categoryMap == null) return null;
        return categoryMap.get(category);
    }
 
    public void setSelectedDemo(Demo demo) {
        Object old = getSelectedDemo();
        this.selectedDemo = demo;
        firePropertyChange("selectedDemo", old, getSelectedDemo());
    }
   
    private Object getSelectedDemo() {
        return selectedDemo;
    }
 
    public class DemoAction extends LinkAction<Demo> {
       
        public DemoAction(Demo demo) {
            super(demo);
        }
 
        @Override
        protected void installTarget() {
            if (getTarget() == null) return;
            setSmallIcon(getTarget().getIcon());
            setName(getTarget().getName());
        }
 
        @Override
        public void actionPerformed(ActionEvent e) {
            setSelectedDemo(getTarget());
            setVisited(true);
        }
       
    }
 
}
 




---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


kschaefe

Posts: 1,662
Re: SwingXSet3 ...
Posted: Apr 10, 2008 7:42 AM   in response to: Kleopatra
  Click to reply to this thread Reply

Jeanette,

private void addDemo(JXTaskPane taskPane, Demo demo) {
    DemoAction action = new DemoAction(demo);
    taskPane.add(new JXHyperlink(action));
}


Actions are already added as JXHyperlinks (with UI-specific configurations). No additional configuration necessary, unless you didn't like the way the UI delegate configure the hyperlinks.

Karl

Kleopatra
Re: SwingXSet3 ...
Posted: Apr 10, 2008 7:42 AM   in response to: kschaefe
  Click to reply to this thread Reply

Karl,
> Jeanette,
>
>
private void addDemo(JXTaskPane taskPane, Demo demo) {
>     DemoAction action = new DemoAction(demo);
>     taskPane.add(new JXHyperlink(action));
> }

>
> Actions are already added as JXHyperlinks (with UI-specific configurations). No additional configuration necessary, unless you didn't like the way the UI delegate configure the hyperlinks.
>
>

ahhh .. cool! Didn't look deep enough (stopped at BasicTaskPaneUI which
returns a plain JButton). Then, if we don't want need further config of
the button, we can even inline that method, pushing the line-count to
under 100 :-)

Thanks for the pointer.
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


rbair

Posts: 1,830
Re: SwingXSet3 ...
Posted: Apr 10, 2008 4:28 PM   in response to: Kleopatra
  Click to reply to this thread Reply

Ya, I'm really impressed with SwingSet3. I basically offers everything I wanted to do with SwingLabs demos, but didn't have time for. I'd love to port our demos over to SwingSet3 format and leverage that work. The code section rocks :-)

Richard

Amy Fowler
Re: SwingXSet3 ...
Posted: Apr 10, 2008 10:33 PM   in response to: Kleopatra
  Click to reply to this thread Reply


On Apr 10, 2008, at 2:57 AM, Kleopatra wrote:
>
>
> Couldn't resist to do the table part swingx style (and unwrapping a
> couple of rough edges in the swingx renderer/highlighter realm) -
> which worked out nicely but is resting in my local workspace. There
> are other parts that would be great to re-do in SwingX (like f.i.
> the DemoSelector which looks like it could be much simplified by
> using JXCollapsiblePanel) for showing off <g> Especially now, with
> FX stealing the show (and resources ;-)

SwingLabs fans might be wondering why I rolled many of my own
components instead of using those
available in swingx (particularly ironic, since I had something to do
with the creation of SwingLabs and swingx).
I'll just come clean here. I started out thinking that since
SwingSet3 would be an advertisement for what Swing
offered out of the box, it should constrain itself to the confines of
that box. Immediately I wrote my own
rudimentary hyperlink and animating collapsible panels. And down the
road when I realized I couldn't live
without JXPanel, I realized the futility (and utter silliness) of this
restraint.

So, I dug back into SwingX, determined to use JXCollapsiblePanel and
the hyperlink functionality. Unfortunately
I was unable to see a straight-forward way of simplifying the look of
JXCollapsiblePanel/JXTaskPane; Also, I
recall that it didn't support animating open/close (??). In short, it
was less work to leave my rudimentary
collapsible panel alone. Same thing happened for hyperlink. I just
couldn't wrap my head around the additional
design pattern when what I wanted was a simple hyperlink component and
cell renderer.

But it's sounding like from Jeanette's post that I stand corrected.
If SwingSet3 can be simplified by using SwingX
versions of components, then I think that's a great thing. I already
bundle the swingx jar for the shear joy of
having JXPanel with animating alpha.

I would love to see SwingSet3 deployed with a swinglabs demo suite.
SwingSet3 was designed to load arbitrary
demos (see https://swingset3.dev.java.net/writing_demos.html). It's
snippet highlighting feature just might help
educate impatient geeks like me on how to use the functionality :-).

Aim

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


Fabrizio Giudici
Re: SwingXSet3 ...
Posted: Apr 10, 2008 11:25 PM   in response to: Amy Fowler
  Click to reply to this thread Reply


On Apr 11, 2008, at 7:33 , Amy Fowler wrote:
>
> I would love to see SwingSet3 deployed with a swinglabs demo
> suite. SwingSet3 was designed to load arbitrary
> demos (see https://swingset3.dev.java.net/writing_demos.html).
> It's snippet highlighting feature just might help
> educate impatient geeks like me on how to use the functionality :-).


From my external perspective, I'm happy to read this. As members of
the Java community we are all engaged in a hard fight to compete with
other desktop technologies and to keep on pushing the revival of Java
on the desktop. We need components from Swing, SwingX and many others,
and this is a huge amount of work, so I see every duplication of code
(unless of course there are compelling reasons for that) as a problem,
a waste of efforts that we can't afford. This holds true for the
JavaFX stuff, of course.

--
Fabrizio Giudici, Ph.D. - Java Architect, Project Manager
Tidalwave s.a.s. - "We make Java work. Everywhere."
weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog
Fabrizio.Giudici@tidalwave.it - mobile: +39 348.150.6941



---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


Kleopatra
Re: SwingXSet3 ...
Posted: Apr 11, 2008 5:17 AM   in response to: Fabrizio Giudici
  Click to reply to this thread Reply

Fabrizio,
>
>
> From my external perspective, I'm happy to read this. As members of
> the Java community we are all engaged in a hard fight to compete with
> other desktop technologies and to keep on pushing the revival of Java
> on the desktop. We need components from Swing, SwingX and many others,
> and this is a huge amount of work, so I see every duplication of code
> (unless of course there are compelling reasons for that) as a problem,
> a waste of efforts that we can't afford.
I agree whole-heartedly. And would go a step further: it's not only
duplication of code that matters, it's duplication of effort in every
layer of development: architecture, design, implementation, learning
from errors, best practices .. whatever. The whole knowledge transfer
between all collaborators need to be improved, IMO.

CU
Jeanette


---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


psychostud

Posts: 34
Re: SwingXSet3 ...
Posted: Apr 11, 2008 8:03 AM   in response to: Kleopatra
  Click to reply to this thread Reply

I think the only way for Swingx to go further is by making practical use of it in our commercial projects. This can only happen if developers have confidence in the stability and future maintainance of the swingx project. I just hope swingx will someday make it into the standard jdk , it would be make a massive difference for sure.

christiaan_se

Posts: 31
Re: SwingXSet3 ...
Posted: Apr 14, 2008 2:33 AM   in response to: Fabrizio Giudici
  Click to reply to this thread Reply

> From my external perspective, I'm happy to read
> this. As members of
> he Java community we are all engaged in a hard fight
> to compete with
> other desktop technologies and to keep on pushing the
> revival of Java
> on the desktop. We need components from Swing, SwingX
> and many others,
> and this is a huge amount of work, so I see every
> duplication of code
> (unless of course there are compelling reasons for
> that) as a problem,
> a waste of efforts that we can't afford. This holds
> true for the
> JavaFX stuff, of course.

This was my first reaction as well. If the swingset demo uses a collapsible pane, shouldn't this be an indication that a component like this should be included in Swing? There are so many component packages out there that already offer these components. But do we really want Sun to focus on additional swing components? To be competitive on the desktop I think a UI component package needs a different release strategy than Sun is applying to the jdk releases. For UI component packages you need to be able to have short release cycles either to provide new (cool) features or to fix bugs which are likely to happen in UI components. I took Sun more than a year to fix an annoying drag bug in JTable. I know this can't be compared to some core compiler bug or security issue, but do you know how many of our users complained about this user interface issue? They could care less about the compiler bug;-)

I'd rather see Sun focus on core issues which can't be done easily by the other UI component providers, like performance, an easy way to deploy swing application on the web, or setting up an application framework so desktop development becomes more standardized and straightforward. Also, maybe there should be more promotion of third party swing components on the java site and tutorials so newcomers know that Swing only provides a default set, but there is much more available out there. If it wasn't for Jide, we would probably never have chosen Java for our rich client product.

Christiaan

Kleopatra
Re: SwingXSet3 ...
Posted: Apr 11, 2008 5:38 AM   in response to: Amy Fowler
  Click to reply to this thread Reply

Amy,
> But it's sounding like from Jeanette's post that I stand corrected.

not my intention :-)

> If SwingSet3 can be simplified by using SwingX
> versions of components, then I think that's a great thing. I already
> bundle the swingx jar for the shear joy of
> having JXPanel with animating alpha.
>

well, to use or not to use SwingX in a core Swing demo, that's more a
political than a technical question, IMO. And depends on what on-lookers
do expect from such a demo. Personally, I would tend to keep them a bit
separated: one part core-only and one part augmenting to core part,
clearly marked as being the addition (not all developers are allowed a
keen on using pre-final stuff ;-) The enhancement part would show-case
where Swing/X is heading for and what already is possible if third party
frameworks are allowed (one of my pets: get rid of that bastard GridBag
and the Rule-breaking setXXSize if we use a decent layoutManager like
MIG or FormLayout <g>)


> I would love to see SwingSet3 deployed with a swinglabs demo suite.
> SwingSet3 was designed to load arbitrary
> demos (see https://swingset3.dev.java.net/writing_demos.html). It's
> snippet highlighting feature just might help
> educate impatient geeks like me on how to use the functionality :-).
>

yeah, I'm all in favor of bringing them together. Only question:
whodunit? SwingX' resources are waaayyyy over-stretched ... (taking the
opportunity to whine a bit :-). And yeah, I love that snippet
highlighting, impatient myself

Cheers
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


kschaefe

Posts: 1,662
Re: SwingXSet3 ...
Posted: Apr 11, 2008 6:38 AM   in response to: Amy Fowler
  Click to reply to this thread Reply

Amy,

> So, I dug back into SwingX, determined to use
> JXCollapsiblePanel and
> the hyperlink functionality. Unfortunately
> I was unable to see a straight-forward way of
> simplifying the look of
> JXCollapsiblePanel/JXTaskPane; Also, I
> recall that it didn't support animating open/close
> (??). In short, it
> was less work to leave my rudimentary
> collapsible panel alone. Same thing happened for
> hyperlink. I just
> couldn't wrap my head around the additional
> design pattern when what I wanted was a simple
> hyperlink component and
> cell renderer.
It would be great if you could file some bugs relating to the lack of configurability that you experienced. I would imagine that you're not the only one. And, to clarify, the collapsibles do support animation.

> I would love to see SwingSet3 deployed with a
> swinglabs demo suite.
That would be great. Maybe it would help drum up more interest and support, but I would be concerned about how the demo would be received by new users when they come to discover that some cool component is not available in core.

Karl

theuserbl

Posts: 38
Re: SwingXSet3 ...
Posted: Apr 14, 2008 10:06 AM   in response to: Kleopatra
  Click to reply to this thread Reply

If you plan to use the external library SwingX for SwingSet3, why not using also JIDE
https://jide-oss.dev.java.net/
http://www.jidesoft.com/
(which have the same license like the OSS Java: GPL+GNU Classpath exception)
and/or
L2FProd-Common
https://l2fprod.dev.java.net/
http://l2fprod.com/common/
which is under the Apache License 2 ?

Kleopatra
Re: SwingXSet3 ...
Posted: Apr 14, 2008 11:25 AM   in response to: theuserbl
  Click to reply to this thread Reply

jdnc-interest@javadesktop.org schrieb:
> If you plan to use the external library SwingX for SwingSet3, why not using also JIDE
>

that's not a serious question, or is it?

Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net


christiaan_se

Posts: 31
Re: SwingXSet3 ...
Posted: Apr 15, 2008 1:00 AM   in response to: Kleopatra
  Click to reply to this thread Reply

> that's not a serious question, or is it?

Why wouldn't it be? It is probably the same remark as your own remark:
"The enhancement part would show-case
where Swing/X is heading for and what already is possible if third party
frameworks are allowed"

kind regards,
Christiaan

Kleopatra
Re: SwingXSet3 ...
Posted: Apr 15, 2008 2:06 AM   in response to: christiaan_se
  Click to reply to this thread Reply

Christiaan,
>> that's not a serious question, or is it?
>>
>
> Why wouldn't it be? It is probably the same remark as your own remark:
> "The enhancement part would show-case
> where Swing/X is heading for and what already is possible if third party
> frameworks are allowed"
>
>

haha .. got me :-) Forgot the "open source" - and last time I looked
the common layer didn't overly impress me.

Cheers
Jeanette


---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net





 XML java.net RSS