Package com.ibm.xsp.component

Examples of com.ibm.xsp.component.UIViewRootEx2


        }
     
        UISbtClient ctClient = (UISbtClient)component;

        // Ensure that the dojo theme is loaded
        UIViewRootEx2 rootEx = (UIViewRootEx2)context.getViewRoot();
        rootEx.setDojoTheme(true);

        // Make the client enabled
        UISbtClient.enableClient(rootEx, true);
       
        // Find the Connections Endpoint
        String endpointName = ctClient.getEndpoint();
        if(StringUtil.isEmpty(endpointName)) {
            endpointName = EndpointFactory.SERVER_CONNECTIONS;
        }
        Endpoint ctServer = EndpointFactory.getEndpointUnchecked(endpointName);
        if(ctServer==null) {
            //Platform.getInstance().log("Sametime server URL is undefined.");
            return;
        }

        boolean inclProfiles = ctClient.isProfilesBusinessCard();
        boolean inclCommunities = ctClient.isCommunitiesBusinessCard();
        if(inclProfiles || inclCommunities) {
            // Write the Profiles semantic servlet
            if(inclProfiles) {
              writeCommunitiesConfig(context, rootEx, ctClient, ctServer, endpointName);
            }

            // Write the Communities semantic servlet
            if(inclCommunities) {
                writeCommunitiesConfig(context, rootEx, ctClient, ctServer, endpointName);
            }
           
            // Add the semantic tag resource
            addSemanticTagResource(context, rootEx, ctClient, ctServer, endpointName, inclProfiles, inclCommunities);
        }

        String sbtlib_dojo = SBTLIBRARY + "?lib=dojo";
        rootEx.addEncodeResource(new ScriptResource(sbtlib_dojo, true));

        // Required by the profiles card code...
        //dijit._Widget,dijit._Templated,dijit._Container,dijit.form.ComboBox               
        rootEx.addEncodeResource(ExtLibResources.dojoI18n); // $NON-NLS-1$
        rootEx.addEncodeResource(ExtLibResources.dojoCookie); // $NON-NLS-1$

        //rootEx.addEncodeResource(new DojoModuleResource("dijit._Widget")); // $NON-NLS-1$
        //rootEx.addEncodeResource(new DojoModuleResource("dijit._Templated")); // $NON-NLS-1$
        rootEx.addEncodeResource(new DojoModuleResource("dijit._Container")); // $NON-NLS-1$
        rootEx.addEncodeResource(new DojoModuleResource("dijit.form.ComboBox")); // $NON-NLS-1$
    }
View Full Code Here


  @Override
    public void encodeBegin(FacesContext context, UIComponent component)
            throws IOException {
        // Mark the Facebook client as enabled
        UIViewRootEx2 rootEx = (UIViewRootEx2)context.getViewRoot();
        UIFacebookClient.enableClient(rootEx, true);
       
        UIFacebookClient dialog = (UIFacebookClient)component;

        String endpoint = dialog.getEndpoint();
View Full Code Here

  public void writeJSSDK(FacesContext context, UIComponent component, OAuthEndpoint bean)
      throws IOException {
        ResponseWriter writer = context.getResponseWriter();
       
        UIViewRootEx2 rootEx = (UIViewRootEx2)context.getViewRoot();
        if(rootEx.getEncodeProperty("xsp.extlib.facebook.jssdk")==null) {
          writer.startElement("div", component);
          writer.writeAttribute("id","fb-root", null);
          writer.endElement("div");
 
            writer.write("\n");
          writer.startElement("script", component);
          writer.writeAttribute("type", "text/javascript", null);
 
          JsonObject config = createJSONConfig(bean);
          StringBuilder b = new StringBuilder(256);
           
          try {
            JsonGenerator.toJson(JsonJavaFactory.instance,b,config,true);
          }
          catch(JsonException ex) {
            throw new FacesExceptionEx(ex);
          }
         
            writer.writeText("\nwindow.fbAsyncInit = function() {", null);
          writer.writeText("\nFB.init(" + b + ");};", null);
         
          // We need to add the xmlns:fb to the HTML tag
            writer.writeText("\n(function() {", null);
          writer.writeText("var elements = document.getElementsByTagName(\"html\");", null);
          writer.writeText("var htmlElement = elements[0];", null);
          writer.writeText("var attribute = document.createAttribute(\"xmlns:fb\");", null);
          writer.writeText("attribute.nodeValue = \"http://www.facebook.com/2008/fbml\";", null);
          writer.writeText("htmlElement.setAttributeNode(attribute); ", null);
          writer.writeText("}());", null);
          // An now we can load the FB script asynchonously
          // Load the SDK Asynchronously
          writer.writeText("\n(function(d){",null);
          writer.writeText("var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}",null);
          writer.writeText("js = d.createElement('script'); js.id = id; js.async = true;",null);
          writer.writeText("js.src = \"//connect.facebook.net/en_US/all.js\";",null);
          writer.writeText("d.getElementsByTagName('head')[0].appendChild(js);",null);
          writer.writeText("}(document));",null);         
          
          writer.endElement("script");
            writer.write("\n");
        }    
        rootEx.putEncodeProperty("xsp.extlib.facebook.jssdk", Boolean.TRUE);
  }
View Full Code Here

        }
     
        UISametimeClient stClient = (UISametimeClient)component;

        // Ensure that the dojo theme is loaded
        UIViewRootEx2 rootEx = (UIViewRootEx2)context.getViewRoot();
        rootEx.setDojoTheme(true);
       
        // Mark the ST client as enabled
        UISametimeClient.enableClient(rootEx, true);
       
        // Find the Sametime Endpoint
View Full Code Here

      if (null == settings) {

        settingsView.recycle();
        XSPContext context = (XSPContext) resolveVariable("context");

        UIViewRootEx2 view = (UIViewRootEx2) resolveVariable("view");
        if (!view.getPageName().equals("/admin.xsp")) {
          System.out.println("mypic: invalid configuration - " + view.getPageName());
          validConfig = false;
          context.redirectToPage("/admin.xsp");
        }

      } else {

        SaveUrlInNab = settings.getItemValueString("saveMypicURLToNab");
        EnableProfiles = settings.getItemValueString("enableProfiles");
        StoreProfilesInNab = settings.getItemValueString("saveProfileToNab");
        NabServer = settings.getItemValueString("nabServer");
        NabFilePath = settings.getItemValueString("nabFilePath");
        ShowApiInNav = settings.getItemValueString("enableAPIPage");
        DefaultFormat = settings.getItemValueString("defaultFormat");
        DefaultSize = settings.getItemValueString("defaultSize");
       
        if (DefaultSize.trim().compareTo("") == 0) {
          DefaultSize = "50";
        }
       
        if (DefaultFormat.trim().compareTo("") == 0) {
          DefaultFormat = "png";
        }

        if ((SaveUrlInNab.equals("Yes") || StoreProfilesInNab.equals("Yes")) && (NabServer.isEmpty() || NabFilePath.isEmpty())) {
          Messages.clear();
          Messages.add("To save mypic URLs or Profile information to a Names and address book, "
              + "the NAB Server and File Path must be specified.");

          UIViewRootEx2 view = (UIViewRootEx2) resolveVariable("view");
          if (!view.getPageName().equals("/admin.xsp")) {
            XSPContext context = (XSPContext) resolveVariable("context");
            validConfig = false;
            context.redirectToPage("/admin.xsp");
          }
View Full Code Here

TOP

Related Classes of com.ibm.xsp.component.UIViewRootEx2

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.