Optimal way to enable user to pick style at run time - Flex

What I'm trying to do: allow a user to be able to select a color palette for a custom component by selecting from a drop down menu with a variety of icons.
I have the drop down menu part down, but I'm trying to understand how to best handle the various styles in my code. Ideally I would have liked to be able to load styles at run time, but I don't see a major advantage with this so I'm now thinking about compiling in all styles. Still, I can't seem to find a decent way to structure the code. Hacking it seems pretty easy / fast, but there's got a better way than having a big fat array of values which can be indexed via some index associated with each icon - yuck!
Would love to hear your thoughts or see any pointers to obvious ways to handle this.
thank you!

Wouldn't style sheets make this a lot easier where the user essentially just picks one?

Similar Messages

  • Getting Lync enable users who are modified after specified time

    Getting Lync enable users who are modified after specified time
    Hi,
    I need to get all the Lync enabled users from Lync 2010 server who are modified after specified time.
    I have written a client with this below code for my purpose
    string
    dateString = "11/4/2014 11:19:10 PM";
    DateTime
    lastModifiedTime = DateTime.Parse(dateString, System.Globalization.CultureInfo.InvariantCulture);
    PSCommand command = new PSCommand();
    command.AddCommand("Get-CsUser");
    command.AddParameter("Filter",
    "WhenChanged -gt " + lastModifiedTime.ToString());
    powershell.Commands
    = command;
    Collection<PSObject> outPut = powershell.Invoke();
    But on calling Invoke method I am getting the below exception,
    Cannot bind parameter 'Filter' to the target. Exception setting "Filter": "Invalid cast problem for value: "11" type: "System.Nullable`1[System.DateTime]" query: "WhenChanged -gt 11/4/2014 11:19:10 PM" "17""
    Can anyone please point me what am I doing wrong.
    This command
    Get-CsUser -filter {whenchanged -gt
    "11/4/2014 11:19:10 PM"}
    when run directly on Windows Powershell works fine.
    Thanks in advance.
    Sandeep

    It appears you may be casting the date variable wrong. 
    If you have
    command.AddParameter("Filter",
    "WhenChanged -gt 11/4/2014 11:19:10 PM"
    And avoid the lastModifiedTime.ToString() addition, does it work?
    If so, it's just the way you're doing your date manipulation.
    Also, why convert from a string to a datetype and back for the datestring?  Are you trying to correct a timezone issue?
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question please click "Mark As Answer".
    SWC Unified Communications
    This forum post is based upon my personal experience and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Changing the source of mx:Style at run time

    Is there a way to be able to change the stylesheet for an
    application at run time? Or is the only way to handle it on the
    server?

    For those who might be interested, here is a class that will
    load a xml file (that describes styles) and applies the styles
    found to your application.
    The xml file is in the format:
    <?xml version="1.0" encoding="utf-8"?>
    <dynamicStyles>
    <Application selectorType="type"
    backgroundImage="images/background.jpg"/>
    <ApplicationControlBar selectorType="type"
    highlightAlphas="0.5, 0.25"/>
    <ToggleButtonBar selectorType="type"
    highlightAlphas="0.5, .25"/>
    <viewPanel borderStyle="solid" borderThickness="1"
    borderColor="#efefef" backgroundColor="#d0d0d0"
    backgroundAlpha="0.5" color="#170505" cornerRadius="5"
    dropShadowEnabled="true"/>
    <infoPanel borderStyle="solid" borderThickness="1"
    borderColor="#7f7e7e" backgroundColor="#ffffff"
    backgroundAlpha="1.0" cornerRadius="5"
    dropShadowEnabled="false"/>
    <infoLabel fontSize="11" fontWeight="bold"/>
    </dynamicStyles>
    The AS class is the following (be sure to name the .as file
    that same as the class name and modify the "package" section yo
    include any path required by your setup.
    package
    import mx.styles.CSSStyleDeclaration;
    import mx.styles.StyleManager;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.*;
    import flash.xml.XMLNode;
    import flash.errors.IOError;
    public final class RuntimeStyle
    private var _source:String;
    public function get source():String {
    return _source;
    public function set source(value:String):void {
    if (value != _source){
    getStylesheet(value);
    _source = value;
    private function getStylesheet(value:String):void {
    var urlRequest:URLRequest = new URLRequest(value);
    var urlLoader:URLLoader = new URLLoader();
    urlLoader.addEventListener(Event.COMPLETE, completeHandler);
    urlLoader.addEventListener(IOErrorEvent.IO_ERROR,
    ioErrorHandler);
    urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    securityErrorHandler);
    urlLoader.load(urlRequest);
    private function completeHandler(event:Event):void {
    var loader:URLLoader = URLLoader(event.target);
    var xmlDoc:XML = new XML(loader.data);
    applyStyles(xmlDoc);
    private function ioErrorHandler(event:IOErrorEvent):void {
    throw new IOError("Error Attempting to load
    RuntimeStylesheet:" + source + " Original Error: " + event.text);
    private function
    securityErrorHandler(event:SecurityErrorEvent):void {
    throw new SecurityError("Error Attempting to load
    RuntimeStylesheet:" + source + " Original Error: " + event.text);
    private function applyStyles(xmlDoc:XML):void {
    var xmlList:XMLList = xmlDoc.children();
    for each(var node:XML in xmlList) {
    if (node.@selectorType == "type") {
    var cssStyle:CSSStyleDeclaration =
    StyleManager.getStyleDeclaration(node.name());
    if (cssStyle != null)
    setStyle(cssStyle, node);
    else {
    var cssStyleDeclaration:CSSStyleDeclaration = new
    CSSStyleDeclaration();
    setStyle(cssStyleDeclaration, node);
    StyleManager.setStyleDeclaration("." +
    node.name().toString(), cssStyleDeclaration, true);
    private function
    setStyle(cssStyleDeclaration:CSSStyleDeclaration, node:XML):void {
    var attributes:XMLList = node.attributes();
    for each(var attributeNode:XML in attributes) {
    var attributeName:String = attributeNode.name().toString();
    if (attributeName != "selectorType") {
    var attributeValue:String =
    node.attribute(attributeName).toString();
    if (attributeValue.indexOf(",") == -1)
    cssStyleDeclaration.setStyle(attributeName, attributeValue);
    else
    cssStyleDeclaration.setStyle(attributeName,
    attributeValue.split(","));
    }

  • Reading from a file. How to ask the user for file name at run time????

    I have the code to read from a file but my problem is how to prompt the user for the file name at run time.
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.util.InputMismatchException;
    import java.util.Scanner;
    public class FileRead {
        public static void main(String args[]) {
            Scanner scan = null;
            File file = new File("Results.txt");
            String number;
            try {
                scan = new Scanner(file);
                while (scan.hasNext()){
                number = scan.next();
                System.out.println(number);}
            catch (FileNotFoundException ex1){
                System.out.println("No such file");
            catch (IllegalStateException ex2){
                System.out.println("Did you close the read by mistake");
            catch (InputMismatchException ex){
                System.out.println("File structure incorrect");
            finally{
                scan.close();}
    }Any hints would be greatly appreciated. Thank you in advance

    I have read through some of the tutorials that you have directed me too and they are very useful, thank you. however there are still a few things that i am not clear about. I am using net beans 5.0 I have placed a text file named Results.txt into the project at the root so the program can view it.
    When I use the code that you provided me with, does it matter where the file is, or will it look through everywhere on the hard drive to find a match?
    This code compiles but at run time it comes up with this error
    run-single:
    java.lang.NoClassDefFoundError: NamedFile
    Exception in thread "main"
    Java Result: 1
    BUILD SUCCESSFUL (total time: 3 seconds)
    import java.util.Scanner;
    import java.io.*;
    class NamedFileInput
      public static void main (String[] args) throws IOException
        int num, square;   
        // this Scanner is used to read what the user enters
        Scanner user = new Scanner( System.in );
        String  fileName;
        System.out.print("File Name: ");
        fileName = user.nextLine().trim();
        File file = new File( fileName );     // create a File object
        // this Scanner is used to read from the file
        Scanner scan = new Scanner( file );     
        while( scan.hasNextInt() )   // is there more data to process?
          num = scan.nextInt();
          square = num * num ;     
          System.out.println("The square of " + num + " is " + square);
    }his is the code that i used. It is the same as the code you posted for me (on chapter 23 I/O using Scanner and PrintStream) Sorry im just really stuck on this!!

  • Is there a way to audit user accounts by last login date/time?

    Hello all,
    Is there a way to see or report on a user's last login.  I don't see a last login date parameter in the UM record.  I see that all security events are logged in the security log including logon and logoff, but what I need is to be able to produce a report that provides all user accounts which have not been logged on to since a specified date or # of days, i.e. since 01/01/2008 or >180 days.
    Any clues or guidance is appreciated.
    Regards,
    Paul

    Is there a SAP / Portal standard way of accessing this information?
    Our authorisations team have asked me to get them such a report, and I can't find anything on the portal (NW2004) that would give this information. I don't think the basis guys would be terribly chuffed to provide access directly to the database. If this (database access) is the only way, then I suppose a custom developed app could be created and deployed to the portal, but I would have thought this is a reasonalby sensible report so would be standard content somewhere.
    Cheers,
    Andrew

  • Is there any way to enable multitask gestures on iphone 4 running ios5?

    jb or not I dont care, I just want to switch between open apps somehow with one gesture or click.

    rSAP has largely been supplanted by ABAP, which the iPhone supports. Most modern smartphones, including the iPhone do NOT store any information on the SIM.
    SMS inboxes. Not much to say. I've never had a desire to do this. I understand it could be useful, but it's unlikely to change.
    As for meetings on the home screen... Wait for iOS 5
    Flash: it's not JUST that Steve doesn't like flash. Adobe has failed to produce a workable version of Flash for iOS. Blame has to go to both sides.  I say good riddance to it.

  • Apex Page Input Item Label Conditional Style at run time

    Hi,
    Apex version 4.2.1.00.08
    We have an issue after migrating to apex 4.2.1. We have a select list and use another couple of dummy items to be used as its label instead of giving the text value to the LABEL control. Only one of the dummy items is shown as a label for the select list conditionally based on another value. It was working fine with the earlier versions upto 4.1, but with the introduction of grid in 4.2, its now displaying the select list on a new row (ie the lable in one row and the select list on the next row).
    However, we really would like to solve this by having a way to display the label of the select list either in "required format style" or as an "optional style". The display style should be determined only at runtime.
    Example. Say P100_MY_SELECT_LIST is the select list
    The label for this item is "My Select List Label"
    I have another dummy item P100_DUMMY
    if P100_dummy = 1 then the label "My Select List Label" should be displayed in red and with an * *My Select List LabelOtherwise it should be in black and without * My Select List LabelPlease help how to do this.
    Thanks in advance.
    Regards,
    Natarajan

    Well, I deviated with the various other things, and finally needed to get it fixed now. I find my own solution by having a Label Template which creates an ID for every label of the input item and calling a couple of javascript functions thro dynamic action.
    1) Create a label template "FormFieldDynamic" as follows
    In the template definition "Before Label"
    <img src="#IMAGE_PREFIX#requiredicon_status2.gif" alt="Required Field Icon" /><label for="#CURRENT_ITEM_NAME#" id="#CURRENT_ITEM_NAME#_LABEL" tabindex="999" class="itemLabel">in the "after label"
    </label>Note, I am having the image for the * always with the laebl and creating an ID for the label with id="#CURRENT_ITEM_NAME#_LABEL" .
    I have created a couple of javascript function to show the label dynamically as required or optional.
    function setLabelRqd(item) {
         var v = item+'_LABEL';
         var pid = document.getElementById(v);
         if (!((pid===null)||(pid===undefined))){
              pid.style.color = "red";
              $('#'+v).prev().show();
    function setLabelOpt(item) {
         var v = item+'_LABEL';
         var pid = document.getElementById(v);
         if (!((pid===null)||(pid===undefined))){
              pid.style.color = "black";
              $('#'+v).prev().hide();
    }Use the template if the input item (label) is dynamically set as Required or Optional at runtime based on a value of another item.
    How to:
    1.     Select the template FormFieldDynamic for the input item.
    2.    Create a dynamic action triggering on the change event of the page item which holds the conditional value to set the input item label as required or as optional.
    Under the When Section
    a.     Event => Change
    b.    Selection Type => Item(s)
    c.     Item(s) => PXXX_ITEM_NAME (The item that holds the conditional value to set the label for the input item
    d.    Condition => equal to
    e.     Value => Enter the value  for which the label needs to be displayed in Required format.
    f.     Set True Action
                                                              i.    Action => Execute Javascript Code  (Identification)
                                                             ii.    Fire on Page Load => checked (Execution Option)
                                                           iii.    Code => setLabelRqd(‘PXXX_ITEM_NAME’);  (Settings)  /*Call the javascript function to set the label as required*/
                                                            iv.    Selection Type => Item(s) (Affected Elements)
                                                             v.    Item(s) => PXXX_INPUT_ITEM1[,PXXX_INPUT_ITEM2]…
    g.     Set False Action
                                                              i.    Action => Execute Javascript Code  (Identification)
                                                             ii.    Fire on Page Load => checked (Execution Option)
                                                           iii.    Code => setLabelOpt(‘PXXX_ITEM_NAME’);  (Settings) /*Call the javascript function to set the label as optional*/
                                                            iv.    Selection Type => Item(s) (Affected Elements)
                                                             v.    Item(s) => PXXX_INPUT_ITEM1[,PXXX_INPUT_ITEM2]…It finally works for me :) and hope this will be helpful to others too. I will greatly appreciate anyone to mention it here if this helps for him.
    Thanks,
    Natarajan

  • Entitlements not picked up at run time

    Hello, I have a question regarding entitlements and WLP9.2.
    I have set an entitlement on a book. The entitlement checks that the "lang" attribute in session is equal to "ja" (japanese).
    In my portal I have a changeLocal jsp, a changeLocal portlet and a backing file that actually changes the value of the "lang" session attribute:
    request.getSession().setAttribute("lang","en")When I hit the portal main page I'm presented with english content and the entitled book is not displayed on the menu (default language is "en" and the resource is entitled to appear only if locale="ja"). So far so good.
    If I switch to Japanese, the menu link still doesn't appear. I have to refresh the browser to have it on the menu or, alternatively, select one of the other menu items.
    When I switch from Japanese to English again, the entitled book remains in the menu and it only disappear when I refresh again the browser.
    It seems that the Portal rules engine does not evaluate the session property after the change locale request.
    Any idea on how to solve this problem?
    Thanks
    Luciano

    Hi
    The way we had worked around it was redirect after set and in another case an explicit button for the user to click, saying your changes have been set, now click here to continue which makes the second request.
    I suppose a filter which traps these request and set's the values before passing on control to the portal would also work.
    The reason i believe this fails till the next request is, the entitlements have to be calculated before the portlets pageflow is executed (after all you may not have access to the portlet). Im not sure if there is someway to clear the cache and force the reload.
    regards
    deepak

  • How to change the font size and style on run time

    dear all
    i try to change the font style and font size on runtime. I did the following:
    1- i created an item(:font_size) in which i will write the size of the font for the the other item ('customer_name')
    2 on the post_change trigger for 'font_size' i write this code
    SET_ITEM_PROPERTY('customer_name',FONT_size,(:font_size);
    i write 12 then then font size changed , then i write 18 , the size does not change. and when i write any value , no change happens. I do not know why
    the second problem is how to change the font style
    i made three checkbooks (bold,italic,underline)
    on the trugger when_checkbox_checked i write
         IF :BOLD = 'B' THEN
         SET_ITEM_PROPERTY('N_SAMPLE',FONT_STYLE,'BOLD');
         ELSE
    SET_ITEM_PROPERTY('N_SAMPLE',FONT_STYLE,'REGULAR');
         END IF;     
    no change happend at all.
    please help

    Hi friend,
    it's a really really strange tip... May be it's a Forms bug? I've tried with set_item_property..and.. you're right, it doesn't work..
    So.. you can try making this:
    - create a visual attribute with an specific font size....
    - use the
    SET_ITEM_INSTANCE_PROPERTY('block.item',CURRENT_RECORD,VISUAL_ATTRIBUTE,'you_visual_attribute');
    and call it from psot-change....
    It works
    Hope it helps,
    Jose.

  • User defined spoolfile name at run time.

    Hi all,
    What I want to run in SQLPlus is
    PROMPT Enter a spoolfile name
    SPOOL &SpFile
    SELECT * FROM Scott.emp
    SPOOL OFF
    When I run this as a script - i.e. @foo.sql, it works fine - i.e. it prompts the
    user for a name for the SpFile. However, when I copy and paste the text into
    SQLPlus and try and run it, it fails - it runs through the PROMPT/SPOOL bit
    of the script with the message
    apps@WHITE> SPOOL &SpFile;
    Enter value for spfile:
    not spooling currently
    apps@WHITE>
    and produces no output. If I put SPOOL '&SpFile'; it produces a file
    called ''.lst - yes two single quotes.lst.
    Can anyone explain what is going on and how I can get the
    behaviours to match in the interactive and batch modes?
    TIA.
    Paul...

    SQL> spool off
    SQL> spool &a
    Enter value for a: c:\abc.txt
    SQL> select count(*) from user_objects where
    rownum<=1;Thanks for your interest, but you have slightly misunderstood me.
    It will work fine if I have the spool &xyz in my_script.sql and then do
    SQL> @my_script
    but it does not* work if I copy and paste the contents of my_script.sql
    at the SQL> prompt - i.e. all in one go.
    This puzzles me, because it works fine if I copy and paste a multiline sql
    statement which has an & in the SELECT part of the statement. I think it's
    related to an issue I noticed recently whereby if you copy and paste an
    SQL script into the buffer which contains non-SQL (i.e. column blah format a30),
    for example, SQLPlus throws an error when you try to run what's in the
    edit buffer by typing / and return.
    This is why I started copying and pasting at the prompt in the first place,
    but this is the first time I've tried to input a "non-SQL" variable name in
    this fashion.
    This is where I'm having the issue. Hope this is clearer now.
    Paul...

  • Is it possible to add a user to a role at run-time?

    basically I need to be able to add a user to a role programmatically before the role-based content is displayed to the user.
    Example: I have a role called 'Manager' created in the portal. When a user logs on, I detect that the user has the attribute 'job title' = 'Manager' so I add the user to the 'Manager' role and the portal shows the content for the 'Manager' role.

    Hi Umesh,
    The assigning and unassigning of the users from the roles can be made dynamic using the IRole, IRoleFactory API's. The Blog below explains how users can be assigned or unassigned to a role programatically.
    Restricting usage of iViews and Pages
    Make some modifications to fit your requirement....
    Hope this helps.
    Regs,
    jaga

  • Is it possible to load a user defined mathscript function at run-time in an executable?

    I am currently allowing a customer to define their own matlab script for post-processing their data file. This is all well and good in the development environment, beecause when I re-load this VI, it searches my MathScript search paths and re-loads the .m file if it has changed. However I am noticing that when doing a build to an exe the MathScript node seems to be compiled from the file as it is at build time.
    Is there anyway to avoid this? Can I programatically call the MathScript function such that it does the search at run-time? Any ideas would be much appreciated.

    Hey,
    How are you including the .m file? Do you think you could post a screen shot of your code?
    Thanks
    Britton C.
    Applications Engineer
    National Instruments

  • Most optimized way to pick open items for customer

    Dear experts,
    I have a restriction that i can pass only companycode and documenttype in where clause of BSID select
          SELECT BUKRS KUNNR VBELN BUDAT BELNR ZFBDT   "--- zfbdt added on 15.12.2010
        FROM BSID
        INTO CORRESPONDING FIELDS OF TABLE IT_ADJUST
        WHERE
        BUKRS = P_BUKRS
        AND BLART = 'RV'.
    I cant change this query but going through response time,i need a more optimized way as an alternate to pick all open items of a customer given in a company code of RV doctype .Seeking your help dear experts.I found BAPI_AR_ACC_GETOPENITEMS but in this bapi i cant pass customer so can exploit it.
    Regards.
    Aditya Sharma.

    Take a look at the current websites that offer information
    about the sporting events you are interested in. Do any of them
    offer RSS feeds? If so, you can roll your own RSS aggregator to
    pull the information down from them to use in your application.
    Keep in mind:
    In some cases, someone had to compile this data from a number
    of different souces, which may mean the websites may have
    restrictions on how the data in their feeds can be used.
    If you are dealing with just one sport at just one level
    (collegiate, NBA, etc) you can go directly to the site of the
    overseeing body of the sport to see if you can obtain the data you
    want in electronic format.

  • Enabling users to create and add tags

    Hi guys!
    We are making a prototype for an app and are looking for a way to enable users to add and create taggs as input in the app.
    Does anyone know how to do this?
    Thanks!
    Anna

    We are making a prototype for an app and are looking for a way to enable users to add and create taggs as input in the app.
    I have no idea what you're asking.  Can you be more specific?
    Nancy O.

  • OIM 11g - User Not enabled After the job "enable user after start date"

    Hi,
    I have a future hired user in OIM whose start date is set in OIM. The status of the user in OIM is 'Disabled Until Start Date'.
    After the start date has passed and the scheduled job 'enable user after start date' is run, I see that the user is still in the status 'Disabled Until Start Date'. I re-run the scheduled job 'enable user after start date', this time manually, still the state of the user remains unchanged.
    Please help in troubleshooting as to find out the root cause of the issue and a workaround/solution, if possible.
    This issue is intermittent and has happened with quite a number of user. Any pointer would be helpful.
    Regards,
    Sudipto S.

    I agree with Nayan.
    One alternative approach can be to write your own custom scheduler which can overcome the limitation of OOTB scheduled job 'enable user after start date'. Let the OOTB job get executed first. After it, your custom scheduler should fire a simple SQL Query:
    SELECT USR_KEY, USR_STATUS FROM USR WHERE (USR_START_DATE > SYSDATE -1) AND USR_STATUS='Disabled Until Start Date';
    //Means those users who are supposed to get enabled today and are still not yet enabled and are in 'Disabled Until Start Date'. May be 2-3 user keys at max will come...
    As you said it happens only intermittently and not for all users... So, let the OOTB scheduled job take care of most of such users... And after it has finished, if any user still remains in 'Disabled Until Start Date', your custom scheduler should enable it via using tcUserOperationsIntf.enableUser(userKey);
    Using API is always better than database update... Because APIs trigger downstream provisioning workflows as well and not just updates OIM Database...
    Keeping your constraints in mind, I think it is the correct answer.

Maybe you are looking for

  • Video freezes after a few seconds

    This is actually a continuation of a post I made almost a year and a half ago, trying to get video chat going so my mom can visit with her grandkids. The thread has been archived, so I can't post there but in case it helps here's the address: http://

  • TS1398 iTunes , cannot connect to server. At both, my fathers and at my place, with both, his iPad1 and my iPad 3

    Started out with "Text Plus" triple charging me. Gave up on them.  iTunes sent me an email with the receipt of all 3 charges with "report a problem"  under each purchase. I clicked on it and that's when I had on my screen "cannot connect to server".

  • Semi colon madness

    At the end of my quiz, the email opens up fine and the information is there, but there is a semi-colon added to the end of my email address for some reason. This brings up a syntax error message from the email program. My quiz is going to go out to a

  • I am trying to monitor activity on an IEEE 488 bus with a NI9914.

    I am attempting to do this using ISR2, and trigerring on ATNI. After set-up, I release the swrst in the acr - and the bus locks up. All I want to do is snoop the bus - I don't want to actively communicate. Does anyone know how to do this?? Thanx,Ben

  • No sound from shockwave files

    I am running OS 10.4.9 on a G5 iMac. Recently I discovered that Shockwave files will not play sound. I upgraded to Quicktme7.1.6 and have a hunch (from what I've read here) that it may be the culprit. I installed the Flash Player 9 upgrade. Still no