public void renameFlameBtn_clicked() { try { Flame flame = poolFlameHolder.getFlame(); if (flame != null) { int idx = flamePropertiesTree.getSelectionRows()[0]; String s = StandardDialogs.promptForText( rootTabbedPane, "Please enter the new title:", flame.getName()); if (s != null) { for (Flame tFlame : project.getFlames()) { if (!tFlame.isEqual(flame) && s.equals(tFlame.getName())) { throw new RuntimeException( "A different flame with the name \"" + s + "\" alread exists"); } } flame.setName(s); refreshProjectFlames(); if (project.getFlames().size() == 0) { flamePropertiesTree_changed(null); } else { try { flamePropertiesTree.setSelectionRow(idx); } catch (Exception ex) { } } enableControls(); } } } catch (Exception ex) { errorHandler.handleError(ex); } }
public void flameToEditorBtn_clicked() { Flame flame = poolFlameHolder.getFlame(); if (flame != null) { parentCtrl.importFlame(flame, true); parentCtrl.getRootTabbedPane().setSelectedIndex(0); } }
public void replaceFlameFromEditorBtn_clicked(Flame pFlame) { if (pFlame != null) { Flame flame = poolFlameHolder.getFlame(); if (flame != null) { int idx = flamePropertiesTree.getSelectionRows()[0]; // cant remove the flame by object reference because its a clone Flame newFlame = validateDancingFlame(pFlame.makeCopy()); Flame oldFlame = project.getFlames().get(idx); for (Motion motion : project.getMotions()) { for (MotionLink link : motion.getMotionLinks()) { if (link.getProperyPath().getFlame().isEqual(oldFlame)) { link.getProperyPath().setFlame(newFlame); } } } project.getFlames().set(idx, newFlame); refreshProjectFlames(); if (project.getFlames().size() == 0) { flamePropertiesTree_changed(null); } else { try { flamePropertiesTree.setSelectionRow(idx); } catch (Exception ex) { } } enableControls(); } } }
public void deleteFlameBtn_clicked() { Flame flame = poolFlameHolder.getFlame(); if (flame != null) { int idx = flamePropertiesTree.getSelectionRows()[0]; // cant remove the flame by object reference because its a clone project.getFlames().remove(idx); refreshProjectFlames(); if (project.getFlames().size() == 0) { flamePropertiesTree_changed(null); } enableControls(); } }
private void enableControls() { loadSoundBtn.setEnabled(!running); addFromClipboardBtn.setEnabled(!running); addFromEditorBtn.setEnabled(!running); addFromDiscBtn.setEnabled(!running); randomCountIEd.setEnabled(!running); genRandFlamesBtn.setEnabled(!running); randomGenCmb.setEnabled(!running); boolean flameSelected = poolFlameHolder.getFlame() != null; flameToEditorBtn.setEnabled(flameSelected); deleteFlameBtn.setEnabled(flameSelected); renameFlameBtn.setEnabled(flameSelected); replaceFlameFromEditorBtn.setEnabled(flameSelected); framesPerSecondIEd.setEnabled(!running); borderSizeSlider.setEnabled(true); morphFrameCountIEd.setEnabled(true); startShowButton.setEnabled(!running && project.getFlames().size() > 0); stopShowButton.setEnabled(running); doRecordCBx.setEnabled(!running); motionTable.setEnabled(!running); addMotionCmb.setEnabled(!running); addMotionBtn.setEnabled(!running); Motion selMotion = getSelectedMotion(); deleteMotionBtn.setEnabled(!running && selMotion != null); renameMotionBtn.setEnabled(deleteMotionBtn.isEnabled()); boolean plainPropertySelected = flamePropertiesTreeService.isPlainPropertySelected(flamePropertiesTree); { boolean linkMotionEnabled = false; if (!running && selMotion != null && selMotion.getParent() == null) { if (plainPropertySelected) { FlamePropertyPath selPath = flamePropertiesTreeService.getSelectedPropertyPath(flamePropertiesTree); linkMotionEnabled = !selMotion.hasLink(selPath); } } linkMotionBtn.setEnabled(linkMotionEnabled); unlinkMotionBtn.setEnabled( selMotion != null && motionLinksTable.getSelectedRow() >= 0 && motionLinksTable.getSelectedRow() < selMotion.getMotionLinks().size()); } createMotionsCmb.setEnabled(!running); clearMotionsBtn.setEnabled(!running && project.getMotions().size() > 0); loadProjectBtn.setEnabled(!running); saveProjectBtn.setEnabled(!running); }