GWT: Help trying to format a composite widget. Tried CSS stuff and it has no effect -


consider following widget:

import com.google.gwt.user.client.ui.composite; import com.google.gwt.user.client.ui.label; import com.google.gwt.user.client.ui.listbox; import com.google.gwt.user.client.ui.textbox; import com.google.gwt.user.client.ui.hashorizontalalignment; import com.google.gwt.user.client.ui.hasverticalalignment; import com.google.gwt.user.client.ui.flextable;  public class selectorpanel extends composite {     private final flextable flextable = new flextable();     private final label lbltitle = new label("##title");     private final listbox listbox = new listbox();     private final label lblsearchtext = new label( "##searchtext" );     private final textbox tbsearch = new textbox();      public selectorpanel()     {         listbox.setvisibleitemcount( 10 );         flextable.setstylename("searchpanel");         flextable.setborderwidth(0);          initwidget( flextable );         flextable.setsize("200px", "0px");         lbltitle.setwordwrap( false );          flextable.setwidget( 0, 0, lbltitle );          flextable.setwidget( 1, 0, listbox );         listbox.setwidth("100%");          flextable.setwidget( 2, 0, lblsearchtext );         tbsearch.setmaxlength( 32 );          flextable.setwidget( 3, 0, tbsearch );         flextable.getcellformatter().sethorizontalalignment( 0, 0, hashorizontalalignment.align_left );         flextable.getcellformatter().setverticalalignment( 2, 0, hasverticalalignment.align_middle );         flextable.getcellformatter().setverticalalignment( 1, 0, hasverticalalignment.align_middle );         flextable.getcellformatter().setverticalalignment( 3, 0, hasverticalalignment.align_middle );         flextable.getcellformatter().setverticalalignment(0, 0, hasverticalalignment.align_bottom);         flextable.getcellformatter().sethorizontalalignment(3, 0, hashorizontalalignment.align_center);     }  } 

i have tried messing css spacing , padding (and have no idea difference is) , has no effect. can change colors in css tool , has no effect.

anyway, here problems widget:

  1. the title text "##title" cut off list box below it. spacing or padding below doesn't happen.

  2. the ##searchtext label close listbox above , overlapped text box below it.

  3. finally whole thing appears @ extreme left on browser , little spacing between , edge of screen.

i can 'kind of' format adjusting cell sizes , not. can't right, better. thinking must wrong way go it.

when @ stockwatcher application use css things this, can't happen. following css file , 2 items experimental , have no effect on anything.

boxed {     margin-top: auto;     border: thin solid;     background-color: silver; } #test {     margin-top: 20px;     margin-bottom: 20px;     padding-top: 20px;     padding-bottom: 20px; } 

is there can explain me? not understand why css has no effect or how resolve above problems. can apply above css cells or labels or other ui objects , nothing happens.

first of can't see overlapping issues. see picture. looks me:

enter image description here

to css-questions: need reference class-name or id of component. class referenced ".classname", id "#id".

if want move widget left 100 pixels can use css:

.searchpanel{ margin-left:100px; } 

or can center with:

.searchpanel{ margin:auto; } 

you applied css-class "searchpanel" in code with:

flextable.setstylename("searchpanel"); 

this way can apply classes every component.

if wan't more spacing on top , bottom of label (##title , ##searchtext) add margin well:

.gwt-label {     margin-top: 10px;    margin-bottom: 10px; } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -