- lenghtAdjustable = ((selected.getType() == Type.INLINE) && selected.isVariable());
- if (insertAdjustable) {
- switch (selected.getType()) {
- case END:
- startButton.setEnabled(false);
- middleButton.setEnabled(false);
- endButton.setEnabled(true);
- updateInsertPosition(PositionType.NEXT);
- break;
- case INLINE:
- if (!selected.isVariable()) {
- startButton.setEnabled(true);
- middleButton.setEnabled(true);
- endButton.setEnabled(true);
- } else {
- startButton.setEnabled(false);
- middleButton.setEnabled(false);
- endButton.setEnabled(true);
- updateInsertPosition(PositionType.NEXT);
- }
- break;
- case NOZZLE:
- startButton.setEnabled(false);
- middleButton.setEnabled(false);
- endButton.setEnabled(true);
- updateInsertPosition(PositionType.NEXT);
- break;
- case TURN:
- startButton.setEnabled(false);
- middleButton.setEnabled(true);
- endButton.setEnabled(true);
- if (insertPosition == PositionType.PREVIOUS)
- updateInsertPosition(PositionType.NEXT);
- break;
- case EQUIPMENT:
- throw new RuntimeException("Expected component, got equipment " + selected);
- }
- } else if (lenghtAdjustable) {
- if (component instanceof InlineComponent) {
- startButton.setEnabled(true);
- middleButton.setEnabled(true);
- endButton.setEnabled(true);
- } else if (component instanceof TurnComponent) {
- startButton.setEnabled(false);
- middleButton.setEnabled(true);
- endButton.setEnabled(true);
- if (insertPosition == PositionType.PREVIOUS)
- updateInsertPosition(PositionType.NEXT);
- } else if (component instanceof EndComponent || component instanceof Nozzle) {
- startButton.setEnabled(false);
- middleButton.setEnabled(false);
- endButton.setEnabled(true);
- updateInsertPosition(PositionType.NEXT);
- }
- } else {
- startButton.setEnabled(false);
- middleButton.setEnabled(false);
- endButton.setEnabled(true);
- }
- if (selected.isVariable()) {
+ lenghtAdjustable = ((selected.getType() == Type.INLINE) && selected.isVariable());
+ if (insertAdjustable) {
+ switch (selected.getType()) {
+ case END:
+ startButton.setEnabled(false);
+ middleButton.setEnabled(false);
+ endButton.setEnabled(true);
+ updateInsertPosition(PositionType.NEXT);
+ break;
+ case INLINE:
+ if (!selected.isVariable()) {
+ startButton.setEnabled(true);
+ middleButton.setEnabled(true);
+ endButton.setEnabled(true);
+ } else {
+ startButton.setEnabled(false);
+ middleButton.setEnabled(false);
+ endButton.setEnabled(true);
+ updateInsertPosition(PositionType.NEXT);
+ }
+ break;
+ case NOZZLE:
+ startButton.setEnabled(false);
+ middleButton.setEnabled(false);
+ endButton.setEnabled(true);
+ updateInsertPosition(PositionType.NEXT);
+ break;
+ case TURN:
+ startButton.setEnabled(false);
+ middleButton.setEnabled(true);
+ endButton.setEnabled(true);
+ if (insertPosition == PositionType.PREVIOUS)
+ updateInsertPosition(PositionType.NEXT);
+ break;
+ case EQUIPMENT:
+ throw new RuntimeException("Expected component, got equipment " + selected);
+ }
+ } else if (lenghtAdjustable) {
+ if (component instanceof InlineComponent) {
+ startButton.setEnabled(true);
+ middleButton.setEnabled(true);
+ endButton.setEnabled(true);
+ } else if (component instanceof TurnComponent) {
+ startButton.setEnabled(false);
+ middleButton.setEnabled(true);
+ endButton.setEnabled(true);
+ if (insertPosition == PositionType.PREVIOUS)
+ updateInsertPosition(PositionType.NEXT);
+ } else if (component instanceof EndComponent || component instanceof Nozzle) {
+ startButton.setEnabled(false);
+ middleButton.setEnabled(false);
+ endButton.setEnabled(true);
+ updateInsertPosition(PositionType.NEXT);
+ }
+ } else {
+ startButton.setEnabled(false);
+ middleButton.setEnabled(false);
+ endButton.setEnabled(true);
+ }
+ if (selected.isVariable()) {