913 |
jpm |
1 |
package org.tela_botanica.client.vues.accueil;
|
|
|
2 |
|
1165 |
jpm |
3 |
import org.tela_botanica.client.Mediateur;
|
913 |
jpm |
4 |
import org.tela_botanica.client.util.Debug;
|
|
|
5 |
|
|
|
6 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
|
|
7 |
import com.extjs.gxt.ui.client.event.IconButtonEvent;
|
|
|
8 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
|
|
9 |
import com.extjs.gxt.ui.client.widget.button.ToolButton;
|
|
|
10 |
import com.extjs.gxt.ui.client.widget.custom.Portlet;
|
|
|
11 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
|
|
12 |
|
|
|
13 |
abstract public class Applette extends Portlet {
|
|
|
14 |
|
1165 |
jpm |
15 |
protected Mediateur mediateur = null;
|
|
|
16 |
|
913 |
jpm |
17 |
private ToolButton epingleBouton = null;
|
|
|
18 |
private ToolButton configurationBouton = null;
|
|
|
19 |
private ToolButton fermetureBouton = null;
|
|
|
20 |
|
1165 |
jpm |
21 |
protected void initialiserApplette(Mediateur mediateurCourrant) {
|
|
|
22 |
initialiserApplette(mediateurCourrant, null);
|
913 |
jpm |
23 |
}
|
|
|
24 |
|
1165 |
jpm |
25 |
protected void initialiserApplette(Mediateur mediateurCourrant, String titre) {
|
|
|
26 |
mediateur = mediateurCourrant;
|
|
|
27 |
|
913 |
jpm |
28 |
setLayout(new FitLayout());
|
|
|
29 |
setHeight(250);
|
|
|
30 |
setCollapsible(true);
|
|
|
31 |
setAnimCollapse(true);
|
|
|
32 |
setScrollMode(Scroll.AUTO);
|
|
|
33 |
setTitre(titre);
|
|
|
34 |
|
|
|
35 |
configurationBouton = new ToolButton("x-tool-gear");
|
|
|
36 |
getHeader().addTool(configurationBouton);
|
|
|
37 |
|
|
|
38 |
epingleBouton = getBoutonEpingle();
|
|
|
39 |
getHeader().addTool(epingleBouton);
|
|
|
40 |
|
|
|
41 |
fermetureBouton = getBoutonFermeture();
|
|
|
42 |
getHeader().addTool(fermetureBouton);
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
private ToolButton getBoutonEpingle() {
|
|
|
46 |
ToolButton bouton = new ToolButton("x-tool-pin", new SelectionListener<IconButtonEvent>() {
|
|
|
47 |
@Override
|
|
|
48 |
public void componentSelected(IconButtonEvent ce) {
|
|
|
49 |
setEpingler(!isPinned());
|
|
|
50 |
}
|
|
|
51 |
});
|
|
|
52 |
return bouton;
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
private ToolButton getBoutonFermeture() {
|
|
|
56 |
ToolButton bouton = new ToolButton("x-tool-close", new SelectionListener<IconButtonEvent>() {
|
|
|
57 |
@Override
|
|
|
58 |
public void componentSelected(IconButtonEvent ce) {
|
|
|
59 |
removeFromParent();
|
|
|
60 |
}
|
|
|
61 |
});
|
|
|
62 |
return bouton;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
public void setTitre(String titre) {
|
|
|
66 |
if (titre != null) {
|
1680 |
raphael |
67 |
setHeadingHtml(titre);
|
913 |
jpm |
68 |
}
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
public void setEpingler(boolean epingler) {
|
|
|
72 |
if (epingler) {
|
|
|
73 |
epingleBouton.setStyleName("x-tool-unpin x-tool");
|
|
|
74 |
setPinned(true);
|
|
|
75 |
} else {
|
|
|
76 |
epingleBouton.setStyleName("x-tool-pin x-tool");
|
|
|
77 |
setPinned(false);
|
|
|
78 |
}
|
1210 |
cyprien |
79 |
Debug.log("epingleBouton.getStyleName() = "+epingleBouton.getStyleName());
|
913 |
jpm |
80 |
layout();
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
protected void ajouterConfigurationListener(SelectionListener<IconButtonEvent> configurationListener) {
|
|
|
84 |
configurationBouton.addSelectionListener(configurationListener);
|
|
|
85 |
}
|
|
|
86 |
}
|