Search in sources :

Example 1 with CommonContextMenuEvent

use of com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent in project Gargoyle by callakrsos.

the class CommonsContextMenu method addMenuEvent.

/**
	 * @Date 2015. 10. 14.
	 * @param tableView
	 * @return
	 * @User KYJ
	 */
private static MenuItem addMenuEvent(Control node) {
    MenuItem menuItem = new MenuItem("추가");
    menuItem.addEventHandler(ActionEvent.ACTION, event -> {
        CommonContextMenuEvent addMenuEvent = new CommonContextMenuEvent(node, menuItem, Menus.ADD);
        node.fireEvent(addMenuEvent);
    });
    return menuItem;
}
Also used : CommonContextMenuEvent(com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent) MenuItem(javafx.scene.control.MenuItem)

Example 2 with CommonContextMenuEvent

use of com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent in project Gargoyle by callakrsos.

the class CommonsContextMenu method downMenuEvent.

/**
	 * 아래로
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 2. 15.
	 * @param node
	 * @return
	 */
private static MenuItem downMenuEvent(Control node) {
    MenuItem menuItem = new MenuItem("아래");
    menuItem.addEventHandler(ActionEvent.ACTION, event -> {
        CommonContextMenuEvent addMenuEvent = new CommonContextMenuEvent(node, menuItem, Menus.DOWN);
        node.fireEvent(addMenuEvent);
    });
    return menuItem;
}
Also used : CommonContextMenuEvent(com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent) MenuItem(javafx.scene.control.MenuItem)

Example 3 with CommonContextMenuEvent

use of com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent in project Gargoyle by callakrsos.

the class CommonsContextMenu method upMenuEvent.

/**
	 * 위로
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 2. 15.
	 * @param node
	 * @return
	 */
private static MenuItem upMenuEvent(Control node) {
    MenuItem menuItem = new MenuItem("위");
    menuItem.addEventHandler(ActionEvent.ACTION, event -> {
        CommonContextMenuEvent addMenuEvent = new CommonContextMenuEvent(node, menuItem, Menus.UP);
        node.fireEvent(addMenuEvent);
    });
    return menuItem;
}
Also used : CommonContextMenuEvent(com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent) MenuItem(javafx.scene.control.MenuItem)

Example 4 with CommonContextMenuEvent

use of com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent in project Gargoyle by callakrsos.

the class CommonsContextMenu method deleteMenuEvent.

/**
	 * @Date 2015. 10. 14.
	 * @param tableView
	 * @return
	 * @User KYJ
	 */
private static MenuItem deleteMenuEvent(Control node) {
    MenuItem menuItem = new MenuItem("삭제");
    menuItem.addEventHandler(ActionEvent.ACTION, event -> {
        CommonContextMenuEvent addMenuEvent = new CommonContextMenuEvent(node, menuItem, Menus.DELETE);
        node.fireEvent(addMenuEvent);
    });
    return menuItem;
}
Also used : CommonContextMenuEvent(com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent) MenuItem(javafx.scene.control.MenuItem)

Example 5 with CommonContextMenuEvent

use of com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent in project Gargoyle by callakrsos.

the class VoEditorController method initialize.

/**
	 * 이벤트 초기화
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2015. 10. 15.
	 */
@FXML
public void initialize() {
    colType.setCellFactory(new ClassTypeCheckBoxCellFactory());
    colName.setCellFactory(TextFieldTableCell.forTableColumn());
    colSize.setCellFactory(TextFieldTableCell.forTableColumn());
    colDesc.setCellFactory(TextFieldTableCell.forTableColumn());
    CommonsContextMenu.addMenus(tbVoEditor, (Menus.useCudButtons() | Menus.UP | Menus.DOWN));
    // tbVoEditor.setContextMenu();
    tbVoEditor.addEventHandler(ActionEvent.ACTION, event -> {
        if (event instanceof CommonContextMenuEvent) {
            CommonContextMenuEvent _event = (CommonContextMenuEvent) event;
            int mode = _event.getMode();
            ObservableList<TableModelDVO> items = tbVoEditor.getItems();
            int selectedIndex = tbVoEditor.getSelectionModel().getSelectedIndex();
            int rowSize = items.size();
            boolean isMove = false;
            if (Menus.isAdd(mode)) {
                items.add(defaultTableModelDVO());
                isMove = true;
            } else if (Menus.isDelete(mode)) {
                items.remove(selectedIndex);
                isMove = true;
            } else if (Menus.isUp(mode)) {
                btnUpOnMouseClick();
            } else if (Menus.isDown(mode)) {
                btnDownOnMouseClick();
            }
            if (isMove) {
                tbVoEditor.getSelectionModel().select(rowSize - 1);
            }
        }
    });
    // 컨트롤 키를 누르면 그리드 데이터 이동처리.
    tbVoEditor.setOnKeyPressed(event -> {
        if (event.isControlDown()) {
            KeyCode code = event.getCode();
            switch(code) {
                case UP:
                    btnUpOnMouseClick();
                    break;
                case DOWN:
                    btnDownOnMouseClick();
                    break;
                default:
                    break;
            }
            event.consume();
        }
    });
    btnGenerate.addEventHandler(MouseEvent.MOUSE_CLICKED, this::btnGenerateOnMouseClick);
    btnSelect.setOnMouseClicked(this::btnSelectOnMouseClick);
    btnDatabase.setOnMouseClicked(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {
            DatabaseTableView databaseTableView = new DatabaseTableView();
            TableDVO show = databaseTableView.show();
            if (show != null) {
                TableMasterDVO tableMasterDVO = show.getTableMasterDVO();
                List<TableModelDVO> tableModelDVOList = show.getTableModelDVOList();
                ObservableList<TableModelDVO> items = tbVoEditor.getItems();
                if (tableMasterDVO != null) {
                    txtClassName.setText(tableMasterDVO.getClassName());
                    txtAreaDesc.setText(tableMasterDVO.getDescription());
                }
                if (tableModelDVOList != null) {
                    items.clear();
                    items.addAll(tableModelDVOList);
                }
            }
        }
    });
}
Also used : TableMasterDVO(kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO) CommonContextMenuEvent(com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent) MouseEvent(javafx.scene.input.MouseEvent) TableModelDVO(kyj.Fx.dao.wizard.core.model.vo.TableModelDVO) DatabaseTableView(com.kyj.fx.voeditor.visual.component.popup.DatabaseTableView) ClassTypeCheckBoxCellFactory(com.kyj.fx.voeditor.visual.component.ClassTypeCheckBoxCellFactory) TableDVO(kyj.Fx.dao.wizard.core.model.vo.TableDVO) ObservableList(javafx.collections.ObservableList) KeyCode(javafx.scene.input.KeyCode) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) FXML(javafx.fxml.FXML)

Aggregations

CommonContextMenuEvent (com.kyj.fx.voeditor.visual.events.CommonContextMenuEvent)6 MenuItem (javafx.scene.control.MenuItem)4 ClassTypeCheckBoxCellFactory (com.kyj.fx.voeditor.visual.component.ClassTypeCheckBoxCellFactory)1 DatabaseTableView (com.kyj.fx.voeditor.visual.component.popup.DatabaseTableView)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ObservableList (javafx.collections.ObservableList)1 FXML (javafx.fxml.FXML)1 KeyCode (javafx.scene.input.KeyCode)1 MouseEvent (javafx.scene.input.MouseEvent)1 TableDVO (kyj.Fx.dao.wizard.core.model.vo.TableDVO)1 TableMasterDVO (kyj.Fx.dao.wizard.core.model.vo.TableMasterDVO)1 TableModelDVO (kyj.Fx.dao.wizard.core.model.vo.TableModelDVO)1 TbpSysDaoMethodsDVO (kyj.Fx.dao.wizard.core.model.vo.TbpSysDaoMethodsDVO)1