Commit 90da2024 authored by lafabregue's avatar lafabregue

fix treelistneres, constraint dialog

parent 18be25b4
package mustic.gui;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.beans.PropertyVetoException;
import java.io.*;
import java.util.List;
import java.util.Vector;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
......@@ -226,6 +231,7 @@ public class MainFrame extends JFrame {
createPanelFromData(null);
updateConfigJMenuBar();
}
mImageProjectTree.clearSelection();
}
});
}
......@@ -271,6 +277,7 @@ public class MainFrame extends JFrame {
createPanelFromImage(null);
updateConfigJMenuBar();
}
mDataProjectTree.clearSelection();
}
});
}
......@@ -2678,7 +2685,7 @@ public class MainFrame extends JFrame {
setCursor(new java.awt.Cursor(Cursor.WAIT_CURSOR));
ClusteringResult result = null;
LearningMethod method = null;
DataObject[] dataObjects = null;
List<DataObject> dataObjects = null;
int[] clusterMap = null;
ClassificationWeights weights = null;
Cluster[] clusters = null;
......@@ -2798,7 +2805,7 @@ public class MainFrame extends JFrame {
* @author Francois Petitjean
*/
ObjectInputStream ois = new ObjectInputStream(in);
dataObjects = (DataObject[]) ois.readObject();
dataObjects = (List<DataObject>) ois.readObject();
}
else if (entry.getName().equals(Messages.getString("MainFrame.182") + i + "/QualitiesFull.ser")) { //$NON-NLS-1$ //$NON-NLS-2$
......
package mustic.gui.dialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
//import mustic.io.geotiff.GEOTiffImage;
/**
* Fenetre permettant de creer une image a partir d'un fichier .arff
*
*/
public class ArffToDataDialog extends JInternalFrame {
private static final long serialVersionUID = 1L;
private JTextField textFile = new JTextField();
private JTextField textData = new JTextField();
public ArffToDataDialog() {
super();
JPanel mainPanel = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridLayout(2, 2));
JPanel pInpout = new JPanel(new BorderLayout());
panel.add(new JLabel(Messages.getString("ArffToDataDialog.0")), BorderLayout.WEST); //$NON-NLS-1$
pInpout.add(this.textFile, BorderLayout.CENTER);
JButton buttonBrowse = new JButton("..."); //$NON-NLS-1$
buttonBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fileChooser = new JFileChooser();
int returnVal = fileChooser
.showOpenDialog(ArffToDataDialog.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
if (fileChooser.getSelectedFile().getPath()
.endsWith(".arff")) //$NON-NLS-1$
ArffToDataDialog.this.textFile.setText(fileChooser
.getSelectedFile().getPath());
else {
JOptionPane.showMessageDialog(ArffToDataDialog.this,
Messages.getString("ArffToDataDialog.3"), Messages.getString("ArffToDataDialog.4"), //$NON-NLS-1$ //$NON-NLS-2$
JOptionPane.WARNING_MESSAGE);
}
}
}
});
pInpout.add(buttonBrowse, BorderLayout.EAST);
panel.add(pInpout);
JPanel pOutpout = new JPanel(new BorderLayout());
panel.add(new JLabel(Messages.getString("ArffToDataDialog.5")), BorderLayout.WEST); //$NON-NLS-1$
pOutpout.add(this.textData, BorderLayout.CENTER);
panel.add(pOutpout);
this.textFile.setPreferredSize(new Dimension(200, 30));
JPanel panelButton = new JPanel();
JButton buttonOk = new JButton(Messages.getString("ArffToDataDialog.7")); //$NON-NLS-1$
panelButton.add(buttonOk);
buttonOk.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
buttonOk_actionPerformed();
}
});
mainPanel.add(panel, BorderLayout.NORTH);
mainPanel.add(panelButton, BorderLayout.SOUTH);
this.setContentPane(mainPanel);
this.setTitle(Messages.getString("ArffToDataDialog.8")); //$NON-NLS-1$
this.setSize(300, 130);
this.setResizable(true);
this.setMaximizable(true);
this.setIconifiable(true);
this.setClosable(true);
this.setVisible(true);
}
protected void buttonOk_actionPerformed() {
try {
FileReader fr = new FileReader(new File(this.textFile.getText()));
BufferedReader br = new BufferedReader(fr);
String line = null;
BufferedImage buff=null;
String sdim = Messages.getString("ArffToDataDialog.9"); //$NON-NLS-1$
while ((line = br.readLine()) != null) {
if (line.startsWith(sdim)) {
String dim = line.substring(sdim.length());
String dimension[] = dim.split(","); //$NON-NLS-1$
int w = Integer.parseInt(dimension[0]);
int h = Integer.parseInt(dimension[1]);
buff=new BufferedImage(w,h,BufferedImage.TYPE_3BYTE_BGR );
} else {
String val[] = line.split(","); //$NON-NLS-1$
if (val.length >= 5) {
int x = Integer.parseInt(val[0]);
int y = Integer.parseInt(val[1]);
buff.setRGB(x, y, (int) (Double.parseDouble(val[2])*256*256+ Double.parseDouble(val[3])*256+ Double.parseDouble(val[4])));
}
}
}
String name = this.textData.getText();
File outputfile = new File(name);
ImageIO.write(buff, "png", outputfile);
JOptionPane.showMessageDialog(this,
Messages.getString("ArffToDataDialog.15") + this.textData.getText(), Messages.getString("ArffToDataDialog.16"), //$NON-NLS-1$ //$NON-NLS-2$
JOptionPane.INFORMATION_MESSAGE);
this.dispose();
} catch (Exception e) {
JOptionPane.showMessageDialog(this,
"File selected isn't supported", Messages.getString("ArffToDataDialog.4"), //$NON-NLS-1$ //$NON-NLS-2$
JOptionPane.WARNING_MESSAGE);
}
}
}
......@@ -383,6 +383,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
addConstraint(line, isImageRelated);
}
enableAllComponents();
displayPixels();
updateUI();
} catch (FileNotFoundException e) {
e.printStackTrace();
......@@ -581,8 +582,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
cluserRelatedPane.add(buildClusterRelatedPane(), BorderLayout.CENTER);
taskPane.add(cluserRelatedPane);
panelInfos.removeAll();
panelInfos.add(taskPane, BorderLayout.CENTER);
panelInfos.add(new JScrollPane(taskPane), BorderLayout.CENTER);
JButton buttonApply = new JButton(Messages.getString("ConstraintsSelectionDialog.21")); //$NON-NLS-1$
JButton buttonClear = new JButton(Messages.getString("ConstraintsSelectionDialog.22")); //$NON-NLS-1$
JPanel paneBouton = new JPanel();
......@@ -999,6 +999,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
constraintsColors.remove(i);
constraintsPanels.remove(i);
mustLinkContainer.remove(container);
displayPixels();
mustLinkContainer.updateUI();
}
});
......@@ -1033,6 +1034,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
constraintsColors.remove(i);
constraintsPanels.remove(i);
cannotLinkContainer.remove(container);
displayPixels();
cannotLinkContainer.updateUI();
}
});
......@@ -1067,6 +1069,7 @@ public class ConstraintsSelectionDialog extends JInternalFrame {
constraintsColors.remove(i);
constraintsPanels.remove(i);
labelContainer.remove(container);
displayPixels();
labelContainer.updateUI();
}
});
......
......@@ -57,17 +57,26 @@ ArffLoadDialog.80=@RELATION
ArffLoadDialog.82=%% nbIntervals
ArffLoadDialog.85=ERROR \!
ArffLoadDialog.86=ERROR\!
ArffLoadDialog.9=File containing the frequent sequentiels motives
ArffLoadDialog.9=File containing the frequent sequential patterns
ArffToImageDialog.0=Input Arff file \:
ArffToImageDialog.10=%% nbIntervals
ArffToImageDialog.15=The image is saved in
ArffToImageDialog.16=Succes
ArffToImageDialog.3=You must select a ARFF file.
ArffToImageDialog.16=Success
ArffToImageDialog.3=You must select an ARFF file.
ArffToImageDialog.4=Warning
ArffToImageDialog.5=Output image path \:
ArffToImageDialog.7=OK
ArffToImageDialog.8=ARFF
ArffToImageDialog.9=%% Dimension
ArffToDataDialog.0=Input Arff file \:
ArffToDataDialog.15=The data is loaded
ArffToDataDialog.16=Success
ArffToDataDialog.3=You must select an ARFF file.
ArffToDataDialog.4=Warning
ArffToDataDialog.5=Output Data name :
ArffToDataDialog.7=OK
ArffToDataDialog.8=ARFF
ArffToDataDialog.9=%% Dimension
ConfigDialog.0=Display a tool bar
ConfigDialog.1=Configuration
ConfigDialog.10=middle
......
......@@ -58,16 +58,25 @@ ArffLoadDialog.82=%% nbIntervals
ArffLoadDialog.85=Erreur \!
ArffLoadDialog.86=Erreur\!
ArffLoadDialog.9=Fichier contenant les motifs sequentiels frquents
ArffToImageDialog.0=Fichier Arff en entr \:
ArffToImageDialog.0=Fichier Arff en entre \:
ArffToImageDialog.10=%% nbIntervals
ArffToImageDialog.15=L'image est enregistre dans
ArffToImageDialog.16=Avec succs
ArffToImageDialog.16=Succs
ArffToImageDialog.3=Vous devez choisir un fichier ARFF.
ArffToImageDialog.4=Avertissement
ArffToImageDialog.4=Attention
ArffToImageDialog.5=Chemin d'image en sortie \:
ArffToImageDialog.7=OK
ArffToImageDialog.8=ARFF
ArffToImageDialog.9=%% Dimension
ArffToDataDialog.0=Fichier Arff en entre \:
ArffToDataDialog.15=Le Data a t charg sous
ArffToDataDialog.16=Succs
ArffToDataDialog.3=Vous devez choisir un fichier ARFF.
ArffToDataDialog.4=Attention
ArffToDataDialog.5=Nom du Data a crer :
ArffToDataDialog.7=OK
ArffToDataDialog.8=ARFF
ArffToDataDialog.9=%% Dimension
ConfigDialog.0=Afficher une barre outils
ConfigDialog.1=Configuration
ConfigDialog.10=moyen
......
......@@ -209,7 +209,7 @@ MainFrame.65=Warning
MainFrame.66=Help
MainFrame.67=Contents
MainFrame.68=About
MainFrame.69=Datas
MainFrame.69=Data
MainFrame.691=Images
MainFrame.7=New
MainFrame.70=Infos
......
......@@ -268,7 +268,6 @@ public class ImageData extends SimpleData implements Serializable {
setSampler(sampler);
wholeDataNbObjects = sampler.getDataSize();
// System.out.println("Le total de doublon est : "+countDoublon+" sur "+current+" objets");
if (MainFrame.DEBUG_MODE) {
System.out.println("Sfarsit Image Data");
long endTime = System.currentTimeMillis();
......@@ -332,7 +331,6 @@ public class ImageData extends SimpleData implements Serializable {
setSampler(sampler);
wholeDataNbObjects = sampler.getDataSize();
// System.out.println("Le total de doublon est : "+countDoublon+" sur "+current+" objets");
if (MainFrame.DEBUG_MODE) {
System.out.println("Sfarsit Image Data");
long endTime = System.currentTimeMillis();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment