Permalink
Browse files

Merge branch 'master' of https://github.com/lotus-tool/lotus-tool

  • Loading branch information...
Bruno Silva Barbosa
Bruno Silva Barbosa committed Nov 29, 2016
2 parents a2cd968 + 4d532cc commit 0312c3a24007b14026adadfacea0a49abe0d22da
@@ -475,13 +475,13 @@ public DesignerWindowImpl(ComponentView viewer) {
mBtnUndo = new Button();
mBtnUndo.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/images/ic_undo.png"))));
mBtnUndo.setOnAction((ActionEvent event) -> {
//historicoViewer("Desfazer");
historicoViewer("Desfazer");
});

mBtnRedo = new Button();
mBtnRedo.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("/images/ic_redo.png"))));
mBtnRedo.setOnAction((ActionEvent event) -> {
//historicoViewer("Refazer");
historicoViewer("Refazer");
});

//Set Colors-----------------------------------------------------------------------------------
@@ -615,7 +615,7 @@ else if(valorDoField.contains("%")){
Tooltip.install(mBtnRedo, redoInfo);

mToolbar.getItems().addAll(mBtnArrow, mBtnState, mBtnTransitionLine, mBtnTransitionArc, mBtnEraser, mBtnHand, mBtnZoom, mBtnBigState,
new Separator(Orientation.VERTICAL),paleta);//mBtnUndo, mBtnRedo); //, new Separator(), txtGuard, txtProbability, txtLabel);
new Separator(Orientation.VERTICAL),paleta, mBtnUndo, mBtnRedo); //, new Separator(), txtGuard, txtProbability, txtLabel);

mStateToolbar = new ToolBar();
mStateToolbar.setVisible(false);
@@ -1021,7 +1021,7 @@ public void updateContID() {
}

//Historico para Desfazer e Refazer
/*private void historicoViewer(String opcao) {
private void historicoViewer(String opcao) {
switch(opcao){
case "Desfazer":{
if(contPosHistoricoCheia>0){
@@ -1048,6 +1048,6 @@ private void addHistorico(ComponentView viewer){
mUndoRedo[contPosHistoricoCheia] = viewer;
contPosHistoricoCheia+=1;
}
}*/
}

}
@@ -10,23 +10,29 @@
import br.uece.lotus.viewer.StateView;
import br.uece.lotus.viewer.StateViewImpl;
import br.uece.lotus.viewer.TransitionView;
import java.awt.AWTException;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.util.List;
import javafx.scene.input.DragEvent;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.ScrollEvent;
import javax.swing.JOptionPane;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
* Created by lva on 19/11/15.
*/
public class OnClickedMouse implements Strategy {

@Override
public void onClickedMouse(DesignerWindowImpl dwi, MouseEvent e) {

if (MouseButton.SECONDARY.equals(e.getButton())) {
dwi.setComponenteSelecionado(dwi.mComponentSobMouse);

@@ -38,7 +44,7 @@ public void onClickedMouse(DesignerWindowImpl dwi, MouseEvent e) {
}
return;
} else {
dwi.mComponentContextMenu.hide();
dwi.mComponentContextMenu.hide();
}

if (e.isControlDown() && e.getButton() == MouseButton.MIDDLE) {
@@ -48,11 +54,13 @@ public void onClickedMouse(DesignerWindowImpl dwi, MouseEvent e) {

dwi.mViewer.getNode().setTranslateX(dwi.mViewerTranslateXPadrao);
dwi.mViewer.getNode().setTranslateY(dwi.mViewerTranslateYPadrao);
}

if (dwi.mModoAtual == MODO_NENHUM) {

if (dwi.mComponentSobMouse != null && (dwi.mComponentSobMouse instanceof StateView)) {
} else if (dwi.mModoAtual == MODO_NENHUM) {
if (dwi.mComponentSobMouse != null && (dwi.mComponentSobMouse instanceof TransitionView)) {
//Foco alterado para o txtaction
dwi.setComponenteSelecionado(dwi.mComponentSobMouse);
}
else if (dwi.mComponentSobMouse != null && (dwi.mComponentSobMouse instanceof StateView)) {
dwi.paleta.setVisible(true);
//VERIFICANDO SE TEM UM BIGSTATE
StateView stateView = (StateView) dwi.mComponentSobMouse;
@@ -64,29 +72,28 @@ public void onClickedMouse(DesignerWindowImpl dwi, MouseEvent e) {
/*System.out.println("NUMERO DE BIGSTATES = "+BigState.todosOsBigStates.size());
System.out.println(((BigState)((StateView)mComponentSobMouse).getState().getValue("bigstate")).toString());*/
if (e.getClickCount() == 2) {
if (!bigState.dismountBigState(dwi.mViewer.getComponent())){
if (!bigState.dismountBigState(dwi.mViewer.getComponent())) {
JOptionPane.showMessageDialog(null, "You need another BigState before dismantling");
return;
}
dwi.mBtnBigState.setSelected(false);
dwi.mBtnBigState.setGraphic(dwi.iconBigState);
dwi.mViewer.getComponent().remove(state);
}
}
else {
} else {
dwi.mBtnBigState.setSelected(false);
dwi.mBtnBigState.setGraphic(dwi.iconBigState);
}
}else{
} else {
dwi.mBtnBigState.setSelected(false);
dwi.mBtnBigState.setGraphic(dwi.iconBigState);

if(!dwi.statesSelecionadoPeloRetangulo){
if (!dwi.statesSelecionadoPeloRetangulo) {
dwi.paleta.setVisible(false);
}
dwi.setComponenteSelecionado(null);
}
}else {

} else {
if (dwi.mModoAtual == MODO_VERTICE) {
if (!(dwi.mComponentSobMouse instanceof StateView)) {
if (dwi.contID == -1) {
@@ -96,40 +103,36 @@ public void onClickedMouse(DesignerWindowImpl dwi, MouseEvent e) {
State s = dwi.mViewer.getComponent().newState(id);
s.setID(dwi.contID);
dwi.contID++;
s.setLayoutX(e.getX()-(StateViewImpl.RAIO_CIRCULO));
s.setLayoutY(e.getY()-(StateViewImpl.RAIO_CIRCULO));
s.setLayoutX(e.getX() - (StateViewImpl.RAIO_CIRCULO));
s.setLayoutY(e.getY() - (StateViewImpl.RAIO_CIRCULO));
s.setLabel(String.valueOf(id));

if (dwi.mViewer.getComponent().getStatesCount() == 0) {
dwi.mViewer.getComponent().setInitialState(s);
}
}
}else if (dwi.mModoAtual == MODO_REMOVER) {


} else if (dwi.mModoAtual == MODO_REMOVER) {

/*if there are states that are selected and the eraser button was chosen
so erase all selected transitions from the component*/

if(!dwi.statesSelecionados.isEmpty()&& dwi.mComponentSobMouse instanceof StateView){


if (!dwi.statesSelecionados.isEmpty() && dwi.mComponentSobMouse instanceof StateView) {

State v = ((StateView) dwi.mComponentSobMouse).getState();
if(!dwi.statesSelecionados.contains(v)){
if (!dwi.statesSelecionados.contains(v)) {
return;
}
for(State s : dwi.statesSelecionados){

for (State s : dwi.statesSelecionados) {
dwi.mViewer.getComponent().remove(s);
}
dwi.statesSelecionados.clear();

return;
}



if (dwi.mComponentSobMouse instanceof StateView) {
State v = ((StateView) dwi.mComponentSobMouse).getState();
if(v.getValue("bigstate") instanceof BigState){
if (v.getValue("bigstate") instanceof BigState) {
BigState.removeBigState((BigState) v.getValue("bigstate"));
}
dwi.mViewer.getComponent().remove(v);
@@ -140,13 +143,13 @@ public void onClickedMouse(DesignerWindowImpl dwi, MouseEvent e) {
dwi.mViewer.getComponent().remove(t);
//Verificar Mais de uma Trasition do mesmo Source e Destiny
List<Transition> multiplasTransicoes = iniTransition.getTransitionsTo(fimTransition);
if(multiplasTransicoes.size() > 0){
if (multiplasTransicoes.size() > 0) {
//deletar da tela
for(Transition trans : multiplasTransicoes){
for (Transition trans : multiplasTransicoes) {
dwi.mViewer.getComponent().remove(trans);
}
//recriar transitions
for(Transition trans : multiplasTransicoes){
for (Transition trans : multiplasTransicoes) {
dwi.mViewer.getComponent().buildTransition(iniTransition, fimTransition)
.setGuard(trans.getGuard())
.setLabel(trans.getLabel())
@@ -160,7 +163,6 @@ public void onClickedMouse(DesignerWindowImpl dwi, MouseEvent e) {
}
}


@Override
public void onMovedMouse(DesignerWindowImpl Dwi, MouseEvent event) {
}
@@ -186,14 +188,19 @@ public void onReleasedMouse(DesignerWindowImpl Dwi, MouseEvent event) {
}

@Override
public void onDragOverMouse(DesignerWindowImpl dwi, DragEvent event) {}
public void onDragOverMouse(DesignerWindowImpl dwi, DragEvent event) {
}

@Override
public void onScrollMouse(DesignerWindowImpl dwi, ScrollEvent event) {}
public void onScrollMouse(DesignerWindowImpl dwi, ScrollEvent event) {
}

@Override
public void onKeyPressed(DesignerWindowImpl dwi, KeyEvent event) {}
public void onKeyPressed(DesignerWindowImpl dwi, KeyEvent event) {
}

@Override
public void onKeyReleased(DesignerWindowImpl dwi, KeyEvent event) {}
public void onKeyReleased(DesignerWindowImpl dwi, KeyEvent event) {
}

}
@@ -157,8 +157,6 @@ public void handle(MouseEvent e) {
TransitionView transitionView = mViewer.locateTransitionView(new Point2D(e.getSceneX(), e.getSceneY()));



//SimulatorUtils.applyEnableStyle(t);

/*EXECUCAO DO CLIQUE NO ESTADO*/

0 comments on commit 0312c3a

Please sign in to comment.