Skip to content
Permalink
Browse files

JavaDoc

  • Loading branch information...
bobjacobsen committed Sep 24, 2018
1 parent aa38e6a commit 83679d7c62860aa85089e6f29e6b2efb2cd4a361
Showing with 41 additions and 9 deletions.
  1. +41 −9 java/src/jmri/util/JmriJFrame.java
@@ -165,7 +165,10 @@ public void makePrivateWindow() {
}
}

void setFrameLocation() {
/**
* Reset frame location and size to stored preference value
*/
public void setFrameLocation() {
InstanceManager.getOptionalDefault(UserPreferencesManager.class).ifPresent(prefsMgr -> {
if (prefsMgr.hasProperties(windowFrameRef)) {
Dimension screen = getToolkit().getScreenSize();
@@ -217,6 +220,7 @@ public void generateWindowRef() {
initref = initref + ":" + this.getTitle();
}
}

int refNo = 1;
String ref = initref;
JmriJFrameManager m = getJmriJFrameManager();
@@ -230,9 +234,9 @@ public void generateWindowRef() {
}
log.debug("Created windowFrameRef: {}", ref);
windowFrameRef = ref;

}

/** @inheritDoc */
@Override
public void pack() {
// work around for Linux, sometimes the stored window size is too small
@@ -384,6 +388,7 @@ void addWindowCloseShortCut() {
// modelled after code in JavaDev mailing list item by Bill Tschumy <bill@otherwise.com> 08 Dec 2004
AbstractAction act = new AbstractAction() {

/** @inheritDoc */
@Override
public void actionPerformed(ActionEvent e) {
// log.debug("keystroke requested close window ", JmriJFrame.this.getTitle());
@@ -466,6 +471,7 @@ public void setEscapeKeyClosesWindow(boolean closesWindow) {
if (closesWindow) {
setEscapeKeyAction(new AbstractAction() {

/** @inheritDoc */
@Override
public void actionPerformed(ActionEvent ae) {
JmriJFrame.this.processWindowEvent(new java.awt.event.WindowEvent(JmriJFrame.this,
@@ -491,6 +497,7 @@ public boolean getEscapeKeyClosesWindow() {
}

/**
* @inheritDoc
* Provide a maximum frame size that is limited to what can fit on the
* screen after toolbars, etc are deducted.
* <p>
@@ -566,6 +573,7 @@ else if (osName.equals("Windows XP") || osName.equals("Windows 98")
}

/**
* @inheritDoc
* The preferred size must fit on the physical screen, so calculate the
* lesser of either the preferred size from the layout or the screen size.
*
@@ -644,6 +652,7 @@ public static JmriJFrame getFrame(String name) {
// handle resizing when first shown
private boolean mShown = false;

/** @inheritDoc */
@Override
public void addNotify() {
super.addNotify();
@@ -705,6 +714,7 @@ public boolean getSaveSize() {
}

/**
* @inheritDoc
* A frame is considered "modified" if it has changes that have not been
* stored.
*/
@@ -715,11 +725,7 @@ public void setModifiedFlag(boolean flag) {
markWindowModified(this.modifiedFlag);
}

/**
* Get the balue of the modified flag.
* <p>
* Not a bound parameter
*/
/** @inheritDoc */
@Override
public boolean getModifiedFlag() {
return modifiedFlag;
@@ -760,39 +766,48 @@ public void markWindowModified(boolean yes) {
}

// Window methods
/** Does nothing in this class */
@Override
public void windowOpened(java.awt.event.WindowEvent e) {
}

/** Does nothing in this class */
@Override
public void windowClosed(java.awt.event.WindowEvent e) {
}

/** Does nothing in this class */
@Override
public void windowActivated(java.awt.event.WindowEvent e) {
}

/** Does nothing in this class */
@Override
public void windowDeactivated(java.awt.event.WindowEvent e) {
}

/** Does nothing in this class */
@Override
public void windowIconified(java.awt.event.WindowEvent e) {
}

/** Does nothing in this class */
@Override
public void windowDeiconified(java.awt.event.WindowEvent e) {
}

/** Does nothing in this class */
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
handleModified();
}

/** Does nothing in this class */
@Override
public void componentHidden(java.awt.event.ComponentEvent e) {
}

/** @inheritDoc */
@Override
public void componentMoved(java.awt.event.ComponentEvent e) {
InstanceManager.getOptionalDefault(UserPreferencesManager.class).ifPresent(p -> {
@@ -802,6 +817,7 @@ public void componentMoved(java.awt.event.ComponentEvent e) {
});
}

/** @inheritDoc */
@Override
public void componentResized(java.awt.event.ComponentEvent e) {
InstanceManager.getOptionalDefault(UserPreferencesManager.class).ifPresent(p -> {
@@ -811,6 +827,7 @@ public void componentResized(java.awt.event.ComponentEvent e) {
});
}

/** Does nothing in this class */
@Override
public void componentShown(java.awt.event.ComponentEvent e) {
}
@@ -834,6 +851,8 @@ public boolean execute() {
protected boolean reuseFrameSavedSized = true;

/**
* @inheritDoc
*
* When window is finally destroyed, remove it from the list of windows.
* <p>
* Subclasses that over-ride this method must invoke this implementation
@@ -904,6 +923,7 @@ private void saveWindowSize(jmri.UserPreferencesManager p) {
*/
protected HashMap<String, Object> properties = new HashMap<>();

/** @inheritDoc */
@Override
public void setIndexedProperty(String key, int index, Object value) {
if (Beans.hasIntrospectedProperty(this, key)) {
@@ -916,6 +936,7 @@ public void setIndexedProperty(String key, int index, Object value) {
}
}

/** @inheritDoc */
@Override
public Object getIndexedProperty(String key, int index) {
if (properties.containsKey(key) && properties.get(key).getClass().isArray()) {
@@ -924,7 +945,9 @@ public Object getIndexedProperty(String key, int index) {
return Beans.getIntrospectedIndexedProperty(this, key, index);
}

// subclasses should override this method with something more direct and faster
/** @inheritDoc
* Subclasses should override this method with something more direct and faster
*/
@Override
public void setProperty(String key, Object value) {
if (Beans.hasIntrospectedProperty(this, key)) {
@@ -934,7 +957,9 @@ public void setProperty(String key, Object value) {
}
}

// subclasses should override this method with something more direct and faster
/** @inheritDoc
* Subclasses should override this method with something more direct and faster
*/
@Override
public Object getProperty(String key) {
if (properties.containsKey(key)) {
@@ -943,11 +968,13 @@ public Object getProperty(String key) {
return Beans.getIntrospectedProperty(this, key);
}

/** @inheritDoc */
@Override
public boolean hasProperty(String key) {
return (properties.containsKey(key) || Beans.hasIntrospectedProperty(this, key));
}

/** @inheritDoc */
@Override
public boolean hasIndexedProperty(String key) {
return ((this.properties.containsKey(key) && this.properties.get(key).getClass().isArray())
@@ -956,20 +983,23 @@ public boolean hasIndexedProperty(String key) {

protected transient WindowInterface windowInterface = null;

/** @inheritDoc */
@Override
public void show(JmriPanel child, JmriAbstractAction action) {
if (null != windowInterface) {
windowInterface.show(child, action);
}
}

/** @inheritDoc */
@Override
public void show(JmriPanel child, JmriAbstractAction action, Hint hint) {
if (null != windowInterface) {
windowInterface.show(child, action, hint);
}
}

/** @inheritDoc */
@Override
public boolean multipleInstances() {
if (null != windowInterface) {
@@ -986,6 +1016,7 @@ public WindowInterface getWindowInterface() {
return windowInterface;
}

/** @inheritDoc */
@Override
public Set<String> getPropertyNames() {
Set<String> names = new HashSet<>();
@@ -1002,6 +1033,7 @@ public boolean getAllowInFrameServlet() {
return allowInFrameServlet;
}

/** @inheritDoc */
@Override
public Frame getFrame() {
return this;

0 comments on commit 83679d7

Please sign in to comment.
You can’t perform that action at this time.