PDA

View Full Version : newBLD.setHideCollapseTool(true) don't work with BorderLayoutData... why?



Crash Override
17 Sep 2010, 5:17 AM
Why I don't hide the collapse tool in for the BorderLayoutData?

I see that this problem was fixed in the svn, but, where is the svn version?

Thank You for all!

sven
17 Sep 2010, 5:25 AM
Which version of GXT are you using? What does your code look like?

Crash Override
17 Sep 2010, 6:56 AM
Which version of GXT are you using? What does your code look like?

ExtGWT 2.2.0 + GWT 2.1.0 M3

But now I understand and resolve my first problem.
Now I have another problem.

Can I send you my project for explain clearly what is my problem?

sven
17 Sep 2010, 6:57 AM
Can I send you my project for explain clearly what is my problem?
Instead of sending me a complete project, try to reproduce your problem with a standalone testcase that implements EntryPoint and post it there. Also explain in detail what is not working.

Crash Override
17 Sep 2010, 7:36 AM
Instead of sending me a complete project, try to reproduce your problem with a standalone testcase that implements EntryPoint and post it there. Also explain in detail what is not working.

OK, I try to explain...

I've done 2 BorderLayout, 1 extern and 1 in the center of the BorderLayout center Region.
I've added the external BL in a viewport.

When I load the project, the center Region of the BorderLayout internal doesn't respect the size that I set to the borderLayoutData assigned to center region.

I hope I was understandable

Thank You

sven
17 Sep 2010, 7:38 AM
You cannot set a size to a center region. It will be as big as the remaining space is (what east, west, north and south dont use).

Crash Override
17 Sep 2010, 7:58 AM
You cannot set a size to a center region. It will be as big as the remaining space is (what east, west, north and south dont use).

In fact! But when I disable or reactivate the status bar of my browser window, the size of the central region of BL internal resize properly, how I wish! BL Internal only the north and south.

On load I only hide the north and the south of the internal BL, I don't resize the center region....

look like a bug.

sven
17 Sep 2010, 8:01 AM
Can you please post a small testcase that implements EntryPoint of your problem? Than i can take a look at it.

Crash Override
17 Sep 2010, 9:01 AM
Can you please post a small testcase that implements EntryPoint of your problem? Than i can take a look at it.

I try, but it is very difficult for me to take just one small example because it interfaces with the Tomcat server which collects information.

Here you go.

http://pastebin.com/UYSV4zxn

sven
17 Sep 2010, 9:11 AM
First suggestions: Rewrite that code and reorder it so it is readable for everyone and not only you. I chaged 4 lines, all marked with a big "CHANGE":
class Phantoms implements EntryPoint {

/** DICHIARAZIONI OGGETTI USATI ************************************************************************/

/**
* Creo il viewport per risolvere il problema del ridimensionamento del
* contenuto con la finestra
*/
public final Viewport viewport = new Viewport();

/** Layout da assegnare al viewport */
public final BorderLayout windowBLout = new BorderLayout();
public final BorderLayout centerBLin = new BorderLayout();

/** NORD: per Immagine e Bottoni */
public LayoutContainer northLCout = new LayoutContainer();
public BorderLayoutData northBLDout = new BorderLayoutData(LayoutRegion.NORTH, 120);

/** SUD: per Footer */
public LayoutContainer southLCout = new LayoutContainer();
public BorderLayoutData southBLDout = new BorderLayoutData(LayoutRegion.SOUTH);

/** OVEST: per Lista Documenti */
public ContentPanel westCPout = new ContentPanel();
public BorderLayoutData westBLDout = new BorderLayoutData(LayoutRegion.WEST);

/** EST: per Note */
public ContentPanel eastCPout = new ContentPanel();
public BorderLayoutData eastBLDout = new BorderLayoutData(LayoutRegion.EAST);

/**
* CENTRO: per Lista Testimoni, Visualizzazione Documento, Visualizzazione
* Matadata
*/
public LayoutContainer centerLCout = new LayoutContainer();
public BorderLayoutData centerBLDout = new BorderLayoutData(LayoutRegion.CENTER);

public ContentPanel northCPinCenter = new ContentPanel();
public BorderLayoutData northBLDinCenter = new BorderLayoutData(LayoutRegion.NORTH);

public ContentPanel centerCPinCenter = new ContentPanel();
public BorderLayoutData centerBLDinCenter = new BorderLayoutData(LayoutRegion.CENTER);

public ContentPanel southCPinCenter = new ContentPanel();
public BorderLayoutData southBLDinCenter = new BorderLayoutData(LayoutRegion.SOUTH);

/** Bottoni */
public SelectionListener<ButtonEvent> slHome;
public SelectionListener<ButtonEvent> slHelp;

/** Servizi */

public VBoxLayout alignCenter = new VBoxLayout(VBoxLayoutAlign.CENTER);

// Lista di nomi di file.xml
public String[] fileList = new String[1000];

// Lista di nomi di documento (senza .xml)
public String[] docList = new String[1000];

public int fileNum = 0;
public FlexTable flexTable = new FlexTable();

public String selectedFile;

/** Metodo Entry point **********************************************************************************/
public void onModuleLoad() {

viewport.setLayout(windowBLout);

// setta northLC (centerCPinNorth e southCPinNorth) (immagine e bottoni)
this.North_ImageButtons();

// setta eastCP (note)
this.East_Notes();

// setta westCP (listaDoc)
this.West_DocList();

// setta southLC (footer)
this.South_Footer();

// setta centerCP (documento)
this.Center_Doc();

westCPout.setBodyStyleName("westCPout-body");

eastCPout.setBodyStyleName("eastCPout-body");

northCPinCenter.setBodyStyleName("northCPinCenter-body");
centerCPinCenter.setBodyStyleName("centerCPinCenter-body");
southCPinCenter.setBodyStyleName("southCPinCenter-body");

centerLCout.add(northCPinCenter, northBLDinCenter); // per testimoni
centerLCout.add(centerCPinCenter, centerBLDinCenter); // per documento
centerLCout.add(southCPinCenter, southBLDinCenter); // per metadata

// configura il viewport
viewport.add(northLCout, northBLDout); // per immagine e bottoni
viewport.add(southLCout, southBLDout); // per footer
viewport.add(eastCPout, eastBLDout); // per note
viewport.add(westCPout, westBLDout); // per listaDoc
viewport.add(centerLCout, centerBLDout); // per testimoni, documento,
// metadata

RootPanel.get().add(viewport);

northLCout.setLayoutOnChange(true);
southLCout.setLayoutOnChange(true);
eastCPout.setLayoutOnChange(true);
westCPout.setLayoutOnChange(true);
centerLCout.setLayoutOnChange(true);
northCPinCenter.setLayoutOnChange(true);
centerCPinCenter.setLayoutOnChange(true);
southCPinCenter.setLayoutOnChange(true);

// collapseForHome();
this.HandleDocuments();

}

/******************************************************************************************************/
public void North_ImageButtons() {
// Creo 1 nuovo BorderLayout per dividere in 2 il north esterno
BorderLayout northBL = new BorderLayout();
northLCout.setLayout(northBL);

// Setto i Margini del north esterno con la pagina a 0
northBLDout.setMargins(new Margins(0));

// Creo 2 nuovi BLD, 1 per area: NORTH e CENTER in cui ho diviso il north
// esterno
BorderLayoutData northOutBLDinNorth = new BorderLayoutData(LayoutRegion.NORTH, 100);
// BorderLayoutData northOutBLDinCenter = new
// BorderLayoutData(LayoutRegion.CENTER, 20);

// Creo 1 LC per il North interno al North esterno
LayoutContainer northOutLCinNorth = new LayoutContainer();

// Imposto l'immagine
Image headImage = new Image("Utils.URL_IMAGE");
headImage.setSize("100%", "100%");

// La Aggiungo al North Interno
northOutLCinNorth.add(headImage);

// Aggiungo la parte North al LayoutContainer northLCout esterno
// dicendogli anche la regione che andra' a completare con
// northOutBLDinNorth
northLCout.add(northOutLCinNorth, northOutBLDinNorth);

this.CreateButtons();
}

public void CreateButtons() {
// Creo un nuovo BorderLayoutData per i dati del Center della regione North
BorderLayoutData northOutBLDinCenter = new BorderLayoutData(LayoutRegion.CENTER, 20);

Button Home = new Button("Homepage");
Button Help = new Button("Help");

// Creo un nuovo LC per la regione Center del North esterno
LayoutContainer northOutLCinCenter = new LayoutContainer();

// Creo un nuovo Layout per quel LC
HBoxLayout northOutLayoutInNorth = new HBoxLayout();
northOutLayoutInNorth.setAdjustForFlexRemainder(true);
northOutLCinCenter.setLayout(northOutLayoutInNorth);

// Creo il LayoutData per i bottoni
HBoxLayoutData buttonData = new HBoxLayoutData();
buttonData.setFlex(1);

Home.addSelectionListener(slHome);
Help.addSelectionListener(slHelp);

northOutLCinCenter.add(Home, buttonData);
northOutLCinCenter.add(Help, buttonData);

CreateServicesListeners();

northLCout.add(northOutLCinCenter, northOutBLDinCenter);
}

public void CreateServicesListeners() {

ClearAll();

slHome = new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
HandleDocuments();
}
};

slHelp = new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
northCPinCenter.hide();
centerCPinCenter.setHeading("Help");
centerCPinCenter.setUrl("Url_Help");
}
};

}

/******************************************************************************************************/
public void East_Notes() {
eastCPout.removeAll();

eastCPout.setHeading("Notes");
eastCPout.setScrollMode(Scroll.AUTO);
eastCPout.setBodyBorder(true);
eastCPout.setVisible(false);

eastBLDout.setFloatable(true);
eastBLDout.setCollapsible(true);
eastBLDout.setSplit(true);
eastBLDout.setMargins(new Margins(0, 0, 0, 2));
eastBLDout.setSize(300);
}

/******************************************************************************************************/
public void West_DocList() {
westCPout.setHeading("Documents List");
westCPout.setScrollMode(Scroll.AUTO);
westCPout.setBodyBorder(true);
westBLDout.setCollapsible(true);
westBLDout.setFloatable(true);
westBLDout.setSplit(true);
westBLDout.setSize(220);
westBLDout.setMargins(new Margins(0, 2, 0, 0));
}

/******************************************************************************************************/
public void South_Footer() {
HorizontalPanel hpSouth = new HorizontalPanel();

HBoxLayoutData infoData = new HBoxLayoutData(new Margins(0, 0, 3, 2));

HTML contacts = new HTML("<a href=" + "Utils.URL_CONTACTS" + ">" + "Utils.STR_CONTACTS" + "</a>");
Label disclaimer = new Label("Utils.STR_FOOTER");

southLCout.add(hpSouth, infoData);
southBLDout.setSize(15);

hpSouth.addText(" ");
hpSouth.addText(" ");
hpSouth.add(disclaimer);
hpSouth.addText(" ");
hpSouth.addText(" ");
hpSouth.add(contacts);
}

/******************************************************************************************************/
public void Center_Doc() {

centerBLDout.setMargins(new Margins(0));
centerLCout.setLayout(centerBLin); // importantissimo!!!! non cancellare

// northCPinCenter.setHeading(Utils.HEADING_DOC);
northCPinCenter.setHeaderVisible(true);
northCPinCenter.setScrollMode(Scroll.NONE);
northCPinCenter.setBodyBorder(true);
northBLDinCenter.setCollapsible(true);
northBLDinCenter.setFloatable(false);
northBLDinCenter.setSplit(true);
northBLDinCenter.setMargins(new Margins(0));
//CHANGE north of 0px? changed to 50 for now
northBLDinCenter.setSize(50);

centerCPinCenter.setHeaderVisible(false);
centerCPinCenter.setScrollMode(Scroll.AUTO);
centerCPinCenter.setBodyBorder(true);
//CHANGE remove that
//centerCPinCenter.setSize("50%", "50%");

centerBLDinCenter.setMargins(new Margins(0));

southCPinCenter.setHeading("Metadata");
southCPinCenter.setScrollMode(Scroll.AUTO);
southCPinCenter.setBodyBorder(true);
southCPinCenter.setVisible(false);
southBLDinCenter.setCollapsible(true);
southBLDinCenter.setFloatable(true);
southBLDinCenter.setSplit(true);
southBLDinCenter.setMargins(new Margins(2, 0, 0, 0));
//CHANGE south of 0px? changed to 50 for now
southBLDinCenter.setSize(50);

}

/******************************************************************************************************/
public void HandleDocuments() {

// this.ExpandAfterService();
// centerBLin.collapse(LayoutRegion.NORTH);
// northCPinCenter.setHeading(Utils.STR_HOME);

this.ClearAll();

// Nascondo i pannelli dei testimoni, delle note e dei metadati
northCPinCenter.hide();
eastCPout.hide();
southCPinCenter.hide();

// Visualizzo solo quello centrale e gli assegno la pagina dell'Home
//CHANGE if you change hedaer visiblity, we need to sync size
centerCPinCenter.getHeader().setVisible(true);
centerCPinCenter.setHeading("Homepage");
centerCPinCenter.setUrl("Utils.URL_HOME");

//CHANGE syncing size
centerCPinCenter.syncSize();
try {
/*
* RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,
* Utils.URL_DOCS_LIST); rb.sendRequest(null, new MyRequestCallback(this,
* Utils.SHOW_DOCS_LIST));
*/
} catch (Exception excp) {
}
}

public void ShowDocList(String response) {
String[] a, b;
String doc;
int row = 0;

westCPout.removeAll();
a = response.split("Utils.listSeparator");

for (String q : a) {
b = q.split("Utils.couplesSeparator");

HTML cell = new HTML();

if (b[0].isEmpty()) { // per quaderno bufalini
String docName[] = b[1].split("Utils.XML_EXSTENSION");
doc = docName[0];
} else {
doc = b[0];
}

cell.setHTML(doc);
this.docList[row] = doc;
this.fileList[row] = b[1];

flexTable.setWidget(row, 0, cell);
flexTable.setStyleName("flexStyle");
// cell.addMouseOverHandler(new MyMouseOverHandler(this, row));
row++;
}
this.fileNum = row;

westCPout.add(flexTable);
// flexTable.addClickHandler(new MyClickHandlerOnDocList(this));
}

public void ShowHtml(String response, ContentPanel cp) {
HTML html = new HTML(response);

cp.removeAll();
cp.add(html);

if (response.equals("")) {
if (eastCPout.isVisible()) {
windowBLout.hide(LayoutRegion.EAST);
centerBLin.show(LayoutRegion.SOUTH);
}
} else {
if (!eastCPout.isVisible()) {
windowBLout.show(LayoutRegion.EAST);
centerBLin.show(LayoutRegion.SOUTH);
}
}
}

public void ShowWitnessList(String response) {
String[] a;
String group = "witList";
int index = 0;

northCPinCenter.removeAll();
HorizontalPanel hp = new HorizontalPanel();

Label text1 = new Label("Scegli un testimone: ");

if (!response.equals("")) {
hp.add(text1);
a = response.split("Utils.listSeparator");

for (String q : a) {
RadioButton radio = new RadioButton(group, q);
hp.setHorizontalAlign(HorizontalAlignment.CENTER);
// hp.setCellHorizontalAlignment(radio,
// HasHorizontalAlignment.ALIGN_CENTER);
hp.add(radio);
// radio.addClickHandler(new MyClickHandlerOnWitnessList(this,
// selectedFile, q, radio));

if (index == 0) {
radio.fireEvent(new ClickEvent() {
});
}
index++;
}

centerBLin.show(LayoutRegion.NORTH);
centerCPinCenter.getHeader().setVisible(false);
northCPinCenter.add(hp);
} else {
centerBLin.hide(LayoutRegion.NORTH);
centerCPinCenter.getHeader().setVisible(true);
centerCPinCenter.setHeading("Documento");

}
}

public void ShowMetaShort(String response) {
PopupPanel p = new PopupPanel(true);
p.setWidget(new HTML(response));
p.setAnimationEnabled(true);
p.setAutoHideEnabled(true);
p.setGlassEnabled(true);
p.setPreviewingAllNativeEvents(true);
p.setSize("3", "5");
p.show();
}

/******************************************************************************************************/
public void ClearAll() {
northCPinCenter.removeAll();
centerCPinCenter.removeAll();
southCPinCenter.removeAll();
eastCPout.removeAll();
}

public void CollapseForServices() {
// centerBLin.collapse(LayoutRegion.NORTH);
// centerBLin.collapse(LayoutRegion.SOUTH);
// windowBLout.collapse(LayoutRegion.EAST);
centerBLin.hide(LayoutRegion.NORTH);
centerBLin.hide(LayoutRegion.SOUTH);
windowBLout.hide(LayoutRegion.EAST);
}

public void ExpandAfterService() {
// centerBLin.expand(LayoutRegion.NORTH);
// centerBLin.expand(LayoutRegion.SOUTH);
// windowBLout.expand(LayoutRegion.EAST);
centerBLin.hide(LayoutRegion.NORTH);
centerBLin.show(LayoutRegion.SOUTH);
windowBLout.show(LayoutRegion.EAST);
}
}

Crash Override
17 Sep 2010, 9:11 AM
I think I resolve the problem, but now I have a new problem.
How can I resize a ComboBox in a FormPanel?
and
How can I set the scroll in those ComboBox?

Crash Override
17 Sep 2010, 9:13 AM
[QUOTE=sven;514881]First suggestions: Rewrite that code and reorder it so it is readable for everyone and not only you. I chaged 4 lines, all marked with a big "CHANGE":[CODE]class Phantoms implements EntryPoint {

excuse me for the bad format of code..

sven
17 Sep 2010, 9:14 AM
excuse me for the bad format of code..
No problem, but imagine you ahve to fix a bug in that code in 10 years ;)

Crash Override
17 Sep 2010, 9:22 AM
No problem, but imagine you ahve to fix a bug in that code in 10 years ;)

you're right, but I have to finish the project by September 20!

Have you read my last question on combobox? you can help me?