2022-12-10 20:23:53 +01:00
package fenetres.create_act ;
import java.awt.event.ActionEvent ;
import javax.swing.AbstractAction ;
import javax.swing.Action ;
2022-12-12 11:49:47 +01:00
import javax.swing.ImageIcon ;
2022-12-13 15:32:28 +01:00
import javax.swing.JOptionPane ;
2022-12-10 20:23:53 +01:00
import cXML.node ;
2022-12-12 11:49:47 +01:00
import fenetres.create ;
2022-12-10 20:23:53 +01:00
public class actsautmultipletrue extends AbstractAction {
{
putValue ( Action . NAME , " true " ) ;
2022-12-12 11:49:47 +01:00
putValue ( Action . SHORT_DESCRIPTION , " true " ) ;
putValue ( Action . SMALL_ICON , new ImageIcon ( create . class . getResource ( " /resources/truemini.png " ) ) ) ;
2022-12-10 20:23:53 +01:00
}
/ * *
*
* /
private static final long serialVersionUID = 1L ;
@Override
public void actionPerformed ( ActionEvent e ) {
node nod = ( node ) fenetres . create . getSelectNode ( ) . getUserObject ( ) ;
2022-12-13 15:32:28 +01:00
boolean informations = false ;
if ( JOptionPane . showConfirmDialog ( null , " Voulez-vous placer le contenu du node après le saut? " , " Information " , JOptionPane . YES_NO_OPTION , JOptionPane . QUESTION_MESSAGE ) = = JOptionPane . YES_OPTION ) {
informations = true ;
}
2022-12-10 20:23:53 +01:00
for ( int i = 0 ; i < nod . getNodes ( ) . size ( ) ; i + + ) {
nod . getNodes ( ) . get ( i ) . getAttributs ( ) . put ( " saut " , " true " ) ;
2022-12-14 10:33:48 +01:00
if ( informations ) {
String content = nod . getNodes ( ) . get ( i ) . retourneLesContenusEnfants ( " " ) ;
if ( ! content . isEmpty ( ) ) if ( content . replaceAll ( " " , " " ) . length ( ) = = 0 ) content = content . replaceAll ( " " , " " ) ;
if ( content . length ( ) > 300 ) content = content . substring ( 0 , 299 ) ;
content = nod . getNodes ( ) . get ( i ) . toString ( ) + " : " + content ;
nod . getNodes ( ) . get ( i ) . getAttributs ( ) . put ( " information " , content ) ;
}
2022-12-10 20:23:53 +01:00
}
2022-12-14 10:33:48 +01:00
//Pour le node page
if ( informations ) {
String content = nod . retourneLesContenusEnfants ( " " ) ;
if ( ! content . isEmpty ( ) ) if ( content . replaceAll ( " " , " " ) . length ( ) = = 0 ) content = content . replaceAll ( " " , " " ) ;
if ( content . length ( ) > 300 ) content = content . substring ( 0 , 299 ) ;
content = nod . toString ( ) + " : " + content ;
nod . getAttributs ( ) . put ( " information " , content ) ;
}
2022-12-10 20:23:53 +01:00
fenetres . create . getTextNodeSelect ( ) . refreshAffichage ( nod ) ;
}
}