Package hidb2.kern

Examples of hidb2.kern.ValuedInstance


                // Check card images files status
                monitor.subTask("Card checking");
                for (Card cd : f.getLstCard())
                  {
                  AttrFile ai = (AttrFile) cd.getValue(attrIdx);

                  if (ai != null)
                    {
                    String absCardFileName = ai.getAbsolutePath();

                    File foundMMFile = null;
                    for (Iterator<File> itfic = lstMMFile.iterator(); itfic.hasNext() && (foundMMFile == null);)
                      {
                      File floc = itfic.next();

                      if (absCardFileName.equals(floc.getAbsolutePath()))
                        {
                        foundMMFile = floc;
                        itfic.remove();
                        }
                      }

                    if (foundMMFile == null)
                      {
                      // Suggest Card Deletion
                      DeltaMMFile dlt = new DeltaMMFile(cd, attrIdx, FileStatus.MISSING);
                      lstDelta.add(dlt);
                      }
                    else
                      {
                      // Check Last modification Date and size
                      Date dateBase = ai.getLastModificationDate();

                      // Get the actual file last modification date
                      long lmd = foundMMFile.lastModified();

                      if (dateBase.getTime() < lmd)
                        {
                        // Suggest Card Update
                        DeltaMMFile dlt = new DeltaMMFile(cd, attrIdx, FileStatus.UPDATED);
                        dlt.setFoundFic(foundMMFile);
                        lstDelta.add(dlt);
                        }
                      else
                        {
                        // Nothing to do with the card, it's up to date
                        }
                      }
                    } // Else the card has a non valued AttrFile
                  }

                monitor.subTask("New File Importation");

                // If the list of read files is not empty, it means that some MM files are not recorded
                // in the database ==> Suggest to create them
                for (File fic : lstMMFile)
                  {
                  DeltaMMFile dlt = new DeltaMMFile(fic);
                  dlt.setFoundFic(fic);

                  AttrImage imgAttr = (AttrImage) a1.create(Application.getDataStore(), fic);

                  if (imgAttr != null)
                    {
                    dlt.setAttrFile(imgAttr);
                    }

                  lstDelta.add(dlt);

                  monitor.worked(1);
                  }

                monitor.done();
                }
            });
          }

        catch (InvocationTargetException e1)
          {
          e1.printStackTrace();
          }

        catch (InterruptedException e1)
          {
          e1.printStackTrace();
          }

        DlgDeltaFile dlg = new DlgDeltaFile(parent);

        res = dlg.open(lstDelta);
        if (res == C_OK)
          {
          for (DeltaMMFile dmmfic : lstDelta)
            {
            Card fcd = dmmfic.getFoundCard();

            switch (dmmfic.getAction())
              {
              case CREATE:
                Card nc = Application.getDataStore().createCard(f);
                nc.setValue(attrIdx, dmmfic.getAttrFile());
                break;

              case DELETE:
                Application.getDataStore().remove(f, fcd);
                break;

              case UPDATE:
                AttrFile atf = (AttrFile) fcd.getValue(attrIdx);
                atf.setLastModificationDate(new Date(dmmfic.getFoundFic().lastModified()));

                if (atf.getStatus() == StatusCycle.UNCHANGED)
                  {
                  atf.setStatus(StatusCycle.MODIFIED);
                  }

                if (fcd.getStatus() == StatusCycle.UNCHANGED)
                  {
                  fcd.setStatus(StatusCycle.MODIFIED);
View Full Code Here


      // The Element is a ValuedInstance
      if (_mapAttr[columnIndex].getType() == AttrType.T_Image)
        {
        ValuedInstance vi = (ValuedInstance) element;

        AttrImage ai = (AttrImage) vi.getValue(_mapIdx[columnIndex]);

        if (ai != null)
          {
          img = ai.getSqrImage(getTable().getDisplay(), _maxIconSize);
          }
        }

      return img;
      }
View Full Code Here

            FileDialog _fd;

            @Override
            protected Object openDialogBox(Control cellEditorWindow)
              {
              AttrImage ai = (AttrImage) getValue();

              // Set initial values (directory)
              if (_fd == null)
                {
                _fd = new FileDialog(cellEditorWindow.getShell());
                }

              if (ai == null)
                {
                ai = new AttrImage();
                ai.setChecker(attr.getChecker());
                }

              String fullname = ai.getAbsolutePath();

              if (fullname != null)
                {
                _fd.setFileName(fullname);
                }

              fullname = _fd.open();

              if (fullname != null)
                {               
                // Find & Use correct DataPath               
                DataPath rDp = Application.getDataStore().findDataPath(fullname);

                ai.setDataPath(rDp);

                if (rDp != null)
                  {
                  fullname = fullname.substring(rDp.getPath().length());
                  }

                ai.setValue(fullname);

                if (ai.getStatus() == StatusCycle.UNCHANGED)
                  {
                  ai.setStatus(StatusCycle.MODIFIED);
                  }
                }
              else
                {
                ai = null;
View Full Code Here

              _fd = new FileDialog(getShell());
              }

            if (_attrImg == null)
              {
              _attrImg = new AttrImage();
              _attrImg.setChecker(_attrImgLayout.getAttr().getChecker());
              }

            String fullname = _attrImg.getAbsolutePath();
View Full Code Here

      for (File imgfic : _tabMMFile)
        {
        Folder f = _inpFdn.create();

        AttrImage imgAttr = (AttrImage) _attr.create(Application.getDataStore(), imgfic);

        f.setValue(_attrIdx, imgAttr);

        if (res == C_ERROR)
          {
View Full Code Here

      div.setPref(pref.getInt(PrefConst.P_IVR_MIN_ZOOM), pref.getInt(PrefConst.P_IVR_MAX_ZOOM), pref
          .getInt(PrefConst.P_IVR_DEFAULT_WIDTH), pref.getInt(PrefConst.P_IVR_DEFAULT_HEIGHT));

      for (Card crd : lstCard)
        {
        AttrImage imgAttr = (AttrImage) crd.getValue(attrIdx);
        if (imgAttr != null)
          {
          File imgFile = new File(imgAttr.getAbsolutePath());

          if (imgFile.exists())
            {
            lstFic.add(imgFile);
            }
          else
            {
            log.warning("File [" + imgAttr.getAbsolutePath() + "] not found");
            }
          }
        }

      div.open(lstFic);
View Full Code Here

                for (File fic : lstMMFile)
                  {
                  DeltaMMFile dlt = new DeltaMMFile(fic);
                  dlt.setFoundFic(fic);

                  AttrImage imgAttr = (AttrImage) a1.create(Application.getDataStore(), fic);

                  if (imgAttr != null)
                    {
                    dlt.setAttrFile(imgAttr);
                    }
View Full Code Here

              //          Tracker tracker = new Tracker(_drawArea, SWT.RESIZE);
              @Override
              public void mouseDoubleClick(MouseEvent e)
                {
                AttrImage ai = (AttrImage) _data;

                // Set initial values (directory)
                if (_fd == null)
                  {
                  _fd = new FileDialog(_wid.getShell());
                  }

                if (ai == null)
                  {
                  _data = ai = new AttrImage();
                  ai.setChecker(_al.getAttr().getChecker());
                  }

                String fullname = ai.getAbsolutePath();

                if (fullname != null)
                  {
                  _fd.setFileName(fullname);
                  }

                fullname = _fd.open();

                if (fullname != null)
                  {
                  // Find & Use correct DataPath               
                  DataPath rDp = Application.getDataStore().findDataPath(fullname);

                  ai.setDataPath(rDp);

                  if (rDp != null)
                    {
                    fullname = fullname.substring(rDp.getPath().length());
                    }

                  ai.setValue(fullname);

                  if (ai.getStatus() == StatusCycle.UNCHANGED)
                    {
                    ai.setStatus(StatusCycle.MODIFIED);
                    }

                  _edPart.setDirty(true);
                  }
                else
View Full Code Here

        log.warning("Not Allowed here");
        break;

      case T_Image:
        log.warning("Not fully Implemented yet");
        AttrImage ai = (AttrImage) v;

        if (ai != null)
          {
          // TODO : Use right size for the square icon
          ((ImageCanvas) _wid).setImage(ai.getSqrImage(_wid.getDisplay(), 64));
          _wid.redraw();
          }

        break;
View Full Code Here

      PojoColumnDescr pcol = _lstAttr.get(columnIndex);
     
      // The Element is a ValuedInstance
      if (pcol.attrType == AttrType.T_Image)
        {
        AttrImage ai = (AttrImage) pcol.get(element);

        if (ai != null)
          {
          img = ai.getSqrImage(getTable().getDisplay(), 128);
          }
        }

      return img;
      }
View Full Code Here

TOP

Related Classes of hidb2.kern.ValuedInstance

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.