Search in sources :

Example 21 with Type

use of model.Type in project uPMT by coco35700.

the class TypeClassRepresentationController method loadProperties.

public void loadProperties() {
    // for each Property, add a representation
    if (!classe.getTypes().isEmpty()) {
        for (Type p : classe.getTypes()) {
            Property prop = (Property) p;
            TypePropertyRepresentation controller = new TypePropertyRepresentation(prop, moment, treeClassTreeItem, main);
            this.properties.getChildren().add(controller);
        }
    }
}
Also used : Type(model.Type) Property(model.Property)

Example 22 with Type

use of model.Type in project uPMT by coco35700.

the class MainViewTransformations method loadTypes.

public static void loadTypes(MomentExpVBox mp, Main main) {
    // System.out.println(mp.getMoment().getNom()+": ");
    for (Type t : mp.getMoment().getTypes()) {
        TypeClassRepresentationController classe = new TypeClassRepresentationController((Category) t, mp, main);
        mp.getTypeSpace().getChildren().add(classe);
        addTypeListener(classe, mp, t, main);
    // System.out.println(t.toString());
    }
// System.out.println("------------------------------------");
}
Also used : Type(model.Type) TypeClassRepresentationController(controller.TypeClassRepresentationController)

Example 23 with Type

use of model.Type in project uPMT by coco35700.

the class MainViewController method duplicate.

private Category duplicate(Category c) {
    Category newc = new Category(c.getName());
    newc.setColor(c.getColor());
    for (Type t : c.getTypes()) {
        newc.addType(t);
    }
    return newc;
}
Also used : AlertType(javafx.scene.control.Alert.AlertType) ButtonType(javafx.scene.control.ButtonType) Type(model.Type) Category(model.Category)

Example 24 with Type

use of model.Type in project uPMT by coco35700.

the class TypeTreeViewControllerClass method rename.

@Override
public void rename() {
    super.rename();
    ChangeListener<Boolean> listener = new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) {
            if (!newPropertyValue) {
                if (type.getType().isCategory()) {
                    String oldName = new String(type.getType().getName());
                    if (!oldName.equals(textField.getText())) {
                        boolean hasName = false;
                        // System.out.println("Parent: "+type.getParent().getName());
                        for (Type classe : type.getParent().getTypes()) {
                            // System.out.println("Classes: "+classe.getName());
                            if (classe.getName().equals(textField.getText())) {
                                hasName = true;
                                break;
                            }
                        }
                        if (!hasName) {
                            RenameClassSchemeCommand cmd = new RenameClassSchemeCommand(type.getClassNameController(), oldName, textField.getText(), main);
                            cmd.execute();
                            UndoCollector.INSTANCE.add(cmd);
                        } else {
                            Alert alert = new Alert(AlertType.INFORMATION);
                            alert.setTitle(main._langBundle.getString("invalid_name"));
                            alert.setHeaderText(null);
                            alert.setContentText(main._langBundle.getString("class_name_invalid"));
                            alert.show();
                        }
                    }
                }
                typePane.setLeft(nomType);
                rename.setDisable(false);
                textField.focusedProperty().removeListener(this);
            }
        }
    };
    textField.setOnKeyPressed(new EventHandler<KeyEvent>() {

        @Override
        public void handle(KeyEvent event) {
            if (event.getCode() == KeyCode.ENTER) {
                if (type.getType().isProperty()) {
                    textField.setText(textField.getText());
                }
                typePane.setLeft(nomType);
                rename.setDisable(false);
            }
            if (event.getCode() == KeyCode.ESCAPE) {
                typePane.setLeft(nomType);
                rename.setDisable(true);
            }
        }
    });
    textField.focusedProperty().addListener(listener);
    typePane.setLeft(textField);
    Platform.runLater(() -> textField.requestFocus());
    Platform.runLater(() -> textField.selectAll());
}
Also used : KeyEvent(javafx.scene.input.KeyEvent) Type(model.Type) AlertType(javafx.scene.control.Alert.AlertType) ObservableValue(javafx.beans.value.ObservableValue) RenameClassSchemeCommand(controller.command.RenameClassSchemeCommand) ChangeListener(javafx.beans.value.ChangeListener) Alert(javafx.scene.control.Alert)

Aggregations

Type (model.Type)14 Type (ca.uhn.hl7v2.model.Type)10 AlertType (javafx.scene.control.Alert.AlertType)8 ButtonType (javafx.scene.control.ButtonType)5 HL7Exception (ca.uhn.hl7v2.HL7Exception)4 TypeController (controller.controller.TypeController)4 Property (model.Property)4 Composite (ca.uhn.hl7v2.model.Composite)3 ChangeListener (javafx.beans.value.ChangeListener)3 ObservableValue (javafx.beans.value.ObservableValue)3 Alert (javafx.scene.control.Alert)3 TreeItem (javafx.scene.control.TreeItem)3 KeyEvent (javafx.scene.input.KeyEvent)3 Category (model.Category)3 Group (ca.uhn.hl7v2.model.Group)2 Segment (ca.uhn.hl7v2.model.Segment)2 Structure (ca.uhn.hl7v2.model.Structure)2 Varies (ca.uhn.hl7v2.model.Varies)2 ArrayList (java.util.ArrayList)2 TreeMap (java.util.TreeMap)2