You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by noobmike <md...@lakeheadu.ca> on 2011/06/23 18:41:07 UTC

Another TablePane Question

Hey guys,

Well this might be a BoxPane Question really, but Im not sure. 

So what I have is a 10x10 tablePane of 35x35 cells inside of a boxPane which
is inside of 
a panorama. I also have stuff underneath the boxPane (another boxPane with
other stuff 
in it). All ofwhich is in the left side of a splitPane.

I have buttons that add rows and columns to the bottom and right of the
tablepane 
respectivly, so its esentially a growing nxm checkerboard if you can picture
that. 

My problem is that when I add a lot of extra rows and the checkerboard
expands lengthwise, 
the box pane expands as well, which then ends up pushing my other boxPane
full of stuff off 
of the window. But when I add columns and the checkerboard expands
widthwise, the panorama
works properly, and the boxpane does not expand. 

I tried setting max heights and prefered heights of the boxpane that the
tablePane is in, but the panorama wont work andyou cant see any rows past
the max height of the boxpane. (exactly
like the second tablePane example on the pivot site, when you add to many
rows.

any ideas? I assume this is a simple fix, but I just cant seem to figure it
out. 

Thanks, 

Mike.


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

Re: Another TablePane Question

Posted by Greg Brown <gk...@verizon.net>.
Unrelated question - if all the cells are the same size, why not use a GridPane?

On Jun 23, 2011, at 1:23 PM, noobmike wrote:

> Sure! 
> 
> This is the problem area. <?xml version="1.0" encoding="UTF-8"?>
> 
> <BoxPane xmlns:bxml="http://pivot.apache.org/bxml"
>    xmlns="org.apache.pivot.wtk"
> 	orientation="vertical" styles="{padding:4, spacing:10, fill:true,
> horizontalAlignment:'center'}">
> 	
> 	<Label text="Cross-Word Designer" styles="{font:'Helvetica bold 15', 
> 	 color:'#000000', wrapText:true, horizontalAlignment:'center',
> verticalAlignment:'top'}"/> 
> 								
> 	<Border styles="{color:'#000000' , padding:4}" >  	
> 	
> 		<Panorama styles="{buttonColor:'0xffffffff',
> buttonBackgroundColor:'0x00000044'}">
> 		<BoxPane orientation="vertical" styles="{fill:false,
> horizontalAlignment:'center'}">	
> 
> 			<Border>
> 			<TablePane bxml:id="crosswordBase" styles="{verticalSpacing:1,
> showHorizontalGridLines:true,
>             horizontalSpacing:1, showVerticalGridLines:true }">
> 				
> ******* I left out the columns and rows, because there are a lot of lines.
> they are all 35x35 fillers 
> 
> 				</TablePane>
> 				</Border>
> 			</BoxPane>
> 		</Panorama>
> 		</Border>
> 	
> 	<Separator/>
> 	
> 	
> 	<TablePane preferredWidth="263" preferredHeight="120"
> styles="{verticalSpacing:10, padding:4}">
>        <columns>
>            <TablePane.Column width="1*"/>
>            <TablePane.Column width="1*"/>
>         </columns>
> 
>        <TablePane.Row height="-1">
>            <BoxPane orientation="horizontal"
> styles="{horizontalAlignment:'left'}">
>                <Label text="Answer:" preferredWidth="50"
> preferredHeight="20"
>                   styles="{horizontalAlignment:'left',
> verticalAlignment:'top'}"/>
> 				<Border styles="{color:10}">
>                <TextArea bxml:id="answer" minimumHeight="50"
> minimumWidth="100" preferredWidth="180" maximumWidth="190"/>
>                </Border>
> 			</BoxPane>
> 			       
> 		
>            <BoxPane orientation="horizontal"
> styles="{horizontalAlignment:'left'}">
>                <Label text="Clue:" preferredWidth="35" preferredHeight="20"
>                styles="{horizontalAlignment:'left',
> verticalAlignment:'top'}"/>
> 				<Border styles="{color:10}">
>                <TextArea bxml:id="clue" minimumHeight="50"
> minimumWidth="100" preferredWidth="180" maximumWidth="190"/>
>                </Border>
> 			</BoxPane>
> 			
> 			</TablePane.Row>
> 				
> 
>        <TablePane.Row height="-1">
>            <BoxPane orientation="horizontal"
> styles="{horizontalAlignment:'left', padding:{left:54}}">
>                <PushButton bxml:id ="publishEntry" buttonData="Publish
> Entry"/>
> 				<PushButton bxml:id ="clearClueAnswer" buttonData="Clear Entry"/>				
> 			</BoxPane>		
> 		</TablePane.Row>
>    </TablePane>
> 	
> 
> </BoxPane>
> 
> I will attach a picture of the sections as well. So you can see what I mean. 
> 
> http://apache-pivot-users.399431.n3.nabble.com/file/n3100693/question.png 
> 
> 
> I hope this helps and thanks for the responses. 
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Another-TablePane-Question-tp3100547p3100693.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Another TablePane Question

Posted by Greg Brown <gk...@verizon.net>.
You need to put the label in the first row of your table pane, the panorama in the second.

On Jun 23, 2011, at 2:01 PM, noobmike wrote:

> Ill check out the gridPane stuff, thanks for the suggestion. 
> 
> For the second part, I like the idea of keeping the panorama, and I wouldnt
> want to put the lable in it. 
> Could I put the panorama around the one tablePane.Row? 
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Another-TablePane-Question-tp3100547p3100816.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Another TablePane Question

Posted by noobmike <md...@lakeheadu.ca>.
Ill check out the gridPane stuff, thanks for the suggestion. 

For the second part, I like the idea of keeping the panorama, and I wouldnt
want to put the lable in it. 
Could I put the panorama around the one tablePane.Row? 

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

Re: Another TablePane Question

Posted by noobmike <md...@lakeheadu.ca>.
You're a GENIUS Greg! Why didn't I think of that.

Thanks! 

Mike.

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

Re: Another TablePane Question

Posted by Greg Brown <gk...@verizon.net>.
If you know that the cell contains a Label, can you just cast the return value of getCellComponent() to a Label and call setText() on it?

On Jun 24, 2011, at 12:39 PM, noobmike wrote:

> Hey Guys, 
> 
> So everything up until now is working, thanks to your suggestions. As for
> the gridPane stuff that 
> you suggested Greg, I think Im too far in to switch everything over to a
> gridPane, and like I said 
> the tablePane tutorial is helping me a lot. 
> 
> However, I am stuck on one part. 
> 
> As shown, I have a dynamically sized tablePane. In each cell is a blank
> Label. I want to set the text
> of the labels without having N x M bxml:id's. I can set the background
> colour like this: 
> 
> CWBase.getCellComponent(firstClickR, i).getStyles().put("backgroundColor",
> colour);
> 
> and I know that the text isnt part of the styles of a Label. Any idea on how
> to do this? 
> Worse comes to worst I could always delete the whole row or column with the
> labels 
> set accordingly, but there has to be a better way. 
> 
> Thanks in advace, 
> 
> Mike. 
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Another-TablePane-Question-tp3100547p3105066.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Another TablePane Question

Posted by noobmike <md...@lakeheadu.ca>.
Hey Guys, 

So everything up until now is working, thanks to your suggestions. As for
the gridPane stuff that 
you suggested Greg, I think Im too far in to switch everything over to a
gridPane, and like I said 
the tablePane tutorial is helping me a lot. 

However, I am stuck on one part. 

As shown, I have a dynamically sized tablePane. In each cell is a blank
Label. I want to set the text
of the labels without having N x M bxml:id's. I can set the background
colour like this: 

CWBase.getCellComponent(firstClickR, i).getStyles().put("backgroundColor",
colour);

and I know that the text isnt part of the styles of a Label. Any idea on how
to do this? 
Worse comes to worst I could always delete the whole row or column with the
labels 
set accordingly, but there has to be a better way. 

Thanks in advace, 

Mike. 

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

Re: Another TablePane Question

Posted by Greg Brown <gk...@verizon.net>.
> As to your first question, I am just more familiar with tablePanes, and the
> tablePane Tutorial on the site covers almost everything I want to do with
> it. The Gridpane tutorial doesnt have any Java code attached to it. 

For any layout with fixed size rows and columns, I'd recommend GridPane.

> For the second part, that makes sense. Is their anything you suggest that
> would work? I know tablePanes grow both ways, I could try a TablePane with
> one column and one row. Seems kind of rediculous though. 

It wouldn't have just one row and column - you'd also need a row for your label. So, the first row would have -1 for height, and the second 1*. The column would have 1* for width.




Re: Another TablePane Question

Posted by noobmike <md...@lakeheadu.ca>.
As to your first question, I am just more familiar with tablePanes, and the
tablePane Tutorial on the site covers almost everything I want to do with
it. The Gridpane tutorial doesnt have any Java code attached to it. 

For the second part, that makes sense. Is their anything you suggest that
would work? I know tablePanes grow both ways, I could try a TablePane with
one column and one row. Seems kind of rediculous though. 

Thanks guys. 

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

Re: Another TablePane Question

Posted by Greg Brown <gk...@verizon.net>.
Oh, and to your other question - you almost never want to put a Panorama or ScrollPane inside a BoxPane. A box pane will only ever fill in one direction, but to get any value out of a panorama or scroll pane, you need something that will fill in both directions.

On Jun 23, 2011, at 1:23 PM, noobmike wrote:

> Sure! 
> 
> This is the problem area. <?xml version="1.0" encoding="UTF-8"?>
> 
> <BoxPane xmlns:bxml="http://pivot.apache.org/bxml"
>    xmlns="org.apache.pivot.wtk"
> 	orientation="vertical" styles="{padding:4, spacing:10, fill:true,
> horizontalAlignment:'center'}">
> 	
> 	<Label text="Cross-Word Designer" styles="{font:'Helvetica bold 15', 
> 	 color:'#000000', wrapText:true, horizontalAlignment:'center',
> verticalAlignment:'top'}"/> 
> 								
> 	<Border styles="{color:'#000000' , padding:4}" >  	
> 	
> 		<Panorama styles="{buttonColor:'0xffffffff',
> buttonBackgroundColor:'0x00000044'}">
> 		<BoxPane orientation="vertical" styles="{fill:false,
> horizontalAlignment:'center'}">	
> 
> 			<Border>
> 			<TablePane bxml:id="crosswordBase" styles="{verticalSpacing:1,
> showHorizontalGridLines:true,
>             horizontalSpacing:1, showVerticalGridLines:true }">
> 				
> ******* I left out the columns and rows, because there are a lot of lines.
> they are all 35x35 fillers 
> 
> 				</TablePane>
> 				</Border>
> 			</BoxPane>
> 		</Panorama>
> 		</Border>
> 	
> 	<Separator/>
> 	
> 	
> 	<TablePane preferredWidth="263" preferredHeight="120"
> styles="{verticalSpacing:10, padding:4}">
>        <columns>
>            <TablePane.Column width="1*"/>
>            <TablePane.Column width="1*"/>
>         </columns>
> 
>        <TablePane.Row height="-1">
>            <BoxPane orientation="horizontal"
> styles="{horizontalAlignment:'left'}">
>                <Label text="Answer:" preferredWidth="50"
> preferredHeight="20"
>                   styles="{horizontalAlignment:'left',
> verticalAlignment:'top'}"/>
> 				<Border styles="{color:10}">
>                <TextArea bxml:id="answer" minimumHeight="50"
> minimumWidth="100" preferredWidth="180" maximumWidth="190"/>
>                </Border>
> 			</BoxPane>
> 			       
> 		
>            <BoxPane orientation="horizontal"
> styles="{horizontalAlignment:'left'}">
>                <Label text="Clue:" preferredWidth="35" preferredHeight="20"
>                styles="{horizontalAlignment:'left',
> verticalAlignment:'top'}"/>
> 				<Border styles="{color:10}">
>                <TextArea bxml:id="clue" minimumHeight="50"
> minimumWidth="100" preferredWidth="180" maximumWidth="190"/>
>                </Border>
> 			</BoxPane>
> 			
> 			</TablePane.Row>
> 				
> 
>        <TablePane.Row height="-1">
>            <BoxPane orientation="horizontal"
> styles="{horizontalAlignment:'left', padding:{left:54}}">
>                <PushButton bxml:id ="publishEntry" buttonData="Publish
> Entry"/>
> 				<PushButton bxml:id ="clearClueAnswer" buttonData="Clear Entry"/>				
> 			</BoxPane>		
> 		</TablePane.Row>
>    </TablePane>
> 	
> 
> </BoxPane>
> 
> I will attach a picture of the sections as well. So you can see what I mean. 
> 
> http://apache-pivot-users.399431.n3.nabble.com/file/n3100693/question.png 
> 
> 
> I hope this helps and thanks for the responses. 
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Another-TablePane-Question-tp3100547p3100693.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Another TablePane Question

Posted by noobmike <md...@lakeheadu.ca>.
Thanks a lot guys! 

Helpful as usual! 

Mike.

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

Re: Another TablePane Question

Posted by Chris Bartlett <cb...@gmail.com>.
 As Greg says, a TablePane seems like a good fit here.

I hacked your BXML around a bit, but you should be able to figure out what
has changed.
Hopefully I understood your issues correctly.
(There is a simple launcher app in the zip too)

Chris

On 24 June 2011 00:23, noobmike <md...@lakeheadu.ca> wrote:

> Sure!
>
> This is the problem area. <?xml version="1.0" encoding="UTF-8"?>
>
> <BoxPane xmlns:bxml="http://pivot.apache.org/bxml"
>    xmlns="org.apache.pivot.wtk"
>        orientation="vertical" styles="{padding:4, spacing:10, fill:true,
> horizontalAlignment:'center'}">
>
>        <Label text="Cross-Word Designer" styles="{font:'Helvetica bold 15',
>         color:'#000000', wrapText:true, horizontalAlignment:'center',
> verticalAlignment:'top'}"/>
>
>        <Border styles="{color:'#000000' , padding:4}" >
>
>                <Panorama styles="{buttonColor:'0xffffffff',
> buttonBackgroundColor:'0x00000044'}">
>                <BoxPane orientation="vertical" styles="{fill:false,
> horizontalAlignment:'center'}">
>
>                        <Border>
>                        <TablePane bxml:id="crosswordBase"
> styles="{verticalSpacing:1,
> showHorizontalGridLines:true,
>             horizontalSpacing:1, showVerticalGridLines:true }">
>
> ******* I left out the columns and rows, because there are a lot of lines.
> they are all 35x35 fillers
>
>                                </TablePane>
>                                </Border>
>                        </BoxPane>
>                </Panorama>
>                </Border>
>
>        <Separator/>
>
>
>        <TablePane preferredWidth="263" preferredHeight="120"
> styles="{verticalSpacing:10, padding:4}">
>        <columns>
>            <TablePane.Column width="1*"/>
>            <TablePane.Column width="1*"/>
>         </columns>
>
>        <TablePane.Row height="-1">
>            <BoxPane orientation="horizontal"
> styles="{horizontalAlignment:'left'}">
>                <Label text="Answer:" preferredWidth="50"
> preferredHeight="20"
>                   styles="{horizontalAlignment:'left',
> verticalAlignment:'top'}"/>
>                                <Border styles="{color:10}">
>                <TextArea bxml:id="answer" minimumHeight="50"
> minimumWidth="100" preferredWidth="180" maximumWidth="190"/>
>                </Border>
>                        </BoxPane>
>
>
>            <BoxPane orientation="horizontal"
> styles="{horizontalAlignment:'left'}">
>                <Label text="Clue:" preferredWidth="35" preferredHeight="20"
>                styles="{horizontalAlignment:'left',
> verticalAlignment:'top'}"/>
>                                <Border styles="{color:10}">
>                <TextArea bxml:id="clue" minimumHeight="50"
> minimumWidth="100" preferredWidth="180" maximumWidth="190"/>
>                </Border>
>                        </BoxPane>
>
>                        </TablePane.Row>
>
>
>        <TablePane.Row height="-1">
>            <BoxPane orientation="horizontal"
> styles="{horizontalAlignment:'left', padding:{left:54}}">
>                <PushButton bxml:id ="publishEntry" buttonData="Publish
> Entry"/>
>                                <PushButton bxml:id ="clearClueAnswer"
> buttonData="Clear Entry"/>
>                        </BoxPane>
>                </TablePane.Row>
>    </TablePane>
>
>
> </BoxPane>
>
> I will attach a picture of the sections as well. So you can see what I
> mean.
>
> http://apache-pivot-users.399431.n3.nabble.com/file/n3100693/question.png
>
>
> I hope this helps and thanks for the responses.
>
> --
> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/Another-TablePane-Question-tp3100547p3100693.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>

Re: Another TablePane Question

Posted by noobmike <md...@lakeheadu.ca>.
Sure! 

This is the problem area. <?xml version="1.0" encoding="UTF-8"?>

<BoxPane xmlns:bxml="http://pivot.apache.org/bxml"
    xmlns="org.apache.pivot.wtk"
	orientation="vertical" styles="{padding:4, spacing:10, fill:true,
horizontalAlignment:'center'}">
	
	<Label text="Cross-Word Designer" styles="{font:'Helvetica bold 15', 
	 color:'#000000', wrapText:true, horizontalAlignment:'center',
verticalAlignment:'top'}"/> 
								
	<Border styles="{color:'#000000' , padding:4}" >  	
	
		<Panorama styles="{buttonColor:'0xffffffff',
buttonBackgroundColor:'0x00000044'}">
		<BoxPane orientation="vertical" styles="{fill:false,
horizontalAlignment:'center'}">	
        
			<Border>
			<TablePane bxml:id="crosswordBase" styles="{verticalSpacing:1,
showHorizontalGridLines:true,
             horizontalSpacing:1, showVerticalGridLines:true }">
				
******* I left out the columns and rows, because there are a lot of lines.
they are all 35x35 fillers 

				</TablePane>
				</Border>
			</BoxPane>
		</Panorama>
		</Border>
	
	<Separator/>
	
	
	<TablePane preferredWidth="263" preferredHeight="120"
styles="{verticalSpacing:10, padding:4}">
        <columns>
            <TablePane.Column width="1*"/>
            <TablePane.Column width="1*"/>
         </columns>
 
        <TablePane.Row height="-1">
            <BoxPane orientation="horizontal"
styles="{horizontalAlignment:'left'}">
                <Label text="Answer:" preferredWidth="50"
preferredHeight="20"
                   styles="{horizontalAlignment:'left',
verticalAlignment:'top'}"/>
				<Border styles="{color:10}">
                <TextArea bxml:id="answer" minimumHeight="50"
minimumWidth="100" preferredWidth="180" maximumWidth="190"/>
                </Border>
			</BoxPane>
			       
		
            <BoxPane orientation="horizontal"
styles="{horizontalAlignment:'left'}">
                <Label text="Clue:" preferredWidth="35" preferredHeight="20"
                styles="{horizontalAlignment:'left',
verticalAlignment:'top'}"/>
				<Border styles="{color:10}">
                <TextArea bxml:id="clue" minimumHeight="50"
minimumWidth="100" preferredWidth="180" maximumWidth="190"/>
                </Border>
			</BoxPane>
			
			</TablePane.Row>
				
 
        <TablePane.Row height="-1">
            <BoxPane orientation="horizontal"
styles="{horizontalAlignment:'left', padding:{left:54}}">
                <PushButton bxml:id ="publishEntry" buttonData="Publish
Entry"/>
				<PushButton bxml:id ="clearClueAnswer" buttonData="Clear Entry"/>				
			</BoxPane>		
		</TablePane.Row>
    </TablePane>
	

</BoxPane>

I will attach a picture of the sections as well. So you can see what I mean. 

http://apache-pivot-users.399431.n3.nabble.com/file/n3100693/question.png 


I hope this helps and thanks for the responses. 

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

Re: Another TablePane Question

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

I think this might well be a BoxPane question as you suggest, but it is hard
to say without seeing the BXML file.
Are you able post the BXML to the list so we can see the exact structure?
Ideally, it won't be a huge BXML file, but rather a minimal one that
demonstrates the issue.

Or have a look at this thread - might be the same sort thing.
http://apache-pivot-users.399431.n3.nabble.com/Fill-window-tp3022622p3022622.html

Chris

On 23 June 2011 23:41, noobmike <md...@lakeheadu.ca> wrote:

> Hey guys,
>
> Well this might be a BoxPane Question really, but Im not sure.
>
> So what I have is a 10x10 tablePane of 35x35 cells inside of a boxPane
> which
> is inside of
> a panorama. I also have stuff underneath the boxPane (another boxPane with
> other stuff
> in it). All ofwhich is in the left side of a splitPane.
>
> I have buttons that add rows and columns to the bottom and right of the
> tablepane
> respectivly, so its esentially a growing nxm checkerboard if you can
> picture
> that.
>
> My problem is that when I add a lot of extra rows and the checkerboard
> expands lengthwise,
> the box pane expands as well, which then ends up pushing my other boxPane
> full of stuff off
> of the window. But when I add columns and the checkerboard expands
> widthwise, the panorama
> works properly, and the boxpane does not expand.
>
> I tried setting max heights and prefered heights of the boxpane that the
> tablePane is in, but the panorama wont work andyou cant see any rows past
> the max height of the boxpane. (exactly
> like the second tablePane example on the pivot site, when you add to many
> rows.
>
> any ideas? I assume this is a simple fix, but I just cant seem to figure it
> out.
>
> Thanks,
>
> Mike.
>
>
> --
> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/Another-TablePane-Question-tp3100547p3100547.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>