Ejemplo n.º 1
0
 /**
  * Returns the instance(s) connected to this instance through the role "ordered pairs".
  *
  * @return the connected instance(s)
  * @throws PDStoreException
  */
 public Collection<PDOrderedPair> getOrderedPairss() throws PDStoreException {
   Set<PDOrderedPair> result = new HashSet<PDOrderedPair>();
   GUID PDOrderedPairTypeId = new GUID("b3ba85348e0ede11980f9a097666e103");
   pdWorkingCopy.getInstances(
       this, roleOrderedPairsId, PDOrderedPair.class, PDOrderedPairTypeId, result);
   return result;
 }
Ejemplo n.º 2
0
  /**
   * Connects this instance to the given instance using role "ordered pairs". If the given instance
   * is null, nothing happens.
   *
   * @param orderedPairs the instance to connect
   * @throws PDStoreException
   */
  public void addOrderedPairs(GUID orderedPairs) throws PDStoreException {

    if (orderedPairs != null) {

      pdWorkingCopy.addLink(this.id, roleOrderedPairsId, orderedPairs);
    }
  }
  @Override
  public void keyPressed(KeyEvent arg0) {
    if (!arg0.isActionKey()) {

      char c = arg0.getKeyChar();

      if (c == ' ' || c == '\n') {
        uncommitedText += c;
        System.out.println("you typed the word: \"" + uncommitedText + "\"");

        /*
         * Code for communicating with PDStore here
         * 1. Create PDWord instance?
         * 2. Commit to PDStore?
         */
        PDWord word = new PDWord(store);
        word.addText(uncommitedText);
        PDOperation op = new PDOperation(store);
        op.setCommand(editor.INSERT);
        Date date = new Date();
        op.setTimeStamp(date.getTime());
        op.setUser(TextEditor.userName);
        PDInsert insert = new PDInsert(store);
        insert.setWord(word);
        insert.setAfter(word);
        op.setSuperParameter(insert);

        history.addOperation(op);

        store.commit();

        // this.repaint();

        uncommitedText = "";
      } else if (c == '\u0008') { // backspace character
        int i = uncommitedText.length();
        uncommitedText = uncommitedText.substring(0, i - 1);
      } else {
        uncommitedText += c;
      }
    }
  }
Ejemplo n.º 4
0
 /**
  * Sets the name of this instance. In PDStore every instance can be given a name. If the instance
  * already has a name, the name will be overwritten. If the given name is null, an existing name
  * will be removed.
  *
  * @return name the new instance name
  * @throws PDStoreException
  */
 public void setName(String name) throws PDStoreException {
   pdWorkingCopy.setName(id, name);
 }
Ejemplo n.º 5
0
 /**
  * Gets the name of this instance. In PDStore every instance can be given a name.
  *
  * @return name the instance name
  * @throws PDStoreException
  */
 public String getName() throws PDStoreException {
   return pdWorkingCopy.getName(id);
 }
Ejemplo n.º 6
0
 /**
  * Loads an instance object of this type into a cache. If the instance is already in the cache,
  * the cached instance is returned.
  *
  * @param PDWorkingCopy pdWorkingCopy to load the instance into
  * @param id GUID of the instance Do not directly call this method. Use the newInstance() method
  *     in PDCache which would call this method
  */
 public static PDOrder load(PDWorkingCopy pdWorkingCopy, GUID id) {
   PDInstance instance = pdWorkingCopy.load(typeId, id);
   return (PDOrder) instance;
 }
Ejemplo n.º 7
0
 /**
  * Connects this instance to the given instance using role "ordered pairs". If there is already an
  * instance connected to this instance through role "ordered pairs", the link will be overwritten.
  * If the given instance is null, an existing link is removed."
  *
  * @param orderedPairs the instance to connect
  * @throws PDStoreException
  */
 public void setOrderedPairs(GUID orderedPairs) throws PDStoreException {
   pdWorkingCopy.setLink(this.id, roleOrderedPairsId, orderedPairs);
 }
Ejemplo n.º 8
0
 /**
  * Removes the link from this instance through role "ordered pairs" to the given instance, if the
  * link exists. If there is no such link, nothing happens.orderedPairs.getId() If the given
  * instance is null, nothing happens.
  *
  * @throws PDStoreException
  */
 public void removeOrderedPairs(Object orderedPairs) throws PDStoreException {
   if (orderedPairs == null) return;
   pdWorkingCopy.removeLink(this.id, roleOrderedPairsId, orderedPairs);
 }
Ejemplo n.º 9
0
 /**
  * Removes the link from this instance through role "ordered pairs".
  *
  * @throws PDStoreException
  */
 public void removeOrderedPairs() throws PDStoreException {
   pdWorkingCopy.removeLink(
       this.id, roleOrderedPairsId, pdWorkingCopy.getInstance(this, roleOrderedPairsId));
 }
Ejemplo n.º 10
0
 /**
  * Returns the instance connected to this instance through the role "ordered pairs".
  *
  * @return the connected instance
  * @throws PDStoreException
  */
 public PDOrderedPair getOrderedPairs() throws PDStoreException {
   return (PDOrderedPair) pdWorkingCopy.getInstance(this, roleOrderedPairsId);
 }
Ejemplo n.º 11
0
 /**
  * Removes the icon of this instance. In PDStore every instance can be given an icon. If the
  * instance does not have an icon, nothing happens.
  *
  * @throws PDStoreException
  */
 public void removeIcon() throws PDStoreException {
   pdWorkingCopy.removeIcon(id);
 }
Ejemplo n.º 12
0
 /**
  * Sets the icon of this instance. In PDStore every instance can be given an icon. If the instance
  * already has an icon, the icon will be overwritten. If the given icon is null, an existing icon
  * will be removed.
  *
  * @return icon the new instance icon
  * @throws PDStoreException
  */
 public void setIcon(Blob icon) throws PDStoreException {
   pdWorkingCopy.setIcon(id, icon);
 }
Ejemplo n.º 13
0
 /**
  * Gets the icon of this instance. In PDStore every instance can be given an icon.
  *
  * @return icon the instance icon
  * @throws PDStoreException
  */
 public Blob getIcon() throws PDStoreException {
   return pdWorkingCopy.getIcon(id);
 }