Package hidb2.kern

Examples of hidb2.kern.AttrLayout


            }
          else
            {
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            Attribut a = (Attribut) obj;

            addidx = a.getDisplayOrder() + 1;
            }

          Attribut at0 = new Attribut(getFD().getID(), T_String);

          getFD().addAttribut(at0, addidx);

          _tabvFdAttr.refresh();
          }
      }, new SelectionAdapter()
      {
        /**
        * Add Before Callback
        */
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvFdAttr.getSelection();
          int addidx = 0;

          if (selection.isEmpty())
            {
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            Attribut a = (Attribut) obj;

            addidx = Math.max(0, a.getDisplayOrder() - 1);
            }

          Attribut at0 = new Attribut(getFD().getID(), T_String);

          getFD().addAttribut(at0, addidx);

          _tabvFdAttr.refresh();
          }
      }, new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvFdAttr.getSelection();
          Object obj = ((IStructuredSelection) selection).getFirstElement();
          Attribut attr = (Attribut) obj;

          // Get confirmation
          boolean rb = MessageDialog.openConfirm(_tabvFdAttr.getControl().getShell(), "Delete Attribute",
              "Do you confirm the deletion of Attribut:" + attr.getName() + "\nType:" + attr.getType().name);

          if (rb)
            {
            // Execute the deletion
            getFD().removeAttribut(attr);

            _tabvFdAttr.refresh();
            }
          }
      }, new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvFdAttr.getSelection();

          if (!selection.isEmpty())
            {
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            Attribut a = (Attribut) obj;

            int r = getFD().changeAttributPosition(a, false);
            if (r == C_OK)
              {
              setDirty(true);
              }

            _tabvFdAttr.refresh();
            }
          }
      }, new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvFdAttr.getSelection();

          if (!selection.isEmpty())
            {
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            Attribut a = (Attribut) obj;

            int r = getFD().changeAttributPosition(a, true);
            if (r == C_OK)
              {
              setDirty(true);
View Full Code Here


    _tabvCdAttr = createTabAttrSection(form, "Card Attributes", new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          Attribut at0 = new Attribut(getFD().getCardDescription().getID(), T_String);

          getFD().getCardDescription().addAttribut(at0, 0);

          _tabvCdAttr.refresh();
          }
      }, new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          Attribut at0 = new Attribut(getFD().getCardDescription().getID(), T_String);

          getFD().getCardDescription().addAttribut(at0, 0);

          _tabvCdAttr.refresh();
          }
      }, new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvCdAttr.getSelection();
          Object obj = ((IStructuredSelection) selection).getFirstElement();
          Attribut attr = (Attribut) obj;

          // Get confirmation
          boolean rb = MessageDialog.openConfirm(_tabvFdAttr.getControl().getShell(), "Delete Attribute",
              "Do you confirm the deletion of Attribut:" + attr.getName() + "\nType:" + attr.getType().name);

          if (rb)
            {
            // Execute the deletion
            getFD().getCardDescription().removeAttribut(attr);

            _tabvCdAttr.refresh();
            }
          }
      }, new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvCdAttr.getSelection();

          if (!selection.isEmpty())
            {
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            Attribut a = (Attribut) obj;

            int r = getFD().getCardDescription().changeAttributPosition(a, false);
            if (r == C_OK)
              {
              setDirty(true);
              }

            _tabvCdAttr.refresh();
            }
          }
      }, new SelectionAdapter()
      {
        @Override
        public void widgetSelected(SelectionEvent e)
          {
          ISelection selection = _tabvCdAttr.getSelection();

          if (!selection.isEmpty())
            {
            Object obj = ((IStructuredSelection) selection).getFirstElement();

            Attribut a = (Attribut) obj;

            int r = getFD().getCardDescription().changeAttributPosition(a, true);
            if (r == C_OK)
              {
              setDirty(true);
View Full Code Here

    ISelection selection = _tabvFolder.getSelection();
    if (!selection.isEmpty())
      {
      Folder f = (Folder) ((IStructuredSelection) selection).getFirstElement();

      Attribut a1 = null;
      for (Attribut a : _inpFd.getCardDescription().getAttributList())
        {
        if (a.getType() == AttrType.T_Image)
          {
          a1 = a;
View Full Code Here

      Object obj = ((IStructuredSelection) selection).getFirstElement();

      addidx = _descr.getAttributList().indexOf(obj) + 1;
      }

    Attribut at0 = new Attribut(_descr.getID(), T_String);

    _descr.addAttribut(at0, addidx);

    refresh();
    }
View Full Code Here

      Object obj = ((IStructuredSelection) selection).getFirstElement();

      addidx = Math.max(0, _descr.getAttributList().indexOf(obj) - 1);
      }

    Attribut at0 = new Attribut(_descr.getID(), T_String);

    _descr.addAttribut(at0, addidx);

    refresh();
    }
View Full Code Here

   */
  public static void BrowseCard(Shell parent, Folder f)
    {
    AttributedDescription descr = ((FolderDescription) f.getDescription()).getCardDescription();

    Attribut a1 = descr.find(AttrType.T_Image);
    if (a1 != null)
      {
      int attrIdx = descr.getAttributList().indexOf(a1);

      List<Card> lstCard = f.getLstCard();
View Full Code Here

  public static int massImport(Shell parent, Folder f)
    {
    int res = C_OK;

    // Open the mapping dialog (does not exist for the moment)
    Attribut a1 = ((FolderDescription) f.getDescription()).getCardDescription().find(AttrType.T_Image);
    if (a1 != null)
      {
      // Keep previous dialog -> Keep memory of last directory
      if (_dd == null)
        {
View Full Code Here

   */
  public static int checkCardDir(final Shell parent, final Folder f)
    {
    int res = C_OK;

    final Attribut a1 = ((FolderDescription) f.getDescription()).getCardDescription().find(AttrType.T_Image);
    if (a1 != null)
      {
      final int attrIdx = ((FolderDescription) f.getDescription()).getCardDescription().getAttributList().indexOf(a1);

      // Keep previous dialog -> Keep memory of last directory
      if (_dd == null)
        {
        _dd = new DirectoryDialog(parent);
        }

      final String fndir = _dd.open();

      final List<DeltaMMFile> lstDelta = new LinkedList<DeltaMMFile>();

      if (fndir != null)
        {
        try
          {
          new ProgressMonitorDialog(parent).run(true, false, new IRunnableWithProgress()
            {
              @Override
              public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
                {
                File fdir = new File(fndir);

                File[] tabMMFile = fdir.listFiles();

                monitor.beginTask("Checking", tabMMFile.length);
                List<File> lstMMFile = new ArrayList<File>(tabMMFile.length);
                for (File fic : tabMMFile)
                  {
                  if (Attribut.isImageExtension(fic))
                    {
                    lstMMFile.add(fic);
                    }
                  }

                // 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);
                    }
View Full Code Here

   * @param lstSel
   */
  public int addFolder(List<File> lstSel)
    {
    int res = C_OK;
    Attribut a1 = null;
    int attrIdx = 0;
    for (Attribut a : _inpFdn.getDescr().getAttributList())
      {
      if (a.getType() == AttrType.T_Image)
        {
View Full Code Here

                  FolderDescription fd = null;
                  CardDescription cd = null;
                  boolean isCard = false;

                  // Retrieve FolderDescription
                  AttributedDescription ad = das.find(fsr.getTableName());

                  if (ad instanceof CardDescription)
                    {
                    cd = (CardDescription) ad;
                    fd = cd.getParent();
View Full Code Here

TOP

Related Classes of hidb2.kern.AttrLayout

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.