Skip to content

Commit

Permalink
Corregido el stringcombo y el multistringcombo para que soporte entra…
Browse files Browse the repository at this point in the history
  • Loading branch information
jjdelcerro authored and jjdelcerro committed Apr 25, 2018
1 parent df54f12 commit 1bd508f
Show file tree
Hide file tree
Showing 7 changed files with 192 additions and 27 deletions.
3 changes: 2 additions & 1 deletion i18n/text.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
#Fri Apr 20 10:55:58 CEST 2018
#Wed Apr 25 18:44:15 CEST 2018
_Change_form_name=Cambiar el nombre del formulario
_Size=Tama\u00F1o
_Key=Clave
Expand All @@ -9,6 +9,7 @@ _Move_down_selected_form_item=Mover hacia bajo el item del formulario selecciona
_Form_%s=Formulario %s
_You_must_define_some_form_before_saving=Debera definir algun formulario antes de salvar
_Are_you_sure_you_want_to_abandon_the_changes=\u00BF Esta seguro de querer abadonar los cambios ?
_Add_a_empty_item=A\u00F1adir un item vacio
_File=Fichero
_Create_a_new_form=Crear un nuevo formulario
_Delete_selected_item=Eliminar el item seleccionado
Expand Down
3 changes: 2 additions & 1 deletion i18n/text_en.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
#Fri Apr 20 10:56:25 CEST 2018
#Wed Apr 25 18:44:35 CEST 2018
_Change_form_name=Change form name
_Size=Size
_Key=Key
Expand All @@ -9,6 +9,7 @@ _Move_down_selected_form_item=Move down selected item
_Form_%s=Form %s
_You_must_define_some_form_before_saving=You must define some form before saving
_Are_you_sure_you_want_to_abandon_the_changes=Are you sure you want to abandon the changes?
_Add_a_empty_item=Add a empty item
_File=File
_Create_a_new_form=Create a new form
_Delete_selected_item=Delete selected item
Expand Down
Binary file added images/add_empty.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion items/multistringcombo/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def translateUI(self):
self.btnUp,
self.btnDown,
self.btnDelete,
self.btnAddEmpty,
self.btnAdd
):
manager.translate(component)
Expand All @@ -106,7 +107,10 @@ def put(self, item):
model = self.lstValues.getModel()
model.removeAllElements()
for value in item.getValues():
model.addElement(str(value))
s = unicode(value,errors="ignore")
if s == "":
s = " "
model.addElement(s)
self.lstValues.setSelectedValue(str(item.getValue()), True)
self.txtValue.setText(str(item.getValue()))

Expand All @@ -121,6 +125,8 @@ def fetch(self,item):
item.setValue(self.txtValue.getText())
model = self.lstValues.getModel()
for value in model.elements():
if value == " ":
value = ""
values.append(value)

def lstValues_change(self, event):
Expand Down Expand Up @@ -180,6 +186,11 @@ def btnAdd_click(self, *args):
)
model.addElement(item)

def btnAddEmpty_click(self, *args):
item = " "
model = self.lstValues.getModel()
model.addElement(item)

class MobileFormItemMultiStringComboPreviewPanel(MobileFormItemPanel, FormPanel):
def __init__(self, factory):
MobileFormItemPanel.__init__(self,factory)
Expand Down
101 changes: 86 additions & 15 deletions items/multistringcombo/properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,12 @@
</at>
</object>
</at>
<at name="selectionStart">16</at>
<at name="background" object="color">236,233,216</at>
<at name="editable">false</at>
<at name="name">txtType</at>
<at name="width">742</at>
<at name="selectionEnd">16</at>
<at name="text">multistringcombo</at>
<at name="height">20</at>
</object>
Expand Down Expand Up @@ -740,7 +742,7 @@
</at>
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
</super>
<at name="id">embedded.164433364</at>
<at name="id">embedded.1484954538</at>
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE</at>
<at name="colspecs">FILL:DEFAULT:GROW(1.0)</at>
<at name="components">
Expand Down Expand Up @@ -850,9 +852,9 @@
</at>
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
</super>
<at name="id">embedded.1332689700</at>
<at name="id">embedded.124080513</at>
<at name="rowspecs">CENTER:DEFAULT:NONE</at>
<at name="colspecs">FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE</at>
<at name="colspecs">FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE</at>
<at name="components">
<object classname="java.util.LinkedList">
<item >
Expand Down Expand Up @@ -999,7 +1001,7 @@
<super classname="com.jeta.forms.store.memento.ComponentMemento">
<at name="cellconstraints">
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
<at name="column">6</at>
<at name="column">10</at>
<at name="row">1</at>
<at name="colspan">1</at>
<at name="rowspan">1</at>
Expand Down Expand Up @@ -1045,15 +1047,15 @@
<at name="icon">
<object classname="com.jeta.forms.store.properties.IconProperty">
<at name="embedded">false</at>
<at name="path">addons/mobileforms/images/delete.png</at>
<at name="description">delete.png</at>
<at name="path">addons/mobileforms/images/add.png</at>
<at name="description">add.png</at>
<at name="width">16</at>
<at name="height">16</at>
</object>
</at>
<at name="name">btnDelete</at>
<at name="name">btnAdd</at>
<at name="width">24</at>
<at name="toolTipText">_Delete_selected_item</at>
<at name="toolTipText">_Add_a_new_item</at>
<at name="height">24</at>
</object>
</at>
Expand All @@ -1068,7 +1070,7 @@
<super classname="com.jeta.forms.store.memento.ComponentMemento">
<at name="cellconstraints">
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
<at name="column">8</at>
<at name="column">6</at>
<at name="row">1</at>
<at name="colspan">1</at>
<at name="rowspan">1</at>
Expand Down Expand Up @@ -1114,15 +1116,15 @@
<at name="icon">
<object classname="com.jeta.forms.store.properties.IconProperty">
<at name="embedded">false</at>
<at name="path">addons/mobileforms/images/add.png</at>
<at name="description">add.png</at>
<at name="path">addons/mobileforms/images/delete.png</at>
<at name="description">delete.png</at>
<at name="width">16</at>
<at name="height">16</at>
</object>
</at>
<at name="name">btnAdd</at>
<at name="name">btnDelete</at>
<at name="width">24</at>
<at name="toolTipText">_Add_a_new_item</at>
<at name="toolTipText">_Delete_selected_item</at>
<at name="height">24</at>
</object>
</at>
Expand All @@ -1131,6 +1133,75 @@
</object>
</at>
</item>
<item >
<at name="value">
<object classname="com.jeta.forms.store.memento.BeanMemento">
<super classname="com.jeta.forms.store.memento.ComponentMemento">
<at name="cellconstraints">
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento">
<at name="column">8</at>
<at name="row">1</at>
<at name="colspan">1</at>
<at name="rowspan">1</at>
<at name="halign">default</at>
<at name="valign">default</at>
<at name="insets" object="insets">0,0,0,0</at>
</object>
</at>
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at>
</super>
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at>
<at name="beanclass">javax.swing.JButton</at>
<at name="beanproperties">
<object classname="com.jeta.forms.store.memento.PropertiesMemento">
<at name="classname">javax.swing.JButton</at>
<at name="properties">
<object classname="com.jeta.forms.store.support.PropertyMap">
<at name="border">
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty">
<super classname="com.jeta.forms.store.properties.BorderProperty">
<at name="name">border</at>
</super>
<at name="borders">
<object classname="java.util.LinkedList">
<item >
<at name="value">
<object classname="com.jeta.forms.store.properties.EmptyBorderProperty">
<super classname="com.jeta.forms.store.properties.BorderProperty">
<at name="name">border</at>
<at name="title"></at>
</super>
<at name="top">2</at>
<at name="left">2</at>
<at name="bottom">2</at>
<at name="right">2</at>
</object>
</at>
</item>
</object>
</at>
</object>
</at>
<at name="icon">
<object classname="com.jeta.forms.store.properties.IconProperty">
<at name="embedded">false</at>
<at name="path">addons/mobileforms/images/add_empty.png</at>
<at name="description">add_empty.png</at>
<at name="width">16</at>
<at name="height">16</at>
</object>
</at>
<at name="name">btnAddEmpty</at>
<at name="width">20</at>
<at name="toolTipText">_Add_a_empty_item</at>
<at name="height">20</at>
</object>
</at>
</object>
</at>
</object>
</at>
</item>
</object>
</at>
<at name="properties">
Expand Down Expand Up @@ -1190,7 +1261,7 @@
<at name="rows">
<object classname="[Ljava.lang.Object;" size="1">
<at name="item" index="0">
<object classname="[Ljava.lang.Object;" size="8"/>
<object classname="[Ljava.lang.Object;" size="10"/>
</at>
</object>
</at>
Expand Down Expand Up @@ -1318,7 +1389,7 @@
</at>
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at>
</super>
<at name="id">embedded.1434046142</at>
<at name="id">embedded.187723723</at>
<at name="rowspecs">CENTER:DEFAULT:NONE</at>
<at name="colspecs">FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE</at>
<at name="components">
Expand Down
16 changes: 14 additions & 2 deletions items/stringcombo/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def translateUI(self):
self.btnUp,
self.btnDown,
self.btnDelete,
self.btnAddEmpty,
self.btnAdd
):
manager.translate(component)
Expand All @@ -106,7 +107,10 @@ def put(self, item):
model = self.lstValues.getModel()
model.removeAllElements()
for value in item.getValues():
model.addElement(str(value))
s = unicode(value,errors="ignore")
if s == "":
s = " "
model.addElement(s)
self.lstValues.setSelectedValue(str(item.getValue()), True)
self.txtValue.setText(str(item.getValue()))

Expand All @@ -121,6 +125,8 @@ def fetch(self,item):
item.setValue(self.txtValue.getText())
model = self.lstValues.getModel()
for value in model.elements():
if value == " ":
value = ""
values.append(value)

def lstValues_change(self, event):
Expand Down Expand Up @@ -171,7 +177,7 @@ def btnDelete_click(self, *args):

def btnAdd_click(self, *args):
model = self.lstValues.getModel()
index = self.lstValues.getSelectedIndex()
index = self.lstValues.getModel().getSize()
item = inputbox(
"Item",
getTitle(),
Expand All @@ -180,6 +186,12 @@ def btnAdd_click(self, *args):
)
model.addElement(item)

def btnAddEmpty_click(self, *args):
item = " "
model = self.lstValues.getModel()
model.addElement(item)


class MobileFormItemStringComboPreviewPanel(MobileFormItemPanel, FormPanel):
def __init__(self, factory):
MobileFormItemPanel.__init__(self,factory)
Expand Down

0 comments on commit 1bd508f

Please sign in to comment.