use of java.beans.PropertyVetoException in project JMRI by JMRI.
the class TableFrames method openBlockPathFrame.
protected void openBlockPathFrame(String sysName) {
JInternalFrame frame = _blockPathMap.get(sysName);
if (frame == null) {
OBlock block = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class).getBySystemName(sysName);
if (block == null) {
return;
}
frame = makeBlockPathFrame(block);
_blockPathMap.put(sysName, frame);
frame.setVisible(true);
_desktop.add(frame);
frame.moveToFront();
} else {
frame.setVisible(true);
try {
frame.setIcon(false);
} catch (PropertyVetoException pve) {
log.warn("BlockPath Table Frame for \"" + sysName + "\" vetoed setIcon " + pve.toString());
}
frame.moveToFront();
}
}
use of java.beans.PropertyVetoException in project JMRI by JMRI.
the class TableFrames method updateOpenMenu.
protected void updateOpenMenu() {
_openMenu.removeAll();
JMenuItem openBlock = new JMenuItem(Bundle.getMessage("OpenBlockMenu"));
_openMenu.add(openBlock);
openBlock.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
_blockTableFrame.setVisible(true);
try {
_blockTableFrame.setIcon(false);
} catch (PropertyVetoException pve) {
log.warn("Block Table Frame vetoed setIcon " + pve.toString());
}
_blockTableFrame.moveToFront();
}
});
JMenuItem openPortal = new JMenuItem(Bundle.getMessage("OpenPortalMenu"));
_openMenu.add(openPortal);
openPortal.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
_portalTableFrame.setVisible(true);
try {
_portalTableFrame.setIcon(false);
} catch (PropertyVetoException pve) {
log.warn("Portal Table Frame vetoed setIcon " + pve.toString());
}
_portalTableFrame.moveToFront();
}
});
JMenuItem openXRef = new JMenuItem(Bundle.getMessage("OpenXRefMenu"));
_openMenu.add(openXRef);
openXRef.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
_blockPortalXRefFrame.setVisible(true);
try {
_blockPortalXRefFrame.setIcon(false);
} catch (PropertyVetoException pve) {
log.warn("XRef Table Frame vetoed setIcon " + pve.toString());
}
_blockPortalXRefFrame.moveToFront();
}
});
JMenuItem openSignal = new JMenuItem(Bundle.getMessage("OpenSignalMenu"));
_openMenu.add(openSignal);
openSignal.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
_signalTableFrame.setVisible(true);
try {
_signalTableFrame.setIcon(false);
} catch (PropertyVetoException pve) {
log.warn("Signal Table Frame vetoed setIcon " + pve.toString());
}
_signalTableFrame.moveToFront();
}
});
JMenu openBlockPath = new JMenu(Bundle.getMessage("OpenBlockPathMenu"));
ActionListener openFrameAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String sysName = e.getActionCommand();
openBlockPathFrame(sysName);
}
};
OBlockManager manager = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class);
String[] sysNames = manager.getSystemNameArray();
for (int i = 0; i < sysNames.length; i++) {
OBlock block = manager.getBySystemName(sysNames[i]);
JMenuItem mi = new JMenuItem(Bundle.getMessage("OpenPathMenu", block.getDisplayName()));
mi.setActionCommand(sysNames[i]);
mi.addActionListener(openFrameAction);
openBlockPath.add(mi);
}
_openMenu.add(openBlockPath);
JMenu openTurnoutPath = new JMenu(Bundle.getMessage("OpenBlockPathTurnoutMenu"));
sysNames = manager.getSystemNameArray();
for (int i = 0; i < sysNames.length; i++) {
OBlock block = manager.getBySystemName(sysNames[i]);
JMenu openTurnoutMenu = new JMenu(Bundle.getMessage("OpenTurnoutMenu", block.getDisplayName()));
openTurnoutPath.add(openTurnoutMenu);
openFrameAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String pathTurnoutName = e.getActionCommand();
openPathTurnoutFrame(pathTurnoutName);
}
};
Iterator<Path> iter = block.getPaths().iterator();
while (iter.hasNext()) {
OPath path = (OPath) iter.next();
JMenuItem mi = new JMenuItem(Bundle.getMessage("OpenPathTurnoutMenu", path.getName()));
mi.setActionCommand(makePathTurnoutName(sysNames[i], path.getName()));
mi.addActionListener(openFrameAction);
openTurnoutMenu.add(mi);
}
}
_openMenu.add(openTurnoutPath);
}
use of java.beans.PropertyVetoException in project jdk8u_jdk by JetBrains.
the class BeanContextChildSupport method setBeanContext.
/**
* Sets the <code>BeanContext</code> for
* this <code>BeanContextChildSupport</code>.
* @param bc the new value to be assigned to the <code>BeanContext</code>
* property
* @throws PropertyVetoException if the change is rejected
*/
public synchronized void setBeanContext(BeanContext bc) throws PropertyVetoException {
if (bc == beanContext)
return;
BeanContext oldValue = beanContext;
BeanContext newValue = bc;
if (!rejectedSetBCOnce) {
if (rejectedSetBCOnce = !validatePendingSetBeanContext(bc)) {
throw new PropertyVetoException("setBeanContext() change rejected:", new PropertyChangeEvent(beanContextChildPeer, "beanContext", oldValue, newValue));
}
try {
fireVetoableChange("beanContext", oldValue, newValue);
} catch (PropertyVetoException pve) {
rejectedSetBCOnce = true;
// re-throw
throw pve;
}
}
if (beanContext != null)
releaseBeanContextResources();
beanContext = newValue;
rejectedSetBCOnce = false;
firePropertyChange("beanContext", oldValue, newValue);
if (beanContext != null)
initializeBeanContextResources();
}
use of java.beans.PropertyVetoException in project JMRI by JMRI.
the class AbstractManager method vetoableChange.
@Override
@OverridingMethodsMustInvokeSuper
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
if ("CanDelete".equals(evt.getPropertyName())) {
//IN18N
StringBuilder message = new StringBuilder();
message.append(Bundle.getMessage("VetoFoundIn", getBeanTypeHandled())).append("<ul>");
boolean found = false;
for (NamedBean nb : _tsys.values()) {
try {
nb.vetoableChange(evt);
} catch (PropertyVetoException e) {
if (e.getPropertyChangeEvent().getPropertyName().equals("DoNotDelete")) {
//IN18N
throw e;
}
found = true;
message.append("<li>").append(e.getMessage()).append("</li>");
}
}
message.append("</ul>").append(Bundle.getMessage("VetoWillBeRemovedFrom", getBeanTypeHandled()));
if (found) {
throw new PropertyVetoException(message.toString(), evt);
}
} else {
for (NamedBean nb : _tsys.values()) {
try {
nb.vetoableChange(evt);
} catch (PropertyVetoException e) {
throw e;
}
}
}
}
use of java.beans.PropertyVetoException in project sic by belluccifranco.
the class PedidosGUI method formInternalFrameOpened.
//GEN-LAST:event_tbl_PedidosMouseClicked
private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
//GEN-FIRST:event_formInternalFrameOpened
this.setSize(sizeInternalFrame);
this.limpiarJTables();
txt_NumeroPedido.setEnabled(false);
dc_FechaDesde.setEnabled(false);
dc_FechaHasta.setEnabled(false);
cmb_Cliente.setEnabled(false);
cmb_Vendedor.setEnabled(false);
dc_FechaDesde.setDate(new Date());
dc_FechaHasta.setDate(new Date());
try {
this.setMaximum(true);
} catch (PropertyVetoException ex) {
String mensaje = "Se produjo un error al intentar maximizar la ventana.";
LOGGER.error(mensaje + " - " + ex.getMessage());
JOptionPane.showInternalMessageDialog(this, mensaje, "Error", JOptionPane.ERROR_MESSAGE);
this.dispose();
}
}
Aggregations