File | Line |
---|
org\xulux\guilayer\swing\core\SwingNativeWidgetHandler.java | 39 |
org\xulux\guilayer\swing\natives\NativeWindowHandler.java | 39 |
public NativeWindowHandler() {
}
/**
* Adds the specified object (if it is an instanceof JComponent)
* to the specified parent.
*
* @see org.xulux.api.gui.INativeWidgetHandler#getWidget(java.lang.Object, org.xulux.api.gui.IWidget)
*/
public IWidget getWidget(Object nativeWidget, IWidget parent) {
if (nativeWidget != null && nativeWidget instanceof JComponent) {
if (parent.canContainChildren()) {
Object nativeParent = parent.getNativeWidget();
if (nativeParent instanceof JComponent) {
((JComponent) nativeParent).add((JComponent) nativeWidget);
return parent;
}
}
} else {
XuluxContext.getLogger().log(ILog.WARN, "NativeWidgetHandler", "Native widget cannot be added, since it is not of type JComponent or null");
}
return null;
}
/**
* Adds a JComponent to the widget specified as parent
*
* @see org.xulux.api.gui.INativeWidgetHandler#getWidget(java.lang.String, org.xulux.api.gui.IWidget)
*/
public IWidget getWidget(String clazz, IWidget parent) {
Object nativeWidget = ClassLoaderUtils.getObjectFromClassString(clazz);
return getWidget(nativeWidget, parent);
}
/**
* @see org.xulux.api.gui.INativeWidgetHandler#setLocationOnWidget(org.xulux.api.gui.IWidget, int, int)
*/
public void setLocationOnWidget(IWidget parent, int x, int y) {
if (parent != null && parent.getNativeWidget() != null) {
JComponent comp = (JComponent) parent.getNativeWidget();
// set the location on the last component added..
if (comp.getComponentCount() > 0) {
Component childComp = comp.getComponent(comp.getComponentCount() - 1);
setLocationOnWidget(childComp, x, y);
}
}
}
/**
* @see org.xulux.api.gui.INativeWidgetHandler#setLocationOnWidget(java.lang.Object, int, int)
*/
public void setLocationOnWidget(Object widget, int x, int y) {
if (!(widget instanceof Component)) {
return;
}
Component comp = (Component) widget;
comp.setLocation(x, y);
}
/**
* @see org.xulux.api.gui.INativeWidgetHandler#addWidgetToParent(org.xulux.api.gui.IWidget, java.lang.Object)
*/
public void addWidgetToParent(IWidget widget, Object parentWidget) {
if (!(parentWidget instanceof JComponent) || widget == null) {
return;
}
JComponent comp = (JComponent) parentWidget;
Object nativeWidget = widget.getNativeWidget();
if (nativeWidget instanceof Component) {
comp.add((Component) widget.getNativeWidget(), widget);
}
}
/**
* @see org.xulux.api.gui.INativeWidgetHandler#refresh(java.lang.Object)
*/
public void refresh(Object widget) {
Component component = (Component) widget;
component.setVisible(false);
component.setVisible(true);
}
} |
File | Line |
---|
org\xulux\guilayer\swing\widgets\TextArea.java | 180 |
org\xulux\guilayer\swing\widgets\TextPane.java | 181 |
initializeValue();
String backgroundColor = null;
if (isRequired() && isEnabled()) {
backgroundColor = getProperty("required-background-color");
} else if (!isEnabled()) {
backgroundColor = getProperty("disabled-background-color");
} else {
backgroundColor = getProperty("default-background-color");
}
if (backgroundColor != null) {
textComponent.setBackground(ColorUtils.getSwingColor(backgroundColor));
}
String foreGroundColor = null;
if (isRequired() && isEnabled()) {
foreGroundColor = getProperty("required-foreground-color");
} else if (!isEnabled()) {
foreGroundColor = getProperty("disabled-foreground-color");
if (foreGroundColor != null) {
textComponent.setDisabledTextColor(ColorUtils.getSwingColor(foreGroundColor));
foreGroundColor = null;
}
}
if (foreGroundColor == null) {
foreGroundColor = getProperty("default-foreground-color");
}
if (foreGroundColor != null) {
textComponent.setForeground(ColorUtils.getSwingColor(foreGroundColor));
}
String border = getProperty("border");
if (border != null) {
String borderThickness = getProperty("border-thickness");
String borderColor = getProperty("border-color");
int thickness = 1;
if (borderThickness != null) {
try {
thickness = Integer.parseInt(borderThickness);
} catch (NumberFormatException nfe) {
System.out.println("invalid borderthickness, value is " + borderThickness + ", but should be a number ");
}
}
Color bColor = null;
if (borderColor != null) {
bColor = ColorUtils.getSwingColor(borderColor);
} else {
// we default to black border color
if (getParent() != null) {
bColor = ((JComponent) getParent().getNativeWidget()).getForeground();
} else {
bColor = Color.black;
}
}
if (border.equalsIgnoreCase("line")) {
textComponent.setBorder(new LineBorder(bColor, thickness));
}
} |
File | Line |
---|
org\xulux\guilayer\swing\widgets\RadioButton.java | 182 |
org\xulux\guilayer\swing\widgets\ToggleButton.java | 249 |
retValue = getGuiValue();
}
return retValue;
}
IMapping map = XuluxContext.getDictionary().getDefaultProvider().getMapping(getPart().getBean().getClass());
if (map != null) {
IField field = map.getField(getField());
if (field != null) {
return field.getValue(getPart().getBean());
}
}
return super.getValue();
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#setValue(java.lang.Object)
*/
public void setValue(Object value) {
if (this.value == null) {
this.value = "false";
}
this.previousValue = this.value;
IMapping map = XuluxContext.getDictionary().getDefaultProvider().getMapping(getPart().getBean());
if (map != null) {
if (getField() != null) {
IField f = map.getField(getField());
Class cClass = f.getType();
if (cClass == Boolean.class || cClass == Boolean.TYPE) {
if (value.getClass() == String.class) {
value = BooleanUtils.toBooleanObject((String) value);
}
} else if (cClass == String.class) {
if (value.getClass() == Boolean.class) {
value = BooleanUtils.toStringTrueFalse((Boolean) value);
}
}
f.setValue(getPart().getBean(), value);
}
}
this.value = value;
if (initialized) {
refresh();
}
}
public IWidgetInitializer getWidgetInitializer() {
return null;
}
} |
File | Line |
---|
org\xulux\guilayer\swing\widgets\TextArea.java | 111 |
org\xulux\guilayer\swing\widgets\TextPane.java | 111 |
textComponent = new JTextPane();
if (getProperty("scrollbar") != null) {
scrollPane = new JScrollPane(textComponent);
String scrollBar = getProperty("scrollbar");
scrollBar = scrollBar.toLowerCase();
if (scrollBar.equals("vertical") || scrollBar.equals("both")) {
int policy = JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED;
String state = getProperty("scrollbar.state");
if ("never".equalsIgnoreCase(state)) {
policy = JScrollPane.VERTICAL_SCROLLBAR_NEVER;
} else if ("always".equalsIgnoreCase(state)) {
policy = JScrollPane.VERTICAL_SCROLLBAR_ALWAYS;
}
scrollPane.setVerticalScrollBarPolicy(policy);
}
if (scrollBar.equals("horizontal") || scrollBar.equals("both")) {
int policy = JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;
String state = getProperty("scrollbar.state");
if ("never".equalsIgnoreCase(state)) {
policy = JScrollPane.HORIZONTAL_SCROLLBAR_NEVER;
} else if ("always".equalsIgnoreCase(state)) {
policy = JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS;
}
scrollPane.setHorizontalScrollBarPolicy(policy);
}
scrollPane.setSize(getRectangle().getRectangle().getSize());
scrollPane.setPreferredSize(getRectangle().getRectangle().getSize()); |
File | Line |
---|
org\xulux\guilayer\swing\widgets\TextArea.java | 61 |
org\xulux\guilayer\swing\widgets\TextPane.java | 61 |
public TextPane(String name) {
super(name);
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#destroy()
*/
public void destroy() {
processDestroy();
removeAllRules();
if (textComponent != null) {
textComponent.removeAll();
Container container = textComponent.getParent();
if (container != null) {
container.remove(textComponent);
}
textComponent = null;
if (scrollPane != null) {
scrollPane.removeAll();
container = scrollPane.getParent();
if (container != null) {
container.remove(scrollPane);
}
}
}
getPart().removeWidget(this, this);
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#getNativeWidget()
*/
public Object getNativeWidget() {
if (!initialized) {
initialize();
}
if (scrollPane != null) {
return scrollPane;
}
return textComponent;
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#initialize()
*/
public void initialize() {
if (this.initialized) {
return;
}
this.initialized = true;
this.setValueCalled = true;
textComponent = new JTextPane(); |
File | Line |
---|
org\xulux\guilayer\swing\widgets\Panel.java | 225 |
org\xulux\guilayer\swing\widgets\Tab.java | 124 |
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#canContainChildren()
*/
public boolean canContainChildren() {
return true;
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#getChildWidgets()
*/
public List getChildWidgets() {
return widgets;
}
/**
* @see org.xulux.nyx.gui.ContainerWidget#addToParent(XuluxWidget)
*/
public void addToParent(IWidget widget) {
if (widget instanceof IShowChildWidgets) {
List children = widget.getChildWidgets();
if (children != null && children.size() > 0) {
Iterator it = children.iterator();
while (it.hasNext()) {
IWidget w = (IWidget) it.next();
panel.add((JComponent) w.getNativeWidget(), w);
w.refresh();
}
}
} else {
panel.add((Component) widget.getNativeWidget(), widget);
widget.refresh();
}
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#focus()
*/
public void focus() {
isRefreshing = true; |
File | Line |
---|
org\xulux\guilayer\swing\widgets\CheckBox.java | 186 |
org\xulux\guilayer\swing\widgets\Entry.java | 416 |
if (getProvider() != null) {
IDataProvider pr = XuluxContext.getDictionary().getProvider(getProvider());
IMapping mapping = null;
IField field = null;
if (!(object instanceof String) && this.value == null) {
this.value = object;
} else {
mapping = pr.getMapping(this.value);
if (getField() != null) {
field = mapping.getField(getField());
} else {
field = mapping.getField(this.value);
}
try {
field.setValue(this.value, object);
setValidValue(true);
} catch(InvalidValueException ive) { |
File | Line |
---|
org\xulux\guilayer\swing\widgets\Entry.java | 217 |
org\xulux\guilayer\swing\widgets\TextArea.java | 186 |
} else {
backgroundColor = getProperty("default-background-color");
}
if (backgroundColor != null) {
textComponent.setBackground(ColorUtils.getSwingColor(backgroundColor));
}
String foreGroundColor = null;
if (isRequired() && isEnabled()) {
foreGroundColor = getProperty("required-foreground-color");
} else if (!isEnabled()) {
foreGroundColor = getProperty("disabled-foreground-color");
if (foreGroundColor != null) {
textComponent.setDisabledTextColor(ColorUtils.getSwingColor(foreGroundColor));
foreGroundColor = null;
}
}
if (foreGroundColor == null) {
foreGroundColor = getProperty("default-foreground-color");
}
if (foreGroundColor != null) {
textComponent.setForeground(ColorUtils.getSwingColor(foreGroundColor));
} |
File | Line |
---|
org\xulux\guilayer\swing\widgets\Entry.java | 148 |
org\xulux\guilayer\swing\widgets\TextPane.java | 140 |
if (isImmidiate()) {
if (this.immidiateListener == null) {
IXuluxListener listener = getPart().getFieldEventHandler(this);
if (listener != null) {
this.immidiateListener = (PrePostFieldListener) listener;
} else {
this.immidiateListener = new PrePostFieldListener(this);
}
}
}
if (isVisible()) {
if (focusListener == null) {
IXuluxListener listener = getPart().getFieldEventHandler(this);
if (listener == null) {
focusListener = (PrePostFieldListener) listener;
} else {
focusListener = new PrePostFieldListener(this);
}
textComponent.addFocusListener(focusListener);
}
} |
File | Line |
---|
org\xulux\guilayer\swing\widgets\Panel.java | 267 |
org\xulux\guilayer\swing\widgets\Tab.java | 165 |
panel.requestFocus();
isRefreshing = false;
// if widget is not showing we have
// to make it showing..
// if we have a tab, we need to call the parent too..
if (!panel.isShowing() && getParent() != null ||
getProperty(TabPanel.TABID) != null) {
// set the session variable, so controls
// can look who requested focus..
getPart().getSession().setValue("nyx.focusrequest", this);
getParent().focus();
// remove session variable again.
getPart().getSession().remove("nyx.focusrequest");
panel.requestFocus();
}
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#getGuiValue()
*/
public Object getGuiValue() {
return null;
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#canContainValue()
*/
public boolean canContainValue() {
return false;
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#isValueEmpty()
*/
public boolean isValueEmpty() {
return true;
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#addXuluxListener(org.xulux.nyx.gui.XuluxListener)
*/
public void addXuluxListener(IXuluxListener listener) {
}
} |
File | Line |
---|
org\xulux\guilayer\swing\layouts\SwingBorderLayout.java | 80 |
org\xulux\guilayer\swing\layouts\SwingBoxLayout.java | 79 |
layout.addLayoutComponent(comp, constraints);
}
}
/**
* @see java.awt.LayoutManager2#maximumLayoutSize(java.awt.Container)
*/
public Dimension maximumLayoutSize(Container target) {
return layout.maximumLayoutSize(target);
}
/**
* @see java.awt.LayoutManager2#getLayoutAlignmentX(java.awt.Container)
*/
public float getLayoutAlignmentX(Container target) {
return layout.getLayoutAlignmentX(target);
}
/**
* @see java.awt.LayoutManager2#getLayoutAlignmentY(java.awt.Container)
*/
public float getLayoutAlignmentY(Container target) {
return layout.getLayoutAlignmentY(target);
}
/**
* @see java.awt.LayoutManager2#invalidateLayout(java.awt.Container)
*/
public void invalidateLayout(Container target) {
if (layout != null) {
layout.invalidateLayout(target);
}
}
/**
* @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
*/
public void addLayoutComponent(String name, Component comp) {
System.out.println("layoutComponent called : " + name);
}
/**
* @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
*/
public void removeLayoutComponent(Component comp) { |
File | Line |
---|
org\xulux\guilayer\swing\widgets\Table.java | 363 |
org\xulux\guilayer\swing\widgets\Table.java | 379 |
public Object getMouseOverValue() {
if (table == null) {
return null;
}
int selectedRow = table.getSelectedRow();
if (selectedRow == -1) {
return null;
}
if (table.getRowSelectionAllowed() && !table.getCellSelectionEnabled()) {
return table.getModel().getValueAt(selectedRow, -1);
} else if (!table.getRowSelectionAllowed() && table.getCellSelectionEnabled()) {
return table.getModel().getValueAt(selectedRow, table.getSelectedColumn());
}
return null;
}
/**
* @see org.xulux.nyx.gui.XuluxWidget#focus()
*/
public void focus() { |