2,6 → 2,7 |
|
import java.util.ArrayList; |
|
import org.tela_botanica.client.ComposantClass; |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
16,6 → 17,7 |
import org.tela_botanica.client.vues.structure.StructureForm; |
|
import com.extjs.gxt.ui.client.event.BaseEvent; |
import com.extjs.gxt.ui.client.event.EventType; |
import com.extjs.gxt.ui.client.event.Events; |
import com.extjs.gxt.ui.client.event.Listener; |
import com.extjs.gxt.ui.client.widget.Info; |
74,16 → 76,16 |
nomChp.setTabIndex(tabIndex++); |
nomChp.setFieldLabel(i18nC.nomCollection()); |
nomChp.setAllowBlank(false); |
nomChp.addStyleName("obligatoire"); |
nomChp.addListener(Events.Change, new Listener<BaseEvent>() { |
nomChp.addStyleName(ComposantClass.OBLIGATOIRE); |
nomChp.addListener(Events.Valid, new Listener<BaseEvent>() { |
@Override |
public void handleEvent(BaseEvent be) { |
nomChp.removeStyleName("obligatoire"); |
nomChp.removeStyleName("obligatoire-ok"); |
nomChp.removeStyleName(ComposantClass.OBLIGATOIRE); |
nomChp.removeStyleName(ComposantClass.OBLIGATOIRE_OK); |
if (nomChp.getRawValue().length() != 0) { |
nomChp.addStyleName("obligatoire-ok"); |
nomChp.addStyleName(ComposantClass.OBLIGATOIRE_OK); |
} else if (nomChp.getRawValue().length() == 0) { |
nomChp.addStyleName("obligatoire"); |
nomChp.addStyleName(ComposantClass.OBLIGATOIRE); |
} |
} |
}); |
92,7 → 94,7 |
|
typesCollectionCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionNcd(), "typeCollectionNcd", tabIndex++); |
typesCollectionCombo.peupler(Valeur.COLLECTION_NCD_HERBIER); |
typesCollectionCombo.addStyleName("obligatoire"); |
typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE); |
typesCollectionCombo.addListener(Events.Select, new Listener<BaseEvent>() { |
@Override |
public void handleEvent(BaseEvent be) { |
110,14 → 112,19 |
} |
mediateur.desactiverChargement(); |
panneauFormulaire.layout(); |
|
} |
}); |
typesCollectionCombo.addListener(Events.Valid, new Listener<BaseEvent>() { |
@Override |
public void handleEvent(BaseEvent be) { |
Valeur valeur = typesCollectionCombo.getValue(); |
// Gestion du style obligatoire |
typesCollectionCombo.removeStyleName("obligatoire"); |
typesCollectionCombo.removeStyleName("obligatoire-ok"); |
typesCollectionCombo.removeStyleName(ComposantClass.OBLIGATOIRE); |
typesCollectionCombo.removeStyleName(ComposantClass.OBLIGATOIRE_OK); |
if (valeur != null) { |
typesCollectionCombo.addStyleName("obligatoire-ok"); |
typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE_OK); |
} else { |
typesCollectionCombo.addStyleName("obligatoire"); |
typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE); |
} |
} |
}); |