mirror of
https://github.com/OMGeeky/ATCS.git
synced 2026-02-15 22:04:29 +01:00
refactor: add navigation handling for replies in CommonEditor and DialogueEditor
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,7 @@
|
|||||||
package com.gpl.rpg.atcontentstudio.ui.tools;
|
package com.gpl.rpg.atcontentstudio.ui.tools;
|
||||||
|
|
||||||
|
import com.gpl.rpg.atcontentstudio.ATContentStudio;
|
||||||
|
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||||
import com.gpl.rpg.atcontentstudio.ui.CollapsiblePanel;
|
import com.gpl.rpg.atcontentstudio.ui.CollapsiblePanel;
|
||||||
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
|
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
|
||||||
import com.gpl.rpg.atcontentstudio.ui.FieldUpdateListener;
|
import com.gpl.rpg.atcontentstudio.ui.FieldUpdateListener;
|
||||||
@@ -11,6 +13,10 @@ import com.jidesoft.swing.JideBoxLayout;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.ListDataEvent;
|
import javax.swing.event.ListDataEvent;
|
||||||
import javax.swing.event.ListDataListener;
|
import javax.swing.event.ListDataListener;
|
||||||
|
import java.awt.event.KeyAdapter;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
@@ -60,6 +66,29 @@ public final class CommonEditor {
|
|||||||
}
|
}
|
||||||
updateRepliesEditorPane.call(repliesEditorPane, selectedReply, listener);
|
updateRepliesEditorPane.call(repliesEditorPane, selectedReply, listener);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
repliesList.addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
if (e.getClickCount() == 2) {
|
||||||
|
GameDataElement navObj = listModel.getNavigationElement( repliesList.getSelectedValue());
|
||||||
|
if (navObj != null) {
|
||||||
|
ATContentStudio.frame.openEditor(navObj);
|
||||||
|
ATContentStudio.frame.selectInTree(navObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
repliesList.addKeyListener(new KeyAdapter() {
|
||||||
|
@Override
|
||||||
|
public void keyReleased(KeyEvent e) {
|
||||||
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||||
|
GameDataElement navObj = listModel.getNavigationElement( repliesList.getSelectedValue());
|
||||||
|
ATContentStudio.frame.openEditor(navObj);
|
||||||
|
ATContentStudio.frame.selectInTree(navObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
if (writable) {
|
if (writable) {
|
||||||
JPanel listButtonsPane = new JPanel();
|
JPanel listButtonsPane = new JPanel();
|
||||||
listButtonsPane.setLayout(new JideBoxLayout(listButtonsPane, JideBoxLayout.LINE_AXIS, 6));
|
listButtonsPane.setLayout(new JideBoxLayout(listButtonsPane, JideBoxLayout.LINE_AXIS, 6));
|
||||||
@@ -138,12 +167,17 @@ public final class CommonEditor {
|
|||||||
protected abstract List<E> getInner();
|
protected abstract List<E> getInner();
|
||||||
|
|
||||||
protected abstract void setInner(List<E> value);
|
protected abstract void setInner(List<E> value);
|
||||||
|
protected GameDataElement getNavigationElement(E element){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public AtListModel(S source) {
|
public AtListModel(S source) {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
if (getInner() == null) return 0;
|
if (getInner() == null) return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user