Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
7dff2956
Kaydet (Commit)
7dff2956
authored
Haz 29, 2011
tarafından
Xisco Fauli
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Save Configuration
üst
315aa5d4
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
65 additions
and
179 deletions
+65
-179
ConfigGroup.py
wizards/com/sun/star/wizards/common/ConfigGroup.py
+4
-3
Configuration.py
wizards/com/sun/star/wizards/common/Configuration.py
+0
-1
FaxWizardDialogImpl.py
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+0
-1
CommonListener.py
wizards/com/sun/star/wizards/ui/event/CommonListener.py
+0
-1
DataAware.py
wizards/com/sun/star/wizards/ui/event/DataAware.py
+9
-163
DataAwareField.py
wizards/com/sun/star/wizards/ui/event/DataAwareField.py
+35
-0
RadioDataAware.java
wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
+0
-1
RadioDataAware.py
wizards/com/sun/star/wizards/ui/event/RadioDataAware.py
+6
-3
UnoDataAware.py
wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+11
-6
No files found.
wizards/com/sun/star/wizards/common/ConfigGroup.py
Dosyayı görüntüle @
7dff2956
...
@@ -20,9 +20,10 @@ class ConfigGroup(ConfigNode):
...
@@ -20,9 +20,10 @@ class ConfigGroup(ConfigNode):
child
.
writeConfiguration
(
configView
.
getByName
(
propertyName
),
child
.
writeConfiguration
(
configView
.
getByName
(
propertyName
),
prefix
)
prefix
)
else
:
else
:
print
getattr
(
self
,
field
)
try
:
configView
.
setHierarchicalPropertyValue
(
propertyName
,
getattr
(
self
,
field
))
setattr
(
configView
,
propertyName
,
getattr
(
self
,
field
))
except
Exception
:
pass
def
readConfiguration
(
self
,
configurationView
,
param
):
def
readConfiguration
(
self
,
configurationView
,
param
):
for
name
,
data
in
inspect
.
getmembers
(
self
):
for
name
,
data
in
inspect
.
getmembers
(
self
):
...
...
wizards/com/sun/star/wizards/common/Configuration.py
Dosyayı görüntüle @
7dff2956
...
@@ -132,7 +132,6 @@ class Configuration(object):
...
@@ -132,7 +132,6 @@ class Configuration(object):
return
configView
.
getByName
(
name
)
return
configView
.
getByName
(
name
)
else
:
else
:
# the new element is the result !
# the new element is the result !
print
type
(
configView
)
newNode
=
configView
.
createInstance
()
newNode
=
configView
.
createInstance
()
# insert it - this also names the element
# insert it - this also names the element
configView
.
insertByName
(
name
,
newNode
)
configView
.
insertByName
(
name
,
newNode
)
...
...
wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
Dosyayı görüntüle @
7dff2956
...
@@ -157,7 +157,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
...
@@ -157,7 +157,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
endWizard
=
False
endWizard
=
False
return
False
return
False
self
.
myFaxDoc
.
setWizardTemplateDocInfo
(
\
self
.
myFaxDoc
.
setWizardTemplateDocInfo
(
\
self
.
resources
.
resFaxWizardDialog_title
,
self
.
resources
.
resFaxWizardDialog_title
,
self
.
resources
.
resTemplateDescription
)
self
.
resources
.
resTemplateDescription
)
...
...
wizards/com/sun/star/wizards/ui/event/CommonListener.py
Dosyayı görüntüle @
7dff2956
...
@@ -34,7 +34,6 @@
...
@@ -34,7 +34,6 @@
# OOo's libraries
# OOo's libraries
import
unohelper
import
unohelper
import
inspect
from
com.sun.star.awt
import
XActionListener
from
com.sun.star.awt
import
XActionListener
class
ActionListenerProcAdapter
(
unohelper
.
Base
,
XActionListener
):
class
ActionListenerProcAdapter
(
unohelper
.
Base
,
XActionListener
):
...
...
wizards/com/sun/star/wizards/ui/event/DataAware.py
Dosyayı görüntüle @
7dff2956
from
common.PropertyNames
import
*
from
common.PropertyNames
import
*
from
abc
import
ABCMeta
,
abstractmethod
from
abc
import
ABCMeta
,
abstractmethod
import
traceback
import
traceback
from
ui.event.CommonListener
import
*
'''
'''
@author rpiterman
@author rpiterman
...
@@ -31,27 +32,6 @@ class DataAware(object):
...
@@ -31,27 +32,6 @@ class DataAware(object):
self
.
_dataObject
=
dataObject_
self
.
_dataObject
=
dataObject_
self
.
_value
=
value_
self
.
_value
=
value_
'''
Sets the given value to the data object.
this method delegates the job to the
Value object, but can be overwritten if
another kind of Data is needed.
@param newValue the new value to set to the DataObject.
'''
def
setToData
(
self
,
newValue
):
self
.
_value
.
set
(
newValue
,
self
.
_dataObject
)
'''
gets the current value from the data obejct.
this method delegates the job to
the value object.
@return the current value of the data object.
'''
def
getFromData
(
self
):
return
self
.
_value
.
get
(
self
.
_dataObject
)
'''
'''
sets the given value to the UI control
sets the given value to the UI control
@param newValue the value to set to the ui control.
@param newValue the value to set to the ui control.
...
@@ -75,7 +55,7 @@ class DataAware(object):
...
@@ -75,7 +55,7 @@ class DataAware(object):
'''
'''
def
updateUI
(
self
):
def
updateUI
(
self
):
data
=
self
.
getFromData
(
)
data
=
self
.
_value
.
get
(
self
.
_dataObject
)
ui
=
self
.
getFromUI
()
ui
=
self
.
getFromUI
()
if
data
is
not
ui
:
if
data
is
not
ui
:
try
:
try
:
...
@@ -90,15 +70,13 @@ class DataAware(object):
...
@@ -90,15 +70,13 @@ class DataAware(object):
'''
'''
def
updateData
(
self
):
def
updateData
(
self
):
data
=
self
.
getFromData
()
try
:
ui
=
self
.
getFromUI
()
data
=
self
.
_value
.
get
(
self
.
_dataObject
)
if
not
equals
(
data
,
ui
):
ui
=
self
.
getFromUI
()
setToData
(
ui
)
if
data
is
not
ui
:
self
.
_value
.
Set
(
ui
,
self
.
_dataObject
)
class
Listener
(
object
):
except
Exception
:
@abstractmethod
traceback
.
print_exc
()
def
eventPerformed
(
self
,
event
):
pass
'''
'''
compares the two given objects.
compares the two given objects.
...
@@ -168,135 +146,3 @@ class DataAware(object):
...
@@ -168,135 +146,3 @@ class DataAware(object):
def
setDataObjects
(
self
,
dataAwares
,
dataObject
,
updateUI
):
def
setDataObjects
(
self
,
dataAwares
,
dataObject
,
updateUI
):
for
i
in
dataAwares
:
for
i
in
dataAwares
:
i
.
setDataObject
(
dataObject
,
updateUI
)
i
.
setDataObject
(
dataObject
,
updateUI
)
'''
Value objects read and write a value from and
to an object. Typically using reflection and JavaBeans properties
or directly using memeber reflection API.
DataAware delegates the handling of the DataObject
to a Value object.
2 implementations currently exist: PropertyValue,
using JavaBeans properties reflection, and DataAwareFields classes
which implement different memeber types.
'''
class
Value
(
object
):
'''gets a value from the given object.
@param target the object to get the value from.
@return the value from the given object.
'''
@abstractmethod
def
Get
(
self
,
target
):
pass
'''
sets a value to the given object.
@param value the value to set to the object.
@param target the object to set the value to.
'''
@abstractmethod
def
Set
(
self
,
value
,
target
):
pass
'''
checks if this Value object can handle
the given object type as a target.
@param type the type of a target to check
@return true if the given class is acceptible for
the Value object. False if not.
'''
@abstractmethod
def
isAssifrom
(
self
,
Type
):
pass
'''
implementation of Value, handling JavaBeans properties through
reflection.
This Object gets and sets a value a specific
(JavaBean-style) property on a given object.
@author rp143992
'''
class
PropertyValue
(
Value
):
__EMPTY_ARRAY
=
range
(
0
)
'''
creates a PropertyValue for the property with
the given name, of the given JavaBean object.
@param propertyName the property to access. Must be a Cup letter
(e.g. PropertyNames.PROPERTY_NAME for getName() and setName("..."). )
@param propertyOwner the object which "own" or "contains" the property
'''
def
__init__
(
self
,
propertyName
,
propertyOwner
):
self
.
getMethod
=
createGetMethod
(
propertyName
,
propertyOwner
)
self
.
setMethod
=
createSetMethod
(
propertyName
,
propertyOwner
,
self
.
getMethod
.
getReturnType
())
'''
called from the constructor, and creates a get method reflection object
for the given property and object.
@param propName the property name0
@param obj the object which contains the property.
@return the get method reflection object.
'''
def
createGetMethod
(
self
,
propName
,
obj
):
m
=
None
try
:
#try to get a "get" method.
m
=
obj
.
getClass
()
.
getMethod
(
"get"
+
propName
,
self
.
__class__
.
__EMPTY_ARRAY
)
except
NoSuchMethodException
,
ex1
:
raise
IllegalArgumentException
(
"get"
+
propName
+
"() method does not exist on "
+
\
obj
.
Class
.
Name
)
return
m
def
Get
(
self
,
target
):
try
:
return
self
.
getMethod
.
invoke
(
target
,
self
.
__class__
.
__EMPTY_ARRAY
)
except
IllegalAccessException
,
ex1
:
ex1
.
printStackTrace
()
except
InvocationTargetException
,
ex2
:
ex2
.
printStackTrace
()
except
NullPointerException
,
npe
:
if
isinstance
(
self
.
getMethod
.
getReturnType
(),
str
):
return
""
if
isinstance
(
self
.
getMethod
.
getReturnType
(),
int
):
return
0
if
isinstance
(
self
.
getMethod
.
getReturnType
(),
tuple
):
return
0
if
isinstance
(
self
.
getMethod
.
getReturnType
(),
list
):
return
[]
return
None
def
createSetMethod
(
self
,
propName
,
obj
,
paramClass
):
m
=
None
try
:
m
=
obj
.
getClass
()
.
getMethod
(
"set"
+
propName
,
[
paramClass
])
except
NoSuchMethodException
,
ex1
:
raise
IllegalArgumentException
(
"set"
+
propName
+
"("
+
\
self
.
getMethod
.
getReturnType
()
.
getName
()
+
\
") method does not exist on "
+
obj
.
Class
.
Name
);
return
m
def
Set
(
self
,
value
,
target
):
try
:
self
.
setMethod
.
invoke
(
target
,
[
value
])
except
IllegalAccessException
,
ex1
:
ex1
.
printStackTrace
()
except
InvocationTargetException
,
ex2
:
ex2
.
printStackTrace
()
def
isAssignable
(
self
,
type
):
return
self
.
getMethod
.
getDeclaringClass
()
.
isAssignableFrom
(
type
)
\
and
self
.
setMethod
.
getDeclaringClass
()
.
isAssignableFrom
(
type
)
wizards/com/sun/star/wizards/ui/event/DataAwareField.py
0 → 100644
Dosyayı görüntüle @
7dff2956
import
traceback
from
DataAware
import
*
import
uno
class
DataAwareField
(
object
):
def
__init__
(
self
,
field
,
convertTo
):
self
.
convertTo
=
convertTo
self
.
field
=
field
def
get
(
self
,
target
):
try
:
i
=
getattr
(
target
,
self
.
field
)
if
isinstance
(
self
.
convertTo
,
bool
):
if
i
:
return
True
else
:
return
False
elif
isinstance
(
self
.
convertTo
,
int
):
return
int
(
i
)
elif
isinstance
(
self
.
convertTo
,
str
):
return
str
(
i
)
elif
self
.
convertTo
.
type
==
uno
.
Any
(
"short"
,
0
)
.
type
:
return
uno
.
Any
(
"[]short"
,(
i
,))
else
:
raise
AttributeError
(
"Cannot convert int value to given type ("
+
\
str
(
type
(
self
.
convertTo
))
+
")."
)
except
AttributeError
,
ex
:
traceback
.
print_exc
()
return
None
def
Set
(
self
,
value
,
target
):
setattr
(
target
,
self
.
field
,
value
)
wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
Dosyayı görüntüle @
7dff2956
...
@@ -92,7 +92,6 @@ public class RadioDataAware extends DataAware
...
@@ -92,7 +92,6 @@ public class RadioDataAware extends DataAware
?
DataAwareFields
.
getFieldValueFor
(
data
,
dataProp
,
new
Integer
(
0
))
?
DataAwareFields
.
getFieldValueFor
(
data
,
dataProp
,
new
Integer
(
0
))
:
new
DataAware
.
PropertyValue
(
dataProp
,
data
),
buttons
);
:
new
DataAware
.
PropertyValue
(
dataProp
,
data
),
buttons
);
XItemListener
xil
=
UnoDataAware
.
itemListener
(
da
,
listener
);
XItemListener
xil
=
UnoDataAware
.
itemListener
(
da
,
listener
);
System
.
out
.
println
(
listener
);
for
(
int
i
=
0
;
i
<
da
.
radioButtons
.
length
;
i
++)
for
(
int
i
=
0
;
i
<
da
.
radioButtons
.
length
;
i
++)
{
{
da
.
radioButtons
[
i
].
addItemListener
(
xil
);
da
.
radioButtons
[
i
].
addItemListener
(
xil
);
...
...
wizards/com/sun/star/wizards/ui/event/RadioDataAware.py
Dosyayı görüntüle @
7dff2956
from
DataAware
import
*
from
DataAware
import
*
from
DataAwareField
s
import
*
from
DataAwareField
import
DataAwareField
from
UnoDataAware
import
*
from
UnoDataAware
import
*
import
time
import
time
'''
'''
...
@@ -34,9 +34,12 @@ class RadioDataAware(DataAware):
...
@@ -34,9 +34,12 @@ class RadioDataAware(DataAware):
@classmethod
@classmethod
def
attachRadioButtons
(
self
,
data
,
dataProp
,
buttons
,
field
):
def
attachRadioButtons
(
self
,
data
,
dataProp
,
buttons
,
field
):
if
field
:
if
field
:
aux
=
DataAwareField
s
.
getFieldValueFor
(
data
,
dataProp
,
0
)
aux
=
DataAwareField
(
dataProp
,
0
)
else
:
else
:
aux
=
DataAware
.
PropertyValue
(
dataProp
,
data
)
aux
=
DataAware
.
PropertyValue
(
dataProp
,
data
)
da
=
RadioDataAware
(
data
,
aux
,
buttons
)
da
=
RadioDataAware
(
data
,
aux
,
buttons
)
method
=
getattr
(
da
,
"updateData"
)
for
i
in
da
.
radioButtons
:
i
.
addItemListener
(
ItemListenerProcAdapter
(
method
))
return
da
return
da
wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
Dosyayı görüntüle @
7dff2956
from
DataAware
import
*
from
DataAware
import
*
from
DataAwareField
s
import
*
from
DataAwareField
import
DataAwareField
from
common.Helper
import
*
from
common.Helper
import
*
'''
'''
...
@@ -84,10 +84,12 @@ class UnoDataAware(DataAware):
...
@@ -84,10 +84,12 @@ class UnoDataAware(DataAware):
def
__attachTextControl
(
def
__attachTextControl
(
self
,
data
,
prop
,
unoText
,
unoProperty
,
field
,
value
):
self
,
data
,
prop
,
unoText
,
unoProperty
,
field
,
value
):
if
field
:
if
field
:
aux
=
DataAwareField
s
.
getFieldValueFor
(
data
,
prop
,
value
)
aux
=
DataAwareField
(
prop
,
value
)
else
:
else
:
aux
=
DataAware
.
PropertyValue
(
prop
,
data
)
aux
=
DataAware
.
PropertyValue
(
prop
,
data
)
uda
=
UnoDataAware
(
data
,
aux
,
unoText
,
unoProperty
)
uda
=
UnoDataAware
(
data
,
aux
,
unoText
,
unoProperty
)
method
=
getattr
(
uda
,
"updateData"
)
unoText
.
addTextListener
(
TextListenerProcAdapter
(
method
))
return
uda
return
uda
@classmethod
@classmethod
...
@@ -112,15 +114,17 @@ class UnoDataAware(DataAware):
...
@@ -112,15 +114,17 @@ class UnoDataAware(DataAware):
@classmethod
@classmethod
def
attachCheckBox
(
self
,
data
,
prop
,
checkBox
,
field
):
def
attachCheckBox
(
self
,
data
,
prop
,
checkBox
,
field
):
if
field
:
if
field
:
aux
=
DataAwareField
s
.
getFieldValueFor
(
data
,
prop
,
0
)
aux
=
DataAwareField
(
prop
,
0
)
else
:
else
:
aux
=
DataAware
.
PropertyValue
(
prop
,
data
)
aux
=
DataAware
.
PropertyValue
(
prop
,
data
)
uda
=
UnoDataAware
(
data
,
aux
,
checkBox
,
PropertyNames
.
PROPERTY_STATE
)
uda
=
UnoDataAware
(
data
,
aux
,
checkBox
,
PropertyNames
.
PROPERTY_STATE
)
method
=
getattr
(
uda
,
"updateData"
)
checkBox
.
addItemListener
(
ItemListenerProcAdapter
(
method
))
return
uda
return
uda
def
attachLabel
(
self
,
data
,
prop
,
label
,
field
):
def
attachLabel
(
self
,
data
,
prop
,
label
,
field
):
if
field
:
if
field
:
aux
=
DataAwareField
s
.
getFieldValueFor
(
data
,
prop
,
""
)
aux
=
DataAwareField
(
prop
,
""
)
else
:
else
:
aux
=
DataAware
.
PropertyValue
(
prop
,
data
)
aux
=
DataAware
.
PropertyValue
(
prop
,
data
)
return
UnoDataAware
(
data
,
aux
,
label
,
PropertyNames
.
PROPERTY_LABEL
)
return
UnoDataAware
(
data
,
aux
,
label
,
PropertyNames
.
PROPERTY_LABEL
)
...
@@ -128,11 +132,12 @@ class UnoDataAware(DataAware):
...
@@ -128,11 +132,12 @@ class UnoDataAware(DataAware):
@classmethod
@classmethod
def
attachListBox
(
self
,
data
,
prop
,
listBox
,
field
):
def
attachListBox
(
self
,
data
,
prop
,
listBox
,
field
):
if
field
:
if
field
:
aux
=
DataAwareFields
.
getFieldValueFor
(
aux
=
DataAwareField
(
prop
,
uno
.
Any
(
"short"
,
0
))
data
,
prop
,
uno
.
Any
(
"short"
,
0
))
else
:
else
:
aux
=
DataAware
.
PropertyValue
(
prop
,
data
)
aux
=
DataAware
.
PropertyValue
(
prop
,
data
)
uda
=
UnoDataAware
(
data
,
aux
,
listBox
,
"SelectedItems"
)
uda
=
UnoDataAware
(
data
,
aux
,
listBox
,
"SelectedItems"
)
method
=
getattr
(
uda
,
"updateData"
)
listBox
.
addItemListener
(
ItemListenerProcAdapter
(
method
))
return
uda
return
uda
def
setEnabled
(
self
,
control
,
enabled
):
def
setEnabled
(
self
,
control
,
enabled
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment