View Full Version : Info.display position
Diego Keller
18 Aug 2010, 8:54 AM
Hi, i am using the code "Info.display" to show a message. It works fine, but i would like to position the message on the top center of the page, and also change de background color and other styles.
How to do that?
You need to extend Info and change it to your needs. However you will need to create your own display methods, because they are static ones.
Diego Keller
18 Aug 2010, 10:01 AM
Thanks for the tip.
I do this, and i would like to share the result:
package com.camara.hamurabi.view.gwt.client.gui.adm;
import com.extjs.gxt.ui.client.util.Point;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.InfoConfig;
public class KXTInfo extends Info {
@Override
protected void onShowInfo() {
super.onShowInfo();
}
/**
* Mostra uma mensagem por um período de tempo.
*
* @param title
* @param message
*/
public static void show(String message) {
show(message, 7000);
}
/**
* Mostra uma mensagem por um período de tempo.
*
* @param title
* @param message
*/
public static void show(String message, int miliseconds) {
// Criação
KXTInfo info = new KXTInfo();
// Configuração
InfoConfig config = new InfoConfig(null, message);
config.display = miliseconds;
// Formatação
info.setBodyStyle("background-color: #f9ff4f; text-align: center; border: 0x solid black; padding: 3px; font-size: 11px; font-weight: bold;");
info.setFrame(false);
info.setAutoHeight(true);
info.setAnimCollapse(true);
// Exibição
info.show(config);
// Posicionamento
info.setAutoWidth(false);
info.setWidth(info.getWidth() + 30);
Point p = info.position();
p.x = ((p.x + info.getWidth()) / 2) - (info.getWidth() / 2);
info.setPosition(p.x, 0);
}
}
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.