Skip to content
Snippets Groups Projects
Commit e46ee197 authored by Katy Saintin's avatar Katy Saintin
Browse files

Use JPanel instead of Panel from Comete

parent 9503c49b
Branches
Tags
No related merge requests found
...@@ -12,6 +12,7 @@ import java.util.List; ...@@ -12,6 +12,7 @@ import java.util.List;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import org.cdma.plugin.mambo.utils.MamboVCGenerator; import org.cdma.plugin.mambo.utils.MamboVCGenerator;
...@@ -23,11 +24,10 @@ import fr.soleil.comete.bean.tangotree.swing.SwingDeviceSelector; ...@@ -23,11 +24,10 @@ import fr.soleil.comete.bean.tangotree.swing.SwingDeviceSelector;
import fr.soleil.comete.definition.widget.IComponent; import fr.soleil.comete.definition.widget.IComponent;
import fr.soleil.comete.definition.widget.IFileBrowser; import fr.soleil.comete.definition.widget.IFileBrowser;
import fr.soleil.comete.swing.FileBrowserFieldButton; import fr.soleil.comete.swing.FileBrowserFieldButton;
import fr.soleil.comete.swing.Panel;
import fr.soleil.comete.swing.ScrollPane; import fr.soleil.comete.swing.ScrollPane;
import fr.soleil.comete.swing.TextArea; import fr.soleil.comete.swing.TextArea;
public class ArchivingPanel extends Panel { public class ArchivingPanel extends JPanel {
private static final long serialVersionUID = 4152804760597320463L; private static final long serialVersionUID = 4152804760597320463L;
...@@ -90,7 +90,7 @@ public class ArchivingPanel extends Panel { ...@@ -90,7 +90,7 @@ public class ArchivingPanel extends Panel {
optionsPanel = new OptionsPanel(); optionsPanel = new OptionsPanel();
optionsPanel.enableOverridePart(); optionsPanel.enableOverridePart();
add(archivingComponent, BorderLayout.CENTER); add((JComponent)archivingComponent, BorderLayout.CENTER);
add(optionsPanel, BorderLayout.EAST); add(optionsPanel, BorderLayout.EAST);
JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
......
package org.cdma.gui.databrowser.impl.cdma.db; package org.cdma.gui.databrowser.impl.cdma.db;
import org.cdma.gui.databrowser.impl.tango.TangoDataSourceBrowser;
import fr.esrf.TangoApi.Database;
import fr.esrf.TangoApi.DbDatum;
import fr.soleil.comete.tango.data.service.helper.TangoDeviceHelper;
import fr.soleil.lib.project.SystemUtils; import fr.soleil.lib.project.SystemUtils;
public class ArchivingUtil { public class ArchivingUtil {
...@@ -46,169 +41,169 @@ public class ArchivingUtil { ...@@ -46,169 +41,169 @@ public class ArchivingUtil {
} }
private static void initExtractorDevice(boolean hdb) { private static void initExtractorDevice(boolean hdb) {
String extractorDevice = hdbExtractorDevice; // String extractorDevice = hdbExtractorDevice;
if (!hdb) { // if (!hdb) {
extractorDevice = tdbExtractorDevice; // extractorDevice = tdbExtractorDevice;
} // }
if (extractorDevice == null) { // if (extractorDevice == null) {
try { // try {
String extractorClassName = HDB_CLASS_NAME; // String extractorClassName = HDB_CLASS_NAME;
if (!hdb) { // if (!hdb) {
extractorClassName = TDB_CLASS_NAME; // extractorClassName = TDB_CLASS_NAME;
} // }
//
if (TangoDataSourceBrowser.isTangoEnabled()) { // if (TangoDataSourceBrowser.isTangoEnabled()) {
Database database = TangoDeviceHelper.getDatabase(); // Database database = TangoDeviceHelper.getDatabase();
if (database != null) { // if (database != null) {
String[] extractorList = database.get_device_exported_for_class(extractorClassName); // String[] extractorList = database.get_device_exported_for_class(extractorClassName);
if ((extractorList != null) && (extractorList.length > 0)) { // if ((extractorList != null) && (extractorList.length > 0)) {
extractorDevice = extractorList[0]; // extractorDevice = extractorList[0];
if (hdb) { // if (hdb) {
hdbExtractorDevice = extractorDevice; // hdbExtractorDevice = extractorDevice;
} else { // } else {
tdbExtractorDevice = extractorDevice; // tdbExtractorDevice = extractorDevice;
} // }
} // }
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
//
} // }
} // }
} }
public static void initArchivingEnvironnement() { public static void initArchivingEnvironnement() {
if(TangoDataSourceBrowser.isTangoEnabled()) { // if(TangoDataSourceBrowser.isTangoEnabled()) {
initExtractorDevice(true); // initExtractorDevice(true);
initExtractorDevice(false); // initExtractorDevice(false);
initArchivingEnvironnement(true); // initArchivingEnvironnement(true);
initArchivingEnvironnement(false); // initArchivingEnvironnement(false);
} // }
} }
private static void initArchivingEnvironnement(boolean hdb) { // private static void initArchivingEnvironnement(boolean hdb) {
String extractorDevice = hdbExtractorDevice; // String extractorDevice = hdbExtractorDevice;
String archiverDevice = HDB_ARCHIVER_CLASS_NAME; // String archiverDevice = HDB_ARCHIVER_CLASS_NAME;
if (!hdb) { // if (!hdb) {
extractorDevice = tdbExtractorDevice; // extractorDevice = tdbExtractorDevice;
archiverDevice = TDB_ARCHIVER_CLASS_NAME; // archiverDevice = TDB_ARCHIVER_CLASS_NAME;
} // }
//
if ((extractorDevice != null) && !extractorDevice.isEmpty()) { // if ((extractorDevice != null) && !extractorDevice.isEmpty()) {
String userPropertyName = getProperty(hdb, "DB_USER"); // String userPropertyName = getProperty(hdb, "DB_USER");
String userProperty = SystemUtils.getSystemProperty(userPropertyName); // String userProperty = SystemUtils.getSystemProperty(userPropertyName);
if ((userProperty == null) || userProperty.isEmpty()) { // if ((userProperty == null) || userProperty.isEmpty()) {
userProperty = getDeviceProperty(extractorDevice, "DbUser"); // userProperty = getDeviceProperty(extractorDevice, "DbUser");
if ((userProperty != null) && !userProperty.isEmpty()) { // if ((userProperty != null) && !userProperty.isEmpty()) {
System.setProperty(userPropertyName, userProperty); // System.setProperty(userPropertyName, userProperty);
} // }
} // }
//
String passPropertyName = getProperty(hdb, "DB_PASSWORD"); // String passPropertyName = getProperty(hdb, "DB_PASSWORD");
String passProperty = SystemUtils.getSystemProperty(passPropertyName); // String passProperty = SystemUtils.getSystemProperty(passPropertyName);
if ((passProperty == null) || passProperty.isEmpty()) { // if ((passProperty == null) || passProperty.isEmpty()) {
passProperty = getDeviceProperty(extractorDevice, "DbPassword"); // passProperty = getDeviceProperty(extractorDevice, "DbPassword");
if ((passProperty != null) && !passProperty.isEmpty()) { // if ((passProperty != null) && !passProperty.isEmpty()) {
System.setProperty(passPropertyName, passProperty); // System.setProperty(passPropertyName, passProperty);
} // }
} // }
} // }
//
if ((archiverDevice != null) && !archiverDevice.isEmpty()) { // if ((archiverDevice != null) && !archiverDevice.isEmpty()) {
String dbDriverPropertyName = getProperty(hdb, "DB_DRIVER"); // String dbDriverPropertyName = getProperty(hdb, "DB_DRIVER");
String driverProperty = SystemUtils.getSystemProperty(dbDriverPropertyName); // String driverProperty = SystemUtils.getSystemProperty(dbDriverPropertyName);
if ((driverProperty == null) || driverProperty.isEmpty()) { // if ((driverProperty == null) || driverProperty.isEmpty()) {
driverProperty = getClassProperty(archiverDevice, "DbType"); // driverProperty = getClassProperty(archiverDevice, "DbType");
if ((driverProperty != null) && !driverProperty.isEmpty()) { // if ((driverProperty != null) && !driverProperty.isEmpty()) {
String driverType = "jdbc:mysql"; // String driverType = "jdbc:mysql";
if (driverProperty.toLowerCase().contains("oracle")) { // if (driverProperty.toLowerCase().contains("oracle")) {
driverType = "jdbc:oracle:thin"; // driverType = "jdbc:oracle:thin";
} // }
System.setProperty(dbDriverPropertyName, driverType); // System.setProperty(dbDriverPropertyName, driverType);
} // }
} // }
//
String racPropertyName = getProperty(hdb, "DB_RAC"); // String racPropertyName = getProperty(hdb, "DB_RAC");
String racProperty = SystemUtils.getSystemProperty(racPropertyName); // String racProperty = SystemUtils.getSystemProperty(racPropertyName);
if ((racProperty == null) || racProperty.isEmpty()) { // if ((racProperty == null) || racProperty.isEmpty()) {
racProperty = getClassProperty(archiverDevice, "isRac"); // racProperty = getClassProperty(archiverDevice, "isRac");
if ((racProperty != null) && !racProperty.isEmpty()) { // if ((racProperty != null) && !racProperty.isEmpty()) {
System.setProperty(racPropertyName, racProperty); // System.setProperty(racPropertyName, racProperty);
} // }
} // }
//
boolean isRac = Boolean.parseBoolean(racProperty); // boolean isRac = Boolean.parseBoolean(racProperty);
//
String schemaPropertyName = getProperty(hdb, "DB_SCHEMA"); // String schemaPropertyName = getProperty(hdb, "DB_SCHEMA");
String schemaProperty = SystemUtils.getSystemProperty(schemaPropertyName); // String schemaProperty = SystemUtils.getSystemProperty(schemaPropertyName);
if ((schemaProperty == null) || schemaProperty.isEmpty()) { // if ((schemaProperty == null) || schemaProperty.isEmpty()) {
schemaProperty = getClassProperty(archiverDevice, "DbSchema"); // schemaProperty = getClassProperty(archiverDevice, "DbSchema");
if ((schemaProperty != null) && !schemaProperty.isEmpty()) { // if ((schemaProperty != null) && !schemaProperty.isEmpty()) {
System.setProperty(schemaPropertyName, schemaProperty); // System.setProperty(schemaPropertyName, schemaProperty);
} // }
} // }
//
String namePropertyName = getProperty(hdb, "DB_NAME"); // String namePropertyName = getProperty(hdb, "DB_NAME");
String nameProperty = SystemUtils.getSystemProperty(namePropertyName); // String nameProperty = SystemUtils.getSystemProperty(namePropertyName);
if ((nameProperty == null) || nameProperty.isEmpty()) { // if ((nameProperty == null) || nameProperty.isEmpty()) {
if (isRac) { // if (isRac) {
nameProperty = getClassProperty(archiverDevice, "DbONSConf"); // nameProperty = getClassProperty(archiverDevice, "DbONSConf");
} else { // } else {
nameProperty = getClassProperty(archiverDevice, "DbName"); // nameProperty = getClassProperty(archiverDevice, "DbName");
} // }
if ((nameProperty != null) && !nameProperty.isEmpty()) { // if ((nameProperty != null) && !nameProperty.isEmpty()) {
System.setProperty(namePropertyName, nameProperty); // System.setProperty(namePropertyName, nameProperty);
} // }
} // }
//
String hostPropertyName = getProperty(hdb, "DB_HOST"); // String hostPropertyName = getProperty(hdb, "DB_HOST");
String hostProperty = SystemUtils.getSystemProperty(hostPropertyName); // String hostProperty = SystemUtils.getSystemProperty(hostPropertyName);
if ((hostProperty == null) || hostProperty.isEmpty()) { // if ((hostProperty == null) || hostProperty.isEmpty()) {
if (isRac) { // if (isRac) {
hostProperty = getClassProperty(archiverDevice, "DbTnsNames"); // hostProperty = getClassProperty(archiverDevice, "DbTnsNames");
} else { // } else {
hostProperty = getClassProperty(archiverDevice, "DbHost"); // hostProperty = getClassProperty(archiverDevice, "DbHost");
} // }
if ((hostProperty != null) && !hostProperty.isEmpty()) { // if ((hostProperty != null) && !hostProperty.isEmpty()) {
System.setProperty(hostPropertyName, hostProperty); // System.setProperty(hostPropertyName, hostProperty);
} // }
} // }
} // }
} // }
private static String getDeviceProperty(final String deviceName, final String propertyName) { // private static String getDeviceProperty(final String deviceName, final String propertyName) {
String value = null; // String value = null;
try { // try {
Database database = TangoDeviceHelper.getDatabase(); // Database database = TangoDeviceHelper.getDatabase();
if (database != null) { // if (database != null) {
DbDatum db_property = database.get_device_property(deviceName, propertyName); // DbDatum db_property = database.get_device_property(deviceName, propertyName);
if ((db_property != null) && !db_property.is_empty()) { // if ((db_property != null) && !db_property.is_empty()) {
value = db_property.extractString(); // value = db_property.extractString();
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
//
} // }
return value; // return value;
} // }
//
private static String getClassProperty(final String className, final String propertyName) { // private static String getClassProperty(final String className, final String propertyName) {
String value = null; // String value = null;
try { // try {
Database database = TangoDeviceHelper.getDatabase(); // Database database = TangoDeviceHelper.getDatabase();
if (database != null) { // if (database != null) {
DbDatum db_property = database.get_class_property(className, propertyName); // DbDatum db_property = database.get_class_property(className, propertyName);
if ((db_property != null) && !db_property.is_empty()) { // if ((db_property != null) && !db_property.is_empty()) {
value = db_property.extractString(); // value = db_property.extractString();
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
//
} // }
return value; // return value;
} // }
private static String getProperty(boolean hdb, final String propName) { private static String getProperty(boolean hdb, final String propName) {
String suffixe = "H"; String suffixe = "H";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment