This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = Formation.TABLE_NAME, | |
uniqueConstraints = { | |
@UniqueConstraint(columnNames = {Formation.COL_COD}) | |
}) | |
@Data | |
public class Formation implements Serializable { | |
private static final long serialVersionUID = 1L; | |
public static final String TABLE_NAME = "formation"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = FormationItem.TABLE_NAME) | |
public class FormationItem implements Serializable { | |
private static final long serialVersionUID = 1L; | |
public static final String TABLE_NAME = "formation_item"; | |
public static final String COL_ID = "id_formation_item"; | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Model | |
@Data | |
public class CanvasFormationItem { | |
private String strIdx; | |
private FormationItem formationItem; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Notre Grille : une liste de CanvasFormationItem | |
private List<CanvasFormationItem> lstTarget = new ArrayList<CanvasFormationItem>(); | |
// une Formation | |
private Formation current; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void init(){ | |
// Mode création, on crée une nouvelle Formation | |
current = new Formation(); | |
// On initialise le nombre des FormationItem à positionner | |
// On est parti pour du foot à 11, mais on pourrait très bien faire du foot à 7 voire du rugby à XV | |
current.setFormationItemList(new ArrayList<FormationItem>()); | |
// par défaut on met numItem == coord | |
for (int i = 1; i <= 11; i++) { | |
FormationItem item = new FormationItem(); | |
item.setNumItem(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function handleDrop(event, ui) { | |
var droppedItem = ui.draggable; | |
droppedItem.fadeOut('fast'); | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h:form> | |
<h:panelGrid columns="3"> | |
<h:outputLabel value="libellé" for="libFormation" /> | |
<p:inputText id="libFormation" | |
value="#{myController.current.libFormation}" | |
title="libellé" | |
> | |
<p:ajax event="blur" update="msg_libFormation"/> | |
</p:inputText> | |
<p:message id="msg_libFormation" for="libFormation"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- On met tout ca dans un panel avec en background une image de terrain de foot--> | |
<p:panel header="Field" styleClass="soccer_field"> | |
<!-- On créé la dataGrid pour afficher la grille--> | |
<p:dataGrid id="trgField" | |
value="#{myController.lstTarget}" | |
var="t" columns="5" | |
style="padding-top: 25px;margin-left: 20px;"> | |
<p:column> | |
<!-- Chaque case de la grille est un panel sans header d'une taille de 50*63--> | |
<p:panel id="trg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onDrop(DragDropEvent event) { | |
// Puisque l'on a associé une datasource à nos éléments droppable | |
// alors event.getData() contient un objet Java et en l'occurrence puisque la datasource | |
// en question était la DataGrid, elle-même associée à lstTarget étant une ArrayList<CanvasFormationItem> | |
// on a donc accès à un objet de type CanvasFormationItem | |
// Attention, c'est l'objet draggé, donc l'objet source. | |
CanvasFormationItem item = (CanvasFormationItem) event.getData(); | |
// Pour avoir accès à l'objet où on a droppé, ce n'est pas encore possible | |
// du coup on feinte :D | |
// on recupère l'ID de l'élément DOM sur lequel on a droppé |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Before | |
public void init() { | |
FirefoxProfile profile = new FirefoxProfile(); | |
profile.setAcceptUntrustedCertificates(true); | |
profile.setAssumeUntrustedCertificateIssuer(false); | |
webdriver = new FirefoxDriver(profile); | |
} |
OlderNewer