Examples of Alignment


Examples of com.vaadin.ui.Alignment

                @Override
                public void valueChange(ValueChangeEvent event) {
                    Integer h = ((Integer) hAlign.getValue()).intValue();
                    int v = ((Integer) vAlign.getValue()).intValue();

                    updateAlignments(new Alignment(h + v));
                }

            };

            hAlign.setValue(new Integer(Bits.ALIGNMENT_LEFT));
            vAlign.addListener(alignmentChangeListener);
            hAlign.addListener(alignmentChangeListener);
            vAlign.setValue(new Integer(Bits.ALIGNMENT_TOP));

            controls.addComponent(new Label("layout alignment"));
            final NativeSelect lAlign = new NativeSelect();
            controls.addComponent(lAlign);
            lAlign.setNullSelectionAllowed(false);
            lAlign.addItem(new Integer(Bits.ALIGNMENT_LEFT));
            lAlign.setItemCaption(new Integer(Bits.ALIGNMENT_LEFT), "left");
            lAlign.addItem(new Integer(Bits.ALIGNMENT_HORIZONTAL_CENTER));
            lAlign.setItemCaption(
                    new Integer(Bits.ALIGNMENT_HORIZONTAL_CENTER), "center");
            lAlign.addItem(new Integer(Bits.ALIGNMENT_RIGHT));
            lAlign.setItemCaption(new Integer(Bits.ALIGNMENT_RIGHT), "right");

            lAlign.addListener(new Property.ValueChangeListener() {
                @Override
                public void valueChange(ValueChangeEvent event) {
                    testPanelLayout.setComponentAlignment(
                            testedLayout,
                            new Alignment(((Integer) lAlign.getValue())
                                    .intValue() + Bits.ALIGNMENT_TOP));
                }
            });
        }
View Full Code Here

Examples of com.vaadin.ui.Alignment

                            newLayout = new VerticalLayout();
                        }

                        while (currentLayout.getComponentCount() > 0) {
                            Component child = currentLayout.getComponent(0);
                            Alignment alignment = currentLayout
                                    .getComponentAlignment(child);
                            float expRatio = currentLayout
                                    .getExpandRatio(child);
                            newLayout.addComponent(child);
                            newLayout.setExpandRatio(child, expRatio);
View Full Code Here

Examples of com.vaadin.ui.Alignment

                                return;
                            }
                            try {
                                Field field = Alignment.class
                                        .getDeclaredField(value);
                                Alignment alignment = (Alignment) field
                                        .get(null);
                                parent.setComponentAlignment(SampleChild.this,
                                        alignment);
                            } catch (Exception e) {
                                throw new RuntimeException(e);
View Full Code Here

Examples of de.codolith.Cinema.Alignment

  }
 
  @Override
  public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    if(args.length==3){
      Alignment alignment = Alignment.vertical0;
      try{
        int align = Integer.parseInt(args[2]);
        alignment = Alignment.values()[align];
      }catch(NumberFormatException nfe){
        try{
View Full Code Here

Examples of de.eydamos.guiadvanced.util.Alignment

            guiBackpack.addSubPart(btn_clear);
            guiBackpack.addSubPart(btn_save);
        }

        int textPositionX = 28;
        Alignment alignment = Alignment.LEFT;
        if(backpack.isIntelligent()) {
            textPositionX = guiBackpack.getWidth() / 2;
            alignment = Alignment.CENTER;
        }
        int textPositionY = 6;
View Full Code Here

Examples of edu.isi.karma.modeling.alignment.Alignment

    }
    Worksheet worksheet = workspace.getWorksheet(worksheetId);
    SuperSelection selection = getSuperSelection(worksheet);
    OntologyManager ontMgr = workspace.getOntologyManager();
    String alignmentId = AlignmentManager.Instance().constructAlignmentId(workspace.getId(), worksheetId);
    Alignment alignment = AlignmentManager.Instance().getAlignment(alignmentId);
    if (alignment == null) {
      alignment = new Alignment(ontMgr);
      AlignmentManager.Instance().addAlignmentToMap(alignmentId, alignment);
    }
   
    // Save the original alignment for undo
    oldAlignment = alignment.getAlignmentClone();
    oldGraph = (DirectedWeightedMultigraph<Node, DefaultLink>)alignment.getGraph().clone();
   
    /*** Add the appropriate nodes and links in alignment graph ***/
    List<SemanticType> typesList = new ArrayList<SemanticType>();
    for (int i = 0; i < typesArr.length(); i++) {
      try {
        LabeledLink newLink = null;
        JSONObject type = typesArr.getJSONObject(i);
       
        String domainValue;
        // For property semantic types, domain uri goes to "domainValue" and link uri goes to "fullTypeValue".
        // For class semantic type, class uri goes "fullTypeValue" and "domainValue" is empty.
        if(type.has(ClientJsonKeys.DomainId.name()))
          domainValue = type.getString(ClientJsonKeys.DomainId.name());
        else
          domainValue = type.getString("Domain"); //For backward compatibility to older models
        String fullTypeValue = type.getString(ClientJsonKeys.FullType.name());
//        logger.trace("FULL TYPE:" + type.getString(ClientJsonKeys.FullType.name()));
//        logger.trace("Domain: " + type.getString(ClientJsonKeys.Domain.name()));
       
        // Look if the domain value exists. If it exists, then it is a domain of a data property. If not
        // then the value in FullType has the the value which indicates if a new class instance is needed
        // or an existing class instance should be used (this is the case when just the class is chosen as a sem type).
//        Label domainName = null;
       
        boolean isClassSemanticType = false;
        boolean semanticTypeAlreadyExists = false;
        Node domain = null;
        String domainUriOrId;
        Label linkLabel;
       
        // if domain value is empty, semantic type is a class semantic type
        if (domainValue.equals("")) {
          isClassSemanticType = true;
          domainUriOrId = fullTypeValue;
          linkLabel = ClassInstanceLink.getFixedLabel();
        } else {
          isClassSemanticType = false;
          domainUriOrId = domainValue;
          linkLabel = ontMgr.getUriLabel(fullTypeValue);
          if (linkLabel == null) {
            logger.error("URI/ID does not exist in the ontology or model: " + fullTypeValue);
            continue;
          }
        }
       
        if(domainUriOrId.endsWith(" (add)"))
          domainUriOrId = domainUriOrId.substring(0, domainUriOrId.length()-5).trim();
       
        domain = alignment.getNodeById(domainUriOrId);
        logger.info("Got domain for domainUriOrId:" + domainUriOrId + " ::" + domain);
        if (domain == null) {
          Label label = ontMgr.getUriLabel(domainUriOrId);
//          if (label == null) {
//            logger.error("URI/ID does not exist in the ontology or model: " + domainUriOrId);
//            continue;
//          }
          if (label == null) {
            if(type.has(ClientJsonKeys.DomainUri.name())) {
              label = new Label(type.getString(ClientJsonKeys.DomainUri.name()));
            } else {
              //This part of the code is for backward compatibility. Newer models should have domainUri
              int len = domainValue.length();
              if ((len > 1) && Character.isDigit(domainValue.charAt(len-1))) {
                String newDomainValue = domainValue.substring(0, len-1);
                label = ontMgr.getUriLabel(newDomainValue);
              }
              if (label == null) {
                logger.error("No graph node found for the node: " + domainValue);
                return new UpdateContainer(new ErrorUpdate("" +
                "Error occured while setting semantic type!"));
              }
            }
          }
          domain = alignment.addInternalNode(label);
        }
         
        // Check if a semantic type already exists for the column
        ColumnNode columnNode = alignment.getColumnNodeByHNodeId(hNodeId);
        columnNode.setRdfLiteralType(rdfLiteralType);
        List<LabeledLink> columnNodeIncomingLinks = alignment.getIncomingLinks(columnNode.getId());
        LabeledLink oldIncomingLinkToColumnNode = null;
        Node oldDomainNode = null;
        if (columnNodeIncomingLinks != null && !columnNodeIncomingLinks.isEmpty()) { // SemanticType already assigned
          semanticTypeAlreadyExists = true;
          oldIncomingLinkToColumnNode = columnNodeIncomingLinks.get(0);
          oldDomainNode = oldIncomingLinkToColumnNode.getSource();
        }

        if (type.getBoolean(ClientJsonKeys.isPrimary.name())) {
         
          if (isClassSemanticType) {
            if (semanticTypeAlreadyExists && oldDomainNode == domain) {
              newLink = oldIncomingLinkToColumnNode;
              // do nothing;
            } else if (semanticTypeAlreadyExists) {
              alignment.removeLink(oldIncomingLinkToColumnNode.getId());
//              alignment.removeNode(oldDomainNode.getId());
              newLink = alignment.addClassInstanceLink(domain, columnNode, LinkKeyInfo.None);
            } else {
              newLink = alignment.addClassInstanceLink(domain, columnNode, LinkKeyInfo.None);
            }
          }
          // Property semantic type
          else {

            // When only the link changes between the class node and the internal node (domain)
            if (semanticTypeAlreadyExists && oldDomainNode == domain) {
              alignment.removeLink(oldIncomingLinkToColumnNode.getId());
              newLink = alignment.addDataPropertyLink(domain, columnNode, linkLabel);
            }
            // When there was an existing semantic type and the new domain is a new node in the graph and semantic type already existed
            else if (semanticTypeAlreadyExists) {
              alignment.removeLink(oldIncomingLinkToColumnNode.getId());
//              alignment.removeNode(oldDomainNode.getId());
              newLink = alignment.addDataPropertyLink(domain, columnNode, linkLabel);
            } else {
              newLink = alignment.addDataPropertyLink(domain, columnNode, linkLabel);
            }           
          }
        } else { // Synonym semantic type
          SemanticType synType = new SemanticType(hNodeId, linkLabel, domain.getLabel(), SemanticType.Origin.User, 1.0);
          typesList.add(synType);
        }
       
        // Create the semantic type object
        newType = new SemanticType(hNodeId, linkLabel, domain.getLabel(), SemanticType.Origin.User, 1.0);
//        newType = new SemanticType(hNodeId, classNode.getLabel(), null, SemanticType.Origin.User, 1.0,isPartOfKey);
        columnNode.setUserSelectedSemanticType(newType);
       
        if(newLink != null) {
          alignment.changeLinkStatus(newLink.getId(),
              LinkStatus.ForcedByUser);
        }
        // Update the alignment
        if(!this.isExecutedInBatch())
          alignment.align();

      } catch (JSONException e) {
        logger.error("JSON Exception occured", e);
      }
    }
View Full Code Here

Examples of edu.umd.hooka.Alignment

    System.out.println("OLD:\n" + at);
    System.out.println("NEW:\n" + ac);
    System.out.println("\nnew:\n"+tc);
    //if (true) return;
    PerplexityReporter cr = new PerplexityReporter();
    Alignment a = hmm.viterbiAlign(pp, cr);
    double ce1 = cr.getCrossEntropy();
    System.out.println(a.toStringVisual() + "\n"+cr);
    assertTrue(a.aligned(0, 0));
    System.out.println(hmm.backtrace);
    hmm = new HMM(tc, ac);
    hmm.buildHMMTables(pp);
    cr.reset();
    a = hmm.viterbiAlign(pp, cr);
    double ce2 = cr.getCrossEntropy();
    // perplexity should decrease!
    assertTrue(ce1 > ce2);
    assert(tc.get(1,1) > 0.0f);
    System.out.println(a.toStringVisual() + "\n" + cr + "\nPG::\n" + hmm.computeAlignmentPosteriors(pp));
    assertEquals(a.getELength(), e.size());
    assertEquals(a.getFLength(), f.size());
  }
View Full Code Here

Examples of net.sourceforge.align.Alignment

    for (Alignment leftAlignment : leftAlignmentList) {
      int index = startIndex;
      Iterator<Alignment> rightIterator =
        rightAlignmentList.listIterator(index);
      while(rightIterator.hasNext()) {
        Alignment rightAlignment = rightIterator.next();
        if (leftAlignment.equals(rightAlignment)) {
          rightOnlyAlignmentList.addAll(
              rightAlignmentList.subList(startIndex, index));
          startIndex = index + 1;
          break;
View Full Code Here

Examples of net.sourceforge.align.coretypes.Alignment

      }
      List<String> sourceList = createSubList(sourceSegmentList,
          x, x + bestCategory.getSourceSegmentCount());
      List<String> targetList = createSubList(targetSegmentList,
          y, y + bestCategory.getTargetSegmentCount());
      Alignment alignment =
          new Alignment(sourceList, targetList, bestScore);
      alignmentList.add(alignment);
      x += bestCategory.getSourceSegmentCount();
      y += bestCategory.getTargetSegmentCount();
      log.trace("(" + x + ", " + y + ") - s: " + bestScore + " (" + Math.exp(-bestScore) + ")");
    }
View Full Code Here

Examples of nextapp.echo2.app.Alignment

        this.setStyleName("Default");
        this.setText(title);
        this.setWidth(new JbsExtent(100, JbsExtent.PERCENT));
        //this.setHeight(new (48, .PX));
        this.setStdColor(this.getBackground());
        this.setAlignment(new Alignment(Alignment.LEFT, Alignment.CENTER));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.