Continuous text in 2 rows fu00FCr advertisement column
Hello,
I'am lookiing for a possibility to create a pdf-form with continuous text in 2 rows for advertisement columns.
Maybe someone know a solution?
Thanks in advance!
Hi Sanjeev,
thanks for the answer. It's ok by interaktive forms. But I need a solution for a pdf-form, where I can use the transaction 'SO10' or rather I want use 1 text block (SO10) for 2 ( or perhaps 1) fields. Perhaps it is possible 1 textfield und 2 rows or I should create a table?!
Generally I must create an advertising copy in 2 rows for a pdf-form.
Thanks very much for the first answers, it was very helpful!
Perhaps you have an other good idea?
Best regards!
Similar Messages
-
How can I continue text into column on next page in the new Pages?
In the previous version of Pages if your text exceeded the length of the column, there was a little icon to the right of the column where you could click to have the remaining text continue to another column on another page. I don't see any option to continue the text once you've run out of space. How can this be done in the new verio
Message was edited by: JoyRoseFeature removed in Pages 5 along with over 90 others.
Peter -
How do I read text from specific rows and columns in a tree structure?
How do I read text from specific rows and columns in a tree structure? In a table you can specify the cell to read from but I have not been able to figure out how to do this with a tree structure.
You need to set two properties to activate the correct cell and then you can read it's string property.
The positioning properties are the "ActiveItemTag" and
"ActiveColNum" properties. With them you select the tree item by it's tag and the active column. The string can then be read from the "Cell String" property.
MTO -
Title/Heading/Row-Align Multi-Column Tables
File under: Frame Annoyances, with a limited hacky work-around
In the two-column format we commonly work in, we often need a table that is column-wide, but may flow into multiple colums.
The problem is that the continuation heading (and TableTitle, if used), never align with the starting heading/title. This is because the continuations start at top of column, whereas the table itself starts (by "Anywhere" default) below the anchor line (presumed to be "In Column" for this discussion)..
OK, what if we change Table > Table Designer [Basic] Start to:
Top of Column: Oops, that becomes top of next column, leaving the anchor text column-widowed (but it gave me an idea).
Top of Page: Oops, that becomes top of next page, leaving the anchor text page-widowed.
Float: No effect
OK, what if we change the anchor text Format > Paragraph > Para Designer [Pagination] Format to:
[Pagination] Across All Columns (AAC): Oops, table appears only in left column on all pages, or;
[Basic] Space & Line Spacing, including negative values, appears to have no effect. Using a tiny font only minimizes the problem, and doesn't cure it.
I thought I had figured out how to solve this at one time, but could not recall it. I'm posting this in part to solicit some simpler solution. Web searching found only one solid candidate solution, and it was, of course, 404. Perhaps Frame versions later than the FM7/Win and FM7.1/Unix that I routinely use have enhancements to address this.
We normally just sidestep the problem by using an AAC format and a table that spans the page, with a fake center gutter, simulating a multi-column flow. But in a recent case, I wanted a real single-column-wide table of variable length (due to conditional rows and expected future growth), but I wanted the headings to align across columns. The table did fit on a single page, which is a limitation of the following hack.
Hack: This example presumes a normal 2-column page text frame that is 7.5in wide with a 0.24in gutter (3.63in columns), and table that needs no more than one page. It works for 3- and 4-column layouts as well.
Use an AAC anchored frame text line.
Create a full page width (7.5in) anchored frame (which can be Below, Top of Col, as desired).
Create a text frame inside the anchored frame. This frame is:
one more than your standard page (3-column for this example)
Same gutter size (0.24in for this example).
Initially draw the text frame to fit inside the the anchored frame, so you can easily grab it.
Make sure the default (anchored table) paragraph format of the first column is "In Column".
Use Graphics > Object Properties to adjust the inside text frame:
Set Width: to your standard text frame total width plus 1 column and 1 gutter (11.37in for this example).
Set Offsets: to 0 and 0 (this will push the rightmost column out of sight for the moment).
Insert your table at the anchored table text of the inside text frame.
In Table Designer, set Start: to Top of Column (this pushes the start of table to column 2).
Select the internal text frame again.
Set Offset From: Left: to negative one column + one gutter (-3.87in for this example).
The table now appears to start in page column one, and flows to additional columns with heading alignment.
This worked perfectly for my recent requirement. In fact, I used a 3-column layout (4 actual) for the text frame inside the anchored frame. Some math is required, sorry .I'm not sure if I followed that correctly, but if I read it right, you
have a single-column table that spans multiple columns, and the issue is
that the first column does not butt up against the top of the text
frame, while the additional columns do. You want the table in all
columns to butt up against the top of the text frame so that they are even.
If that is the case, the solution is this:
1. Create a paragraph format called "TableAnchor" in the Paragraph
Designer. Assign it with a negative Space Below of -12.0 pt, "Fixed"
line spacing, "Start Anywhere.," "In Column." Assign the font size as
12.0 pt.
2. Create your table format. Give it a Space Above of 12.0 pt.
3. Then, always insert your table into its own, empty TableAnchor
paragraph. You will get the alignment you seek.
NOTES: Anywhere I said "12.0 pt," you can use a different font size-- as
long as you use the same number in each place. You may also want to
create a TableAnchorAAC paragraph format, which is identical except for
the Across All Columns setting, to hold tables that span multiple columns.
I hope I understood the question correctly and was of help. -
How can we fix images and String in a perticular row's second column in JTa
Hi,
I have to design a window in which there is a table I have to set the some row's second column data with images and text data both and some row contan only text data Please help me on it .There is two column and 5 row in my table.
Thanks in advance,
anum[url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#editrender]Using Editors and Renderers
You will need to create a custom renderer to display both an image and text. Renderers are assigned to a column. If you require different renderers for a given row in a column then you will need to override the getCellRenderer(...) method to return a renderer for the specific row. -
Auto Truncat of text in table row.
Is there any way to truncate the text displayed in the table row. I need to auto truncate the text in case text does not fit in the row with current column height.
Hi Kevin,
I am also facing the same situation. I want to display teh text with truncated to 30 characters only. I identified the outputTexta nd added the truncateAt attribute and set it to 30. but it doesn't seem to work. Moreover the line - truncateAt="30" is underlined with orange squiggly lines indicating that there is some error and when I mouse over it , it says that this attribute is not supported when the component is inside of a hierarchyViewer component.
Any pointers?
Thanks,
Dhirendra -
If myText.text == any value in a datagrid column
Hey guys, in a simple form, I am trying to achieve what's in my title.
I have a text box in which you type in a value (number).
I have a submit button which inserts the value into my data-grid which is populated by a data provider to display that information (ZendAMF).
For my submit button function I need it to loop through all the values(rows) in a column (my dataprovider) of my data-grid to check if my text box value is equal to any of the data in the rows for that column.
I found a function on another forum that should help me achieve this but I still cannot get it to work as I don't think I'm using the function correctly. Note the function is called "findItem()"
Here is my example code:
//I have a datagrid
<mx:DataGrid id="myDataGrid" dataProvider="amfcall.getData.lastResult}">
<mx:columns>
<mx:DataGridColumn headerText="MyHeading" dataField="myDataField"/>
</mx:columns>
</mx:DataGrid>
//I have a form for adding data into the datagrid
<mx:Form id="addData">
<mx:FormItem>
<mx:TextInput id="myText"/>
</mx:FormItem>
</mx:Form>
//I have a button to submit the form data by calling a function
<mx:Button label="Add" id="addData" click="findItem()"/>
//I have the function to find any item in the datagrid column that is equal to the text input in the form. This is what I can't code correctly.
public function findItem(myDataGrid.dataProvider, myDataField:String, myText.text):Boolean
for each(var item:Object in myDataGrid.dataProvider)
if(item[myDataField] == myText.text)
return true;
return false;
So I don't think I'm correctly typing the first line of the 'findItem' function as I'm currently receiving [I]1084: Syntax error: expecting rightparen before dot.[/I] for this line [I]public function findItem(myDataGrid.dataProvider, myDataField:String, myText.text):Boolean [/I]
Also, the error does not change if I strict type those things to ':Object' etc.
I may just be using the function totally wrong, can anyone hlpe me out?Hard to tell what’s going on from the information you are providing; but just looking at the first line of your sample code:
Have you checked in the debugger to see what your dataProvider looks like?
You want a resultHandler to set some kind of list – let’s say a previously declared AC, which then becomes your dataProvider for the DataGrid. Something like:
private function amfCallResultHandler(event:ResultEvent):void{
Var someVar:ArrayCollection = event.result as ArrayCollection;
blah blah blah;
myDataProvider = someVar;
HTH,
Carlos -
Can not get text selection cursor to change to column selection cursor
Hi, Thank You for any time and help .
I'm new to InDesign, and I'm hoping to use the new feature of moving columns / rows.
But, I can not get the text cursor to change into the column or row selection cursor.
I am able to get the resize cursor, or use the ctrl+3 shortcut to select the entire column,
but I can not get the downward pointing arrow cursor to select the column, and/or move it.
Sometimes the row selection cursor will appear, and some rows can be moved, but I have been unable to move the columns.
Thanks again, all my bestThank You Sumit !
That does appear to work, but not in all cases?
Example: 9/12/2014 10:44:14 AM - YouTube <--quick vid capture of issue.
I am able to select and move columns and rows, but columns appear to need a 'clean' column to work / move?
Thanks again, I sincerely appreciate it! -
Adding Specific columns of dynamic internal table row into another column
Hi Gurus,
I need to add few columns of a dynamic internal table row into another column:
Article description hy01 hy02 total
101 panza 10 12 22
102 masht 12 12 24
dynamic internal table is created and columns hy01 hy02.... can increase
How to add the the values in hy01 hy 02... into total.
Regards,
DepHi,
If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
Here an example how to generate a dynamic table based on another internal table, hope this will help you.
TYPE-POOLS: slis.
PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
* Type ZST_T:
* matnr TYPE matnr
* maktx TYPE maktx
* hy01 TYPE i
* total TYPE i
TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
PERFORM main.
*& Form main
* text
FORM main.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_t TYPE ty_t,
lr_new_t TYPE REF TO data.
FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
"Add some lines to LT_T just to have something to display on screen
DO 10 TIMES.
APPEND INITIAL LINE TO lt_t.
ENDDO.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZST_S'
CHANGING
ct_fieldcat = lt_fieldcat.
"Copy LT_T to LR_NEW_T
PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
CLEAR lt_t. "Not needed anymore...
ASSIGN lr_new_t->* TO <lt_new_t>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <lt_new_t>.
ENDFORM. "main
*& Form extend_and_copy_table
FORM extend_and_copy_table USING ut_t TYPE STANDARD TABLE
uv_nb_hy TYPE i
CHANGING cr_t TYPE REF TO data
ct_fieldcat TYPE slis_t_fieldcat_alv
RAISING cx_sy_struct_creation cx_sy_table_creation.
DATA: lo_tabledescr TYPE REF TO cl_abap_tabledescr,
lo_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_tabledescr TYPE REF TO cl_abap_tabledescr,
lt_components TYPE cl_abap_structdescr=>component_table,
ls_component TYPE cl_abap_structdescr=>component,
lv_field_cnt TYPE numc2,
ls_fieldcat TYPE slis_fieldcat_alv,
lr_fieldcat TYPE REF TO slis_fieldcat_alv.
FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
<lt_new_t> TYPE STANDARD TABLE,
<ls_new_s> TYPE ANY.
"Get the list of all components from UT_T line structure
lo_tabledescr ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
lt_components = lo_structdescr->get_components( ).
"The new columns will be from type of column HY01
ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
"The new columns will have the same fieldcat info as column HY01
READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
"HY<lv_field_cnt> = new field name
lv_field_cnt = uv_nb_hy + 1.
"For each new column...
DO uv_nb_hy TIMES.
"Generate the new column field name
CONCATENATE 'HY' lv_field_cnt INTO ls_component-name.
ls_fieldcat-fieldname = ls_component-name.
"Add the new field to the components of the new structure
INSERT ls_component INTO lt_components INDEX 4.
"Add the new field's fieldcat info to the fieldcat
INSERT ls_fieldcat INTO ct_fieldcat INDEX 4.
lv_field_cnt = lv_field_cnt - 1.
ENDDO.
"Adjust the COL_POS from fieldcat
LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
lr_fieldcat->col_pos = sy-tabix.
ENDLOOP.
"Create the new table
lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
lo_new_tabledescr = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
ASSIGN cr_t->* TO <lt_new_t>.
"Copy all data from old to new table
LOOP AT ut_t ASSIGNING <ls_old_s>.
APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
ENDLOOP.
ENDFORM. "main -
Table Rendering - Row level vs Column level
Normally renderers are specified for a given class of data or column of data.
So, how would you handle rendering requirements that are row or table dependent? For example, how do I:
a) color alternate lines in a table
b) change the border of the selected cell
Traditional Approach
Most answers in the forum would be something like "use a custom render". Sounds great, but what does it really mean? If all your data is displayed as a String then it really isn't too difficult to create a single renderer with the required logic and add it to the table as the default renderer.
However, what if you table contains, String's, Dates, Integer's, Double's and Boolean's and you want your cell to retain the default formatting of each data type in addition to the above requirement? Now you have two options:
a) render by class (multiple renderers). Each renderer would need to implement the default "formatting" of the data (dates: dd-MMM-yyy, numbers: right justified, etc) in addition to the "row/table" rendering requirements. So the answer really becomes "use five custom renderers". Now the "row/table" rendering code is found in 5 classes. Of course you could always move the "row/table" rendering code up to a common base class.
b) render by table (single renderer). A single custom renderer would be created and would need to implement the default "formatting" for all data types in the table, in addition to the "row/table" rendering. The benefit is that all the rendering code is in one class. An example solution is include for this approach.
Alternative Approach
I recently came across an approach where the "formatting" of the data is still done by the default renderers and the "row/table" rendering is done at the table level by overriding the prepareRenderer() method. This approach is much simpler, but the rendering is done in two different places. Is this a problem?
So, my question is which approach do you prefer:
a) Traditional Approach - multiple renderers
b) Triditional Approach - single renderer
c) Alternative Approach
Me, I like the alternative approach, but I'm more of a problem solver than I am a designer, so I don't know how the solution fits in a large scale application.
Hopefully your response will consider:
a) OO design principles
b) class reusability
c) class maintenance
d) anything else you can think of
import java.awt.*;
import java.text.*;
import java.util.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.table.*;
public class TableRowRendering extends JFrame
JTable table;
Border selected = new LineBorder(Color.GREEN);
public TableRowRendering()
// Model used by both tables
Object[] columnNames = {"Type", "Date", "Company", "Shares", "Price"};
Object[][] data =
{"Buy", new Date(), "IBM", new Integer(1000), new Double(80.50)},
{"Sell",new Date(), "MicroSoft", new Integer(2000), new Double(6.25)},
{"Sell",new Date(), "Apple", new Integer(3000), new Double(7.35)},
{"Buy", new Date(), "Nortel", new Integer(4000), new Double(20.00)}
DefaultTableModel model = new DefaultTableModel(data, columnNames)
public Class getColumnClass(int column)
return getValueAt(0, column).getClass();
// Traditional Approach
table = new JTable( model );
table.setPreferredScrollableViewportSize(table.getPreferredSize());
getContentPane().add(new JScrollPane( table ), BorderLayout.WEST);
TableCellRenderer custom = new CustomRenderer();
table.setDefaultRenderer(Object.class, custom);
table.setDefaultRenderer(String.class, custom);
table.setDefaultRenderer(Date.class, custom);
table.setDefaultRenderer(Number.class, custom);
table.setDefaultRenderer(Double.class, custom);
// Alternative Approach
table = new JTable( model )
public Component prepareRenderer(
TableCellRenderer renderer, int row, int column)
Component c = super.prepareRenderer(renderer, row, column);
if (!isRowSelected(row))
String type = (String)getModel().getValueAt(row, 0);
c.setBackground(row % 2 == 0 ? null : Color.LIGHT_GRAY );
if (isRowSelected(row) && isColumnSelected(column))
((JComponent)c).setBorder(selected);
return c;
table.setPreferredScrollableViewportSize(table.getPreferredSize());
getContentPane().add(new JScrollPane( table ), BorderLayout.EAST);
// Custom renderer used by Traditional approach
class CustomRenderer extends DefaultTableCellRenderer
DateFormat dateFormatter = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM);
NumberFormat numberFormatter = NumberFormat.getInstance();
public Component getTableCellRendererComponent(
JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column)
super.getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column);
// Code for data formatting
setHorizontalAlignment(SwingConstants.LEFT);
if ( value instanceof Date)
setText(dateFormatter.format((Date)value));
if (value instanceof Number)
setHorizontalAlignment(SwingConstants.RIGHT);
if (value instanceof Double)
setText(numberFormatter.format(((Number) value).floatValue()));
// Code for highlighting
if (!isSelected)
String type = (String)table.getModel().getValueAt(row, 0);
setBackground(row % 2 == 0 ? null : Color.LIGHT_GRAY );
if (table.isRowSelected(row) && table.isColumnSelected(column))
setBorder(selected);
return this;
public static void main(String[] args)
TableRowRendering frame = new TableRowRendering();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setLocationRelativeTo( null );
frame.setVisible(true);
}Before you make your final decision. What changes would be required for each solution in the following "what if " scenarios:
a) what if, you added a Boolean column to the table
b) what if, you added a second Double column to the table which should be formatted as a currency (ie. 1,234.5 --> $1,234.50).
Here is an example of a currency renderer:
class CurrencyRenderer extends DefaultTableCellRenderer
private NumberFormat formatter;
public CurrencyRenderer()
super();
formatter = NumberFormat.getCurrencyInstance();
setHorizontalAlignment( SwingConstants.RIGHT );
public void setValue(Object value)
if ((value != null) && (value instanceof Number))
value = formatter.format(value);
super.setValue(value);
}Well, here's a partila solution using technique from a link you cited in another thread.
import tests.basic.tables.ColorProvider;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.text.NumberFormat;
public class DecoratedTablePrepareRenderer extends JFrame {
JTable table;
private DefaultTableModel model;
public DecoratedTablePrepareRenderer() {
Object[] columnNames = {"Type", "Company", "Price", "Shares", "Closed"};
Object[][] data =
{"Buy", "IBM", new Double(80.50), new Double(1000), Boolean.TRUE},
{"Sell", "MicroSoft", new Double(6.25), new Double(2000), Boolean.FALSE},
{"Sell", "Apple", new Double(7.35), new Double(3000), Boolean.TRUE},
{"Buy", "Nortel", new Double(20.00), new Double(4000), Boolean.FALSE}
model = new DefaultTableModel(data, columnNames);
table = new JTable(model) {
// Returning the Class of each column will allow different
// renderers to be used based on Class
public Class getColumnClass(int column) {
return getValueAt(0, column).getClass();
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Component c = super.prepareRenderer(renderer, row, column);
if (isRowSelected(row))
c.setFont(c.getFont().deriveFont(Font.BOLD));
return c;
ColorProvider prov = new TransactionColorProvider();
ColorTableCellRenderer renderer = new ColorTableCellRenderer(table.getDefaultRenderer(Object.class),prov);
ColorTableCellRenderer boolrenderer = new ColorTableCellRenderer(table.getDefaultRenderer(Boolean.class),prov);
ColorTableCellRenderer doublerenderer = new ColorTableCellRenderer(table.getDefaultRenderer(Double.class),prov);
int priceIndex = model.findColumn("Price");
table.getColumnModel().getColumn(priceIndex).setCellRenderer( new EtchedBorderTableCellRenderer(new ColorTableCellRenderer(new CurrencyRenderer(),prov) ));
table.setDefaultRenderer(Object.class,new EtchedBorderTableCellRenderer(renderer));
table.setDefaultRenderer(Double.class,new EtchedBorderTableCellRenderer(doublerenderer));
table.setDefaultRenderer(Boolean.class, new EtchedBorderTableCellRenderer(boolrenderer));
JScrollPane scrollPane = new JScrollPane(table);
getContentPane().add(scrollPane);
class CurrencyRenderer extends DefaultTableCellRenderer {
private NumberFormat formatter;
public CurrencyRenderer() {
super();
formatter = NumberFormat.getCurrencyInstance();
setHorizontalAlignment(SwingConstants.RIGHT);
public void setValue(Object value) {
if ((value != null) && (value instanceof Number)) {
value = formatter.format(value);
super.setValue(value);
public static void main(String[] args) {
DecoratedTablePrepareRenderer frame = new DecoratedTablePrepareRenderer();
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
class ColorTableCellRenderer implements TableCellRenderer{
protected TableCellRenderer delegate;
protected ColorProvider provider;
public ColorTableCellRenderer(TableCellRenderer delegate, ColorProvider provider) {
this.delegate = delegate;
this.provider = provider;
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component c = delegate.getTableCellRendererComponent(table, value,isSelected,hasFocus,row, column);
c.setBackground(provider.getBackgroundColor(row, column));
return c;
class EtchedBorderTableCellRenderer implements TableCellRenderer{
protected TableCellRenderer delegate;
public EtchedBorderTableCellRenderer(TableCellRenderer delegate) {
this.delegate = delegate;
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent c = (JComponent)delegate.getTableCellRendererComponent(table, value,isSelected,hasFocus,row, column);
JPanel panel = new JPanel(new GridLayout(0,1));
panel.add(c);
panel.setBorder(BorderFactory.createEtchedBorder());
return panel;
class TransactionColorProvider implements ColorProvider {
private int keyIndex = 0;
private Color sellColor = Color.yellow;
private Color buyColor = Color.green;
public TransactionColorProvider() {
keyIndex = model.findColumn("Type");
public Color getBackgroundColor(int row, int column) {
if( model.getValueAt(row,keyIndex).equals("Sell")){
return sellColor;
else {
return buyColor;
public Color getForegroundColor(int row, int column) {
return Color.black;
}Boolean values are problematical since JCheckBox does seem to like borders, using a panel as I did in the Etched renderer seems to work. This solution need a little more work, this is submitted as a prototype
Cheers
DB -
Displaying jtable as rows instead of columns
This may be really simple, but I can't figure it out. I want to display information in a JTable as rows instead of columns. Can anyone help me with this?
Thanks in advance,
mCheck here:
http://www2.gol.com/users/tame/swing/examples/SwingExam
les.html
They may well have what you want, if not they will
probably have some ideas you can use.There's always the swing tutorial, also. I learned JTables from the tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/table.html and it gave me a lot of good ideas and points to start from.
You could probably create your own cell renderer (or use the header renderer) and set the first column to use that to display their text. -
Multi selection N rows and N Columns
i am using ADF 10g jdeveloper 10.1.3.5
i want make multi selection(Check box) in 3 row and N columns depend on size of iterator, can give example or .....
thanksOption 3 signal in and out.
1. From table1 drag a line and select Signal Out.
2. Select the fields you want and click ok.
In this example will use:
field name x data type number
y data type date
z data type text.
3. Add a submit button to the table.
Right Click on table and select create tool bar.
- Click on plus sign to add a button.
- Click Change button action to system action.
- Change action name to a desired name.
Click on the line that connect the signal out to the table and change the event name to submit.
4. Click on Compose and drag a signal in to the story board.
5. Connect the Signal in to the second Web service.
6. <b>Change the Signal in name to much the signal out name</b>
7. Add fields to the signal in:
Field name x data type number
y data type date
z data type text.
8. Click on the line that connect the Signal in to the second web service and map the fields.
9. Add a table view to the Second web service.
Deploy.
For me it worked only when I have changes the Capacity of the first web service.
If you need the GML file with the web services I used please email me at
[email protected] -
Print Row Numbers and Column Letters
How do you tell Numbers to print the Row numbers and Column letters? This was very simple in Appleworks (print dialog box had that option). Can't find it in Numbers though.
Here is a script doing all the job for us.
Just select one or several cells in a table and run the script.
It duplicates it, add an header row, an header column, insert the needed labels and fill the other cells with a formula grabbing the contents of the original table.
--[SCRIPT build a table with headers]
Enregistrer len tant que Script: build a table with headers.scpt
déplacer le fichier créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
Selectionner une cellule dans la table à dupliquer
menu Scripts > Numbers > build a table with headers
Le script duplique la table et crée des en-têtes de lignes et colonnes.
--=====
L'aide du Finder explique:
L'Utilitaire AppleScript permet d'activer le Menu des scripts :
Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case "Afficher le menu des scripts dans la barre de menus".
+++++++
Save the script as Script: build a table with headers.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
Select a range of cells in the table to 'duplicate'
menu Scripts > Numbers > build a table with headers
The script duplicate the table and inserts columns/rows headers.
--=====
The Finder's Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the "Show Script Menu in menu bar" checkbox.
--=====
Yvan KOENIG (VALLAURIS, France)
2009/09/19
--=====
property theApp : "Numbers"
--=====
my activateGUIscripting() (* to be sure than GUI scripting will be active *)
set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
if r_Name is missing value then
if my parleAnglais() then
error "No selected cells"
else
error "Il n'y a pas de cellule sélectionnée !"
end if
end if
set new_Table to t_Name & "_#"
my duplicateTable(s_Name, t_Name, new_Table)
set delim to my getLocalizedDelimiter()
(* grab localized function names and add an open parenthesis at end *)
set IF_loc to my getLocalizedFunctionName("Numbers", "IF") & "("
set CHAR_loc to my getLocalizedFunctionName("Numbers", "CHAR") & "("
set INT_loc to my getLocalizedFunctionName("Numbers", "INT") & "("
set MOD_loc to my getLocalizedFunctionName("Numbers", "MOD") & "("
set INDIRECT_loc to my getLocalizedFunctionName("Numbers", "INDIRECT") & "("
set ADDRESS_loc to my getLocalizedFunctionName("Numbers", "ADDRESS") & "("
(* grab localized function names and add a couple of parenthesis at end *)
set ROW_loc to my getLocalizedFunctionName("Numbers", "ROW") & "()"
set COLUMN_loc to my getLocalizedFunctionName("Numbers", "COLUMN") & "()"
tell application "Numbers" to tell document d_Name to tell sheet s_Name to tell table new_Table
if column count = 256 then
if my parleAnglais() then
error "Oops, already 256 columns !"
else
error "Désolé, il y a déjà 256 colonnes !"
end if
end if
if row count = 65536 then
if my parleAnglais() then
error "Oops, already 65536 rows !"
else
error "Désolé, il y a déjà 65536 lignes !"
end if
end if
try
add row above row 1
on error
if my parleAnglais() then
error "Oops, already five header row !"
else
error "Désolé, il y a déjà cinq rangs d’en tête !"
end if
end try
try
add column before column 1
on error
if my parleAnglais() then
error "Oops, already five header columns !"
else
error "Désolé, il y a déjà cinq rangs d’en tête !"
end if
end try
set nbr to row count
set nbc to column count
(* =IF(COLUMN()<28,CHAR(COLUMN()63),CHAR(INT((COLUMN()-2)/26)+64)&CHAR(MOD(COLUMN()-2,26)65)) *)
set theFormula to "=" & IF_loc & COLUMN_loc & "<28" & delim & CHAR_loc & COLUMN_loc & "+63)" & delim & CHAR_loc & INT_loc & "(" & COLUMN_loc & "-2)/26)+64)&" & CHAR_loc & MOD_loc & COLUMN_loc & "-2" & delim & "26)+65))"
tell row 1
repeat with c from 2 to nbc
set value of cell c to theFormula
end repeat
end tell -- row 1
(* =ROW()-1 *)
set theFormula to "=" & ROW_loc & "-1"
tell column 1
repeat with r from 2 to nbr
set value of cell r to theFormula
end repeat
end tell -- column 1
(* =INDIRECT(ADDRESS(ROW()-1,COLUMN()-1,,,"Tableau 2")) *)
set theFormula to "=" & INDIRECT_loc & ADDRESS_loc & ROW_loc & "-1" & delim & COLUMN_loc & "-1" & delim & delim & delim & quote & t_Name & quote & "))"
repeat with r from 2 to nbr
repeat with c from 2 to nbc
set value of cell r of column c to theFormula
end repeat -- with c
end repeat -- with r
end tell -- Numbers
--=====
Set the parameter delimiter which must be used in Numbers formulas
on getLocalizedDelimiter()
if character 2 of (0.5 as text) is "." then
return ","
else
return ";"
end if
end getLocalizedDelimiter
--=====
on getLocalizedFunctionName(theApp, x)
local p2bndl
set p2bndl to (path to application support as text) & "iWork '09:Frameworks:SFTabular.framework:Versions:A:Resources:"
return my getLocalizedName(theApp, x, p2bndl)
end getLocalizedFunctionName
--=====
on getLocalizedName(a, x, f)
tell application a to return localized string x from table "Localizable" in bundle file f
end getLocalizedName
--=====
on getSelection()
local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
tell application "Numbers" to tell document 1
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of tables
if x > 0 then
repeat with y from 1 to x
try
(selection range of table y) as text
on error errMsg number errNum
set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
return {theDoc, theSheet, theTable, theRange}
end try
end repeat -- y
end if -- x>0
end tell -- sheet
end repeat -- i
end tell -- document
return {missing value, missing value, missing value, missing value}
end getSelection
--=====
on decoupe(t, d)
local l
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
return l
end decoupe
--=====
on isItAsheet(s)
try
tell application "Numbers" to tell document 1
count of tables of sheet s (*
Post an error if s is not a sheet *)
end tell
return true
on error
return false
end try
end isItAsheet
--=====
on activateGUIscripting()
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true (* to be sure than GUI scripting will be active *)
end tell
end activateGUIscripting
--=====
on duplicateTable(sourceSheet, sourceTable, newName)
local lesFeuilles, lesTables1, found, listOfRows, cor, i, isSourceSheet, nameI, j, lesTables2
tell application "Numbers"
activate
tell document 1
set lesFeuilles to name of sheets
if sourceSheet is in lesFeuilles then
tell sheet sourceSheet to set lesTables1 to name of tables
if sourceTable is not in lesTables1 then
if my parleAnglais() then
error "The sheet “" & sourceTable & "” of sheet “" & sourceSheet & "” is unavailable ! "
else
error "La table “" & sourceTable & "” de la feuille “" & sourceSheet & "” n'existe pas ! "
end if
end if -- sourceTable is not
else
if my parleAnglais() then
error "The sheet “" & sourceSheet & "” is unavailable ! "
else
error "La feuille “" & sourceSheet & "” n'existe pas ! "
end if
end if -- sourceSheet is in
end tell -- document
end tell -- application
if newName is not in lesTables1 then (*
Now, an ugly workaround to duplicate the sheet *)
set isOS4 to (system attribute "sys2") < 5
tell application "System Events" to tell application process "Numbers"
set docWindow to false (* CAUTION, an inspector ("AXFloatingWindow") or a Find/Search ("AXDialog") window may be open *)
repeat with i from 1 to (count of windows)
if subrole of window i is "AXStandardWindow" then
set docWindow to i (* got the document's window *)
exit repeat
end if
end repeat
if docWindow is not false then
tell outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of window docWindow
select row 1
set value of attribute "AXFocused" to true
set found to false
set listOfRows to name of static text of every row
set cor to count of rows (* equal count of listOfRows *)
if isOS4 then (*
for mac Os X 10.4.11
CAUTION, listOfRows it's a list of lists !
{{"Feuille 2"}, {"Tableau 1"}, {"theSheet"}, {"Feuille 1"}, {"Tableau 2"}, {"Clément"}, {"Feuille 4"}} *)
repeat with i from 1 to cor (*
Scan the thumbnails *)
set nameI to item 1 of item i of listOfRows
set isSourceSheet to (sourceSheet = nameI) and my isItAsheet(nameI)
if isSourceSheet then
select row i
if (i < cor) and not my isItAsheet(item 1 of item (i + 1) of listOfRows) then (*
Here we may scan the thumbnails of tables of sourceSheet *)
repeat with j from i + 1 to i + (count of lesTables1)
if sourceTable = item 1 of item j of listOfRows then
select row j
set found to true
exit repeat
end if -- sourceTable
end repeat
else
if my parleAnglais() then
error "The sheet “" & sourceTable & "” of sheet “" & sourceSheet & "”" & return & " is not revealed in thumbnails ! "
else
error "La table “" & sourceTable & "” de la feuille “" & sourceSheet & "”" & return & " n'est pas affichée dans les vignettes ! "
end if -- my parleFrancais
end if -- (i < cor)
end if -- isSourceSheet
if found then exit repeat
end repeat -- i
else (*
for mac Os X 10.5.x
CAUTION, listOfRows is a list of lists !
{{}, {"Tableau 1"}, {"theSheet"}, {}, {"Tableau 2"}, {"Clément"}, {}}
With 10.5.x, the names of sheets are empty *)
repeat with i from 1 to cor
set isSourceSheet to (class of UI element 1 of row i is group) and (get value of static text 1 of group 1 of row i) is sourceSheet
if isSourceSheet then (*
Here we may scan the thumbnails of tables of sourceSheet *)
if value of UI element 1 of group 1 of row i is 0 then (*
reveal the tables's thumbnails and adjust the list accordingly *)
click UI element 1 of group 1 of row i (* click the black triangle to reveal tables *)
delay 0.1
set listOfRows to name of static text of every row (* update the list accordingly *)
end if -- value of UI…
repeat with j from i + 1 to i + (count of lesTables1)
if sourceTable = item 1 of item j of listOfRows then
select row j
set found to true
exit repeat
end if -- sourcetable
end repeat -- with j
end if -- isSourceSheet
if found then exit repeat
end repeat -- with i
end if -- check OS
end tell -- outline …
keystroke "d" using command down
end if -- docWindow
end tell -- System Events…
if docWindow is not false then (*
Rename the new table according to the passed name: newTable *)
tell application "Numbers" to tell document 1 to tell sheet sourceSheet
set lesTables2 to name of tables
repeat with i in lesTables2
if i is not in lesTables1 then (*
Here i is the name of the newly created table *)
set name of table i to newName
exit repeat
end if
end repeat
end tell
end if -- docWindow
end if -- newName is not…
end duplicateTable
--=====
on parleAnglais()
local z
try
tell application theApp to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
--[/SCRIPT]
Yvan KOENIG (VALLAURIS, France) samedi 19 septembre 2009 17:33:59 -
How to transpose rows into multiple columns using pivot table
I have 1 row containing 12 columns with value "JAN", "FEB", "MAR", "J-1","F-1","M-1","J-2","F-2","M-2","J-3","F-3","M-3"
I want to display as
JAN J-1 F-1 M-1
FEB J-2 F-2 M-2
MAR J-3 F-3 M-3
How do I achieve the above?Today you have only 3 months JAN, FEB, MAR. Is it always the same number of columns. What if there are more months added to this row?
Is your data really coming from relational source or some sort of text file?
There is a better way to do this in narrative view using HTML if your requirement is just to show them in multiple rows and do some calculations.
Go to Narrative View;
In prefix, use <html> <table>
In 'Narrative' text box add something like this
<tr> <td> @1 </td> <td> @4 </td> <td> @7 </td> </tr>
<tr> <td> @2 </td> <td> @5 </td> <td> @8 </td> </tr>
<tr> <td> @3 </td> <td> @6 </td> <td> @9 </td> </tr>
In Suffix, use </table> </html>
You can also add simple calculations like sum etc at the very bottom of these rows as grand totals.
kris -
Master-detail: one detail row with multiple columns
Hi All,
I have a normal master-detail situation in the databse, in the form however all detail rows should be displayed in one single row, using more columns. The number of details are limited, so I can use a predefined number of text-items.
Any ideas on how to implement this?
Regards,
Michielcreate a function that returns your details. e.g. :
function get_detail (P_PK, P_rownum) ...
let's use the example dept and emp. Your master is dept. Your detail is emp. deptno is the PK for the master table.
you have in your form multi-records of dept and maybe 5 items for employees. The name of the text-items TI_data_1 .. TI_data_5. In the post-query-trigger you code :
:DEPT.TI_data_1 := get_detail (:DEPT.DEPTNO, 1);
:DEPT.TI_data_2 := get_detail (:DEPT.DEPTNO, 2);
if you need more columns create a loop and use the built-in COPY for assigning the detail-values to the text-items.
the get_detail e.g. is a select-statement:
SELECT ENAME
FROM EMP
WHERE DEPTNO = P_PK
AND rownum = P_rownum
ORDER BY EMPNO
try it
Gerd
Maybe you are looking for
-
Cloud storage on multiple devices
Hello, I've been pretty satisfied with Apple, EXCEPT when it comes to cloud storage. I have three devices: iPad Retina My 6 year old daughter has my iPAd 2 and my iPhone. all devices are under the same account, but every day I get a message stating t
-
I have all my mail on my Touch now, but I cannot send any messages. It says my outgoing server isnt correct. I checked my mail settings to get it, and I put it in correctly. Any suggestions?
-
How to use a structure at run time....
Hi gurus, I am confused on how to use the structure in our report..why do we need it...Please help me with that... Thanks Cheers:Jim
-
Webcam works in options, but is crossed out for ca...
This is for my wife's 32 bit Ubuntu laptop. Both it and Skype are up to date as of right now. I just got a Logitech Webcam Pro 9000 for her. I plugged it in and Cheese recognized it immediately, but wouldn't show up in Skype Video Options. I edited
-
Error in setting up page format for Script.
Hi, I have set up a customized page format. I set up Page format, Format types and Device types. I have throughly checked wit the other working formats, everthing seems right.. Page format : zmed_po - Portait Format type : zmed_po Error - No Prin