Package dyntabs

Class JsfUtils

java.lang.Object
dyntabs.JsfUtils

public class JsfUtils extends Object
Author:
DynTabs
  • Field Details

  • Constructor Details

    • JsfUtils

      public JsfUtils()
  • Method Details

    • refreshComponentInDynamicTab

      public static void refreshComponentInDynamicTab(String compId, String dynTabId)
    • getExpressionValue

      public static Object getExpressionValue(String jsfExpression)
    • getApplication

      public static jakarta.faces.application.Application getApplication()
    • findParentNamingContainer

      public static jakarta.faces.component.UINamingContainer findParentNamingContainer(jakarta.faces.component.UIComponent component)
    • findParentNamingContainerWithIdPrefix

      public static jakarta.faces.component.UINamingContainer findParentNamingContainerWithIdPrefix(jakarta.faces.component.UIComponent component, String idPrefix)
      Finds the first parent NamingContainer of the given component whose ID starts with the given prefix.
      Parameters:
      component - the starting component
      idPrefix - the ID prefix to match
      Returns:
      the matching parent NamingContainer, or null if not found
    • findParentWithIdPrefix

      public static jakarta.faces.component.UIComponent findParentWithIdPrefix(jakarta.faces.component.UIComponent component, String idPrefix)
    • findParentForm

      public static jakarta.faces.component.UIComponent findParentForm(jakarta.faces.component.UIComponent component)
    • findParentComponentOfClass

      public static jakarta.faces.component.UIComponent findParentComponentOfClass(jakarta.faces.component.UIComponent component, Class clazz)
    • findComponent

      public static jakarta.faces.component.UIComponent findComponent(jakarta.faces.component.UIComponent base, String id)
    • findComponentsClientId

      public static Collection<String> findComponentsClientId(jakarta.faces.component.UIComponent base, String id)
    • findComponentInDynamicTab

      public static jakarta.faces.component.UIComponent findComponentInDynamicTab(String componentId, String dynTabId)
    • findComponentWithIdInNamigContainer

      public static jakarta.faces.component.UIComponent findComponentWithIdInNamigContainer(jakarta.faces.component.UIComponent component, String ncIdPrefix, String Id)
      Within the first parent NamingContainer of the given component (whose ID starts with ncIdPrefix), finds and returns the child component with the specified ID.
      Parameters:
      component - the starting component
      ncIdPrefix - the ID prefix for the parent NamingContainer
      Id - the ID of the component to find
      Returns:
      the found component, or null if not found
    • createValueExpression

      public static jakarta.el.ValueExpression createValueExpression(String exprStr, Class cls)
    • openPFDialog

      public static void openPFDialog(org.primefaces.component.dialog.Dialog dlg)
      Opens a PrimeFaces dialog by setting its visibility condition in the viewScope.

      Each CRUD dialog has a visible condition expression: "#{viewScope." + dlg.getClientId().replace(":", "_") + "}" which is set up in solveDlgVisible(). This method makes that condition evaluate to true, making the dialog visible.

      NOT WORKING

      Parameters:
      dlg - the PrimeFaces dialog to open
    • findComponentByClientId

      public static jakarta.faces.component.UIComponent findComponentByClientId(String clientId)
      Removes the visibility attribute for a p:dialog from the viewScope.

      Each CRUD dialog has a visible expression set up via f:event listener="#{drugiBean.solveDlgVisible}" type="postAddToView", specifically in adjustVisibleForDialog(), in the form: "#{viewScope." + dlg.getClientId().replace(":", "_") + "}"

      To make the dialog visible, crudListener() sets this viewScope attribute to true. To hide the dialog, this method removes the attribute so the expression evaluates to false.

      NOT WORKING

      Parameters:
      dlgClientId - public static void removePFDialogVisibleCondition(String dlgClientId) { Mapinvalid input: '<'String, Object> viewMap = FacesContext.getCurrentInstance().getViewRoot().getViewMap(); String dlgClId_rep = dlgClientId.replace(":", "_"); viewMap.remove(dlgClId_rep); System.out.println(" -removed viewScope attribute: " + dlgClientId.replace(":", "_")); System.out.println("_DIALOG CLOSED " + dlgClientId + ", REMOVED viewAttr: " + dlgClId_rep); }
    • getStringFromAppResourceBundle

      public static String getStringFromAppResourceBundle(String rbName, String key)
    • getAppResourceBundle

      public static ResourceBundle getAppResourceBundle(String rbName)
    • downloadFile

      public static void downloadFile(byte[] fileBytes, String mimeType, String fileName) throws IOException
      Throws:
      IOException
    • readFileBytes

      public static byte[] readFileBytes(org.primefaces.model.file.UploadedFile file)
    • getURLBase

      public static String getURLBase()
      Returns: