Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [nebula-dev] (PropertyTable) How to change PTProperty color when the property changed?
  • From: "Helle, Guillaume" <guillaume.helle@xxxxxxxxxxxxx>
  • Date: Thu, 12 Aug 2021 20:33:03 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=capgemini.com; dmarc=pass action=none header.from=capgemini.com; dkim=pass header.d=capgemini.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0pbJHLZhuNwpEj/ARzhCWW9N3ZWz3OI1YEqnXOXxqMA=; b=ZyRl6AOSfkvu9+K/VesipeKxqp07D0yKbzQPrkAtg0UwJT8T3q08iytRpT2RFYN/JEcCmNhnP9QVBvyZbu2Ag8VnhN5NBkTnkhgUXGKTyW+bErDUfJXygJdAiGkRbBqOaiRdAyd8vWagjOx2akEjY+kqEHczCunjhntTVkiXzpdkrSuUgQpGdHcoYNZhBNT5s5rVhr85mM/KCeRW0ldYBiq6oLS6CJY78CzAjnQDv6bTNhsWH+YNxOw41N5IE/Vr6wKj1WIEnLqepQrFdsoavho8V2f0MOHOXDZjVDwmaqWl8yCBvdUiBY1V+yTyU54oTjAS9a0huU7XksEYnyjMEw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pyn6jI7dc0uKlHJaRjlUwKzp+Gcy2dMPjQerD6cB7HXREYDNQJ3L6h7wR8z+YIU8sMuYqo39eyWS8C6mduj5XI9PgmliC3vAZUquhVAIe1bG6Q8moCeQtPtTbzmjnbul8eie9VUNeIgBxMfkRCskrEITvwHn/pPB72SEEQKUAL12uUTSlEv2tIPGrx/eW1abuAK4Lh0WH8Ga1WKuxeAV8E2NLS5CKpkfrJAFR4UZ88EdAUMTWmw/TMzbd0ngrLCDsSyy3lXcjaXTA0Nv/naN8KTe/0powmR/1jZ26Hks1a0RAJDJ2GOKrsQYkWnI8wmAicAYmOWyW1tOAPyMJK/asQ==
  • Delivered-to: nebula-dev@xxxxxxxxxxx
  • Ironport-sdr: LostUh20qbbCvKlXvOPc7CMpdE1Z2p2OLFaDVBbSr+tRbMMeo1gvIFC7TMuBqdWn2st61jveDk mUOVrGnlf0yw==
  • List-archive: <https://www.eclipse.org/mailman/private/nebula-dev/>
  • List-help: <mailto:nebula-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/nebula-dev>, <mailto:nebula-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/nebula-dev>, <mailto:nebula-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AdePoFHl739w0eV1QniAg8PeQiuG3QABLpyAAAT0VnA=
  • Thread-topic: [nebula-dev] (PropertyTable) How to change PTProperty color when the property changed?

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

 

Hi Guillaume

 

Can you please post a snippet, I'll have a look at your problem.

 

Regards

 

Laurent

 

Le jeu. 12 août 2021 à 19:39, Helle, Guillaume via nebula-dev <nebula-dev@xxxxxxxxxxx> a écrit :

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


Back to the top