📄 accreditdevsoisp.java
字号:
}
private boolean isAllDataValid()
{
Component[] components = AccreditDevsOisp.this.getComponents();
for (int i = 0; i < components.length; i++)
{
if (DataEditor.class.isInstance(components[i]))
{
if (!((DataEditor) components[i]).isDataValid())
{
return false;
}
}
}
return true;
}
public void clear()
{
// clear all the data fields in all the dataEditors
Component[] components = AccreditDevsOisp.this.getComponents();
for (int i = 0; i < components.length; i++)
{
if (DataEditor.class.isInstance(components[i]))
{
((DataEditor) components[i]).clear();
}
}
}
public void setMode(int newMode)
{
Component[] components = AccreditDevsOisp.this.getComponents();
for (int i = 0; i < components.length; i++)
{
if (DataEditor.class.isInstance(components[i]))
{
((DataEditor) components[i]).setMode(newMode);
}
}
if (newMode == ADD_NEW_MODE)
{
ok.setText("Add");
}
else if (newMode == EDIT_EXISTING_MODE)
{
ok.setText("Ok");
}
mode = newMode;
}
private void showSelectedComponents()
{
remove(userInfo);
remove(marshal);
if (callReturn != null)
{
remove(callReturn);
}
remove(aliases);
Component[] components = getComponents();
if (showAdmin)
{
add(userInfo, 0);
add(marshal, 1);
if (callReturn != null)
{
add(callReturn);
}
components = getComponents();
if (callReturn != null)
{
add(callReturn, components.length - 2);
}
}
if (showUser)
{
if (showAdmin)
{
add(aliases, 2);
}
else
{
add(aliases, 0);
}
}
}
public void removeAliasPanel()
{
remove(aliases);
}
public void setShowAdmin(boolean show)
{
Component[] components = getComponents();
showAdmin = show;
showSelectedComponents();
components = getComponents();
for (int i = 0; i < components.length; i++)
{
if (Feature.class.isInstance(components[i]))
{
((Feature) components[i]).setShowAdmin(show);
}
}
}
public void setShowUser(boolean show)
{
showUser = show;
showSelectedComponents();
Component[] components = getComponents();
for (int i = 0; i < components.length; i++)
{
if (Feature.class.isInstance(components[i]))
{
((Feature) components[i]).setShowUser(show);
}
}
}
public void setUserData(Vector user)
{
userName = (String) user.elementAt(UserTableModel.USER_NAME);
// get all the components in this panel
Component[] components = AccreditDevsOisp.this.getComponents();
components = AccreditDevsOisp.this.getComponents();
for (int id = 0; id <= UserTableModel.MAX_COLUMN_ID; id++)
{
for (int i = 0; i < components.length; i++)
{
// if this component was responsible for editing user data
if (DataEditor.class.isInstance(components[i]))
{
DataEditor editor = (DataEditor) components[i];
String dataValue = (String) user.elementAt(id);
if (editor.setData(id, dataValue))
{
break;
}
} // end if this is a dataEditor
} // end for each component
} // end for each data id
}
public int getLastButtonClicked()
{
return lastButtonClicked;
}
public Vector getUserData()
{
Vector data = new Vector();
for (int i = 0; i <= UserTableModel.MAX_COLUMN_ID; i++)
{
data.addElement(null);
}
// get all the components in this panel
Component[] components = getComponents();
// find out which components are the ones which can edit user data
for (int i = 0; i < components.length; i++)
{
// if this component was responsible for editing user data
if (DataEditor.class.isInstance(components[i]))
{
// ask it for a data value for each of the columns. If the component
// is responsible for editing that data value (and it was changed)
// it will return a string. Otherwise it will return null
for (int id = 0; id <= UserTableModel.MAX_COLUMN_ID; id++)
{
String dataElement = null;
if (id == UserTableModel.PASSWORD)
{
if (passwordPanel.getLastButtonClicked() == Buttons.BUTTON_OK)
{
dataElement = passwordPanel.getPassword();
}
passwordPanel.clear();
}
else
{
dataElement = ((DataEditor) components[i]).getData(id);
}
if (dataElement != null)
{
data.setElementAt(dataElement, id);
}
}
((DataEditor) components[i]).clear();
}
}
return data;
}
// -----------------implementation of the Windowlistener interface-------------
public void windowOpened(WindowEvent e)
{
// nothing to do
}
public void windowIconified(WindowEvent e)
{
// nothing to do
}
public void windowDeiconified(WindowEvent e)
{
// nothing to do
}
public void windowDeactivated(WindowEvent e)
{
// nothing to do
}
/**
* This should be called when the user presses the "close window" icon it the
* title bar of the dialog displaing this panel.
* That action should be equivalent to pressing cancel so we clear the editor
* and let the last button pressed to cancel.
*/
public void windowClosing(WindowEvent e)
{
lastButtonClicked = UserPanel.BUTTON_CANCEL;
clear();
}
public void windowClosed(WindowEvent e)
{
// nothing to do
}
public void windowActivated(WindowEvent e)
{
// nothing to do
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -