You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Chaska <el...@hotmail.com> on 2012/11/23 10:51:55 UTC

Newbie query

I am trying to do an interface wit Apache Pivot. It is the first time I use
this, and I am not very experienced with Java nor XML neither.

I want to insert a table (with a bit of logic), which is in a .bxml, into a
border which is in a more complex .bxml. All is in a package called
tutorials.  That is the situation:

*table1.bxml (the small table)*
<layout:Datum title="Table Views" maximized="true"
    xmlns:bxml="http://pivot.apache.org/bxml"
    xmlns:content="org.apache.pivot.wtk.content"
    xmlns:tableviews="tutorials"
    xmlns:layout="tutorials"
    xmlns="org.apache.pivot.wtk">

        <ScrollPane horizontalScrollBarPolicy="fill">
            <TableView bxml:id="tableView">

               ---
          <columnHeader>
                <TableViewHeader tableView="$tableView"
sortMode="single_column"/>
            </columnHeader>
        </ScrollPane>
</layout:Datum>

*Datum.java (to sort columns)*
package tutorials;
 
import java.net.URL;
 
import org.apache.pivot.util.concurrent.TaskExecutionException;
import org.apache.pivot.wtk.media.Image;
 
public class Datum {---}

*borders.bxml (The "big" bxml)*

<Window title="Borders" maximized="true"
    xmlns:bxml="http://pivot.apache.org/bxml"
    xmlns="org.apache.pivot.wtk">
    <Border title="Borde general" styles="{color:'#0000A0',
titleColor:'#000000', thickness:10,
                cornerRadii:20, padding:30}">
    	<Label text="Borde tapado"
        styles="{horizontalAlignment:'center', verticalAlignment:'bottom',
wrapText:true}"/>
    
    <TablePane styles="{horizontalSpacing:10}">
        <columns>
            <TablePane.Column width="1*"/>
            <TablePane.Column width="4*"/>
        </columns>
 
        <TablePane.Row height="1*">
        	
            <Border title="Borde izquierdo" styles="{padding:1}">
            	*<bxml:include bxml:id="busqev" src="busqev.bxml"/>* 
                ---
            </Border>
</Window>

*Main.java*
package tutorials;

import org.apache.pivot.beans.BXMLSerializer;
import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.Window;
 
public class Main4 implements Application {
    private Window window = null;
 
    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        BXMLSerializer bxmlSerializer = new BXMLSerializer();
        window = (Window)bxmlSerializer.readObject(Main4.class,
"tabla1.bxml");
        window.open(display);
    }


The outpup is "class.tutorials is not a sequence". I dont know how to
include table1.bxml into borders.bxml without destroy the link with Datum.
java (and the logic with it)

Thak you very much, and sorry about the long post and the terrible English
=(




--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Newbie-query-tp4022247.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Newbie query

Posted by Chaska <el...@hotmail.com>.
Sorry, a small bug, busquev.bxml is table1.bxml:

<Border title="Borde izquierdo" styles="{padding:1}">
	            	*<bxml:include bxml:id="table1" src="table1.bxml"/> *

I copy from a preview version. I still have the same problem





--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Newbie-query-tp4022247p4022248.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Newbie query

Posted by Roger and Beth Whitcomb <Ro...@rbwhitcomb.com>.
Hello and welcome to Pivot.

     Let me try to explain what's going on.  When the BXMLSerializer 
reads your "table1.bxml" it is going to instantiate the tutorials.Datum 
object (using its no-argument constructor), then when it encounters the 
ScrollPane element it will try to add this new component to your Datum 
object, but there is no method defined in Datum to do the "add".  I 
think you can fix this by implementing the Sequence interface in your 
Datum class (see here: 
http://pivot.apache.org/2.0.2/docs/api/org/apache/pivot/collections/Sequence.html). 
But, since there are a large number of methods in this interface it 
would probably be easier to make Datum a subclass of Container:
public class Datum extends org.apache.pivot.wtk.Container
     But, there may also be a problem with your XML namespaces, since 
the error says "class.tutorials is not a sequence", but I'm not sure...
     We appreciate you using Pivot and feel free to ask more.

Hope that helps,
~Roger Whitcomb

On 11/23/12 1:51 AM, Chaska wrote:
> I am trying to do an interface wit Apache Pivot. It is the first time I use
> this, and I am not very experienced with Java nor XML neither.
>
> I want to insert a table (with a bit of logic), which is in a .bxml, into a
> border which is in a more complex .bxml. All is in a package called
> tutorials.  That is the situation:
>
> *table1.bxml (the small table)*
> <layout:Datum title="Table Views" maximized="true"
>      xmlns:bxml="http://pivot.apache.org/bxml"
>      xmlns:content="org.apache.pivot.wtk.content"
>      xmlns:tableviews="tutorials"
>      xmlns:layout="tutorials"
>      xmlns="org.apache.pivot.wtk">
>
>          <ScrollPane horizontalScrollBarPolicy="fill">
>              <TableView bxml:id="tableView">
>
>                 ---
>            <columnHeader>
>                  <TableViewHeader tableView="$tableView"
> sortMode="single_column"/>
>              </columnHeader>
>          </ScrollPane>
> </layout:Datum>
>
> *Datum.java (to sort columns)*
> package tutorials;
>   
> import java.net.URL;
>   
> import org.apache.pivot.util.concurrent.TaskExecutionException;
> import org.apache.pivot.wtk.media.Image;
>   
> public class Datum {---}
>
> *borders.bxml (The "big" bxml)*
>
> <Window title="Borders" maximized="true"
>      xmlns:bxml="http://pivot.apache.org/bxml"
>      xmlns="org.apache.pivot.wtk">
>      <Border title="Borde general" styles="{color:'#0000A0',
> titleColor:'#000000', thickness:10,
>                  cornerRadii:20, padding:30}">
>      	<Label text="Borde tapado"
>          styles="{horizontalAlignment:'center', verticalAlignment:'bottom',
> wrapText:true}"/>
>      
>      <TablePane styles="{horizontalSpacing:10}">
>          <columns>
>              <TablePane.Column width="1*"/>
>              <TablePane.Column width="4*"/>
>          </columns>
>   
>          <TablePane.Row height="1*">
>          	
>              <Border title="Borde izquierdo" styles="{padding:1}">
>              	*<bxml:include bxml:id="busqev" src="busqev.bxml"/>*
>                  ---
>              </Border>
> </Window>
>
> *Main.java*
> package tutorials;
>
> import org.apache.pivot.beans.BXMLSerializer;
> import org.apache.pivot.collections.Map;
> import org.apache.pivot.wtk.Application;
> import org.apache.pivot.wtk.DesktopApplicationContext;
> import org.apache.pivot.wtk.Display;
> import org.apache.pivot.wtk.Window;
>   
> public class Main4 implements Application {
>      private Window window = null;
>   
>      @Override
>      public void startup(Display display, Map<String, String> properties)
>          throws Exception {
>          BXMLSerializer bxmlSerializer = new BXMLSerializer();
>          window = (Window)bxmlSerializer.readObject(Main4.class,
> "tabla1.bxml");
>          window.open(display);
>      }
>
>
> The outpup is "class.tutorials is not a sequence". I dont know how to
> include table1.bxml into borders.bxml without destroy the link with Datum.
> java (and the logic with it)
>
> Thak you very much, and sorry about the long post and the terrible English
> =(
>
>
>
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Newbie-query-tp4022247.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>
>