Search in sources :

Example 1 with FxPostInitialize

use of com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize in project Gargoyle by callakrsos.

the class LogViewController method onAfter.

@FxPostInitialize
public void onAfter() throws IOException {
    File monitoringFile = composite.getMonitoringFile();
    fileChannel = FileChannel.open(monitoringFile.toPath(), StandardOpenOption.READ);
    buffer = ByteBuffer.allocate(seekSize);
    String encoding = ResourceLoader.loadCharset();
    if (Charset.isSupported(encoding)) {
        charset.set(Charset.forName(encoding));
    } else {
        LOGGER.info("does not supported encoding {} , default utf-8 setting. ", encoding);
        encoding = "UTF-8";
        charset.set(Charset.forName(encoding));
    }
    //설정에 저장된 인코딩셋을 불러와 디폴트로 선택되게함.
    ObservableList<Toggle> toggles = ENCODING.getToggles();
    toggles.stream().map(tg -> {
        if (tg instanceof RadioMenuItem) {
            RadioMenuItem r = (RadioMenuItem) tg;
            if (r.getText().toUpperCase().equals(charset.get().name().toUpperCase())) {
                return r;
            }
        }
        return null;
    }).filter(v -> v != null).findFirst().ifPresent(rmi -> {
        rmi.setSelected(true);
    });
    //캐릭터셋이 변경될때 환경변수에 등록하는 과정
    this.charset.addListener((oba, o, newCharset) -> {
        String name = newCharset.name();
        if (ValueUtil.isEmpty(name)) {
            return;
        }
        ResourceLoader.saveCharset(name);
    });
}
Also used : Button(javafx.scene.control.Button) RadioMenuItem(javafx.scene.control.RadioMenuItem) LoggerFactory(org.slf4j.LoggerFactory) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FXCollections(javafx.collections.FXCollections) Timer(java.util.Timer) ByteBuffer(java.nio.ByteBuffer) Charset(java.nio.charset.Charset) TimerTask(java.util.TimerTask) KeyCode(javafx.scene.input.KeyCode) ObjectProperty(javafx.beans.property.ObjectProperty) Logger(org.slf4j.Logger) RuntimeException(com.sun.star.uno.RuntimeException) StandardOpenOption(java.nio.file.StandardOpenOption) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) IOException(java.io.IOException) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) LongProperty(javafx.beans.property.LongProperty) CodeArea(org.fxmisc.richtext.CodeArea) KeyEvent(javafx.scene.input.KeyEvent) File(java.io.File) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) ResourceLoader(com.kyj.fx.voeditor.visual.momory.ResourceLoader) BooleanProperty(javafx.beans.property.BooleanProperty) ActionEvent(javafx.event.ActionEvent) ToggleGroup(javafx.scene.control.ToggleGroup) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) ToggleButton(javafx.scene.control.ToggleButton) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Closeable(java.io.Closeable) Window(javafx.stage.Window) Toggle(javafx.scene.control.Toggle) ObservableList(javafx.collections.ObservableList) FileChannel(java.nio.channels.FileChannel) SimpleLongProperty(javafx.beans.property.SimpleLongProperty) Toggle(javafx.scene.control.Toggle) RadioMenuItem(javafx.scene.control.RadioMenuItem) File(java.io.File) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize)

Example 2 with FxPostInitialize

use of com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize in project Gargoyle by callakrsos.

the class SkinPreviewViewComposite method previewTabInit.

@FxPostInitialize
public void previewTabInit() {
    Task<Void> task = new Task<Void>() {

        @Override
        protected Void call() throws Exception {
            Thread.sleep(5000L);
            Platform.runLater(() -> {
                //메뉴바 배경.
                {
                    Background background = mbSample.getBackground();
                    Color fill = (Color) background.getFills().get(0).getFill();
                    colorMbSample.setValue(fill);
                    //메뉴바 텍스트
                    {
                        Label lookup = (Label) mbSample.lookup(".label");
                        Color textFill = (Color) lookup.getTextFill();
                        colorMbLabelSample.setValue(textFill);
                    }
                }
                //Hbox 배경.
                {
                    Background background = hboxSample.getBackground();
                    Color fill = (Color) background.getFills().get(0).getFill();
                    colorHboxSample.setValue(fill);
                }
                {
                    //선택디지않는 탭 색상 처리.
                    Set<Node> lookupAll = tabpaneSample.lookupAll(".tab:top");
                    lookupAll.forEach(lookup -> {
                        Optional<PseudoClass> findFirst = lookup.getPseudoClassStates().stream().filter(v -> {
                            return "selected".equals(v.getPseudoClassName());
                        }).findFirst();
                        if (findFirst.isPresent()) {
                            Label selectedTabLabel = (Label) lookup.lookup(".tab-label");
                            Color textFill = (Color) selectedTabLabel.getTextFill();
                            colorSelectedTabText.setValue(textFill);
                        } else {
                            Label selectedTabLabel = (Label) lookup.lookup(".tab-label");
                            Color textFill = (Color) selectedTabLabel.getTextFill();
                            colorUnSelectedTabText.setValue(textFill);
                        }
                    });
                    {
                        lookupAll.stream().findFirst().ifPresent(n -> {
                            Pane p = (Pane) n;
                            Background background = p.getBackground();
                            Color fill = (Color) background.getFills().get(0).getFill();
                            colorTabSample1Selected.setValue(fill);
                        });
                    }
                }
            });
            return null;
        }
    };
    Window window = this.getScene().getWindow();
    if (window != null) {
        FxUtil.showLoading(window, task);
    } else
        FxUtil.showLoading(task);
}
Also used : Button(javafx.scene.control.Button) TextArea(javafx.scene.control.TextArea) PseudoClass(javafx.css.PseudoClass) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) DialogUtil(com.kyj.fx.voeditor.visual.util.DialogUtil) TableColumn(javafx.scene.control.TableColumn) Task(javafx.concurrent.Task) TabPane(javafx.scene.control.TabPane) Map(java.util.Map) FileUtil(com.kyj.fx.voeditor.visual.util.FileUtil) TableView(javafx.scene.control.TableView) Pane(javafx.scene.layout.Pane) ColorPicker(javafx.scene.control.ColorPicker) HBox(javafx.scene.layout.HBox) Color(javafx.scene.paint.Color) Pair(javafx.util.Pair) Logger(org.slf4j.Logger) Label(javafx.scene.control.Label) MenuBar(javafx.scene.control.MenuBar) Node(javafx.scene.Node) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) Set(java.util.Set) IOException(java.io.IOException) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) JFXToggleButton(com.jfoenix.controls.JFXToggleButton) Background(javafx.scene.layout.Background) File(java.io.File) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) Stage(javafx.stage.Stage) Optional(java.util.Optional) Window(javafx.stage.Window) SkinManager(com.kyj.fx.voeditor.visual.momory.SkinManager) ObservableList(javafx.collections.ObservableList) BorderPane(javafx.scene.layout.BorderPane) StringProperty(javafx.beans.property.StringProperty) Window(javafx.stage.Window) Task(javafx.concurrent.Task) Set(java.util.Set) Background(javafx.scene.layout.Background) Optional(java.util.Optional) Color(javafx.scene.paint.Color) Label(javafx.scene.control.Label) TabPane(javafx.scene.control.TabPane) Pane(javafx.scene.layout.Pane) BorderPane(javafx.scene.layout.BorderPane) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize)

Example 3 with FxPostInitialize

use of com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize in project Gargoyle by callakrsos.

the class InjectionItemListComposite method loaditems.

@FxPostInitialize
public void loaditems() {
    itemsDir = new File(CODE_DIR);
    if (!itemsDir.exists()) {
        itemsDir.mkdirs();
    }
    List<CodeItem> collect = Stream.of(itemsDir.listFiles(new FilenameFilter() {

        @Override
        public boolean accept(File dir, String name) {
            return name.endsWith(".java");
        }
    })).map(f -> {
        CodeItem codeItem = new CodeItem();
        codeItem.setFile(f);
        codeItem.setName(f.getName());
        return codeItem;
    }).collect(Collectors.toList());
    lvItems.getItems().addAll(collect);
}
Also used : FilenameFilter(java.io.FilenameFilter) HBox(javafx.scene.layout.HBox) ObjectProperty(javafx.beans.property.ObjectProperty) Logger(org.slf4j.Logger) Label(javafx.scene.control.Label) ListView(javafx.scene.control.ListView) ListCell(javafx.scene.control.ListCell) LoggerFactory(org.slf4j.LoggerFactory) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) Collectors(java.util.stream.Collectors) File(java.io.File) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) List(java.util.List) ToggleGroup(javafx.scene.control.ToggleGroup) Stream(java.util.stream.Stream) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) InstanceTypes(com.kyj.fx.voeditor.visual.framework.InstanceTypes) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) RadioButton(javafx.scene.control.RadioButton) BorderPane(javafx.scene.layout.BorderPane) Callback(javafx.util.Callback) FilenameFilter(java.io.FilenameFilter) File(java.io.File) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize)

Example 4 with FxPostInitialize

use of com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize in project Gargoyle by callakrsos.

the class CodeAnalysisJavaTextArea method init.

@FxPostInitialize
public void init() {
    List<SourceAnalysisDVO> methodList = Collections.emptyList();
    try {
        newInstance = new BizFile(javaFile);
        List<String> readLines = newInstance.getReadLines();
        txtJavaTextArea.setContent(readLines);
        // svo = ProgramSpecUtil.doJavaFile("sampleJavaProject",
        // javaFile.getName(), (AbstractJavaProgramSpecFile) newInstance);
        // this.setContent(svo.getFile().getInspectorSourceMeta().getSourceCode());
        SourceCodeAnalysis sa = newInstance.getJavaSourceAnalysis();
        methodList = sa.findStatement();
        choMethod.getItems().addAll(methodList);
    } catch (Exception e) {
        LOGGER.error(ValueUtil.toString(e));
    }
}
Also used : SourceCodeAnalysis(com.kyj.fx.voeditor.visual.words.spec.auto.msword.biz.SourceCodeAnalysis) SourceAnalysisDVO(com.kyj.fx.voeditor.visual.words.spec.auto.msword.vo.SourceAnalysisDVO) BizFile(com.kyj.fx.voeditor.visual.words.spec.auto.msword.model.BizFile) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize)

Example 5 with FxPostInitialize

use of com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize in project Gargoyle by callakrsos.

the class MacroSqlComposite method post.

@FxPostInitialize
public void post() {
    MenuItem menuAddItem = new MenuItem("Add");
    menuAddItem.setAccelerator(new KeyCodeCombination(KeyCode.INSERT, KeyCharacterCombination.CONTROL_DOWN));
    menuAddItem.setOnAction(e -> {
        addOnAction();
    });
    MenuItem menuDeleteItem = new MenuItem("Delete");
    menuDeleteItem.setAccelerator(new KeyCodeCombination(KeyCode.DELETE, KeyCharacterCombination.CONTROL_DOWN));
    menuDeleteItem.setOnAction(e -> {
        addOnAction();
    });
    tvFavorite.setContextMenu(new ContextMenu(menuAddItem, menuDeleteItem));
    borContent.setCenter(new MacroControl(connectionSupplier, initText));
    MacroFavorTreeItemCreator macroFavorTreeItem = new MacroFavorTreeItemCreator(connectionSupplier);
    MacroItemVO f = new MacroItemVO();
    tvFavorite.setRoot(macroFavorTreeItem.createRoot(f));
    tvFavorite.setShowRoot(false);
}
Also used : MenuItem(javafx.scene.control.MenuItem) KeyCodeCombination(javafx.scene.input.KeyCodeCombination) ContextMenu(javafx.scene.control.ContextMenu) FxPostInitialize(com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize)

Aggregations

FxPostInitialize (com.kyj.fx.voeditor.visual.framework.annotation.FxPostInitialize)6 File (java.io.File)4 FXMLController (com.kyj.fx.voeditor.visual.framework.annotation.FXMLController)3 FxUtil (com.kyj.fx.voeditor.visual.util.FxUtil)3 IOException (java.io.IOException)3 FXML (javafx.fxml.FXML)3 Button (javafx.scene.control.Button)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 JFXToggleButton (com.jfoenix.controls.JFXToggleButton)2 ValueUtil (com.kyj.fx.voeditor.visual.util.ValueUtil)2 List (java.util.List)2 Platform (javafx.application.Platform)2 ObjectProperty (javafx.beans.property.ObjectProperty)2 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)2 ObservableList (javafx.collections.ObservableList)2 Label (javafx.scene.control.Label)2 ToggleGroup (javafx.scene.control.ToggleGroup)2 BorderPane (javafx.scene.layout.BorderPane)2 HBox (javafx.scene.layout.HBox)2