How to get bounds of a component in FreeDesign layout
When I try to get bounds of a component that is inside JPanel with FreeDesign layout, I get (0,0,0,0)!
How can I find out current bounds of those components?
When I add a component on JPanel with FreeDesign layout (I use NetBeans GUI editor to do it), in generated code I find org.jdesktop.layout.GroupLayout with some HorizontalGroup and VerticalGroup components, and no bounds are ever set!!! When I start the application, a component is shown on JPanel, and definitely bounds are not 0,0,0,0! The components are stretched over window, and everything looks just as I set in GUI editor. A problem is that in runtime I need to know bounds of a component that is showed on screen. A method getBounds() returns (0,0,0,0), so I think that it is not appropriate for this layout.
So, my question remains: How to find out bounds of a component in FreeDesign layout!
Thanks!
Message was edited by:
mmilic
Similar Messages
-
How to get the list of component?
How to get the list of component through java API in Adobe CQ5?
There are probably more than a few ways, but here is a little component .jsp code that uses the jcr query api to pull out all the components and list them on a page. If I know CQ, there might be a way to ask for a list of components another way though, maybe through another API, or possibly a .json url, I might remember reading something about that, somewhere, lol, but this at least gets you the list in a somewhat simple way.
Code Example:
<%@include file="/apps/psul/components/global.jsp"%>
<%@ page import="javax.jcr.*,
javax.jcr.query.*"
%>
<%
// Login to create an anonymous session on the default workspace
Session session = resourceResolver.adaptTo(Session.class);
//Declare a query for all the components in the system
String SQL = "select * from cq:Component";
//side note: if you want just the components in your site area, then make the query more like below...
// SQL = "select * from cq:Component where jcr:path like '/apps/yoursitename/%'";
QueryManager qm = session.getWorkspace().getQueryManager();
Query query = qm.createQuery(SQL, Query.SQL);
QueryResult result = query.execute();
NodeIterator nodes = result.getNodes();
while (nodes.hasNext()) {
Node node = (Node)nodes.next();
%>
<p><%=node.getName() %> (<b><%=node.getPath() %></b>)</p>
<% } %> -
How to get back deleted software component along with underlaying objects.
Dear Experts,
By mistake i deleted my software component. When i deleted it even doesn't ask for activate. When i check in change list there is no change list for that deleted software component. So request you please let me how to get back my software component with all the namespaces and objects.
Please treat this as high priority and revert me back ASAP.
Thanks in advance.
HAri.I don't know if is possible to restore a deleted SoftComp and all dependent object in repository... You can try to renew the SoftComp import from SLD....
-
How to get the Dynamic UI component value from JSFF page to any managedbean
HI ,
We have list of bean objects in jSF page we are iterating the list of bean using the forEach loop and displaying the value into Input type text (UI component) value filed .
If we try to get the UI component value in Managed bean we are not getting the dynamic values .
The below piece of code used to retrieve the dynamic values from the JSF page doesn't have any form :
UIComponent component = null;
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null) {
UIComponent root = facesContext.getViewRoot();
component = findComponent(root, componentId);
then component type casting to the based on UI component which we trying to access and getting the value as " NULL " ..Please let me know how to get the dynamic values form the JSF ?
Please let me know if any other approach or any changes required on above ?
ThanksHi,
the root problem is this
<h:inputText id="it3" value="#{familyList.ctn}" />
<tr:commandButton text="Save" id="cb3"Note how each row writes to the same managed bean property, thus showing the same data. Instead your managed bean should expose a HashMap property that you then apply values to using a key/value pair. The key could be the ID of the field, which then you also should dynamically define e.g. cb<rowIndx>. The command button could then have a f:attribute assigned that has the row HahMap key as a value. This way you truly create value instances for the object
Frank -
How to get only the dc component of a dc signal with noise?
I need to read a temperature value (a dc value). However signal has some noise in it, and i need to get it out. How can i make it? Using a low pass filter? Which one.? Is there any DC pass filter?
First, depending on the sensor you are using and how you are making the measurement, make sure you use the appropriate VI from the palette:
Data Acquisition -> Signal Conditioning
Sure you can use most of the filters located in:
Signal Processing -> Filters
Create a constant from the "filter type" input and select "Lowpass".
There is also an AC & DC estimator vi, located in:
Signal Processing -> Measurement
Always remember to check the shielding of your system.
Finally, check the following at NI, which have good information on how to get rid of noise:
DC voltage
Regards;
Enrique
www.vartortech.com -
Reg:How to get boarders in the webpage composer page layout
Hi All
How to enable boarders for the webpage composer page layout .
Thanks & Regards
DeepikaHI
This is the portal home page which is designed using webpages .we need border between application to application screens as well as overall broader.
please find the screen shot ....
Thanks & Regards
Deepika -
How to get bounds of bounding box of text item.
Hi all,
I am trying to get the bounds of bounding box of paragraph text item. I found the following link,
the coordinate of a bounding box is the same as the layer's coordinate?
But the solution doesn't work for me. It gives me the layer's bound every time i.e. the bounds of actual text.
Can someone have any idea how to accomplish this?
Thanks.It's a known "not trivial". You have layer.textItem.width/height, but they don't always report correct values. I.e. if the layer or doc has been resized, those values are missing scale multipliers. Worse it's works differently wrong in different versions of CC and Mac/Win. What I use is below (with some utility functions missing), but it's just CC 2012 and 2014 (CS6 is just bounds).
Alternatively you can get this stuff on Action Manager only, but I'm not familiar enough and let other comment on it.
Photoshop = {
getTextExtents: function (layer) {
if (layer && layer.textItem) {
var text_item = layer.textItem
if (Photoshop.isCC2014() || (Photoshop.isMac() && Photoshop.isCC2012())) { // in mac the newer method is correct also in CC2012
return Photoshop._getTextExtentsCC2014(text_item)
} else if (Photoshop.isCC2012()) {
return Photoshop._getTextExtentsCC2012(text_item)
} else {
return Photoshop._getTextExtentsCS6(text_item)
_getTextExtentsCC2014: function (text_item) {
app.activeDocument.activeLayer = text_item.parent
var ref = new ActionReference()
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") )
var action = executeActionGet(ref)
//Photoshop._debugActionKeys(action)
var textKey = action.getObjectValue(stringIDToTypeID('textKey'))
var bounds = textKey.getObjectValue(stringIDToTypeID('bounds'))
var width = bounds.getUnitDoubleValue (stringIDToTypeID('right'))
var height = bounds.getUnitDoubleValue (stringIDToTypeID('bottom'))
var x_scale = 1
var y_scale = 1
if (textKey.hasKey(stringIDToTypeID('transform'))) {
var transform = textKey.getObjectValue(stringIDToTypeID('transform'))
x_scale = transform.getUnitDoubleValue (stringIDToTypeID('xx'))
y_scale = transform.getUnitDoubleValue (stringIDToTypeID('yy'))
x_scale *= width / text_item.width
y_scale *= height / text_item.height
return {
x:Math.round(text_item.position[0]),
y:Math.round(text_item.position[1]),
width:Math.round(width*x_scale),
height:Math.round(height*y_scale) }
_getTextExtentsCC2012: function(text_item) {
app.activeDocument.activeLayer = text_item.parent
var ref = new ActionReference()
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") )
var action = executeActionGet(ref)
var textKey = action.getObjectValue(stringIDToTypeID('textKey'))
//Photoshop._debugActionKeys(textKey)
var bounds = textKey.getObjectValue(stringIDToTypeID('bounds'))
var width = bounds.getUnitDoubleValue (stringIDToTypeID('right'))
var height = bounds.getUnitDoubleValue (stringIDToTypeID('bottom'))
var x_scale = 1
var y_scale = 1
if (textKey.hasKey(stringIDToTypeID('transform'))) {
var transform = textKey.getObjectValue(stringIDToTypeID('transform'))
x_scale = transform.getUnitDoubleValue (stringIDToTypeID('xx'))
y_scale = transform.getUnitDoubleValue (stringIDToTypeID('yy'))
return {
x:Math.round(text_item.position[0]),
y:Math.round(text_item.position[1]),
width:Math.round(width*x_scale),
height:Math.round(height*y_scale)
_getTextExtentsCS6: function (text_item) {
var layer = text_item.parent
return {
x:Photoshop.getLayerLeft(layer),
y:Photoshop.getLayerBottom(layer),
width:Photoshop.getLayerWidth(layer),
height:Photoshop.getLayerHeight(layer) -
How to get name of a Component retuned by FocusEvent.getOppositeComponent()
Hi,
I have three instances of JTable named table1, table2, table3 and one button. For the button I have FocusListener which listens to focusGained event. The FocusEvent enables me to get the Component which has lost the focus by e.getOppositeComponent(). Now my question: how can I understand which instance is that component table1, table2, or table3? getName(), getAccessibleContext().getAccessibleName() return nulls. I SIMPLY WANT TO KNOW WHICH TABLE LOST FOCUS WHEN BUTTON WAS PRESSED.
Thanksif you have the object use if (component instanceof table1) .....
Noah -
How to get values from dynamic component?
Hi:
I am displaying dynamic components based on user selection, where InputText and OutputText display properly. But now i want to read that component value on
button click. Can any body help me in that?
Source code is as follow,
text.xhtml
*<code>*
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:ice="http://www.icesoft.com/icefaces/component"
template="/WEB-INF/includes/templates/page-template.xhtml">
<ui:define name="page-content">
<div class="exampleBox splashContainer"
style="background: url('./xmlhttp/css/rime/css-images/contentContainer_bg.gif') top repeat-x">
<table>
<tr>
<td colspan="2">
<h2>Set Request Process Flow</h2>
</td>
</tr>
<tr>
<td colspan="2"><ice:messages style="color:red;" /></td>
</tr>
<tr>
<td><ice:outputText value="Request Type*"></ice:outputText></td>
<td><ice:selectOneMenu value="#{offlinereq.requestno}"
valueChangeListener="#{offlinereq.requestChange}"
partialSubmit="true">
<f:selectItem itemValue="" itemLabel="--Select--" />
<f:selectItems value="#{offlinereq.requests}" />
</ice:selectOneMenu></td>
</tr>
<tr>
<td>*<h:panelGroup binding="#{offlinereq.panelBind}">*
* </h:panelGroup>*</td>
</tr>
<tr>
<td colspan="4"><ice:commandButton value="Add"
actionListener="#{offlinereq.add}" /> <ice:commandButton
value="Update" actionListener="#{offlinereq.update}" /> <ice:commandButton
value="Delete" actionListener="#{offlinereq.delete}" /> <ice:commandButton
value="Reset" actionListener="#{offlinereq.reset}" /></td>
</tr>
</table>
</div>
</ui:define>
</ui:composition>
*</code>*
bean.java
*<code>*
//ValuechangeListener
public void requestChange(ValueChangeEvent e){
System.out.println("Select Value is::"+e.getNewValue()+"::"+userid);
Connection conn=null;
try {
if(!panelBind.getChildren().isEmpty())
panelBind.getChildren().clear();
Class.forName ("oracle.jdbc.OracleDriver");
conn = JdbcUtil.getConnection();
Statement stmt = conn.createStatement();
String sql="select * from IB_CUSTOMER_REQUEST_PARAMETERS where IB_REQMAST_SRNO='"+e.getNewValue()+"'";
ResultSet rs = stmt.executeQuery(sql);
String out="out";
int i=1;
String ii;
while(rs.next()) {
FacesContext facesContext = FacesContext.getCurrentInstance();
Application application = facesContext.getApplication();
HtmlPanelGrid grid = (HtmlPanelGrid)application.createComponent(HtmlPanelGrid.COMPONENT_TYPE);
grid.setColumns(2);
HtmlOutputText output = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
output.setValue(rs.getString("IB_CUSTREQSTPARA_NAME"));
ii=Integer.toString(i);
output.setId("a"+ii.toString());
System.out.println("id"+ii);
HtmlInputText input = (HtmlInputText)application.createComponent(HtmlInputText.COMPONENT_TYPE);
//input.setValue(rs.getString(1));
grid.getChildren().add(output);
grid.getChildren().add(input);
panelBind.getChildren().add(grid);
i++;
catch(Exception e1)
System.out.println(e1);
//Action listeners
public void add(ActionEvent e)
System.out.println("ADD");
*</code>*
Thank You,
AnupWhere are you stuck? find the component (UIComponent.findComponent) in the JSF component tree by its ID and get the value from it. This article might help:
http://illegalargumentexception.blogspot.com/2009/02/jsf-working-with-component-ids.html
Note: the code tag is \ -
How to get the command button component id in bean class?
Hi All,
I'm using adf 11g.
I'm having three command button , which have some similar code to use on fire of these buttons.
if it possible to catch the component id in bean , i can use the code with little parameter passing .Hi,
You can get the command button from the actionEvent (if you are writing a generic actionListener) and from it, you can get the Text of the command button. Using which, you can process accordingly.
If the text also same, then set some client attribute for the command button (check out [url http://docs.oracle.com/cd/E21764_01/apirefs.1111/e12419/tagdoc/af_clientAttribute.html]af:clientAttribute), and from the actionListener, get the client attribute using getClientAttribute method and process accordingly.
-Arun -
How to get reference of application component in anothor component?
Hello Friends
I have one problem so plz help me.
Thanks in advance.
I have two file one is application and other is component. I have created Dividedbox in application and i put two buttons in component and used component in application. Now i want to change the direction of dividedbox when i click on button. I have written code but not working. Following is my code.
Application file: test.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:ns1="*">
<fx:Script>
<![CDATA[
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:DividedBox id="plistdvidebox" direction="vertical" width="100%" >
<s:Group id="grp_rlpart" width="100%" height="100%">
<s:layout>
<s:HorizontalLayout paddingTop="10" paddingLeft="10">
</s:HorizontalLayout>
</s:layout>
<s:Label text="Left ot top part"></s:Label>
</s:Group>
<s:Group id="grp_rrpart" width="100%" >
<s:layout>
<s:HorizontalLayout paddingTop="10" paddingLeft="10">
</s:HorizontalLayout>
</s:layout>
<s:Label text="right or bottom part" />
</s:Group>
</mx:DividedBox>
<ns1:tc x="90" y="156">
</ns1:tc>
</s:Application>
Component File : tc.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
<fx:Script>
<![CDATA[
import mx.containers.BoxDirection;
protected function btnhr_clickHandler(event:MouseEvent):void
var t:test=new test();
t.plistdvidebox.direction=BoxDirection.HORIZONTAL;
protected function btnvr_clickHandler(event:MouseEvent):void
var t:test=new test();
t.plistdvidebox.direction=BoxDirection.VERTICAL;
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:HBox>
<s:Button id="btnhr" content="HR" click="btnhr_clickHandler(event)" />
<s:Button id="btnvr" content="VR" click="btnvr_clickHandler(event)" />
</mx:HBox>
</s:Group>
Plz tell me how to do this?
plz reply me fast.
Thanks
ManjurhusenCheck this:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7e3a.html -
How To get data from agreement component to claims
Hi
i added fields in agroe component and i want those values to my claim component
can any opne tell me how it can be donesolved on own
-
How to get change a GUI component from another class?
Hi there,
I'm currently trying to change a GUI component in my 'Application' class from my 'Dice' class.
So the Application class sets up some GUI including a JLabel that initially displays "Change".
The 'Dice' class contains the ActionPerformed() method for when the 'Change' button (made from Application class) is clicked.
And it returns an 'int' between 1 and 6.
Now I want to set this number back int he JLabel from the Application class.
APPLICATION CLASS
import javax.swing.*;
import java.awt.*;
import java.util.Random;
import java.awt.event.*;
public class Application extends JFrame implements ActionListener{
public JPanel rollDicePanel = new JPanel();
public JLabel dice = new JLabel("Loser");
public Container contentPane = getContentPane();
public JButton button = new JButton("Change");
public Dice diceClass = new Dice();
public Application() {}
public static void main(String[] args)
Application application = new Application();
application.addGUIComponents();
public void addGUIComponents()
contentPane.setLayout(new BorderLayout());
rollDicePanel.add(dice);
button.addActionListener(diceClass);
contentPane.add(rollDicePanel, BorderLayout.SOUTH);
contentPane.add(button,BorderLayout.NORTH);
this.setSize(460, 655);
this.setVisible(true);
this.setResizable(false);
public void changeDice()
dice.setText("Hello");
public void actionPerformed(ActionEvent e) {}
}DICE
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Dice implements ActionListener
public Dice() {}
public void actionPerformed(ActionEvent e)
//super.actionPerformed(e);
String event = e.getActionCommand();
if(event.equals("Change"))
System.out.println("Will be about to change the 'dice' label");
Application application = new Application();
application.dice.setText("Hello");
}It's all about references, baby. The Dice object needs a way to communicate with the Application object, and so Dice needs a reference to Application. There are many ways to pass this. In my example I pass the application object directly to Dice, but a better way would use interfaces and some indirection. Look up the Observer pattern for a better way to do this that scales much better than my brute-force approach.
import javax.swing.*;
import java.awt.*;
public class Application extends JFrame // *** implements ActionListener
// *** make all of these fields private ***
private JPanel rollDicePanel = new JPanel();
private JLabel dice = new JLabel("Loser");
private Container contentPane = getContentPane();
private JButton button = new JButton("Change");
// *** pass a reference to your application ("this")
// *** to your Dice object:
private Dice diceClass = new Dice(this);
public Application()
public static void main(String[] args)
Application application = new Application();
application.addGUIComponents();
public void addGUIComponents()
contentPane.setLayout(new BorderLayout());
rollDicePanel.add(dice);
button.addActionListener(diceClass);
contentPane.add(rollDicePanel, BorderLayout.SOUTH);
contentPane.add(button, BorderLayout.NORTH);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setPreferredSize(new Dimension(460, 655));
pack();
setLocationRelativeTo(null);
setVisible(true);
setResizable(false);
// *** I'm not sure what this is supposed to be doing, so I commented it out.
//public void changeDice()
//dice.setText("Hello");
// *** ditto. I strongly dislike making a GUI class implement ActionListeenr
//public void actionPerformed(ActionEvent e)
// *** here's the public method that the Dice object calls
public void setTextDiceLabel(String text)
dice.setText(text);
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Dice implements ActionListener
// *** have a variable that holds a reference to your application object
private Application application;
private boolean hello = true;
public Dice(Application application)
// *** get that reference via a constructor parameter (one way to do this)
this.application = application;
public void actionPerformed(ActionEvent e)
String event = e.getActionCommand();
if (event.equals("Change"))
System.out.println("Will be about to change the 'dice' label");
if (hello)
// *** call the application's public method
application.setTextDiceLabel("Hello");
else
application.setTextDiceLabel("Goodbye");
hello = !hello;
//Application application = new Application();
//application.dice.setText("Hello");
} -
How to get value of a component in a multiple level container in Javascrip
Hi,
Can anyone help with this please.
I have a JSC page contains a data table dataTable1which has a column contains a gridPanel1 which has textField1 and textField2.
I can not use document.getElementById(form1:textField1) because textField1 is inside gridPanel1 and dataTable1.
What is the correct syntax to get the value of my textField1 and my textField2
Thanks.Hi,
i�m trying to get the content of a input field that it is in a table. one of the columns of the table has a button , when user clicks the button the javascript function "Valida_Tabla " is fired.
The first alert is ok and displays the correct row number, but the second alert is not displayed.
function Valida_Tabla(aRowNumber)
alert("Row is ["+aRowNumber+"]")
var p = document.getElementById("form1:table1:aRowNumber:textField1").value;
alert("Content of field is ["+p+"]")
[ /code]
What i�m doing wrong? -
How to get application name or component name
I have a requirement to make a Z table similar to the context change log table . I need to add application name to that.Is there a way one can retrieve application name of the current application from a function module or any other way?The table WDY_APPLICATION does not seem to have all the custom applications built it only shows the SAP provided applicatoin details.
here is coding to get the wd app name:
DATA:
lr_ctrl_api TYPE REF TO if_wd_controller,
lr_comp_api TYPE REF TO if_wd_component,
lr_appl_api TYPE REF TO if_wd_application,
lr_appl_info TYPE REF TO if_wd_rr_application,
l_appl_name TYPE string.
* get app name
lr_ctrl_api = wd_this->wd_get_api( ).
lr_comp_api = lr_ctrl_api->get_component( ).
lr_appl_api = lr_comp_api->get_application( ).
lr_appl_info = lr_appl_api->get_application_info( ).
l_appl_name = lr_appl_info->get_name( ).
For further Information check also the Runtime Repository APIs: [http://help.sap.com/saphelp_nw04s/helpdata/en/46/a07a6e79822c10e10000000a114a6b/frameset.htm]
Maybe you are looking for
-
Limit number of rows from wildcard expansion- DRG-51030
We use CONTEXT iindex in 11g to search on a text DB column, "Name". This is used in a UI to show autosuggest list of 25 matching names. When the end user types an 'a' we want to show a list of the first 25 names that contain an 'a'. We hit the issue
-
HTML in Attribute used in message
Hello: I have created an attribute of type text in my flow. I what to paste some html txt into it and use it in a message(html body). I do this and it appears the mailer is encoding this data and replacing with no-html characters, i.e. "<" is changed
-
Is there any way to get rid of the goofy picture viewer that comes up when you click on a photo in your picture page? I just want the slide show option.
-
So AT&T states they are legally allowed to restrict the use of FaceTime over cellular data solely based on the fact that the FaceTime feature is a preloaded app on the device not a downloaded one. I say we request that Apple remove it as a preloaded
-
Need Help With Find/Replace In DW8
I need to know how to Find/Replace for more than one tag at a time (I.E--Search for <table>, <tr>, and <td> or <b> and </b> and remove the code) As it is right now, it will only search for one tag at a time but I would assume DW can handle this kind