Exemplo n.º 1
0
 public boolean equals(Object obj) {
   if (!(obj instanceof UpdatableProperty)) {
     return false;
   }
   UpdatableProperty up = (UpdatableProperty) obj;
   if (haveSavedValue != up.haveSavedValue) {
     return false;
   }
   if (setSubmittedInLocalValue != up.setSubmittedInLocalValue) {
     return false;
   }
   if (setLocalValueInValueBinding != up.setLocalValueInValueBinding) {
     return false;
   }
   if (!CoreUtils.objectsEqual(name, up.name)) {
     return false;
   }
   if (!CoreUtils.objectsEqual(savedValue, up.savedValue)) {
     return false;
   }
   if (!CoreUtils.objectsEqual(submittedValue, up.submittedValue)) {
     return false;
   }
   if (!CoreUtils.objectsEqual(value, up.value)) {
     return false;
   }
   return true;
 }
Exemplo n.º 2
0
 public boolean equals(Object obj) {
   if (!super.equals(obj)) {
     return false;
   }
   if (!(obj instanceof Move)) {
     return false;
   }
   Move effect = (Move) obj;
   if (x != effect.x) {
     return false;
   }
   if (y != effect.y) {
     return false;
   }
   if (!CoreUtils.objectsEqual(mode, effect.mode)) {
     return false;
   }
   return true;
 }
 public static DnDCache getInstance(FacesContext context, boolean encoding) {
   if (CoreUtils.isPortletEnvironment()) {
     PortletSession portletSession =
         (PortletSession) context.getExternalContext().getSession(false);
     DnDCache cache =
         (DnDCache) portletSession.getAttribute(SESSION_KEY, PortletSession.APPLICATION_SCOPE);
     if (cache == null) {
       cache = new DnDCache();
       portletSession.setAttribute(SESSION_KEY, cache, PortletSession.APPLICATION_SCOPE);
     }
     return cache;
   } else {
     String viewId = context.getViewRoot().getViewId();
     Map map = context.getExternalContext().getSessionMap();
     DnDCache cache = (DnDCache) map.get(SESSION_KEY);
     if (cache == null) {
       cache = new DnDCache();
       map.put(SESSION_KEY, cache);
     }
     return cache;
   }
 }
Exemplo n.º 4
0
  private File createFile(FacesContext fc, String type, UIData uiData) {
    OutputTypeHandler outputHandler = null;
    String path = CoreUtils.getRealPath(fc, "/export");
    File exportDir = new File(path);
    if (!exportDir.exists()) exportDir.mkdirs();
    String pathWithoutExt = path + "/export_" + new Date().getTime();

    if (getOutputTypeHandler() != null) outputHandler = getOutputTypeHandler();
    else if (DataExporter.EXCEL_TYPE.equals(getType())) {
      outputHandler = new ExcelOutputHandler(pathWithoutExt + ".xls", fc, uiData.getId());
    } else if (DataExporter.CSV_TYPE.equals(getType())) {
      outputHandler = new CSVOutputHandler(pathWithoutExt + ".csv");
    } else if (DataExporter.PDF_TYPE.equals(getType())) {
      outputHandler = new PDFOutputHandler(pathWithoutExt + ".pdf", uiData.getId());
    } else {
      outputHandler = NoopOutputHandler;
    }
    renderToHandler(outputHandler, uiData, fc);
    setMimeType(outputHandler.getMimeType());

    return outputHandler.getFile();
  }