protected static void selectRow(int row, ListSelectionModel model) { if (model == null) { return; } model.setSelectionInterval(row, row); }
void emitterSelected () { int row = emitterTable.getSelectedRow(); if (row == -1) { row = editIndex; emitterTable.getSelectionModel().setSelectionInterval(row, row); } if (row == editIndex) return; editIndex = row; editor.reloadRows(); }
void emitterSelected () { int row = emitterTable.getSelectedRow(); if (row == -1) { row = editIndex; emitterTable.getSelectionModel().setSelectionInterval(row, row); } if (row == editIndex) return; editIndex = row; editor.reloadRows(); }
void deleteEmitter () { int row = emitterTable.getSelectedRow(); if (row == -1) return; int newIndex = Math.min(editIndex, emitterTableModel.getRowCount()-2); editor.removeEmitter(row); emitterTableModel.removeRow(row); //Reload data check emitterTable.getSelectionModel().setSelectionInterval(newIndex, newIndex); }
void deleteEmitter () { int row = emitterTable.getSelectedRow(); if (row == -1) return; int newIndex = Math.min(editIndex, emitterTableModel.getRowCount()-2); editor.removeEmitter(row); emitterTableModel.removeRow(row); //Reload data check emitterTable.getSelectionModel().setSelectionInterval(newIndex, newIndex); }
void openEffect () { File file = editor.showFileLoadDialog(); if(file != null){ if(editor.openEffect(file, true) != null){ emitterTableModel.getDataVector().removeAllElements(); for (ControllerData data : editor.controllersData) { emitterTableModel.addRow(new Object[] {data.controller.name, true}); } editIndex = 0; emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex); } } }
void openEffect () { File file = editor.showFileLoadDialog(); if(file != null){ if(editor.openEffect(file, true) != null){ emitterTableModel.getDataVector().removeAllElements(); for (ControllerData data : editor.controllersData) { emitterTableModel.addRow(new Object[] {data.controller.name, true}); } editIndex = 0; emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex); } } }
void deleteEmitter () { if (editor.effect.getEmitters().size == 1) return; int row = emitterTable.getSelectedRow(); if (row == -1) return; if (row <= editIndex) { int oldEditIndex = editIndex; editIndex = Math.max(0, editIndex - 1); if (oldEditIndex == row) editor.reloadRows(); } editor.effect.getEmitters().removeIndex(row); emitterTableModel.removeRow(row); emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex); }
void deleteEmitter () { if (editor.effect.getEmitters().size == 1) return; int row = emitterTable.getSelectedRow(); if (row == -1) return; if (row <= editIndex) { int oldEditIndex = editIndex; editIndex = Math.max(0, editIndex - 1); if (oldEditIndex == row) editor.reloadRows(); } editor.effect.getEmitters().removeIndex(row); emitterTableModel.removeRow(row); emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex); }
private void addEmitter (final ParticleController emitter, boolean select) { editor.addEmitter(emitter); emitterTableModel.addRow(new Object[] {emitter.name, true}); int row = emitterTableModel.getRowCount() - 1; emitterChecked (row, true); if (select) { emitterTable.getSelectionModel().setSelectionInterval(row, row); } }
protected void importEffect () { File file = editor.showFileLoadDialog(); if(file != null){ ParticleEffect effect; if( (effect = editor.openEffect(file, false)) != null){ for(ParticleController controller : effect.getControllers()) addEmitter(controller, false); editIndex = 0; emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex); } } }
protected void importEffect () { File file = editor.showFileLoadDialog(); if(file != null){ ParticleEffect effect; if( (effect = editor.openEffect(file, false)) != null){ for(ParticleController controller : effect.getControllers()) addEmitter(controller, false); editIndex = 0; emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex); } } }
private void addEmitter (final ParticleController emitter, boolean select) { editor.addEmitter(emitter); emitterTableModel.addRow(new Object[] {emitter.name, true}); int row = emitterTableModel.getRowCount() - 1; emitterChecked (row, true); if (select) { emitterTable.getSelectionModel().setSelectionInterval(row, row); } }
void move (int direction) { if (direction < 0 && editIndex == 0) return; Array<ParticleEmitter> emitters = editor.effect.getEmitters(); if (direction > 0 && editIndex == emitters.size - 1) return; int insertIndex = editIndex + direction; Object name = emitterTableModel.getValueAt(editIndex, 0); emitterTableModel.removeRow(editIndex); ParticleEmitter emitter = emitters.removeIndex(editIndex); emitterTableModel.insertRow(insertIndex, new Object[] {name}); emitters.insert(insertIndex, emitter); editIndex = insertIndex; emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex); }
void move (int direction) { if (direction < 0 && editIndex == 0) return; Array<ParticleEmitter> emitters = editor.effect.getEmitters(); if (direction > 0 && editIndex == emitters.size - 1) return; int insertIndex = editIndex + direction; Object name = emitterTableModel.getValueAt(editIndex, 0); emitterTableModel.removeRow(editIndex); ParticleEmitter emitter = emitters.removeIndex(editIndex); emitterTableModel.insertRow(insertIndex, new Object[] {name}); emitters.insert(insertIndex, emitter); editIndex = insertIndex; emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex); }
emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex); editor.reloadRows();
private void addEmitter (String name, boolean select, final ParticleEmitter emitter) { Array<ParticleEmitter> emitters = editor.effect.getEmitters(); if (emitters.size == 0) emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2); else { ParticleEmitter p = emitters.get(0); emitter.setPosition(p.getX(), p.getY()); } emitters.add(emitter); emitterTableModel.addRow(new Object[] {name, true}); if (select) { editor.reloadRows(); int row = emitterTableModel.getRowCount() - 1; emitterTable.getSelectionModel().setSelectionInterval(row, row); } }
protected void createVelocity (Object selectedItem) { //Add the velocity to the table and to the influencer ParticleController controller = editor.getEmitter(); DynamicsInfluencer influencer = (DynamicsInfluencer)controller.findInfluencer(DynamicsInfluencer.class); VelocityWrapper wrapper = new VelocityWrapper(createVelocityValue(selectedItem), true); velocities.add(wrapper); influencer.velocities.add(wrapper.velocityValue); int index = velocities.size-1; velocityTableModel.addRow(new Object[] {"Velocity "+index, true}); //Reinit editor.restart(); //Select new velocity velocityTable.getSelectionModel().setSelectionInterval(index, index); revalidate(); repaint(); }
private void addEmitter (String name, boolean select, final ParticleEmitter emitter) { Array<ParticleEmitter> emitters = editor.effect.getEmitters(); if (emitters.size == 0) emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2); else { ParticleEmitter p = emitters.get(0); emitter.setPosition(p.getX(), p.getY()); } emitters.add(emitter); emitterTableModel.addRow(new Object[] {name, true}); if (select) { editor.reloadRows(); int row = emitterTableModel.getRowCount() - 1; emitterTable.getSelectionModel().setSelectionInterval(row, row); } }
protected void createVelocity (Object selectedItem) { //Add the velocity to the table and to the influencer ParticleController controller = editor.getEmitter(); DynamicsInfluencer influencer = (DynamicsInfluencer)controller.findInfluencer(DynamicsInfluencer.class); VelocityWrapper wrapper = new VelocityWrapper(createVelocityValue(selectedItem), true); velocities.add(wrapper); influencer.velocities.add(wrapper.velocityValue); int index = velocities.size-1; velocityTableModel.addRow(new Object[] {"Velocity "+index, true}); //Reinit editor.restart(); //Select new velocity velocityTable.getSelectionModel().setSelectionInterval(index, index); revalidate(); repaint(); }