Af:table range navigation and select with rownum
I'm trying to use af:table to display some data (long list), but the value attribute always returns the entire list. (Basic example)
I'd like to use the range navigation so the application only select a sublist from the database (using rownum between x and y) and also display the navigation pane with all the pages, but I was only able to get the specific page with no navigation pane.
Does anyone have a good example on how to use the range navigation with selects/rownum?
Assuming I have an untitled1.jspx page with an Untitled1.java backing bean and an <af:table> on my page whose whose binding attribute is set to the EL expression #{Untitled1.table} to expose the table UI component in the backing bean, and a rangeChangeListener set to the EL expression #{Untitled1.onRangeChanged}, then with the following backing bean class, I seem to have been able to disable the user's picking the "Show all" option. It still appears in the list, but visually picking it stays on the current range of rows.
package test.backing;
import oracle.adf.view.faces.component.core.data.CoreTable;
import oracle.adf.view.faces.event.RangeChangeEvent;
public class Untitled1 {
private CoreTable table;
public Untitled1() {
public void onRangeChanged(RangeChangeEvent rangeChangeEvent) {
int newStart = rangeChangeEvent.getNewStart();
int newEnd = rangeChangeEvent.getNewEnd();
if (newEnd - newStart > getTable().getRows()) {
int oldEnd = rangeChangeEvent.getOldEnd();
int oldStart = rangeChangeEvent.getOldStart();
queueRangeChangeEventForTable(newStart, newEnd, oldStart, oldEnd);
private void queueRangeChangeEventForTable(int oldStart, int oldEnd,
int newStart, int newEnd) {
RangeChangeEvent rce =
new RangeChangeEvent(getTable(), oldStart, oldEnd, newStart, newEnd);
getTable().queueEvent(rce);
public void setTable(CoreTable table) {
this.table = table;
public CoreTable getTable() {
return table;
}
Similar Messages
-
Dynamically changing af:table range navigation
Hi Steve,
I have a requirement of changing range navigation on another variable "items per page" on the table.
1. User can select any number of items to be displayed at a time on page from a drop down with values 10,20,30 etc.
2. I have a valueChangeEvent Bound to this drop down to set the table rows.
public void itemsPerPageValueChange(ValueChangeEvent valueChangeEvent) {
// Add event code here...
if (valueChangeEvent.getNewValue() != null) {
Integer items = (Integer)valueChangeEvent.getNewValue();
getTable1().setRows(items);
This happens fine on the first page i.e. On page display. But say if there are more records then the selected value
in the dropdown, a table range navigation is displayed as expected. Now if i go to next set of records by "pressing next",
and select a larger value from "items per page", the list is not displayed as per the selected value. i.e. if there are 16 records
and i select 20, the display is still displaying the last six records. Only if i click "previous 10" on the table, do i get
20 records and the range navigation for the table disappears.
How can i control this?
1.I mean to always display number of records as selected by the user irrespective of which range of
records he is seeing.
2.To display correct value in "previous" and "next" navigation controls depending on value selected by user from dropdown
Thanks
sameerHi Steve,
I have a requirement of changing range navigation on another variable "items per page" on the table.
1. User can select any number of items to be displayed at a time on page from a drop down with values 10,20,30 etc.
2. I have a valueChangeEvent Bound to this drop down to set the table rows.
public void itemsPerPageValueChange(ValueChangeEvent valueChangeEvent) {
// Add event code here...
if (valueChangeEvent.getNewValue() != null) {
Integer items = (Integer)valueChangeEvent.getNewValue();
getTable1().setRows(items);
This happens fine on the first page i.e. On page display. But say if there are more records then the selected value
in the dropdown, a table range navigation is displayed as expected. Now if i go to next set of records by "pressing next",
and select a larger value from "items per page", the list is not displayed as per the selected value. i.e. if there are 16 records
and i select 20, the display is still displaying the last six records. Only if i click "previous 10" on the table, do i get
20 records and the range navigation for the table disappears.
How can i control this?
1.I mean to always display number of records as selected by the user irrespective of which range of
records he is seeing.
2.To display correct value in "previous" and "next" navigation controls depending on value selected by user from dropdown
Thanks
sameer -
How to display table range navigation bar at the bottom of the tr table i
Hello,
While I am using trinidad, I have to face a critical issue. Can I display table range navigation bar at the bottom of the <tr table> in Trinidad? and remove the range dropdown list, only show the "previous" and "next" link? The project is critical on the UI, this problem is very small but has to be fixed? Does anyone have any ideas?Difficult to do? No.
<ul id="bottom-nav"><li><a hef="whatever.php">whatever</a></li><li class="last"><a hef="whatever2.php">whatever2</a></li></ul>
With this CSS -
ul#bottom-nav {
list-style-type:none;
overflow:hidden;
width:70%;
margin:0 auto;
ul#bottom-nav li {
float:left;
padding-right:10px;
border-right:1px solid #FFF;
ul#bottom-nav li.last {
border:none;
ul#bottom-nav a {
/* your styles here */ -
How to move ADF table range navigation towards left?
Hi All,
I am using jdev 10.1.3.4. The page I am working is showing a table with many columns. So I need to scroll horizontally to see the table navigation.
Is there any way to move the table range navigation to the left so that I dont need to scroll?
Can it be done with using skin selectors?
Can anyone help me regarding this?
--AbhijitIf you can do it I guess you have to use skinning.
Check out the skin selectors for af|table [http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/skin-selectors.html#Component-level%20Selectors|http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/skin-selectors.html#Component-level%20Selectors] here
Frank Nimphius has an old blog entry [http://thepeninsulasedge.com/frank_nimphius/2007/10/02/adf-faces-hidden-skinning-nugget/|http://thepeninsulasedge.com/frank_nimphius/2007/10/02/adf-faces-hidden-skinning-nugget/] which reveals a hidden (or unknown) feature. There may be more...
Timo -
Issue with ADF table range paging and sorting
Hello,
We have a requirement to support pagination in ADF tables. For this, we have made use of Range paging access mode in the view object level. The paging works perfectly fine with this. But we have another requirement of letting the user do a sort on the table (Yes!! The paginated table). The sort should be applied on all rows in the db and the control should return to the first row.
Applying sort as it is provided by the fwk, sorts the records in the obtained range only. So we have over ridden the Sort listener in Managed bean for this and are able to acheive the sorting of all rows through a AM method call. We are seeing a problem after this. If the sort action is applied to the key attribute then the previous and next range navigation works fine. If the same action is applied to non-key field, then some times (yea!! This is not consistent) the next set is not fetched.
Here is the code snippet that is called on Next navigation:
Map<String,Object> pfScope = AdfFacesContext.getCurrentInstance().getPageFlowScope();
Object objPageNumber = pfScope.get("pageNumber");
int pageNumber = 0;
if(null != objPageNumber)
pageNumber = new Integer(objPageNumber.toString()).intValue();
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
JUCtrlRangeBinding view = (JUCtrlRangeBinding)bindings.getControlBinding("GeDmRequestVO");
int iRange = getTable().getAutoHeightRows();
int currentPage = view.getIteratorBinding().getNavigatableRowIterator().getRangeStart()/(iRange + 1);
System.out.println("Before " + view.getIteratorBinding().getNavigatableRowIterator().getRangeStart());
System.out.println("Current : " + currentPage);
System.out.println("Page Number : " + pageNumber);
System.out.println("Range : " + iRange);
System.out.println("Value : " + iRange*(currentPage + pageNumber));
view.getIteratorBinding().getNavigatableRowIterator().scrollRange(iRange*pageNumber);
System.out.println("After " + view.getIteratorBinding().getNavigatableRowIterator().getRangeStart());
Although, the new values are not refreshed in the table, the SOPs for before and after print the proper range sizes. And as I mentioned above, the above code works perfectly fine if there is no sort applied or when key attribute is sorted.
Would appreciate your help on this regard with navigation after non-key attribute sort.
Thanks,
Chitra.Hi Chitra,
Can you specify some links to implement RangePaging.....We need to implement pagination.If possible can you share the code or specify the steps how you achieved it.
Thanks -
Af:table range navigation
Hi, i'm facing a problem...i'm using seperate af:selectRangeChoiceBar for range navigation. But sometimes the rangebar behaves wrongly, like in safari, if i slecet the range from option list, range is changing and suddenly again server trip is happening, and restoring previous range position, means calling "RangeChangeEvent" twice and sometimes by clicking next button , its jumping one range going to the range after that , like 1-10 of 100 then when clicking next going to 31-40 of 100. its happening in IE also...i have seen if i use table default range bar the first error still i'm getting in safari in somesituation. what may be the problem.the possibilities...pls help.
thanksTurns out, I had forgotten that I had indeed used a rangeChangeListener, and this is in fact related to the bug when a table is displayed in Safari or Chrome, which both use the WebKit rendering engine to display web pages. I've now got a demo project with this stripped down to it's bare essentials. By the way this is ADF Faces on 10.1.3.4, not 11g, though it is possible that the problem is in Trinidad's table component too.
It contains:
A Model project with one read-only ADF BC View Object based on the ALL_OBJECTS dictionary view, and one Application Module referencing the VO. You can use practically any database connection - I'm using SCOTT/TIGER.
A ViewController project with one jspx page, allObjects.jspx, that has an af:table component referencing the above VO. There is a single backing bean for this page which only contains one method - a rangeChangeListener. This simply does System.out.println to show the old and new ranges.
Run the page with Firefox or Internet Explorer, and you will see almost the expected behavior - if I use the drop down range selection control to jump from the first set of rows to a set in the middle, say 91-100, I see:
Range Changed from 0-10 to 90-99.
I say "almost" the expected behavior, because I would have expected to see the starting range from 0-9 - which is what is on the screen with a zero based index.
But if you do the same thing from Safari, you get:
Range Changed from 0-10 to 90-99.
Range Changed from 90-99 to 0-9.
And that is exactly what you see on the screen - it briefly flashes with the selected range - 91-100, then returns to the original range 1-10.
In this example, after the first range change, Safari behaves correctly, but in my actual application my rangeChangeListener manipulates the ranges, so it does it every time. Changing the range with the "Previous" and "Next" links always works correctly.
Change the af:table component so that it doesn't reference the rangeChangeListener, and the page works correctly in all browsers. -
ADF faces tables - range navigation table footer
Hi,
I have a strage situation using ADF Faces' table, sometimes it displays range navigation on top and bottom of the table and sometimes only on top of the table. Is it possible to show always the range navigation on top and bottom of the table? How? If not, can someone give me an example of using an selectRangeChoiceBar to implement navigation on bottom of the table?
Thanks in advance.
Best Regards,
Giuseppebump
-
Table range navigator location
Hi all,
could I place range navigation of af:Table in the beggining or into the middle
of this table? If so, how exactly. Thanksthis isn't working. i tried overriding all possible id's i can find in the source.
when i did a view source of my jsp page, this is a part of the source i see..
<div style="overflow:auto; width:100.0%; height:85.0%; margin:0.0pt auto;"><form id="itmTable:_id13" name="itmTable:_id13" style="margin:0px" onkeypress="return _submitOnEnter(event,'itmTable:_id13');" method="POST" action="/fileViewer/faces/fileViewer.jsp"><div id="{color:#ff0000}itmTable{color}:{color:#ff0000}mytable{color}"><table cellpadding="0" cellspacing="0" border="0" summary=""><tr><td><table cellpadding="0" cellspacing="0" border="0" width="100%" summary="" class="x2h"><tr><td width="100%"></td><td {color:#0000ff}align="right"{color} valign="middle"><script>function _navSubmit1(formName, event, id, vld, val){return _submitPartialChange(formName,vld,{event:event,source:id,value:val});}</script><script>function _navChoiceSubmit1(choice, formName, event, id, vld){if (!_navSubmit1(formName, event, id, vld, choice.options[choice.selectedIndex].value)){choice.selectedIndex = choice._lastValue;}}</script><table cellpadding="0" cellspacing="0" border="0" summary="" id="itmTable:mytable-nb"><tr><td id="itmTable:mytable-nb-i" valign="middle"><img src="/fileViewer/adf/images/oracle/tnavpd.gif" width="14" height="14" border="0" alt="Previous functionality disabled"></td><td><script>t(5,1)</script></td><td valign="middle" nowrap><span class="x55">Previous</span></td><td><script>t(5,1)</script></td><td valign="middle" nowrap><select title="Select record set" class="x6" onchange="_navChoiceSubmit1(this, 'itmTable:_id13','goto','itmTable:mytable',1)" onfocus="this._lastValue = this.selectedIndex" id="itmTable:mytable-nb__xc_c"><option value="all">Show All 100</option><option value="1" selected>1-40 of 100</option><option value="41">41-80 of 100</option><option value="81">81-100 of 100</option></select><label for="itmTable:mytable-nb__xc_c" class="x4e">Select record set</label><script>_setSelectIndexById("itmTable:mytable-nb__xc_c",1)</script></td><td><script>t(5,1)</script></td><td valign="middle" nowrap><a href="#" onclick="_navSubmit1('itmTable:_id13', 'goto', 'itmTable:mytable',1,'41');return false" class="x54">Next 40</a></td><td><script>t(5,1)</script></td><td valign="middle"><a href="#" onclick="_navSubmit1('itmTable:_id13', 'goto', 'itmTable:mytable',1,'41');return false"><img src="/fileViewer/adf/images/oracle/tnavn.gif" width="14" height="14" border="0" alt="Select to view next set"></a></td></tr></table></td></tr></table></td></tr><tr><td><table class="x2f" cellpadding="1" cellspacing="0" border="0" width="100%"><tr><th scope="col" class="x36 x68" onclick="return _tableSort('itmTable:_id13',1,'itmTable:mytable','col2');">
'itmTable' is the id for my subview.
'mytable' is the id for the adf table
what i can see from this is the text in blue (ie "right") should be overrided to "left".
i tried everything possible in the world but no success.
Edited by: khan379 on Oct 14, 2008 5:15 PM -
Trinidad Table range navigation problem
Hi,
I'm using Trinidad components, I try to display a table with range navigation but the range navigation don't work, the first range is always displayed. Must I implement some business myself?
Here is my jspx code:
<tr:table value="#{jobScheduler.userJobsTable}"
var="row"
emptyText="No rows"
rowBandingInterval="1"
rows="3">
<tr:column headerText="N°">
<tr:outputText value="#{row.job}"/>
</tr:column>
</tr:table>
The userJobsTable property is a java.Util.List.
I know that there is a param first in the table tags, but I don't know, which value I must set to it, ...
Thanks in advance.
MikeHi,
Trinidad question should be posted to the Trinidad mailing lists on MyFaces at Apache.org
Frank -
ORA-12815 while reorg/compression of tables without LONG and LOB with 11g
Hello fellows,
I am in the luxury situation that I got a copy of our production R/3 environment that was left over from a project and is no more required by any of our developers.
As we are still on oracle 9.2.0.7 I upgraded this copy to 11.2 in a two step process (from 9i to 10g to 11g).
I got myself the SAP dbatools 7.20(3) and the Note 1431296 - LOB conversion and table compression with BRSPACE 7.20.
I started with some small tablespaces but after a while I thought I'd like to try to reorg/compress the worst of all tablespaces...PSAPPOOLD with ~15.000 tables.
I first converted tables with LONG fields online that can be compressed, than the onse that can not be compressed, than I reorged the tables that contain old LOB fields online. With these different executions of the brspace commands that are also mentioned in the above note I managed to move ~ 3.000 tables without any issues.
But now I started with the biggest bunch of tables, the compression of tables without LONG and LOB fields online.
This is the command I used:
brspace -u / -p reorgEXCL.tab -f tbreorg -a reorg -o sapr3 -s PSAPPOOLD -t allsel -n psapreorg -i psapreorgi -c ctab -SCT
...after a few checks that are performed by brspace, I end up in the screen
Options for reorganization of tables (which is still nothing I wouldn't have expected)
1 * Reorganization action (action) ............ [reorg]
2 - Reorganization mode (mode) ................ [online]
3 - Create DDL statements (ddl) ............... [yes]
4 ~ New destination tablespace (newts) ........ [PSAPREORG]
5 ~ Separate index tablespace (indts) ......... [PSAPREORGI]
6 - Parallel threads (parallel) ............... [1]
7 ~ Table/index parallel degree (degree) ...... []
8 ~ Category of initial extent size (initial) . []
9 ~ Sort by fields of index (sortind) ......... []
10 # Index for IOT conversion (iotind) ......... [FIRST]
11 - Compression action (compress) ............. [none]
12 # LOB compression degree (lobcompr) ......... [medium]
13 # Index compression method (indcompr) ....... [ora_proc]
But independent of what I enter in point 6 and 7, I always end up with below erros during the reorg/compression of the outstanding tables:
Just one sample, but the issue is always the same.
BR0301E SQL error -12815 in thread 2 at location tab_onl_reorg-26, SQL statement:
'CREATE UNIQUE INDEX "SAPR3"."RTXTF_____0#$" ON "SAPR3"."RTXTF#$" ("MANDT", "APPLCLASS", "TEXT_NAME", "TEXT_TYPE", "FROM_LINE",
"FROM_POS")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 1662976 NEXT 655360 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "PSAPREORGI" PARALLEL ( INSTANCES 0) '
ORA-12815: value for INSTANCES must be greater than 0
Just in case, here it the OBJECT DDL:
CREATE UNIQUE INDEX "SAPR3"."RTXTF_____0"
ON "SAPR3"."RTXTF" ("MANDT", "APPLCLASS", "TEXT_NAME",
"TEXT_TYPE", "FROM_LINE", "FROM_POS")
TABLESPACE "PSAPPOOLI" PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE ( INITIAL 1624K NEXT 640K MINEXTENTS 1 MAXEXTENTS
2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1)
LOGGING
Perhaps someone already gained some experience on the compression with brspace and can give me a hint.
Many thanks
FlorianHello Florian,
> Perhaps someone already gained some experience on the compression with brspace and can give me a hint.
I have not performed any compression operations on Oracle 11g R2 with brspace until yet .. but this error seems to be very obvious.
It seems like SAP is still not using the procedure DBMS_REDEFINITION.COPY_TABLE_DEPENDENT to create the indexes (and NOT NULL constraints) on Oracle 11g R2. No idea why, i can only think of one case (create a DDL file before reorganisation to change the DDL parameters through the reorganisation in some kind of ways).
So in your case it seems like SAP is creating a wrong SQL for creating the index on the interim table.
You can try to create the DDL file first and correct the parameters and after that you can try to run the reorganisation again.
Please check sapnote #646681 (Remark 5) for more information about the procedure for "creating the DDL first .. and then do the reorg with edited parameters).
Regards
Stefan -
Table.setRowSelectionInterval(a,a)select with yellow color why
Hi
table.setRowSelectionInterval(a,a);
Why duos this method selects around the cell
With a yellow color not blue like when I mouse click
Thanksmaybe resetting the colour to another one and then revert back to original if it works...
Hope this helps.
Best wishes
Shirley -
Linked images in a table showing visted and messing with the the whole table
Help Please.
I have never had this happen in any other version of dreamweaver. Using dreamweaver CC right now.
I have an image created in photoshop. cut into slices. load the html and images into dreamweaver. Dreamweaver then creates a table. If i upload just like that, site looks fine. Once I choose an image slice, create a link to it and then upload the site, there is a purple border around the image therefore wrecking my whole table. The site shows breaks between each image slice.
THank youThe only real advice I can give, that will help you in the long run, would be to take some time to learn at least the basics of html and css. Photoshop's way of doing things will almost always blow your site to pieces as soon as you start changing content around. To create professional websites with DW, you are expected to understand HTML and CSS (and to a lesser degree, javascript). Without a firm understanding of HTML and CSS though, little issues like the IE border problem can become huge problems.
There are tons of places online to get tutorials on all of this, I personally like the following links, for the basics...
HTML: http://w3schools.com/html
CSS: http://w3schools.com/css
Once you understand what's going on behind the scenes in DW, it's much easier to work with the program. Once you understand how to work with the code the program gives you, Photoshop can be left to do the work it was designed for, image manipulation. -
Update table based on a select with a where clause
I am trying to update a table only for records where i have a status of changed.
Using the following code the update changes all the records putting in blank data if it is outwith the where clause.
ideas?
-- Update changed records
UPDATE IP_SURVEY_ACTIVITY_REG_NO old
SET (
old.SLPN,
old.SURVEY_DATE,
old.SEQUENTIAL_REF_NUMBER,
old.TOTAL_NUM_OF_SAMPLES,
old.TOTAL_NUM_OF_ASSOC_SAMPLES,
old.AIR_TESTS,
old.REMARKS,
old.SURVEY_DETAILS,
old.FURTHER_SURVEY_DETAILS,
old.GENERAL_COMMENTS) =
(SELECT
new.SLPN,
new.SURVEY_DATE,
new.SEQUENTIAL_REF_NUMBER,
new.TOTAL_NUM_OF_SAMPLES,
new.TOTAL_NUM_OF_ASSOC_SAMPLES,
new.AIR_TESTS,
new.REMARKS,
new.SURVEY_DETAILS,
new.FURTHER_SURVEY_DETAILS,
new.GENERAL_COMMENTS
FROM IP_SURVEY_ACTIVITY_REG_NO_INT new
WHERE new.load_id = v_load_id
AND new.status = 'CHANGED'
AND new.sarn = old.sarn);
cheers bjornThe EXISTS claue just needs to be added to your original query as a predicate on the ip_survey_activity_reg_no table. somethign like:
UPDATE ip_survey_activity_reg_no old
SET (old.slpn, old.survey_date, old.sequential_ref_number,
old.total_num_of_samples, old.total_num_of_assoc_samples,
old.air_tests, old.remarks, old.survey_details,
old.further_survey_details, old.general_comments) =
(SELECT new.slpn, new.survey_date,
new.sequential_ref_number,
new.total_num_of_samples,
new.total_num_of_assoc_samples, new.air_tests,
new.remarks, new.survey_details,
new.further_survey_details,new.general_comments
FROM ip_survey_activity_reg_no_int new
WHERE new.load_id = v_load_id and
new.status = 'CHANGED' and
new.sarn = old.sarn)
WHERE EXISTS (SELECT 1 FROM ip_survey_activity_reg_no_int new
WHERE new.load_id = v_load_id and
new.status = 'CHANGED' and
new.sarn = old.sarn)An updateable join view is similar, except you just join the two tables. Assuming that sarn is the primary key of ip_survey_activity_reg_no_int, or is at least declared as unique in that table, then the update of the join would look something like:
UPDATE (SELECT old.slpn oslpn, old.survey_date osurvey_date,
old.sequential_ref_number osequential_ref_number,
old.total_num_of_samples ototal_num_of_samples,
old.total_num_of_assoc_samples ototal_num_of_assoc_samples,
old.air_tests oair_tests, old.remarks oremarks,
old.survey_details osurvey_details,
old.further_survey_details ofurther_survey_details,
old.general_comments ogeneral_comments,
new.slpn nslpn, new.survey_date nsurvey_date,
new.sequential_ref_number nsequential_ref_number,
new.total_num_of_samples ntotal_num_of_samples,
new.total_num_of_assoc_samples ntotal_num_of_assoc_samples,
new.air_tests nair_tests, new.remarks nremarks,
new.survey_details nsurvey_details,
new.further_survey_details nfurther_survey_details,
new.general_comments ngeneral_comments
FROM ip_survey_activity_reg_no old, ip_survey_activity_reg_no_int new
WHERE new.sarn = old.sarn and
new.status = 'CHANGED' and
new.load_id = v_load_id)
SET oslpn = nslpn,
osurvey_date = nsurvey_date,
osequential_ref_number = nsequential_ref_number,
ototal_num_of_samples = ntotal_num_of_samples,
ototal_num_of_assoc_samples = ntotal_num_of_assoc_samples,
oair_tests = nair_tests,
oremarks = nremarks,
osurvey_details = nsurvey_details,
ofurther_survey_details = nfurther_survey_details,
ogeneral_comments = ngeneral_commentsHTH
John
Message was edited by:
John Spencer
Honest, Eric wasn't there when I posted :-) -
Problem Filling and Selecting with Paths.jsx
I have copied Paths.jsx from the Adobe Photoshop CS5 Javascript Scripting Reference, p. 141. It works OK. It makes a path that is the outline of an ice cream cone and strokes it with the current foreground color.
I then tried to fill the path and that does not work. I have tried 3 methods using the following additional code and changing the appropriate false's to true:
// Fill the path
fillColor = new SolidColor
fillColor.rgb.red = 255
fillColor.rgb.green = 0
fillColor.rgb.blue = 0
try {
if(false) {
// This works and gives a gray fill that is neither the
// foreground nor background color
// Only the ice cream part of the cone is selected and filled
myPathItem.fillPath()
} else if(false) {
// With a color specified, it doesn't work
myPathItem.fillPath(fillColor)
} else if(true) {
// This makes a selection of the PathItem, selects it and fills it
// Only the ice cream part of the cone is selected and filled
myPathItem.makeSelection(0, false, SelectionType.REPLACE)
selRef = app.activeDocument.selection;
selRef.fill(fillColor, ColorBlendMode.NORMAL)
} catch(ex) {
msg = "Error filling path:\n" + ex.message
alert(msg, "Exception", true);
They do as the comments say. None of them does what I would expect. For the second way, the error message is:
General Photoshop error occurred. This functionality may not be available in this version of Photoshop
- Could not complete the command because of a program error.
I do not understand why only the ice cream part of the cone is filled or selected (the third array). I can manually make a selection from the Path in PS and it also only selects the ice cream part. All of the lines are stroked. Only the top part is filled or selected.
Why does fillPath not work?
I can supply the whole script if necessary. I am an experienced programmer but new to Photoshop scripting. Is this a bug or am I doing something wrong?
Thanks for any help.This is the whole script:
// Paths.jsx
#target photoshop
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
// Set Adobe Photoshop CS5 to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
// First close all the open documents
while (app.documents.length) {
app.activeDocument.close()
// Create a document to work with
var docRef = app.documents.add(5000, 7000, 72, "Simple Line")
// line 1--it’s a straight line so the coordinates for anchor, left, and right
// for each point have the same coordinates
var lineArray = new Array()
lineArray[0] = new PathPointInfo
lineArray[0].kind = PointKind.CORNERPOINT
lineArray[0].anchor = Array(100, 100)
lineArray[0].leftDirection = lineArray[0].anchor
lineArray[0].rightDirection = lineArray[0].anchor
lineArray[1] = new PathPointInfo
lineArray[1].kind = PointKind.CORNERPOINT
lineArray[1].anchor = Array(150, 200)
lineArray[1].leftDirection = lineArray[1].anchor
lineArray[1].rightDirection = lineArray[1].anchor
var lineSubPathArray = new Array()
lineSubPathArray[0] = new SubPathInfo()
lineSubPathArray[0].operation = ShapeOperation.SHAPEXOR
lineSubPathArray[0].closed = false
lineSubPathArray[0].entireSubPath = lineArray
// line 2
var lineArray2 = new Array()
lineArray2[0] = new PathPointInfo
lineArray2[0].kind = PointKind.CORNERPOINT
lineArray2[0].anchor = Array(150, 200)
lineArray2[0].leftDirection = lineArray2[0].anchor
lineArray2[0].rightDirection = lineArray2[0].anchor
lineArray2[1] = new PathPointInfo
lineArray2[1].kind = PointKind.CORNERPOINT
lineArray2[1].anchor = Array(200, 100)
lineArray2[1].leftDirection = lineArray2[1].anchor
lineArray2[1].rightDirection = lineArray2[1].anchor
lineSubPathArray[1] = new SubPathInfo()
lineSubPathArray[1].operation = ShapeOperation.SHAPEXOR
lineSubPathArray[1].closed = false
lineSubPathArray[1].entireSubPath = lineArray2
// Ice cream curve
// It’s a curved line, so there are 3 points, not 2
// coordinates for the middle point (lineArray3[1]) are different.
// The left direction is positioned "above" the anchor on the screen.
// The right direction is positioned "below" the anchor
// You can change the coordinates for these points to see
// how the curve works...
var lineArray3 = new Array()
lineArray3[0] = new PathPointInfo
lineArray3[0].kind = PointKind.CORNERPOINT
lineArray3[0].anchor = Array(200, 100)
lineArray3[0].leftDirection = lineArray3[0].anchor
lineArray3[0].rightDirection = lineArray3[0].anchor
lineArray3[1] = new PathPointInfo
lineArray3[1].kind = PointKind.CORNERPOINT
lineArray3[1].anchor = Array(150, 50)
lineArray3[1].leftDirection = Array(100, 50)
lineArray3[1].rightDirection = Array(200, 50)
lineArray3[2] = new PathPointInfo
lineArray3[2].kind = PointKind.CORNERPOINT
lineArray3[2].anchor = Array(100, 100)
lineArray3[2].leftDirection = lineArray3[2].anchor
lineArray3[2].rightDirection = lineArray3[2].anchor
lineSubPathArray[2] = new SubPathInfo()
lineSubPathArray[2].operation = ShapeOperation.SHAPEXOR
lineSubPathArray[2].closed = false
lineSubPathArray[2].entireSubPath = lineArray3
// Create the path item
var myPathItem = docRef.pathItems.add("A Line", lineSubPathArray)
// Stroke it so we can see something
myPathItem.strokePath(ToolType.BRUSH)
// Fill the path
fillColor = new SolidColor
fillColor.rgb.red = 255
fillColor.rgb.green = 0
fillColor.rgb.blue = 0
try {
if(false) {
// This works and gives a gray fill that is neither the
// foreground nor background color
// Only the ice cream part of the cone is selected and filled
myPathItem.fillPath()
} else if(false) {
// With a color specified, it doesn't work
myPathItem.fillPath(fillColor)
} else if(true) {
// This makes a selection of the PathItem, selects it and fills it
// Only the ice cream part of the cone is selected and filled
myPathItem.makeSelection(0, false, SelectionType.REPLACE)
selRef = app.activeDocument.selection;
selRef.fill(fillColor, ColorBlendMode.NORMAL)
} catch(ex) {
msg = "Error filling path:\n" + ex.message
alert(msg, "Exception", true);
// Reset the application preferences
preferences.rulerUnits = startRulerUnits
preferences.typeUnits = startTypeUnits
displayDialogs = startDisplayDialogs -
Selecting with rownum=1 taking time
Hi, I am using below script in one of my PL/SQL program. The strange thing is that this is taking time to execute. But If we gather stats on user_scheduler_job_run_details, it executes quickly. Looks like it is doing a full table scan in the 1st case. Any idea about why this is happening. SELECT * FROM user_scheduler_job_run_details where ROWNUM = 1 Thanks.
Hi,
1) USER_SCHEDULER_JOB_RUN_DETAILS is a view. How do you collect optimizer stats on a view?!
2) "the strange thing is that this is taking time to execute" -- there is nothing strange about that. Everything takes time. How much time does the query take exactly?
3) "looks like it is doing a full table scan" -- post appropriate diagnostic information for this query, e.g. SQL real-time monitor output, dbms_xplan.display_cursor output or tkprof'ed trace file.
Best regards,
Nikolay
Maybe you are looking for
-
ITunes 6.0.2 glitch - unable to specify 3 star rating in smart playlists
Hi all, there seems to be an interface glitch in iTunes 6.0.2 which prevents me from setting up a smart playlist rule containing a rating of 3 stars. Whenever i try to adjust the slider to * it jumps back to ***. Can anybody confirm this? regards, Di
-
How to select last record or first record value in a formula?
Post Author: d111 CA Forum: General I am using a query in a report that in addition to other columns, has a column of month labels like: There are no unique identifiers or sequence fields that can be used. There is only 4 columns: the label and 3 p
-
Artwork does not appear on the grid or coverflow.
Artwork does not appear on the grid or coverflow for several albums but appears in the artwork viewer when you play a song from the album. How do I get the artwork to appear? The artwork seems to be missing for albums that I believe were on a playl
-
BPM: RFC (SYNC) - BPM- HTTP client
All XI Experts My scenario is RFC synchonous to XI (BPM) to HTTP Client. I correctly configured all my messages interfaces and mapping programs. I have defined the following:- Sync Abstract message interface for the RFC structure Async Abstract MI fo
-
I am using Keynote 9 in OS X version 10.8.4. I would like to be able to use a "save as" function to specify where my file is to be placed without have to do a find and move. Help would be greatly appreciated.