Package hidb2.gui.action

Examples of hidb2.gui.action.OpenFile


                      "Give range:", MessageDialog.INFORMATION, new String[]
                        {
                            "Ok", "Cancel"
                        }, 0);

                  AttrChecker curAck = (AttrChecker) getValue();

                  int rmsg = dlg.open(curAck);

                  return (rmsg == 0) ? curAck : null;
                  }
View Full Code Here


      Attribut attr = _fd.getAttributList().get(_mapIdx[idx]);

      if ((attr.getType() == AttrType.T_RefList) && (o != null))
        {
        AttrEnumItemChecker aei = (AttrEnumItemChecker) attr.getChecker();

        int idxName = aei.getLstEnumItem().indexOf(o);

        o = new Integer(idxName);
        }

      return o;
View Full Code Here

            break;

          case T_RefList:
            int index = (Integer) value;

            AttrEnumItemChecker aei = (AttrEnumItemChecker) attr.getChecker();

            value = aei.getLstEnumItem().get(index);
            break;
          }

        vi.setValue(_mapIdx[idx], value);
View Full Code Here

      case T_Color: // Color
        cellEdt = new ColorCellEditor(table);
        break;

      case T_RefList:
        AttrEnumItemChecker aei = (AttrEnumItemChecker) attr.getChecker();

        List<EnumItem> lstEnumItems = aei.getLstEnumItem();

        String[] tabRefListNames = new String[lstEnumItems.size()];

        int ii = 0;
View Full Code Here

                // 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

TOP

Related Classes of hidb2.gui.action.OpenFile

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.