Hx - HxProfile

HxProfiles

The BHxProfile is used to customize the HTML page around the current HxView. The profile is responsible for writing out the outer HTML tags ( html, head, and body), any custom markup, and the current view. It is important that your profile respect the order HxOps are created in these methods: writeDocument, updateDocument, processDocument, and saveDocument. If any HxView uses the auto name constructor of HxOp to create a unique path name, it must be called in the exact same order in order to resolve correctly.

HxProfile exposes customization hooks through convenience methods, so there is no need to handle the boilerplate code:

  
  public class BMyProfile
    extends BHxProfile
  {  
    public static final BMyProfile INSTANCE = new BMyProfile();
    
    public Type getType() { return TYPE; }
    public static final Type TYPE = Sys.loadType(BMyProfile.class);
    
    protected BMyProfile() {}  
  
    public void doBody(BHxView view, HxOp op) 
      throws Exception
    {
      BHxPathBar.INSTANCE.write(makePathBarOp(op));
      view.write(op);
      displayError(op);
    }
    
    public void updateDocument(BHxView view, HxOp op) 
      throws Exception
    {
      BHxPathBar.INSTANCE.update(makePathBarOp(op));
      view.update(op);
    }  
    
    public boolean processDocument(BHxView view, HxOp op) 
      throws Exception
    {
      if (BHxPathBar.INSTANCE.process(makePathBarOp(op)))
        return true;
      return view.process(op);
    }
    
    public void saveDocument(BHxView view, HxOp op)
      throws Exception
    {
      BHxPathBar.INSTANCE.save(makePathBarOp(op));
      view.save(op);
    }
    
    protected HxOp makePathBarOp(HxOp op)
    {
      return op.make("pathbar", op);
    }
  }