Changing data in a stylesheet after an event happens?

Hello all,
sorry if my title doesn't make too much sense, but basically I have a slider that I want to change colors based on which major tick it is on.
I figure I could make 5 different css files, but that seems a bit much. 
I also thought about changing the style inline, but I have to set 3 labels, as well as all of the parts of my slider, so I think that would be annoying to have to do that within the listener I already have setu.
It would be nice if in the stylesheets we could conditional styles.
i.e.,
if(i == 1)
.text
-fx-fill: red;
If anyone has any better ideas I would appreciate it, or else I'll have to go with the 5 stylesheets(lame but w/e ).
Thanks as always,
~KZ

node.lookupAll(...) gives a list of nodes at or below node in the scene graph which match the provided css selector. I always feel it lacks some robustness: first there's the string binding for the selector, relying on the class or id having been set, and second it won't give the correct results until the scene has been rendered. This use case is perfect for it, though.
A style sheet is an external file (or other resource, potentially) containing style information, typically in css.
A style class is applied to a node in order to select it in css. In JavaFX, all controls automatically get a style class which is the "css-ized" version of the Java class name (Label gets label, TextField gets text-field, etc).
So in a style sheet, the rule
.text {
     -fx-fill: red ;
is applied to all nodes with style class "text" (which will include all instances of Text, by default).
This works fine for me:
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Slider;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class StyleSlider extends Application {
    @Override
    public void start(Stage primaryStage) {
        final VBox root = new VBox(5);
        root.setPadding(new Insets(10));
        final Label label1 = new Label("Label 1");
        final Label label2 = new Label("Label 2");
        label1.getStyleClass().add("stylable-by-slider");
        label2.getStyleClass().add("stylable-by-slider");
        final Slider slider = new Slider();
        slider.setMax(5);
        final String[] colors = new String[] { "red", "orange", "yellow",
                "green", "blue", "purple" };
        slider.valueProperty().addListener(new ChangeListener<Number>() {
            @Override
            public void changed(ObservableValue<? extends Number> obs, Number oldValue, Number newValue) {
                for (Node node : root.lookupAll(".stylable-by-slider")) {
                    node.setStyle("-fx-text-fill: " + colors[newValue.intValue()] + ";");
        root.getChildren().addAll(label1, label2, slider);
        final Scene scene = new Scene(root, 300, 200);
        primaryStage.setScene(scene);
        primaryStage.show();
    public static void main(String[] args) {
        launch(args);
Another approach is to define all the styles in your stylesheet, and manipulate the style classes in the listener:
        label1.getStyleClass().add("slider-style0");
     label2.getStyleClass().add("slider-style0");
        slider.valueProperty().addListener(new ChangeListener<Number>() {
            @Override
            public void changed(ObservableValue<? extends Number> obs, Number oldValue, Number newValue) {
                for (Node node : root.lookupAll(".slider-style"+oldValue.intValue())) {
                    node.getStyleClass().remove("slider-style"+oldValue.intValue());
                    node.getStyleClass().add("slider-style"+newValue.intValue());
and then in your external css do
.text.slider-style0 {
     -fx-fill: red ;
.text.slider-style1 {
     -fx-fill: orange ;
/* etc */

Similar Messages

  • Using + and - keys to change dates and times; Find and Replace event

    Hi all, \
    I have two iCal related questions. One has been bugging me since the Snow Leopard upgrade and the other I'm just wondering about.
    1. Is it just me or is it no longer possible to use the + and - keys to increment dates and times when editing an event? It seems that now I have to actually type in the numerals instead. Is there something in the preferences I'm missing or is that just the way it is now? Seems like a step backward, if so.
    2. Is there a way to do a "find and replace" for an event that occurs sporadically throughout the year, but isn't a repeating event per se? I just want to rename the event itself.

    Don,
    ...is it no longer possible to use the + and - keys to increment dates and times when editing an event?
    I did not know that was possible. Try using the ↑/↓ arrow keys to increment numbers, and →/← arrow keys to change fields.
    Is there a way to do a "find and replace" for an event that occurs sporadically throughout the year, but isn't a repeating event per se?
    AFAIK, you have to use the search field to find the individual events, and change them when you click on the events in the search results field.
    ;~)

  • How can i change an existing JPanel from a JFrame after an event happens?

    Good day!
    i'm new in java programing and im trying to build a GUI for a for a small inventory system.
    here's a part of my code............
    if(e.getSource()==invButton){
                   if(username.equals(storekeeper)){
                        cont.add(new Equipment(cont,deck,username),"equipment");
                        deck.show(cont,"equipment");
                        cont.remove(this);
                   }else{
                        cont.add(new EquipmentEmployee(cont,deck,username),"equipmentEmployee");
                        deck.show(cont,"equipmentEmployee");
                        cont.remove(this);
    my code calls a new class called Equipment.java after a button is pressed and add it into a frame.
    but the problem is nothings happened. my code didn't work.
    can anyone help me fix my problem?..
    thanx!!...

    my code calls a new class called Equipment.java after a button is pressed and add it into a frame.
    but the problem is nothings happened. my code didn't work.Did you add the action listener to your button? Like below:
    invButton.addActionListener(this);

  • I can not map field after changing data source location

    Hi
    I have a small problem that I got a report file and database from my customer, after that I setup database, open the file and change data source to my setting. but some filed can not map. The field mapping widonw does not display all field in the table. Of course I have checked the missing fields are existing in the table.
    OS:Windows7
    DB:Oracle11
    CR:XI Release 2
    Does anyone have an idea?

    hi,
    In Map Fields window, there is an option "Match Type".
    Please Unchek that option, so that you will be able to see all the fields from that table.
    Also, while mapping please verify the datatypes of source and target fields.
    Regards,
    Vamsee

  • My ibook keeps shutting down completely with the date to reverting back to 1969.  i restart only after i plug in charger it lets me, then change date and save.  the next time i use same thing happens, safari, iphoto, email are the only ones i have used.

    my ibook keeps shutting down completely with the date to reverting back to 1969.  i restart only after i plug in charger it lets me, then change date and save.  the next time i use same thing happens, safari, iphoto, email are the only ones i have used.
    please help!  i am at a loss here.
    thank you, movie lady
    ibook g4

    The iBook does not have a backup (PRAM) battery. It only has the main battery and a small capacitor which maintains the settings long enough to do a battery swap. If the battery is dead, what you are seeing can happen.
    If the battery is not a problem (or even if it is), you could try resetting the PMU and see if that helps.

  • How do i change date in iphoto on an event?

    how do i change date in iphoto on an event?

    Change the dates on the photos. Then, to force iPhoto to revise the ctalogue, flag the photos and go: Events: New Event from Flagged Photos.
    Regards
    TD

  • Can I change dates underneath events?

    I am brand new to iphoto and have a question. There is a date, and sometimes a range of dates, that show up underneath each event when the mouse is placed over the event or the event is active. For some of my events, this date is accurate. For others, however, it is very inaccurate (for example, it will show a range of many years for the photos in the event that were all shot on the same day). It probably has something to do with settings on my digital cameras....anyway, is it possible to alter these dates?
    I tried going in to Photos>Adjust Date and Time and made adjustments that way to all selected photos in the event, but to no avail...the dates underneath the event folder still display the original and inaccurate date information.
    Any ideas would be greatly appreciated.
    Thanks!

    It probably is best to go to the Apple download page and download it - sometimes software update outsmarts its self
    http://www.apple.com/downloads/macosx/apple/application_updates/iphoto715.html
    and
    http://www.apple.com/downloads/macosx/apple/application_updates/ilifesupport831. html
    and
    http://www.apple.com/downloads/macosx/apple/application_updates/compatibilityupd ateforquicktime.html
    LN

  • Last changed date different between two systems after transport

    Hi, first of all, I am not from basis background and just want to make sure whether is this something correct or not.
    I found that the "Last changed date" and "username" are not same between the original system and the target system. Is this something configurable?
    And the "username" field is totally empty. However, the program code's version is identical in both systems.

    I think I misunderstood your question.  You are referring to the system Transports not the connections between systems.  If the Transports are not transferring all the contents, you really should talk to your basis folks and tell them which items are not being reproduced correctly.
    Regards,
    Mike

  • Editable ALV, how to capture changed data

    Hi All,
    I have created an editable ALV. User can make some changes in the displayed record and press "Submit" button (custom button on application toolbar), the program should validate the data and write the file on application server if validations are successful otherwise controls stay on the same screen.
    I am handling this validation and writing file part in PAI of the screen.
    Problem: The program is capturing the data when user changes it for the first, but program is failing to capture the subsequent changes (user makes after the validation fails). Program processes always the first time changed data only. Please help me in getting this problem resolved.
    Step1 : Program shows output.
    Step2: User changes Company Code.
    Step3: User clicks on Submit Button.
    Step3.1: Program reads the new data and performs validation.
    Step3.2: New Company code is not valid, error displayed.
    Step4: User changes the company code again, presses submit button.
    Goto step 3.1 -> Here program does not read the new data, rather first time changes company code is again read and validated, and program shows the same error again, which is not a desired result

    Hi Ashish,
    you need a method HANDLE_DATA_CHANGED as handler for grid event DATA_CHANGED.
    Use
    LOOP AT er_data_changed->mt_mod_cells ASSIGNING <mod>.
    to check all changed data. In this event, add the error messages to ER_DATA_CHANGED object.
    set all required handlers, i.e.
    SET HANDLER:
          handle_data_changed          FOR ro_grid,
          handle_data_changed_finished FOR ro_grid,
          handle_toolbar_set           FOR ro_grid,
          handle_user_command          FOR ro_grid,
          handle_hotspot_click         FOR ro_grid,
          handle_f4                    FOR ro_grid,
          handle_f1                    FOR ro_grid.
       ro_grid->set_toolbar_interactive( ).
    Register ENTER and MODIFIED events.
        ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_enter ).
        ro_grid->register_edit_event( cl_gui_alv_grid=>mc_evt_modified ).
    Regards,
    Clemens

  • Batch Change Dates in Aperture

    I want to batch change hundreds of images in 1 event (or project) in Aperture 3 to be timed apart by the time designation I set forth on the batch process. I have easily done this in iPhoto 8 by selecting all the photos, ctrl-clicking "batch change" and changing the date to be set for a given time, and adding 1 minute to each photo.
    I'm building a book by interleaving 2 events of scanned images by their times. It works great in iPhoto, but I can't process the images like I can in Aperture.
    If anyone knows how to batch change dates as in the above procedure, let me know. Thanks.

    I've been using ABFR and ABFA from http://www.publicspace.net/index.html to change thousands of images in the Finder that had incorrect time/date stamps and used ABFR to pre-fix the file names with the correct date stamp. You can also setup a batch droplet based on your settings.
    It was able to grab the camera date, even though the created/modified dates were wrong and correct things.
    May or may not be what you are after, but for batch renaming/adjusting attributes I haven't found anything better.

  • Change data capture - ignore delete?

    Hello,
    I'm trying to solve an issue I met on a synchronous change data capture : I created a CDC table with the DBMS_LOGMNR_CDC_PUBLISH.CREATE_CHANGE_TABLE procedure:
    BEGIN
       DBMS_LOGMNR_CDC_PUBLISH.CREATE_CHANGE_TABLE (
          OWNER             => 'APPO',
          CHANGE_TABLE_NAME => 'CT_TEMP_H1',
          CHANGE_SET_NAME   => 'SYNC_SET',
          SOURCE_SCHEMA     => 'APPO',
          SOURCE_TABLE      => 'TEMP_H1',
          COLUMN_TYPE_LIST  => 'ISSUE VARCHAR2(10), TITOLO VARCHAR2(150)',
          CAPTURE_VALUES    => 'BOTH',
          RS_ID             => 'Y',
          ROW_ID            => 'N',
          USER_ID           => 'N',
          TIMESTAMP         => 'N',
          OBJECT_ID         => 'N',
          SOURCE_COLMAP     => 'Y',
          TARGET_COLMAP     => 'Y',
          OPTIONS_STRING    => NULL)
    END;
    Now, it works correctly, and in the CT_TEMP_H1 table I can find all the information about changes that occourr in the TEMP_H1 table
    What I'd like to know is if there is a way to avoid the capture "trigger" to fire in the event of DELETE records: due to the application business logic, I'm interested just in insert and updates on the source table, and I don't mind about delete(s), so I don't want them to consume resources (both disk space and CPU) on the server.
    Is there a supported way to do so?
    Thanks in advance,
    - Paolo

    Thanks for your answer, Damorgan,
    But the CAPTURE_VALUES parameter only manages the UPDATE issues, to have one row containing the row values before the update occurred and another row containing the row values after the update occurred.
    What I'm interested in is aviod logging in the change table all the delete operations occourring in the source tables (a sort of "afert indert or update" trigger, instead of the "insert, update or delete"...)
    Any hint?
    - Paolo

  • Change Data Provider Based on ComboBox Selection

    Complete noob using Flash CS5 for Macs. I have a ComboBox component and a TileList. I want the ComboBox selection to change the data provider for the TileList. I've used a sample script from the Adobe website at the bottom, but it is not working in this context. Google returns no better examples. Can anyone point me in the right direction?
    import fl.controls.ComboBox;
    import fl.data.DataProvider;
    import flash.display.DisplayObject;
    import flash.display.MovieClip;
    import fl.events.DataChangeEvent;
    // Combo Box ("aCb")
    var aCb:ComboBox = aCb;
    var Choices:Array = new Array(
        {label:"Artist Resin", data: "resin"},
        {label:"Ceramic", data: "ceramic"}
    aCb.dataProvider = new DataProvider(Choices);
    // TileList ("aTl")
    aTl.columnWidth = 110;
    aTl.rowHeight = 130;
    aTl.setSize(110,150);
    aTl.move(20, 150);
    aTl.setStyle("contentPadding", 5);
    // TileList Content
    var i:uint = 0;
    var resinitems:Array = [
    {label: "Image 1", source: "http://www.helpexamples.com/images/montreal/images/IMG_5057.jpg"},
    {label: "Image 2", source: "http://www.helpexamples.com/flash/images/gallery2/images/IMG_1592.jpg"}];
    var resin:DataProvider = new DataProvider();
    for(i=0; i < resinitems.length; i++) {}
    var ceramicitems:Array = [
    {label: "Image 3", source: "http://www.helpexamples.com/flash/images/gallery1/images/pic11.jpg"},
    {label: "Image 4", source: "http://www.helpexamples.com/flash/images/gallery1/images/pic14.jpg"},];
    var ceramic:DataProvider = new DataProvider();
    for(i=0; i < ceramicitems.length; i++) {}
    addChild(aCb);
    addChild(aTl); 
    // Code to Change Data Provider for Tile List
    aCb.addEventListener(Event.CHANGE, changedataProvider);
    function changedataProvider(event:Event):void {
        aTl.dataProvider = event.target.selectedItem.data;

    Thanks for your answers.
    I have already checked those links.
    Now th problem what I am facing is,
    I am not able to call the function ChangeLanguage through javascript.
    I have created a dropdwon using Hovermenu and added English and German.
    Now when I click on these the function should be called.
    Please help me in getting how setClientSideScript() can be used to call a function.
    or any other way to call the function after clicking on Hovermenu Item.
    Thanks in advance,
    Sumangala

  • Changing Date and Time

    I have selected both photos and event separately in several attempts to change date and time in Photos/Adjust Date and Time without success. Each time I have attempted to do so another date and time has replaced the previous one but each has been incorrect. Some dates have been inserted dating back several centuries!! The time as well as the date has been incorrect.
    I would appreciate suggestions and help in making the change correct.
    Thanks.
    Vernon

    I also have this problem. One folder in particular is affected; within it after a few times to get it into the 2000's from 1900's, it is currently showing 1539.
    I am at a loss since the batch change roller lets me select the correct year in iphoto.
    I thought it might be a glitch in the older software so upgraded to the '11 iphoto. This made no difference at all.
    This is still an issue unless the original poster got an answer or worked it out him/her self.
    I also use Picasa on the same system but since it gets the photos from iphoto, it gets its errors there too.

  • Editable ALV -- OO -- Changed data capture

    Hi,
    I'm using an editable ALV to display the output. Output has a field for the user to enter comments. When the user enters the comments and presses "ENTER" key or clicks somewhere else on the ALV itself, the event DATA_CHANGED or DATA_CHANGED_FINISHED gets triggered and I'm able to capture the changed data and update the DB table.(I have a "SAVE" button on the menu bar which when pressed will update the ALV values into DB table.)
    However, I need to capture this changed data even if the user does not press the "ENTER" key or clicks somewhere else on the ALV, but just presses the "SAVE" button.  Please let me know if there is any way to do this.
    Thanks,
    Raj.

    Hi,
    in your program check the user-command if 'SAVE' then write the following code in it
    "Call the method check_changed_data to update the  internal table with changed data.
    DATA: lv_valid TYPE xfeld,
                lv_refresh TYPE xfeld.
          CALL METHOD gv_alv_grid->check_changed_data
            IMPORTING
              e_valid   = lv_valid
            CHANGING
              c_refresh = lv_refresh.
    " to refresh alv
    CALL METHOD gv_alv_grid->refresh_table_display
            EXCEPTIONS
              finished = 1
              OTHERS   = 2.
    by this way it the internal table will get the changed data and then you can update it in the DB and also after updating show the ALV since it is refreshed it will now show the changed data.
    Hope it helps you,
    Regards,
    Abhijit G. Borkar

  • Popularity trend/usage report is not working in sp2013. Data was not being processed to EVENT STORE folder which was present under the Analytics_GUID folder.

    Hi
     I am working in a sharepoint migration project. We have migrated one SharePoint project from moss2007 to sp2013. Issue is when we are clicking on Popularity trend > usage report,  it is throwing an error.
    Issue: The data was not being processed to EVENT STORE folder which was present under the
    Analytics_GUID folder. Also data was not present in the Analytical Store database.
    In log viewer I have found the bellow error.
    HIGH -
    SearchServiceApplicationProxy::GetAnalyticsEventTypeDefinitions--Error occured: System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly
    secured fault was received from the other party.
    UNEXPECTED - System.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail,
    System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]: We're sorry, we weren't able to complete the operation, please try again in a few minutes.
    HIGH - Getting Error Message for Exception System.Web.HttpUnhandledException
    (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party.
    CRITICAL - A failure was reported when trying to invoke a service application:
    EndpointFailure Process Name: w3wp Process ID: 13960 AppDomain Name: /LM/W3SVC/767692721/ROOT-1-130480636828071139 AppDomain ID: 2 Service Application Uri: urn:schemas-microsoft-
    UNEXPECTED - Could not retrieve analytics event definitions for
    https://XXX System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: We're sorry, we weren't able to complete the operation, please try again in a few minutes.
    UNEXPECTED - System.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail,
    System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]: We're sorry, we weren't able to complete the operation, please try again in a few minutes.
    I have verified few things in server which are mentioned below
    Two timer jobs (Microsoft SharePoint Foundation Usage Data Processing, Microsoft SharePoint Foundation Usage Data Import) are running fine.
    APPFabric Caching service has been started.
    Analytics_GUID folder has been
    shared with
    WSS_ADMIN_WPG and WSS_WPG and Read/Write access was granted
    .usage files are getting created and also the temporary(.tmp) file has been created.
    uasage  logging database for uasage data being transported. The data is available.
    Please provide pointers on what needs to be done.

    Hi Nabhendu,
    According to your description, my understanding is that you could not use popularity trend after you migrated SharePoint 2007 to SharePoint 2013.
    In SharePoint 2013, the analytics functionality is a part of the search component. There is an article for troubleshooting SharePoint 2013 Web Analytics, please take a look at:
    Troubleshooting SharePoint 2013 Web Analytics
    http://blog.fpweb.net/troubleshooting-sharepoint-2013-web-analytics/#.U8NyA_kabp4
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

Maybe you are looking for

  • Conditions not appearing in the display mode of Purchase order

    Hi, We are facing an issue where in the display mode of Purchase order,if I click on the conditions tab in the item details, Iam getting a blank screen. But if I trigger the pricing procedure  in the change mode for eg. by changing the quantity or pr

  • Problem in formatting with XSLT

    Hi - I am using xslt to format my xml file. Below is teh code that i worte. The structure and teh xslt file are both shown below. The airport has an attribute called name. The problem is while displaying the text in the record element, I should also

  • Join multiple output tables of BAPI into new table

    Hi, In my model (VC 7.0), I have a BAPI which outputs two different tables. Tables have many multiple records. Each table has several fields and a common field also. I want to combine these tables into one table form. I used the following methods and

  • Photoshop will not open after installing window's 7 updates

    I'm in a bit of a dilema, any help is appreciated. My Windows 7 has updates. When it does this, Photoshop will not run. I have reverted the PC back before the update and Photoshop runs fine. The only thing is that the PC will update itself unless I t

  • Object model for development in SP 2013

    any good article on Server side object model vs Client Side object model vs REST vs Apps model? I mean in which situation to use which one?