Hi laurent,
Thx for your help…
The goal is to add code for color in the listener.
public
class RouteurConfigPart
{
public
final
static String
PROP_gribPath =
"gribPath";
public
final
static String
PROP_startTime =
"startTime";
public
final
static String
PROP_origin =
"origin";
public
final
static String
PROP_destination =
"destination";
public
final
static String
PROP_stepTime =
"stepTime";
public
final
static String
PROP_nbSecteurs =
"nbSecteurs";
public
final
static String
PROP_maxIterations =
"maxIterations";
public
final
static String
PROP_isoSearchMode =
"isoSearchMode";
public
final
static String
PROP_routingSearch =
"routingSearch";
public
final
static String
PROP_stepSearch =
"stepSearch";
public
final
static String
PROP_secteurSize =
"secteurSize";
public
final
static String
PROP_targetSize =
"targetSize";
public
final
static String
PROP_dynamicStepTimes =
"dynamicStepTimes";
public
final
static String
PROP_stepsTimes =
"StepsTimes";
public
final
static String
PROP_zones =
"Zones";
EZRouteurConfiguration
ezRouteurConfiguration =
null;
Boat
boat =
null;
VRRace
race =
null;
IsoConfiguration
isoConfiguration =
null;
RouteurGUIService
routeurService =
null;
Composite
panel =
null;
Header
header =
null;
PropertyTable
configurationTable =
null;
NatTable
natTableStepTimes =
null;
NatTable
natTableZones =
null;
public RouteurConfigPart() {
ezRouteurConfiguration = ConfigurationProvider.getInstance().getEzRouteurConfiguration();
if (ezRouteurConfiguration.getBoats().size()
> 0) {
boat =
ezRouteurConfiguration.getBoats().get(0);
if (boat.getRaces().size()
> 0) {
race =
boat.getRaces().get(0);
isoConfiguration =
race.getIsoConfiguration();
}
}
routeurService =
new RouteurGUIService();
System.out.println(this.getClass().getSimpleName()
+ " constructed");
}
@PostConstruct
public
void createControls(Composite
parent) {
panel =
new Composite(parent,
SWT.NONE);
GridLayout
layout =
new GridLayout();
layout.marginHeight
= 5;
layout.marginWidth
= 5;
panel.setLayout(layout);
GridDataFactory.fillDefaults().grab(true,
true).applyTo(panel);
Composite
gridPanel =
new Composite(panel,
SWT.FILL);
gridPanel.setLayout(layout);
GridDataFactory.fillDefaults().grab(true,
true).applyTo(gridPanel);
Composite
buttonPanel =
new Composite(panel,
SWT.NONE);
buttonPanel.setLayout(new
RowLayout());
GridDataFactory.fillDefaults().grab(true,
true).applyTo(buttonPanel);
header =
new Header(gridPanel,
SWT.NONE);
header.setTitle("Routeur
Configuration for " +
race.getName());
header.setImage(InitEZRouteur.getInstance().getRoutEzLogo48());
header.setDescription("Description
area for the header.");
header.pack();
configurationTable =
new PropertyTable(gridPanel,
SWT.NONE);
configurationTable.showButtons();
configurationTable.viewAsCategories();
configurationTable.showDescription();
double
floatValue = 0;
int
intValue = 0;
String
champ =
isoConfiguration==null?".":isoConfiguration.getGribFilename()==null?".":isoConfiguration.getGribFilename();
configurationTable.addProperty(new
PTProperty(PROP_gribPath,
"Grib path:",
"grib path (EZ grib, Zezo Grib,...",
champ).setCategory("General")).setEditor(new
PTFileEditor());
Date
date =
isoConfiguration==null?new
Date():isoConfiguration.getStartTime()==null?new
Date():isoConfiguration.getStartTime().getDate();
configurationTable.addProperty(new
PTProperty(PROP_startTime,
"Start Time:",
"Route start time",
date)).setCategory("General").setEditor(new
PTDateEditor());
champ =
isoConfiguration==null?"":isoConfiguration.getOrigin()==null?"":isoConfiguration.getOrigin().toDMS();
configurationTable.addProperty(new
PTProperty(PROP_origin,
"Route Origin:",
"Position of Route origin",
champ)).setCategory("General").setEditor(new
PTStringEditor());
champ =
isoConfiguration==null?"":isoConfiguration.getDestination()==null?"":isoConfiguration.getDestination().toDMS();
configurationTable.addProperty(new
PTProperty(PROP_destination,
"Route Destination:",
"Position of Route destination",
champ).setCategory("General")).setEditor(new
PTStringEditor());
floatValue =
isoConfiguration==null?300:isoConfiguration.getStepTime();
configurationTable.addProperty(new
PTProperty(PROP_stepTime,
"Step duration:",
"Step Duration for computing",
floatValue).setCategory("Computing")).setEditor(new
PTFloatEditor());
intValue =
isoConfiguration==null?3600:isoConfiguration.getNbSecteurs();
configurationTable.addProperty(new
PTProperty(PROP_nbSecteurs,
"Nb Secteurs:",
"Nb Secteurs for computing",
floatValue).setCategory("Computing")).setEditor(new
PTIntegerEditor());
intValue =
isoConfiguration==null?3000:isoConfiguration.getMaxIterations();
configurationTable.addProperty(new
PTProperty(PROP_maxIterations,
"Nb Itérations maximum:",
"Nb Itérations maximum",
intValue).setCategory("Computing")).setEditor(new
PTIntegerEditor());
IsoSearchMode
value =
isoConfiguration==null?IsoSearchMode.SPEED_SEARCH:isoConfiguration.getIsoSearchMode();
configurationTable.addProperty(new
PTProperty(PROP_isoSearchMode,
"Route Search mode:",
"Route Search mode",
intValue).setCategory("Computing")).setEditor(new
PTComboEditor(IsoSearchMode.SPEED_SEARCH,IsoSearchMode.TARGET_SEARCH,IsoSearchMode.MIX_SEARCH));
floatValue =
isoConfiguration==null?220:isoConfiguration.getRoutingSearch();
configurationTable.addProperty(new
PTProperty(PROP_routingSearch,
"Search Angle:",
"Search Angle for computing",
floatValue).setCategory("Computing")).setEditor(new
PTFloatEditor());
floatValue =
isoConfiguration==null?1.0:isoConfiguration.getStepSearch();
configurationTable.addProperty(new
PTProperty(PROP_stepSearch,
"Step Angle Search:",
"Step Angle Search for computing",
floatValue).setCategory("Computing")).setEditor(new
PTFloatEditor());
floatValue =
isoConfiguration==null?0.1:isoConfiguration.getSecteurSize();
configurationTable.addProperty(new
PTProperty(PROP_secteurSize,
"Secteurs Size:",
"Secteurs Size for computing",
floatValue).setCategory("Computing")).setEditor(new
PTFloatEditor());
floatValue =
isoConfiguration==null?5.0:isoConfiguration.getTargetSize();
configurationTable.addProperty(new
PTProperty(PROP_targetSize,
"Target Size:",
"Target Size for computing",
floatValue).setCategory("Computing")).setEditor(new
PTFloatEditor());
configurationTable.addChangeListener(new
PTPropertyChangeListener() {
@Override
public
void propertyHasChanged(PTProperty
property) {
switch (property.getName())
{
case
PROP_gribPath :
break;
case
PROP_startTime :
break;
case
PROP_origin :
break;
case
PROP_destination :
break;
case
PROP_stepTime :
break;
case
PROP_nbSecteurs :
break;
case
PROP_maxIterations :
break;
case
PROP_isoSearchMode :
break;
case
PROP_routingSearch :
break;
case
PROP_stepSearch :
break;
case
PROP_secteurSize :
break;
case
PROP_targetSize :
break;
case
PROP_dynamicStepTimes :
break;
case
PROP_zones :
break;
}
}
});
configurationTable.setLayoutData(new
GridData(GridData.FILL, GridData.FILL,
true,
true, 1, 2));
/************** BUTTON *************/
Button
saveButton =
new Button(buttonPanel,
SWT.PUSH);
saveButton.setText("Save
changes");
saveButton.addSelectionListener(new
SelectionAdapter() {
@Override
public
void widgetSelected(SelectionEvent
e) {
if (MessageDialog.openQuestion(parent.getShell(),
"Save changes",
"Do you really want to save configuration?"))
{
// todo
}
}
});
Button
discardButton =
new Button(buttonPanel,
SWT.PUSH);
discardButton.setText("Discard
changes");
discardButton.addSelectionListener(new
SelectionAdapter() {
@Override
public
void widgetSelected(SelectionEvent
e) {
if (MessageDialog.openQuestion(parent.getShell(),
"Discard changes",
"Do you really want to lost changes?")) {
//todo
}
}
});
}
@PreDestroy
public
void dispose() {
configurationTable.dispose();
header.dispose();
}
}
De : nebula-dev <nebula-dev-bounces@xxxxxxxxxxx> De la part de Laurent Caron
Envoyé : jeudi 12 août 2021 20:08
À : Nebula Dev
Objet : Re: [nebula-dev] (PropertyTable) How to change PTProperty color when the property changed?
This mail has been sent from an external source
|
Can you please post a snippet, I'll have a look at your problem.
Hello,
I want to change the property color of a PropertyTable when it is modified.
I am using PTPropertyChangeListener to get the new PTProperty value but i want to change th PTProperty color to show the modified property…
But i have no access to the widget / Item of the property…
What is the way for that ?
Thx for your help !
Regards
Guillaume
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
_______________________________________________
nebula-dev mailing list
nebula-dev@xxxxxxxxxxx
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/nebula-dev