示例#1
0
 public static Version getOneUIVersion(FacesContext context) {
   FacesContextEx ctxEx = (FacesContextEx) context;
   Version v = (Version) ctxEx.getAttributes().get("extlib.oneui.Version"); // $NON-NLS-1$
   if (v != null) {
     return v;
   }
   v = findOneUIVersion(ctxEx);
   ctxEx.getAttributes().put("extlib.oneui.Version", v); // $NON-NLS-1$
   return v;
 }
示例#2
0
 public void compact(UIInputEx c) {
   String value = c.getValueAsString();
   value = prettify(value, true);
   if (value != null) {
     c.setValue(value);
   } else {
     FacesContextEx ctx = FacesContextEx.getCurrentInstance();
     String msg = "Invalid file content";
     FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_WARN, msg, msg);
     ctx.addMessage(c != null ? c.getClientId(ctx) : null, m);
   }
 }
示例#3
0
 public static String getDefaultRendererType(ThemeControl c, String defaultRenderer) {
   if (useTheme852 /*ExtLibUtil.isXPages852()*/) {
     // 852: we assume OneUI
     if (!isOneUITheme(FacesContextEx.getCurrentInstance())) {
       // or we could actually check to see if it's OneUI
       return defaultRenderer;
     }
     if (OneUIRendererTypes == null) {
       synchronized (ThemeUtil.class) {
         if (OneUIRendererTypes == null) {
           OneUIRendererTypes = buildOneUIMap();
         }
       }
     }
     String rt = OneUIRendererTypes.get(c.getStyleKitFamily());
     if (StringUtil.isEmpty(rt)) {
       return defaultRenderer;
     }
     return rt;
   } else {
     // Post 852: we assume that the renderer type is forced by a theme
     // So we just set the default renderer here
     return defaultRenderer;
   }
 }
示例#4
0
 public static AbstractBean getCurrentInstance(final String suffix) {
   AbstractBean result = null;
   result =
       (AbstractBean)
           LibraryUtils.resolveVariable(
               FacesContextEx.getCurrentInstance(), OAuthLibrary.LIBRARY_BEAN_PREFIX + suffix);
   return result;
 }
示例#5
0
 private static Version findOneUIVersion(FacesContextEx ctxEx) {
   for (StyleKitImpl st = (StyleKitImpl) ctxEx.getStyleKit(); st != null; st = st.getParent()) {
     if (st.getName().startsWith("oneui")) { // $NON-NLS-1$
       String oneui = st.getName();
       if (oneui.equals("oneui")) { // $NON-NLS-1$
         return ONEUI_V1;
       }
       if (oneui.equals("oneuiv2") || oneui.startsWith("oneuiv2_")) { // $NON-NLS-1$ $NON-NLS-2$
         return ONEUI_V2;
       }
       if (oneui.equals("oneuiv2.1")
           || oneui.startsWith("oneuiv2.1_")) { // $NON-NLS-1$ $NON-NLS-2$
         return ONEUI_V21;
       }
     }
   }
   // OneUI is not enabled
   return ONEUI_NONE;
 }