You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Alex Ryzhov <ar...@gmail.com> on 2011/08/01 07:00:19 UTC

Eclipse plugin

I have another annoying issue: can't make Eclipse plugin to work. I use
Eclipse 3.6. I put the jar in the dropins directory and verified that it's
loaded by going to About -> Installation Details -> Plug-ins. It shows
"Eclipse Plug-in for Apache Pivot" v. 2.0 there.

However, I can't edit BXML and I don't see any other Pivot-related features.
Without IDE support BXML is not effective. Please help.

Thanks,
Alex

Re: Eclipse plugin

Posted by Chris Bartlett <cb...@gmail.com>.
One other thing to note.

Pivot applications do not have to use BXML (for their UI or anything
else), and BXML can be used with any Java bean styles classes (public
zero arg constructor & get/set accessors), so can be used to model an
object graph that doesn't contain any Pivot classes.

More info here
http://pivot.apache.org/tutorials/bxml-primer.html

Chris

On 1 August 2011 12:00, Alex Ryzhov <ar...@gmail.com> wrote:
> I have another annoying issue: can't make Eclipse plugin to work. I use
> Eclipse 3.6. I put the jar in the dropins directory and verified that it's
> loaded by going to About -> Installation Details -> Plug-ins. It shows
> "Eclipse Plug-in for Apache Pivot" v. 2.0 there.
>
> However, I can't edit BXML and I don't see any other Pivot-related features.
> Without IDE support BXML is not effective. Please help.
>
> Thanks,
> Alex
>

Re: Eclipse plugin

Posted by Greg Brown <gk...@verizon.net>.
> I believe the main thing the plugin gives you (correct me if I'm
> wrong, wizards) is the ability to run a bxml file standalone. 

That's correct. It helps simplify development using BXML since you don't need to write a launcher Java app.

G


Re: Eclipse plugin

Posted by Greg Brown <gk...@verizon.net>.
> P.S. I want to start another thread regarding the architecture. I was mildly shocked when I read that a Component is a controller. 

Interesting. Please elaborate if you don't mind.


Re: Eclipse plugin

Posted by Chris Bartlett <cb...@gmail.com>.
As Brent said, I found having access to Pivot source and example code
very helpful.  I'm don't think that the 'tests' and 'examples' Eclipse
projects are included in the source code distribution, but they are
available from the Subversion server.

http://svn.apache.org/repos/asf/pivot/trunk/examples/
http://svn.apache.org/repos/asf/pivot/trunk/tests/

When learning BXML, I would often search the '*.bxml' files to find
examples of syntax to specify certain things.  Like how to specify the
backgroundColor style for a Component's skin, or how to add a listener
in BXML.

These are the source code for the demos & tutorials on the Pivot website.
http://svn.apache.org/repos/asf/pivot/trunk/demos/
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/

Chris



On 2 August 2011 04:27, Brent Atkinson <br...@gmail.com> wrote:
> Hi Alex,
>
> I share the desire for a BXML editor with auto-completion. I agree that it
> would make Pivot's BXML much more attractive to developers during
> development. Are there any developers with eclipse RCP experience on the
> list? ;D
>
> Having said that, a BXML hierarchy is a View from Model-View-Controller? If
> that is supposed to be true it is not obvious, at least IMHO.
>
> Trying to map textbook MVC onto Swing, SWT or Pivot is going to give you a
> headache for sure. MVC is usually a pattern for the applications, not the
> frameworks themselves, though sometimes the components can follow the
> pattern somewhat (like Swing's JTable and TableModel).
>
> I would suggest trying to understand it for what it is rather than trying to
> retro fit a textbook pattern onto it. If you've seen MVC and understand why
> it is advantageous, it will serve you well in understanding how Pivot is
> designed. In the absence of book-style documentation, attaching the Pivot
> source in your IDE and using the debugger to step through your application
> when it is not working how you expect can help immensely.
>
> I'm fairly new to Pivot myself, but after having used it my understanding on
> BXML is that it is a useful language for object creation and dependency
> injection. It comes in handy for constructing the static structure of your
> application's objects, not the behavior though you can use the scripting
> support for some of that. Because Java is a language for describing behavior
> using objects and messages (typical OOP), the two co-exist quite well.
> Define the static structure using BXML, use the code-behind support to
> hookup the behavioral code. It's addictively fun when you get the hang of
> it.
>
> HTH,
>
> Brent
>
> On Mon, Aug 1, 2011 at 4:54 PM, Alex Ryzhov <ar...@gmail.com> wrote:
>>
>>
>>>
>>> you can probably disregard that. In practice, the Component is more of a
>>> view/model and the Skin a view/controller. Does that help?
>>>
>>>
>> http://pivot.apache.org/tutorials/platform-overview.html
>>
>> Yes, that's the document I read. What you are saying makes more sense but
>> the picture is still messy. I brought up this issue with regards to BXML:
>> Obviously, BXML is View. It defines the structure of Components, which are
>> therefore View as well. But it also affects Skin which is a view controller.
>> If Component is view model then why does it have methods layout() and
>> paint()?
>>
>
>

Re: Eclipse plugin

Posted by Greg Brown <gk...@verizon.net>.
> the division into Component/Skin isn't helping.

A typical application should not need to be concerned with this. Unless you are writing skins, their existence should be largely transparent to you.

> I am looking for a good design pattern.

I'd suggest looking into BXML and the Bindable interface. It allows you to create user interfaces using an approach similar to what you might do in MXML or XAML. Bindable is briefly discussed here:

http://pivot.apache.org/tutorials/bxml-primer.html

A simple example is here:

http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/scripting/

Take a look at JavaWindow.java and java_window.bxml for an example written in Java.

G


Re: Eclipse plugin

Posted by Alex Ryzhov <ar...@gmail.com>.
Well said, Brent. Desktop app architectures are certainly more complex and
MVC is too simple IMHO. I am in the process of migrating a Swing app to
Pivot and I want to get the architecture straight. I have had experience
with MVP and I liked it -- I have completely isolated model, view, and
presenter modules. In a desktop app it's much harder, and the division into
Component/Skin isn't helping. I am looking for a good design pattern.

Thanks,
Alex

Re: Eclipse plugin

Posted by Brent Atkinson <br...@gmail.com>.
Hi Alex,

I share the desire for a BXML editor with auto-completion. I agree that it
would make Pivot's BXML much more attractive to developers during
development. Are there any developers with eclipse RCP experience on the
list? ;D

Having said that, a BXML hierarchy is a View from Model-View-Controller? If
that is supposed to be true it is *not* obvious, at least IMHO.

Trying to map textbook MVC onto Swing, SWT or Pivot is going to give you a
headache for sure. MVC is usually a pattern for the applications, not the
frameworks themselves, though sometimes the components can follow the
pattern somewhat (like Swing's JTable and TableModel).

I would suggest trying to understand it for what it is rather than trying to
retro fit a textbook pattern onto it. If you've seen MVC and understand why
it is advantageous, it will serve you well in understanding how Pivot is
designed. In the absence of book-style documentation, attaching the Pivot
source in your IDE and using the debugger to step through your application
when it is not working how you expect can help immensely.

I'm fairly new to Pivot myself, but after having used it my understanding on
BXML is that it is a useful language for object creation and dependency
injection. It comes in handy for constructing the *static structure* of your
application's objects, not the *behavior* though you can use the scripting
support for some of that. Because Java is a language for describing behavior
using objects and messages (typical OOP), the two co-exist quite well.
Define the static structure using BXML, use the code-behind support to
hookup the behavioral code. It's addictively fun when you get the hang of
it.

HTH,

Brent

On Mon, Aug 1, 2011 at 4:54 PM, Alex Ryzhov <ar...@gmail.com> wrote:

>
>
>
>> you can probably disregard that. In practice, the Component is more of a
>> view/model and the Skin a view/controller. Does that help?
>>
>>
>> http://pivot.apache.org/tutorials/platform-overview.html
>
> Yes, that's the document I read. What you are saying makes more sense but
> the picture is still messy. I brought up this issue with regards to BXML:
> Obviously, BXML is View. It defines the structure of Components, which are
> therefore View as well. But it also affects Skin which is a view controller.
> If Component is view model then why does it have methods layout() and
> paint()?
>
>

Re: Eclipse plugin

Posted by Greg Brown <gk...@verizon.net>.
> you can probably disregard that. In practice, the Component is more of a view/model and the Skin a view/controller. Does that help?
> 
> 
> http://pivot.apache.org/tutorials/platform-overview.html
> 
> Yes, that's the document I read. What you are saying makes more sense but the picture is still messy. I brought up this issue with regards to BXML: Obviously, BXML is View.

BXML isn't limited to components, so it isn't technically a "view".

> It defines the structure of Components, which are therefore View as well. But it also affects Skin which is a view controller. If Component is view model then why does it have methods layout() and paint()?

The Component is part view because it defines things like position and size on screen. However, it delegates all presentation-related methods to the Skin.




Re: Eclipse plugin

Posted by Alex Ryzhov <ar...@gmail.com>.
> you can probably disregard that. In practice, the Component is more of a
> view/model and the Skin a view/controller. Does that help?
>
>
> http://pivot.apache.org/tutorials/platform-overview.html

Yes, that's the document I read. What you are saying makes more sense but
the picture is still messy. I brought up this issue with regards to BXML:
Obviously, BXML is View. It defines the structure of Components, which are
therefore View as well. But it also affects Skin which is a view controller.
If Component is view model then why does it have methods layout() and
paint()?

Re: Eclipse plugin

Posted by Greg Brown <gk...@verizon.net>.
> P.S. I want to start another thread regarding the architecture. I was mildly shocked when I read that a Component is a controller. 

Oh, if you are referring to the Architecture section of this doc,

http://pivot.apache.org/tutorials/platform-overview.html

you can probably disregard that. In practice, the Component is more of a view/model and the Skin a view/controller. Does that help?



Re: Eclipse plugin

Posted by Alex Ryzhov <ar...@gmail.com>.
Chris, Greg: I agree that BXML is XML -- I tried it with an XML validator,
so it was my mistake. I will double-check the errors and will write back.

Regarding "taste": I use MXML with GWT and I kind of like it. BXML is very
similar. However, there is IDE support for MXML including compile-time
checking and auto-completion. That said, I don't like to write XML by hand.

P.S. I want to start another thread regarding the architecture. I was mildly
shocked when I read that a Component is a controller.

Re: Eclipse plugin

Posted by Chris Bartlett <cb...@gmail.com>.
Alex.

On 2 August 2011 01:00, Greg Brown <gk...@verizon.net> wrote:
>> I tried associating XML Editor with .bxml files and it didn't work. It says "Invalid content" or something like that. And rightfully so - BXML isn't correct XML.
>
> That is incorrect. BXML is well-formed XML. I do not have any problems editing BXML as XML in Eclipse.

Likewise, I can edit XML in Eclipse with no problems.  If you can post
the exact errors we might be able to assist.


>> Again, as a developer I don't think I'll be more productive with BXML without IDE support; I would prefer to use Java to construct my UI instead. The reason - compile-time checking and auto-complete that  I get from Java which I don't get with BXML without IDE support.

BXML will never be to everyone's taste.  I had used Thinlet before
Pivot and saw value in BXML for UI specification (even though I
strongly dislike XML in general)  It took a little while to pick it
up, but I find it very useful.

You might be interested in this thread about a converter tool for
BXML.  I can't remember if a working converter was made available or
not in the end, but if it was you could use it to convert the tutorial
and example BXML files to help get up to speed with Pivot.

http://apache-pivot-users.399431.n3.nabble.com/pivot-are-there-any-tools-to-convert-bxml-to-Java-td2118284.html

Chris

Re: Eclipse plugin

Posted by Greg Brown <gk...@verizon.net>.
> I tried associating XML Editor with .bxml files and it didn't work. It says "Invalid content" or something like that. And rightfully so - BXML isn't correct XML. 

That is incorrect. BXML is well-formed XML. I do not have any problems editing BXML as XML in Eclipse.

> Again, as a developer I don't think I'll be more productive with BXML without IDE support; I would prefer to use Java to construct my UI instead. The reason - compile-time checking and auto-complete that  I get from Java which I don't get with BXML without IDE support.


That is perfectly valid. However, even without IDE support, you may still find BXML to be convenient. IMO, it makes visualizing and modifying the UI hierarchy much easier.

G


Re: Eclipse plugin

Posted by Alex Ryzhov <ar...@gmail.com>.
I tried associating XML Editor with .bxml files and it didn't work. It says
"Invalid content" or something like that. And rightfully so - BXML isn't
correct XML.

Again, as a developer I don't think I'll be more productive with BXML
without IDE support; I would prefer to use Java to construct my UI instead.
The reason - compile-time checking and auto-complete that  I get from Java
which I don't get with BXML without IDE support.

On Sun, Jul 31, 2011 at 11:45 PM, Bill van Melle
<bi...@gmail.com>wrote:

> You'll also want to associate BXML files with the Eclipse XML editor,
> so that you can have an editor for BXML that's at least a little
> better than a plain text editor.  Instructions are at
>
> http://apache-pivot-users.399431.n3.nabble.com/Assign-wtkx-to-xml-editor-on-eclipse-tp916608p916648.html
> (substitute "bxml" for "wtkx").  This was supposed to get into the
> FAQ, but I don't see it there.
>
>

Re: Eclipse plugin

Posted by Bill van Melle <bi...@gmail.com>.
I believe the main thing the plugin gives you (correct me if I'm
wrong, wizards) is the ability to run a bxml file standalone.  That
is, if you have a bxml file whose root element is Window (or a
subclass thereof), and doesn't depend on any java code (e.g., to
install and respond to event handlers), then you can right-click on
the bxml file in the project view and choose Run/Debug | As Pivot
Application.  I find this a useful lightweight way to debug various
bxml snippets in lieu of an actual visual designer, which Pivot sadly
does not have.  If you have a bxml component that isn''t rooted at
Window, you can make yourself a simple Window-based bxml file that
does a bxml:include of the other file in order to debug it.

You'll also want to associate BXML files with the Eclipse XML editor,
so that you can have an editor for BXML that's at least a little
better than a plain text editor.  Instructions are at
http://apache-pivot-users.399431.n3.nabble.com/Assign-wtkx-to-xml-editor-on-eclipse-tp916608p916648.html
(substitute "bxml" for "wtkx").  This was supposed to get into the
FAQ, but I don't see it there.


On Sun, Jul 31, 2011 at 10:00 PM, Alex Ryzhov <ar...@gmail.com> wrote:
> I have another annoying issue: can't make Eclipse plugin to work. I use
> Eclipse 3.6. I put the jar in the dropins directory and verified that it's
> loaded by going to About -> Installation Details -> Plug-ins. It shows
> "Eclipse Plug-in for Apache Pivot" v. 2.0 there.
>
> However, I can't edit BXML and I don't see any other Pivot-related features.
> Without IDE support BXML is not effective. Please help.

Re: Eclipse plugin

Posted by Chris Bartlett <cb...@gmail.com>.
Alex,

The FAQ *very* briefly describes part of what the Eclipse plugin does.
'How can I create a Pivot project in Eclipse?'

The main thing to note is that it is not a BXML editor.  It creates
Eclipse launch configurations for certain .java and .bxml files.

It allows you to select a java source file that implements
org.apache.pivot.wtk.Application and launch it via Run As -> Pivot
Application.

You can also launch .bxml files as 'script applications' by selecting
a BXML file whose root object is either a org.apache.pivot.wtk.Window,
or a subclass of it.  This should show up as 'Run As -> Pivot Script
Application'

Example of a BXML file with a Window as the root object
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/hello.bxml

Example of a BXML file with a subclass of Window as the root object
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists/list_views.bxml
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists/ListViews.java

Chris

On 1 August 2011 12:00, Alex Ryzhov <ar...@gmail.com> wrote:
> I have another annoying issue: can't make Eclipse plugin to work. I use
> Eclipse 3.6. I put the jar in the dropins directory and verified that it's
> loaded by going to About -> Installation Details -> Plug-ins. It shows
> "Eclipse Plug-in for Apache Pivot" v. 2.0 there.
>
> However, I can't edit BXML and I don't see any other Pivot-related features.
> Without IDE support BXML is not effective. Please help.
>
> Thanks,
> Alex
>