package gui.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import com.cloudgarden.resource.SWTResourceManager;
/**
* Esta clase implementa el di�logo para la configuraci�n
* de componentes (por ejemplo, propiedades de un robot).
*/
public class AdminComponentsGUI extends Dialog
{
private Shell dialogShell;
private CLabel titulo;
private Composite composite2;
private Label label2;
private TableColumn tableColumn4;
private TableColumn tableColumn3;
private TableColumn tableColumn2;
private TableColumn tableColumn1;
private Table listado;
private Composite composite1;
private ToolItem calibrarRobot;
private ToolItem configRobot;
private ToolItem copyRobot;
private ToolItem remRobot;
private CTabItem cTabItem1;
private ToolItem toolItem1;
private ToolBar toolBarRobot;
private Composite barraRobots;
private CTabItem cTabItem7;
private CTabItem cTabItem6;
private CTabItem cTabItem5;
private CTabItem cTabItem4;
private CTabItem cTabItem3;
private CTabItem cTabItem2;
private CTabFolder cTabFolder2;
private CTabItem globalPositioner;
private CTabItem features;
private CTabItem neuralNetworks;
private CTabItem conectors;
private CTabFolder cTabFolder1;
private Label label1;
private Composite back;
public AdminComponentsGUI(Shell parent, int style)
{
super(parent, style);
}
public void open()
{
try
{
Shell parent = getParent();
dialogShell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
{
//Register as a resource user - SWTResourceManager will
//handle the obtaining and disposing of resources
SWTResourceManager.registerResourceUser(dialogShell);
}
GridLayout dialogShellLayout = new GridLayout();
dialogShell.setLayout(dialogShellLayout);
dialogShellLayout.horizontalSpacing = 0;
dialogShellLayout.marginHeight = 0;
dialogShellLayout.marginWidth = 0;
dialogShellLayout.verticalSpacing = 0;
{
back = new Composite(dialogShell, SWT.NONE);
GridLayout backLayout = new GridLayout();
backLayout.makeColumnsEqualWidth = true;
backLayout.horizontalSpacing = 0;
backLayout.marginHeight = 0;
backLayout.marginWidth = 0;
backLayout.verticalSpacing = 0;
GridData backLData = new GridData();
backLData.grabExcessHorizontalSpace = true;
backLData.horizontalAlignment = GridData.FILL;
backLData.verticalAlignment = GridData.FILL;
back.setLayoutData(backLData);
back.setLayout(backLayout);
{
titulo = new CLabel(back, SWT.NONE);
titulo.setText("Adminstraci�n de Componentes");
titulo.setImage(SWTResourceManager.getImage("resources/icons/icon32x32/enable/Toolbar_�Customize.png"));
titulo.setFont(SWTResourceManager.getFont("Tahoma", 8, 1, false, false));
}
{
label1 = new Label(back, SWT.SEPARATOR | SWT.HORIZONTAL);
GridData label1LData = new GridData();
label1LData.horizontalAlignment = GridData.FILL;
label1LData.grabExcessHorizontalSpace = true;
label1.setLayoutData(label1LData);
label1.setText("label1"); // TODO: "label1" ??????
}
{
cTabFolder1 = new CTabFolder(back, SWT.NONE);
{
cTabItem1 = new CTabItem(cTabFolder1, SWT.NONE);
cTabItem1.setText("Robots");
{
composite1 = new Composite(cTabFolder1, SWT.NONE);
GridLayout composite1Layout = new GridLayout();
composite1Layout.makeColumnsEqualWidth = true;
composite1Layout.horizontalSpacing = 2;
composite1Layout.marginHeight = 2;
composite1Layout.marginWidth = 0;
composite1Layout.verticalSpacing = 0;
composite1Layout.marginLeft = 3;
composite1Layout.marginRight = 3;
composite1.setLayout(composite1Layout);
cTabItem1.setControl(composite1);
{
barraRobots = new Composite(
composite1,
SWT.NONE);
RowLayout barraRobotsLayout = new RowLayout(
org.eclipse.swt.SWT.HORIZONTAL);
barraRobots.setLayout(barraRobotsLayout);
GridData barraRobotsLData = new GridData();
barraRobots.setLayoutData(barraRobotsLData);
{
toolBarRobot = new ToolBar(
barraRobots,
SWT.FLAT);
RowData toolBarRobotLData = new RowData();
toolBarRobot
.setLayoutData(toolBarRobotLData);
{
toolItem1 = new ToolItem(
toolBarRobot,
SWT.NONE);
toolItem1.setToolTipText("Agregar");
toolItem1
.setImage(SWTResourceManager
.getImage("iconos/24x24/AIBO210-add.png"));
}
{
remRobot = new ToolItem(
toolBarRobot,
SWT.NONE);
remRobot
.setImage(SWTResourceManager
.getImage("iconos/24x24/AIBO210-rem.png"));
}
{
copyRobot = new ToolItem(
toolBarRobot,
SWT.NONE);
copyRobot
.setImage(SWTResourceManager
.getImage("iconos/24x24/AIBO210-copy.png"));
}
{
configRobot = new ToolItem(
toolBarRobot,
SWT.NONE);
configRobot
.setToolTipText("Propiedades");
configRobot
.setImage(SWTResourceManager
.getImage("iconos/24x24/Toolbar-_�Applications.png"));
}
{
calibrarRobot = new ToolItem(
toolBarRobot,
SWT.NONE);
calibrarRobot
.setImage(SWTResourceManager
.getImage("iconos/24x24/System-ColorSync.png"));
}
}
}
{
label2 = new Label(composite1, SWT.SEPARATOR
| SWT.HORIZONTAL);
GridData label2LData = new GridData();
label2LData.grabExcessHorizontalSpace = true;
label2LData.horizontalAlignment = GridData.FILL;
label2.setLayoutData(label2LData);
label2.setText("label2"); // TODO: "label2" ???
}
{
GridData listadoLData = new GridData();
listadoLData.grabExcessHorizontalSpace = true;
listadoLData.horizontalAlignment = GridData.CENTER;
listadoLData.heightHint = 89;
listadoLData.widthHint = 592;
listadoLData.verticalIndent = 3;
listado = new Table(composite1, SWT.MULTI
| SWT.CHECK
| SWT.FULL_SELECTION);
listado.setLayoutData(listadoLData);
listado.setHeaderVisible(true);
listado.setItemCount(5);
listado.setLinesVisible(true);
{
tableColumn4 = new TableColumn(
listado,
SWT.CENTER);
tableColumn4.setWidth(29);
}
{
tableColumn1 = new TableColumn(
listado,
SWT.NONE);
tableColumn1.setText("Nombre");
tableColumn1.setWidth(287);
}
{
tableColumn2 = new TableColumn(
listado,
SWT.CENTER);
tableColumn2.setText("Ruta del JAR");
tableColumn2.setWidth(206);
}
{
tableColumn3 = new TableColumn(
listado,
SWT.NONE);
tableColumn3.setText("Comentario");
tableColumn3.setWidth(72);
}
}
}
}
{
neuralNetworks = new CTabItem(cTabFolder1, SWT.NONE);
neuralNetworks.setText("Redes Neuronales");
}
{
features = new CTabItem(cTabFolder1, SWT.NONE);
features.setText("Features");
{
cTabFolder2 = new CTabFolder(cTabFolder1, SWT.NONE);
features.setControl(cTabFolder2);
{
cTabItem2 = new CTabItem(cTabFolder2, SWT.NONE);
cTabItem2.setText("Sensores");
{
composite2 = new Composite(
cTabFolder2,
SWT.NONE);
GridLayout composite2Layout = new GridLayout();
composite2Layout.makeColumnsEqualWidth = true;
composite2.setLayout(composite2Layout);
cTabItem2.setControl(composite2);
}
}
{
cTabItem3 = new CTabItem(cTabFolder2, SWT.NONE);
cTabItem3.setText("Camaras");
}
{
cTabItem4 = new CTabItem(cTabFolder2, SWT.NONE);
cTabItem4.setText("Motores");
}
{
cTabItem5 = new CTabItem(cTabFolder2, SWT.NONE);
cTabItem5.setText("Leds");
}
{
cTabItem6 = new CTabItem(cTabFolder2, SWT.NONE);
cTabItem6.setText("Displays");
}
{
cTabItem7 = new CTabItem(cTabFolder2, SWT.NONE);
cTabItem7.setText("Miscelaneos");
}
cTabFolder2.setSelection(0);
}
}
{
globalPositioner = new CTabItem(cTabFolder1, SWT.NONE);
globalPositioner.setText("Posicionamiento GLobal");
}
{
conectors = new CTabItem(cTabFolder1, SWT.NONE);
conectors.setText("Conectores");
}
GridData cTabFolder1LData = new GridData();
cTabFolder1LData.grabExcessHorizontalSpace = true;
cTabFolder1LData.horizontalAlignment = GridData.FILL;
cTabFolder1LData.verticalAlignment = GridData.FILL;
cTabFolder1LData.verticalIndent = 3;
cTabFolder1.setLayoutData(cTabFolder1LData);
cTabFolder1.setSelection(0);
}
}
dialogShell.layout();
dialogShell.pack();
dialogShell.setSize(631, 250);
dialogShell.open();
Display display = dialogShell.getDisplay();
while (!dialogShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
catch (Exception e)
{
// TODO: qu� hacer??
}
}
}