Article Discussion
Integrating Flex with a Java EE Application, Part II
Summary: The second part of a two-part series on progressively enhancing an enterprise Web application with Flex, this article describes Flex's ability to interact with a variety of server-side data sources, including fetching JSON and XML via HTTP, and invoking server-side Java objects from a Flex client.
1 post.
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: February 19, 2010 1:34 AM by Devika
    Bill
     
    Posts: 409 / Nickname: bv / Registered: January 17, 2002 4:28 PM
    Integrating Flex with a Java EE Application, Part II
    April 23, 2009 9:00 AM      
    Part II of this three-part article series demonstrates different ways Flex can interact with server-side data sources, including fetching JSON and XML via HTTP, and invoking server-side Java objects from a Flex client.

    http://www.artima.com/articles/enterprise_flex_part_2.html

    What do you think of Flex's ability to integrate with enterprise Java applications?
    • Devika
       
      Posts: 1 / Nickname: devikanrgh / Registered: February 18, 2010 7:30 PM
      Re: Integrating Flex with a Java EE Application, Part II
      February 19, 2010 1:34 AM      
      Hi,

      Here is the code to add Fiji Chart dynamically.

      import com.exadel.fiji.component.html.HtmlBarChart;
      import com.exadel.fiji.component.html.HtmlChartData;
      :
      :

      HtmlChartData chartData =new HtmlChartData();
      chartData.setValue(new MedalsBean().getNames());


      HtmlBarChart chart=new HtmlBarChart();
      chart.setValue(new MedalsBean().getMedalsData());
      chartData.setParent(chart);

      chart.setBarColors(new MedalsBean().getColors());
      chart.setWidth(200);
      chart.setHeight(200);
      chart.setId(chart.getClientId(_context)+1);
      chart.setRendered(true);
      :
      :
      But this chart is not rendering. i.e there is some error in Filling Data to chart.

      Can anybody tell me how to add the Chart dynamically.
      Code For MedalBean

      package fiji;

      import java.util.ArrayList;
      import java.util.LinkedHashMap;
      import java.util.Map;

      import javax.annotation.PostConstruct;

      public class MedalsBean {
      private Map<String, Integer[]> medalsData = new LinkedHashMap<String,Integer[]>();
      private ArrayList<String> colors = new ArrayList<String>();
      private ArrayList<String> names = new ArrayList<String>();

      private Integer[] medalsChina = new Integer[]{51, 21, 28};
      private Integer[] medalsUSA = new Integer[]{36, 38, 36};
      private Integer[] medalsRussia = new Integer[]{23, 21, 28};

      private String countrySelected;
      private String medalTypeSelected;
      private String medalCountSelected;

      public String getCountrySelected() {
      return countrySelected;
      }

      public void setCountrySelected(String countrySelected) {
      this.countrySelected = countrySelected;
      }

      public String getMedalTypeSelected() {
      return medalTypeSelected;
      }

      public void setMedalTypeSelected(String medalTypeSelected) {
      this.medalTypeSelected = medalTypeSelected;
      }

      public String getMedalCountSelected() {
      return medalCountSelected;
      }

      public void setMedalCountSelected(String medalCountSelected) {
      this.medalCountSelected = medalCountSelected;
      }

      @PostConstruct
      private void init() {
      medalsData.put("China", medalsChina);
      medalsData.put("USA", medalsUSA);
      medalsData.put("Russia", medalsRussia);

      names.add("Gold");
      names.add("Silver");
      names.add("Bronze");

      colors.add("#DAA520");
      colors.add("#C0C0C0");
      colors.add("#B87333");
      }

      public Map<String, Integer[]> getMedalsData() {
      return medalsData;
      }
      public ArrayList<String> getColors() {
      return colors;
      }
      public ArrayList<String> getNames() {
      return names;
      }
      public Integer[] getMedalsChina() {
      return medalsChina;
      }
      public Integer[] getMedalsUSA() {
      return medalsUSA;
      }
      public Integer[] getMedalsRussia() {
      return medalsRussia;
      }
      }

      Thanks in advance.

      Regards
      Devika.N