@Override
  public void registerAdditionalActions(
      @NotNull DefaultActionGroup leftToolbar,
      @NotNull DefaultActionGroup topToolbar,
      @NotNull DefaultActionGroup settings) {
    Constraints beforeRunner = new Constraints(Anchor.BEFORE, "Runner.Layout");
    leftToolbar.add(Separator.getInstance(), beforeRunner);
    leftToolbar.add(
        ActionManager.getInstance().getAction(DebuggerActions.DUMP_THREADS), beforeRunner);
    leftToolbar.add(Separator.getInstance(), beforeRunner);

    Constraints beforeSort = new Constraints(Anchor.BEFORE, "XDebugger.ToggleSortValues");
    settings.addAction(new WatchLastMethodReturnValueAction(), beforeSort);
    settings.addAction(new AutoVarsSwitchAction(), beforeSort);
  }
 public void testRemoveLast2() {
   String[] oldL = {"A"};
   String[] newL = {};
   String golden = "head {delete} A tail \n";
   ListMatcher matcher = ListMatcher.instance(oldL, newL);
   if (matcher.match()) {
     Separator s = new Separator(matcher.getTransformedResult(), JavaTokenId.COMMA);
     s.compute();
     System.err.println("testRemoveLast2:");
     System.err.println(p(oldL, newL));
     System.err.println(s.print());
     assertEquals(golden, s.print());
   } else {
     assertTrue("No match!", false);
   }
 }
 public void testAddToEmpty() {
   String[] oldL = {};
   String[] newL = {"A", "B", "C"};
   String golden = "head {insert} A next \n" + "{insert} B next \n" + "{insert} C tail \n";
   ListMatcher matcher = ListMatcher.instance(oldL, newL);
   if (matcher.match()) {
     Separator s = new Separator(matcher.getTransformedResult(), JavaTokenId.COMMA);
     s.compute();
     System.err.println("testAddToEmpty: ");
     System.err.println(p(oldL, newL));
     System.err.println(s.print());
     assertEquals(golden, s.print());
   } else {
     assertTrue("No match!", false);
   }
 }
 public void testModify1() {
   String[] oldL = {"A", "X", "C"};
   String[] newL = {"A", "B", "C"};
   String golden = "";
   ListMatcher matcher = ListMatcher.instance(oldL, newL);
   if (matcher.match()) {
     Separator s = new Separator(matcher.getTransformedResult(), JavaTokenId.COMMA);
     s.compute();
     System.err.println("testModify1: ");
     System.err.println(p(oldL, newL));
     System.err.println(s.print());
     assertEquals(golden, s.print());
   } else {
     assertTrue("No match!", false);
   }
 }
 public void testRemoveLastThree() {
   String[] oldL = {"A", "B", "C", "D"};
   String[] newL = {"A"};
   String golden = "previous {delete} B next \n" + "{delete} C next \n" + "{delete} D \n";
   ListMatcher matcher = ListMatcher.instance(oldL, newL);
   if (matcher.match()) {
     Separator s = new Separator(matcher.getTransformedResult(), JavaTokenId.COMMA);
     s.compute();
     System.err.println("testRemoveLastThree:");
     System.err.println(p(oldL, newL));
     System.err.println(s.print());
     assertEquals(golden, s.print());
   } else {
     assertTrue("No match!", false);
   }
 }
Beispiel #6
0
  @Override
  public DatasetProperties detect(BufferedReader br) throws IOException {
    String line;
    int count, i;
    while ((line = br.readLine()) != null) {
      for (Separator s : separators) {
        count = CharMatcher.is(s.getSymbol()).countIn(line);
        if (count == 0) {
          //    separators.remove(s);
        } else {
          System.out.println("symbol " + s.getSymbol() + " cnt: " + count);
        }
        System.out.println(line);
      }
      System.out.println("total sep: " + separators.size());

      //
    }
    return null;
  }
 public void testComplex() {
   String[] oldL = {"A", "B", "C", "D", "E", "F", "G"};
   String[] newL = {"B", "C", "C1", "D", "E", "G", "H"};
   String golden =
       "{delete} A next \n"
           + "{insert} C1 next \n"
           + "{delete} F next \n"
           + "previous {insert} H \n";
   ListMatcher matcher = ListMatcher.instance(oldL, newL);
   if (matcher.match()) {
     Separator s = new Separator(matcher.getTransformedResult(), JavaTokenId.COMMA);
     s.compute();
     System.err.println("testComplex: ");
     System.err.println(p(oldL, newL));
     System.err.println(s.print());
     assertEquals(golden, s.print());
   } else {
     assertTrue("No match!", false);
   }
 }
 public CounterValidation(FTDriver dt) {
   super(dt);
   this.ftprops.add(
       new FTPropEnum(
           dt,
           this.getClass().getName(),
           DELIM,
           "delim",
           "Delimiter character separating fields - if not default",
           Separator.values(),
           Separator.Comma));
 }
 @Override
 protected ActionGroup getActionGroup(boolean inToolbar) {
   DefaultActionGroup actionGroup = new DefaultActionGroup();
   actionGroup.add(new RefreshAction());
   actionGroup.add(Separator.getInstance());
   actionGroup.add(new ActionInstallPlugin(this, installed));
   if (inToolbar) {
     actionGroup.add(new SortByStatusAction("Sort Installed First"));
     actionGroup.add(new MyFilterRepositoryAction());
     actionGroup.add(new MyFilterCategoryAction());
   }
   return actionGroup;
 }
  @NotNull
  protected ArrayList<AnAction> createActions(final boolean fromPopup) {
    final ArrayList<AnAction> result = new ArrayList<AnAction>();
    AbstractAddGroup addAction = createAddAction();
    if (addAction != null) {
      result.add(addAction);
    }
    result.add(new MyRemoveAction());

    final List<? extends AnAction> copyActions = createCopyActions(fromPopup);
    result.addAll(copyActions);
    result.add(Separator.getInstance());

    result.add(new MyFindUsagesAction(myTree));

    return result;
  }
 public DelimitedFileImporter(FTDriver dt) {
   super(dt);
   this.ftprops.add(
       new FTPropEnum(
           dt,
           this.getClass().getName(),
           DELIM,
           "delim",
           "Delimiter character separating fields",
           Separator.values(),
           Separator.Comma));
   this.ftprops.add(
       new FTPropEnum(
           dt,
           this.getClass().getName(),
           HEADROW,
           HEADROW,
           "Treat first row as header",
           YN.values(),
           YN.Y));
 }
 private void initSeparator() {
   WebComponent separator = Separator.create();
   wplMenu.add(separator, posMenuLeft);
 }
  public void addTrip(ViaggioGruppo viaggoGruppo) {
    int i;

    int from = gpPack.getChildren().size();
    int fromRow = gpPackRow;

    RadioButton rb = new RadioButton();
    rb.setId(Integer.toString(viaggoGruppo.getVid()));
    rb.setToggleGroup(this.tg);
    rb.setOnAction(this::buildRight);

    gpPack.add(new Label(viaggoGruppo.getNumPacket().getNome()), 0, gpPackRow);
    gpPack.add(new Label(Integer.toString(viaggoGruppo.getNumPacket().getPrezzo())), 1, gpPackRow);
    gpPack.add(
        new Label(viaggoGruppo.getNumPacket().getOffertaPernotto().getCittà()), 2, gpPackRow);
    gpPack.add(
        new Label(viaggoGruppo.getNumPacket().getOffertaPernotto().getTipologia()), 4, gpPackRow);
    gpPack.add(
        new Label(Integer.toString(viaggoGruppo.getNumPacket().getOffertaPernotto().getStelle())),
        5,
        gpPackRow);
    gpPack.add(
        new Label(
            Integer.toString(viaggoGruppo.getNumPacket().getOffertaPernotto().getNumeroNotti())),
        6,
        gpPackRow);
    gpPack.add(
        new Label(viaggoGruppo.getNumPacket().getOffertaTrasporto().getCittàPartenza()),
        8,
        gpPackRow);
    gpPack.add(
        new Label(viaggoGruppo.getNumPacket().getOffertaTrasporto().getTipologia()), 9, gpPackRow);
    gpPack.add(
        new Label(Integer.toString(viaggoGruppo.getNumPacket().getOffertaTrasporto().getDurata())),
        10,
        gpPackRow);
    gpPack.add(rb, 20, gpPackRow);

    gpPack.add(new Label(Integer.toString(viaggoGruppo.getMinP())), 15, gpPackRow);
    gpPack.add(new Label(Integer.toString(viaggoGruppo.getMaxP())), 16, gpPackRow);
    gpPack.add(new Label(Double.toString(viaggoGruppo.getDiscount())), 17, gpPackRow);
    gpPack.add(new Label(Integer.toString(viaggoGruppo.getNumreserved())), 18, gpPackRow);

    int j = 0;
    for (OffertaEvento events : viaggoGruppo.getNumPacket().getOffertaEvento()) {
      gpPack.add(new Label(events.getNome()), 12, gpPackRow);
      gpPack.add(new Label(events.getTipologia()), 13, gpPackRow);

      j += 2;
      gpPackRow++;
    }

    Separator separator = new Separator();
    gpPack.add(separator, 0, gpPackRow, 19, 1);
    gpPackRow++;

    Separator separator1 = new Separator();
    separator1.setOrientation(Orientation.VERTICAL);

    Separator separator2 = new Separator();
    separator2.setOrientation(Orientation.VERTICAL);

    Separator separator3 = new Separator();
    separator3.setOrientation(Orientation.VERTICAL);

    Separator separator4 = new Separator();
    separator4.setOrientation(Orientation.VERTICAL);

    Separator separator5 = new Separator();
    separator4.setOrientation(Orientation.VERTICAL);

    gpPack.add(separator1, 3, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size());
    gpPack.add(separator2, 7, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size());
    gpPack.add(separator3, 11, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size());
    gpPack.add(separator4, 14, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size());
    gpPack.add(separator5, 19, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size());
  }
  private StackPane buildLeft() {

    StackPane sp = new StackPane();

    sp.setPadding(new Insets(0, 0, 0, 5.0));

    gpPackRow = 1;

    gpPack = new GridPane();

    gpPack.setHgap(15);
    gpPack.setVgap(10);

    Label name = new Label("Nome Viaggio Gruppo");
    name.getStyleClass().add("text-titlesmall");

    Label price = new Label("Prezzo");
    price.getStyleClass().add("text-titlesmall");

    Label citta = new Label("Città");
    citta.getStyleClass().add("text-titlesmall");

    Label tipoPern = new Label("Tipologia");
    tipoPern.getStyleClass().add("text-titlesmall");

    Label stelle = new Label("Stelle");
    stelle.getStyleClass().add("text-titlesmall");

    Label notti = new Label("Numero notti");
    notti.getStyleClass().add("text-titlesmall");

    Label cittaP = new Label("Partenza");
    cittaP.getStyleClass().add("text-titlesmall");

    Label tipoTras = new Label("Tipologia");
    tipoTras.getStyleClass().add("text-titlesmall");

    Label durata = new Label("Durata");
    durata.getStyleClass().add("text-titlesmall");

    Label evento = new Label("Nome evento");
    evento.getStyleClass().add("text-titlesmall");

    Label tipoEven = new Label("Tipologia");
    tipoEven.getStyleClass().add("text-titlesmall");

    Label pernotto = new Label("Pernotto");
    pernotto.getStyleClass().add("text-titlesmall");

    Label trasporto = new Label("Trasporto");
    trasporto.getStyleClass().add("text-titlesmall");

    Label eventi = new Label("Eventi");
    eventi.getStyleClass().add("text-titlesmall");

    Label caratteristiche = new Label("Caratteristiche Viaggio Gruppo");
    caratteristiche.getStyleClass().add("text-titlesmall");

    Label pacchetto = new Label("Pacchetto");
    pacchetto.getStyleClass().add("text-titlesmall");

    Label minL = new Label("Minimo numero partecipanti");
    minL.getStyleClass().add("text-titlesmall");

    Label maxL = new Label("Massimo numero partecipanti");
    maxL.getStyleClass().add("text-titlesmall");

    Label discountL = new Label("Sconto da applicare");
    discountL.getStyleClass().add("text-titlesmall");

    Label reservedL = new Label("Numero Prenotati");
    reservedL.getStyleClass().add("text-titlesmall");

    Separator separator = new Separator();
    gpPack.add(separator, 0, gpPackRow, 20, 1);
    gpPackRow++;

    gpPack.add(pacchetto, 1, 2, 3, 1);
    gpPack.add(pernotto, 4, 2, 3, 1);
    gpPack.add(trasporto, 8, 2, 2, 1);
    gpPack.add(eventi, 12, 2, 2, 1);
    gpPack.add(caratteristiche, 16, 2, 4, 1);

    gpPack.add(name, 0, 3);
    gpPack.add(price, 1, 3);
    gpPack.add(citta, 2, 3);

    gpPack.add(tipoPern, 4, 3);
    gpPack.add(stelle, 5, 3);
    gpPack.add(notti, 6, 3);

    gpPack.add(cittaP, 8, 3);
    gpPack.add(tipoTras, 9, 3);
    gpPack.add(durata, 10, 3);

    gpPack.add(evento, 12, 3);
    gpPack.add(tipoEven, 13, 3);

    gpPack.add(minL, 15, 3);
    gpPack.add(maxL, 16, 3);
    gpPack.add(discountL, 17, 3);
    gpPack.add(reservedL, 18, 3);

    Separator separator1 = new Separator();
    separator1.setOrientation(Orientation.VERTICAL);

    Separator separator2 = new Separator();
    separator2.setOrientation(Orientation.VERTICAL);

    Separator separator3 = new Separator();
    separator3.setOrientation(Orientation.VERTICAL);

    Separator separator4 = new Separator();
    separator4.setOrientation(Orientation.VERTICAL);

    Separator separator6 = new Separator();
    separator4.setOrientation(Orientation.VERTICAL);

    Separator separator7 = new Separator();
    separator4.setOrientation(Orientation.VERTICAL);

    gpPack.add(separator1, 3, 1, 1, 5);
    gpPack.add(separator2, 7, 1, 1, 5);
    gpPack.add(separator3, 11, 1, 1, 5);
    gpPack.add(separator4, 14, 1, 1, 5);
    gpPack.add(separator6, 19, 1, 1, 5);

    gpPackRow += 2;

    Separator separator5 = new Separator();
    gpPack.add(separator5, 0, gpPackRow, 20, 1);
    gpPackRow++;

    List<ViaggioGruppo> viaggi = prenotaViaggioControl.getTrips();
    if (viaggi != null) {
      for (ViaggioGruppo viaggioGruppo : viaggi) {
        this.addTrip(viaggioGruppo);
      }
    }

    sp.getChildren().add(gpPack);

    return sp;
  }
  private static Options deriveOptionsFromTypeInfo(
      ITypeInfo typeInfo, /*IN-OUT*/ List<IPropertyInfo> propsToSet, boolean useStaticProps) {
    List<? extends IPropertyInfo> propertyInfos = typeInfo.getProperties();
    Options options = new Options();
    for (IPropertyInfo propertyInfo : propertyInfos) {
      if (propertyInfo instanceof IGosuVarPropertyInfo) {
        IGosuVarPropertyInfo gsVarPropInfo = (IGosuVarPropertyInfo) propertyInfo;
        if (gsVarPropInfo.hasDeclaredProperty() || gsVarPropInfo.isFinal()) {
          continue;
        }
      }
      if (useStaticProps == propertyInfo.isStatic() && propertyInfo.isWritable(null)) {
        String shortName = getShortName(propertyInfo);
        boolean needsArg = needsArg(propertyInfo);

        GosuOption opt =
            new GosuOption(
                shortName, getLongName(propertyInfo), needsArg, deriveDescription(propertyInfo));
        opt.setHidden(propertyInfo.hasAnnotation(TypeSystem.get(Hidden.class)));

        opt.setRequired(propertyInfo.hasAnnotation(TypeSystem.get(Required.class)));
        if (propertyInfo.getFeatureType().isArray()) {
          opt.setType(propertyInfo.getFeatureType().getComponentType().getName());

          if (propertyInfo.hasAnnotation(TypeSystem.get(ArgNames.class))) {
            ArgNames argNames =
                (ArgNames)
                    propertyInfo
                        .getAnnotationsOfType(TypeSystem.get(ArgNames.class))
                        .get(0)
                        .getInstance();
            if (argNames.names() != null && argNames.names().length > 0) {
              String compoundNames = "";
              for (int i = 0; i < argNames.names().length; i++) {
                if (i != 0) {
                  compoundNames += " ";
                }
                compoundNames += argNames.names()[i];
              }
              opt.setArgName(compoundNames);
              if (propertyInfo.hasAnnotation(TypeSystem.get(ArgOptional.class))) {
                opt.setOptionalArg(true);
              }
              opt.setArgs(argNames.names().length);
            }
          } else {
            opt.setArgs(Option.UNLIMITED_VALUES);
          }

          if (propertyInfo.hasAnnotation(TypeSystem.get(Separator.class))) {
            Separator argNames =
                (Separator)
                    propertyInfo
                        .getAnnotationsOfType(TypeSystem.get(Separator.class))
                        .get(0)
                        .getInstance();
            opt.setValueSeparator(argNames.value().charAt(0));
          }

        } else {
          opt.setType(propertyInfo.getFeatureType().getName());
          if (propertyInfo.hasAnnotation(TypeSystem.get(ArgNames.class))) {
            ArgNames argNames =
                (ArgNames)
                    propertyInfo
                        .getAnnotationsOfType(TypeSystem.get(ArgNames.class))
                        .get(0)
                        .getInstance();
            if (argNames.names() != null && argNames.names().length > 0) {
              opt.setArgName(argNames.names()[0]);
            }
          }
        }

        propsToSet.add(propertyInfo);
        options.addOption(opt);
      }
    }
    return options;
  }
 @Test
 public void defaultConstructorShouldBeHorizontalSeparator() {
   Separator sep = (Separator) (smi.getContent());
   assertEquals(Orientation.HORIZONTAL, sep.getOrientation());
 }
 @Test
 public void defaultConstructorCanChangeSeparatorOrientation() {
   Separator sep = (Separator) (smi.getContent());
   sep.setOrientation(Orientation.VERTICAL);
   assertEquals(Orientation.VERTICAL, sep.getOrientation());
 }
  public IndividualLifeBarTitledPane(final IndividualLifeBar individualLifeBar) {
    this.individualLifeBar = individualLifeBar;

    setText("Configuração LifeBar de Objeto");

    VBox layout = new VBox();

    GridPane gridPane = new GridPane();

    ColumnConstraints col1 = new ColumnConstraints();
    col1.setPercentWidth(40);
    ColumnConstraints col2 = new ColumnConstraints();
    col2.setPercentWidth(30);
    ColumnConstraints col3 = new ColumnConstraints();
    col3.setPercentWidth(30);
    gridPane.getColumnConstraints().addAll(col1, col2, col3);

    Label label = new Label("Objeto");
    gridPane.add(label, 0, 0);

    boxLabelObjects = new ComboBox<String>();
    boxLabelObjects.getItems().addAll(individualLifeBar.getWorld().getObjectIds());

    if (individualLifeBar.getOwnerId() != null) {
      boxLabelObjects.getSelectionModel().select(individualLifeBar.getOwnerId());
    }

    boxLabelObjects.setOnMouseClicked(
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent event) {
            for (String label : individualLifeBar.getWorld().getObjectIds()) {
              if (!boxLabelObjects.getItems().contains(label)) {
                boxLabelObjects.getItems().add(label);
              }
            }
          }
        });

    boxLabelObjects.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            individualLifeBar.setOwner(boxLabelObjects.getValue());
          }
        });

    gridPane.add(boxLabelObjects, 1, 0);
    layout.getChildren().add(gridPane);

    Separator separator = new Separator(Orientation.HORIZONTAL);
    separator.setPadding(new Insets(5, 0, 5, 0));
    layout.getChildren().add(separator);
    layout.setPadding(new Insets(5));

    lifeBarPane = new LifebarPane(individualLifeBar);
    layout.getChildren().add(lifeBarPane);
    ScrollPane scroll = new ScrollPane(layout);
    scroll.setFitToWidth(true);
    setContent(scroll);
  }