use of com.centurylink.mdw.designer.utils.SwingFormGenerator.MenuButton in project mdw-designer by CenturyLinkCloud.
the class FormWidgetDialog method updateWidgetLabel.
private void updateWidgetLabel(MbengNode node) {
String labelNew = node.getAttribute(FormConstants.FORMATTR_LABEL);
if (labelNew != null && !labelNew.equals(labelOld)) {
if (node.getName().equals(FormConstants.WIDGET_PANEL)) {
JPanel panel = (JPanel) generator.getWidget(node);
((TitledBorder) panel.getBorder()).setTitle(labelNew);
} else if (node.getName().equals(FormConstants.WIDGET_BUTTON)) {
JButton button = (JButton) generator.getWidget(node);
button.setText(labelNew);
} else if (node.getName().equals(FormConstants.WIDGET_MENU)) {
Component menu = generator.getWidget(node);
if (menu instanceof JPopupMenu)
((JPopupMenu) menu).setName(labelNew);
else if (menu instanceof MenuButton)
((MenuButton) menu).setText(labelNew);
else
((JMenu) menu).setText(labelNew);
} else if (node.getName().equals(FormConstants.WIDGET_MENUITEM)) {
JMenuItem menuitem = (JMenuItem) generator.getWidget(node);
menuitem.setText(labelNew);
} else if (node.getName().equals(FormConstants.WIDGET_TAB)) {
JPanel panel = (JPanel) generator.getWidget(node);
JTabbedPane tabbedPane = (JTabbedPane) panel.getParent();
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
Component comp = tabbedPane.getComponent(i);
if (comp == panel) {
tabbedPane.setTitleAt(i, labelNew);
break;
}
}
} else if (node.getName().equals(FormConstants.WIDGET_COLUMN)) {
JTablePlus tablePlus = (JTablePlus) generator.getWidget(node.getParent());
int c = Integer.parseInt(node.getAttribute("INDEX"));
tablePlus.setColumnLabel(c, labelNew);
} else {
JLabel label = generator.getLabel(node);
if (label != null) {
label.setText(generator.formatText(labelNew));
}
}
}
}
use of com.centurylink.mdw.designer.utils.SwingFormGenerator.MenuButton in project mdw-designer by CenturyLinkCloud.
the class FormDesignCanvas method actionPerformed.
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
Component src = (Component) e.getSource();
MbengNode node = generator.getNode(src);
if (cmd.equals(FormConstants.ACTION_MENU)) {
MenuButton button = (MenuButton) src;
JPopupMenu menu = button.getMenu();
menu.show(src, src.getWidth() - 10, src.getHeight() - 10);
} else {
showWidgetDialog(node);
}
}
use of com.centurylink.mdw.designer.utils.SwingFormGenerator.MenuButton in project mdw-designer by CenturyLinkCloud.
the class FormPanel method actionPerformed.
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
Component src = (Component) e.getSource();
if (cmd.equals(FormConstants.ACTION_MENU)) {
MenuButton button = (MenuButton) src;
JPopupMenu menu = button.getMenu();
menu.show(src, src.getWidth() - 10, src.getHeight() - 10);
} else if (cmd.equals(SwingFormGenerator.ACTION_TABBING)) {
JTabbedPane tabbedPane = (JTabbedPane) src;
MbengNode node = canvas.getGenerator().getNode(tabbedPane);
String id = node.getAttribute(FormConstants.FORMATTR_ID);
String datapath = node.getAttribute(FormConstants.FORMATTR_DATA);
if (datapath == null || datapath.length() == 0)
datapath = "__mdwtabindex__" + id;
String paginator = node.getAttribute(FormConstants.FORMATTR_ACTION);
if (paginator == null)
paginator = "com.centurylink.mdw.listener.formaction.TabChanger";
int index = e.getID();
String action = paginator + "?action=tabbing&tabs=" + id + "&tab=" + index + "&data=" + datapath;
performGenericAction(action);
} else if (cmd.equals(JTablePlus.ACTION_ENGINE_CALL)) {
String action = ((JTablePlus) src).getEngineCallAction();
performGenericAction(action);
} else {
MbengNode node = canvas.getGenerator().getNode(src);
performJavaScriptAction(e, src, cmd, node);
}
}
Aggregations