MAJ (Prise en compte des doubles, triples, ... sur style:tab-stop)

This commit is contained in:
pablo rodriguez 2022-11-24 17:01:49 +01:00
parent 86a0973c99
commit c06bdca77f
10 changed files with 52 additions and 41 deletions

Binary file not shown.

4
bin/.gitignore vendored
View File

@ -1 +1,5 @@
/MEPTL/
/calcul/
/evaluer/
/fenetres/
/list/

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -138,6 +138,13 @@ public class rechercherUnNodeStudent {
if(nameNode.equals("text:tab") || nameNode.equals("style:graphic-properties")) {
nodStudent = findByContentZero(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
}
//*************************************************************
//** Recherche le node style:tab-stop par son style:position **
//*************************************************************
if(nameNode.equals("style:tab-stop")) {
nodStudent = findBystylePosition(nameNode, nodSujet, nod0Student, nod1Student, nod2Student, a);
}
//***********************************************
//** Recherche le node par son nom **
@ -542,6 +549,25 @@ public class rechercherUnNodeStudent {
return nodStudent;
}
/**
* Recherche le node style:tab-stop par style:position.</br>
* @param nameNode
* @param nodSujet
* @param nod0Student
* @param nod1Student
* @param nod2Student
* @param a
* @return
*/
private static node findBystylePosition(String nameNode, node nodSujet,node nod0Student, node nod1Student, node nod2Student, Run a) {
node nodStudent = null;
String valueAttribut = evaluation.withoutCodeAndPoint(nodSujet.getAttributs().get("style:position"));
if(nod2Student!=null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod2Student, nameNode, "style:position", valueAttribut);
if(nod1Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod1Student, nameNode, "style:position", valueAttribut);
if(nod0Student!=null) if(nodStudent==null) nodStudent = a.retourneFirstNodeByNameAttributValue(nod0Student, nameNode, "style:position", valueAttribut);
return nodStudent;
}
/**
* Rechercher le node table:table par table:name.</br>
* @param nameNode

View File

@ -834,6 +834,9 @@ public final class create extends JFrame {
*/
private AbstractAction actRedo = new AbstractAction() {
/**
*
*/
private static final long serialVersionUID = 1L;
{
@ -881,28 +884,6 @@ public final class create extends JFrame {
this.dispose();
}
// public static void expandOrCollapsePath (JTree tree,TreePath treePath,int level,int currentLevel,boolean expand) {
// System.out.println("Exp level="+currentLevel+", exp="+expand + ", level=" + level);
// if (expand && level<=currentLevel && level>0) return;
//
// TreeNode treeNode = ( TreeNode ) treePath.getLastPathComponent();
// TreeModel treeModel=tree.getModel();
// if ( treeModel.getChildCount(treeNode) >= 0 ) {
// for ( int i = 0; i < treeModel.getChildCount(treeNode); i++ ) {
// TreeNode n = ( TreeNode )treeModel.getChild(treeNode, i);
// TreePath path = treePath.pathByAddingChild( n );
// expandOrCollapsePath(tree,path,level,currentLevel+1,expand);
// }
// if (!expand && currentLevel<level) return;
// }
// if (expand) {
// tree.expandPath( treePath );
//// System.err.println("Path expanded at level "+currentLevel+"-"+treePath);
// } else {
// tree.collapsePath(treePath);
//// System.err.println("Path collapsed at level "+currentLevel+"-"+treePath);
// }
// }
/**

View File

@ -53,27 +53,27 @@ public class actUpNode extends AbstractAction{
if(selectedNodeIndex>0) {
nod.getParent().upNodeEnfant(nod);
// int index = nod.getParent().getNodes().indexOf(nod);
//
// DefaultTreeModel treeModel = (DefaultTreeModel) fenetres.create.getTree().getModel();
// treeModel.insertNodeInto(selectNode, selectParentNode, selectedNodeIndex-1);
// treeModel.reload();
// DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot();
DefaultTreeModel treeModel = (DefaultTreeModel) fenetres.create.getTree().getModel();
treeModel.insertNodeInto(selectNode, selectParentNode, selectedNodeIndex-1);
treeModel.reload();
DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot();
// path = (TreePath) selectParentNode.getChildAt(selectedNodeIndex-1);
// System.out.println(path.toString());
// fenetres.create.setTree(treeModel);
// treeModel.reload(root);
System.out.println(path.toString());
fenetres.create.setTree(treeModel);
treeModel.reload(root);
fenetres.create.getTree().repaint();
DefaultMutableTreeNode SelectParentNode = (DefaultMutableTreeNode) selectNode.getParent();
SelectParentNode.removeAllChildren();
SelectParentNode = addNodeMutable(nod.getParent(),SelectParentNode);
DefaultTreeModel model = (DefaultTreeModel) fenetres.create.getTree().getModel();
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
model.reload(root);
// path= (TreePath) SelectParentNode.getFirstChild();
model.reload(root);
// DefaultMutableTreeNode SelectParentNode = (DefaultMutableTreeNode) selectNode.getParent();
// SelectParentNode.removeAllChildren();
// SelectParentNode = addNodeMutable(nod.getParent(),SelectParentNode);
//
//
// DefaultTreeModel model = (DefaultTreeModel) fenetres.create.getTree().getModel();
// DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
// model.reload(root);
//// path= (TreePath) SelectParentNode.getFirstChild();
// model.reload(root);
fenetres.create.getTree().setSelectionPath(path);
fenetres.create.getTree().expandPath(path);