1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 package com.sun.star.wizards.ui; 24 25 import java.util.ArrayList; 26 import java.util.Vector; 27 import com.sun.star.wizards.common.*; 28 import com.sun.star.wizards.db.*; 29 import com.sun.star.lang.EventObject; 30 import com.sun.star.beans.*; 31 import com.sun.star.sdbc.SQLException; 32 import com.sun.star.uno.AnyConverter; 33 34 import com.sun.star.awt.*; 35 36 public class AggregateComponent extends ControlScroller 37 { 38 39 String[] sFunctions; 40 String[] sFunctionOperators = new String[] 41 { 42 "SUM", "AVG", "MIN", "MAX" 43 }; 44 QueryMetaData CurDBMetaData; 45 XButton optDetailQuery; 46 XButton optSummaryQuery; 47 String soptDetailQuery; 48 String soptSummaryQuery; 49 String slblAggregate; 50 String slblFieldNames; 51 String sDuplicateAggregateFunction; 52 int Count; 53 int iQueryType; 54 final int SOADDROW = 1; 55 final int SOREMOVEROW = 2; 56 final int CONTROLROWDIST = 18; 57 Vector ControlRowVector; 58 String OPTIONBUTTONDETAILQUERY_ITEM_CHANGED = "toggleComponent"; 59 String OPTIONBUTTONSUMMARYQUERY_ITEM_CHANGED = "toggleComponent"; 60 String LISTBOXFUNCTIONS_ACTION_PERFORMED; 61 String LISTBOXFUNCTIONS_ITEM_CHANGED; 62 String LISTBOXFIELDNAMES_ACTION_PERFORMED; 63 String LISTBOXFIELDNAMES_ITEM_CHANGED; 64 String COMMANDBUTTONPLUS_ACTION_PERFORMED = "addRow"; 65 String COMMANDBUTTONMINUS_ACTION_PERFORMED = "removeRow"; 66 Vector ControlRows; 67 int curHelpID; 68 int lastHelpIndex; 69 70 /** Creates a new instance of AggrgateComponent */ AggregateComponent(WizardDialog _CurUnoDialog, QueryMetaData _CurDBMetaData, int _iStep, int _iPosX, int _iPosY, int _iWidth, int _uitextfieldcount, int _firstHelpID)71 public AggregateComponent(WizardDialog _CurUnoDialog, QueryMetaData _CurDBMetaData, int _iStep, int _iPosX, int _iPosY, int _iWidth, int _uitextfieldcount, int _firstHelpID) 72 { 73 super(_CurUnoDialog, _CurDBMetaData.xMSF, _iStep, _iPosX + 10, _iPosY, _iWidth - 12, _uitextfieldcount, 18, _firstHelpID + 2); 74 try 75 { 76 curHelpID = _firstHelpID; 77 this.CurDBMetaData = _CurDBMetaData; 78 Count = 1; 79 optDetailQuery = CurUnoDialog.insertRadioButton("optDetailQuery", 0, new ActionListenerImpl(), 80 new String[] 81 { 82 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 83 }, 84 new Object[] 85 { 86 8, HelpIds.getHelpIdString(curHelpID), soptDetailQuery, new Integer(_iPosX), new Integer(iCompPosY - 42), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(iCompWidth) 87 }); 88 89 optSummaryQuery = CurUnoDialog.insertRadioButton("optSummaryQuery", 0, new ActionListenerImpl(), 90 new String[] 91 { 92 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 93 }, 94 new Object[] 95 { 96 16, HelpIds.getHelpIdString(curHelpID + 1), soptSummaryQuery, Boolean.TRUE, new Integer(_iPosX), new Integer(iCompPosY - 32), IStep, new Short(curtabindex++), new Integer(iCompWidth) 97 }); 98 CurUnoDialog.insertLabel("lblAggregate", 99 new String[] 100 { 101 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 102 }, 103 new Object[] 104 { 105 8, slblAggregate, new Integer(iCompPosX + 5), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90 106 }); 107 CurUnoDialog.insertLabel("lblFieldnames", 108 new String[] 109 { 110 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 111 }, 112 new Object[] 113 { 114 8, slblFieldNames, new Integer(iCompPosX + 101), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90 115 }); 116 this.setTotalFieldCount(1); 117 FontDescriptor oFontDescriptor = new FontDescriptor(); 118 oFontDescriptor.Weight = com.sun.star.awt.FontWeight.BOLD; 119 oFontDescriptor.Height = (short) 14; 120 121 int iButtonPosY = iCompPosY + iCompHeight + 3; 122 CurUnoDialog.insertButton("btnplus", SOADDROW, new ActionListenerImpl(), 123 new String[] 124 { 125 PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 126 }, 127 new Object[] 128 { 129 oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 1), "+", new Integer(_iPosX + iCompWidth - 36), new Integer(iButtonPosY), IStep, new Short((curtabindex++)), 16 130 }); 131 CurUnoDialog.insertButton("btnminus", SOREMOVEROW, new ActionListenerImpl(), 132 new String[] 133 { 134 PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 135 }, 136 new Object[] 137 { 138 oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 2), "-", new Integer(_iPosX + iCompWidth - 16), new Integer(iButtonPosY), IStep, new Short(curtabindex++), 16 139 }); 140 CurDBMetaData.Type = getQueryType(); 141 } 142 catch (com.sun.star.uno.Exception exception) 143 { 144 Resource.showCommonResourceError(CurDBMetaData.xMSF); 145 } 146 } 147 getQueryType()148 public int getQueryType() 149 { 150 if (((Short) CurUnoDialog.getControlProperty("optDetailQuery", PropertyNames.PROPERTY_STATE)).intValue() == 1) 151 { 152 return QueryMetaData.QueryType.SODETAILQUERY; 153 } 154 else 155 { 156 return QueryMetaData.QueryType.SOSUMMARYQUERY; 157 } 158 } 159 160 class ActionListenerImpl implements com.sun.star.awt.XActionListener 161 { 162 disposing(EventObject eventObject)163 public void disposing(EventObject eventObject) 164 { 165 } 166 actionPerformed(com.sun.star.awt.ActionEvent actionEvent)167 public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) 168 { 169 try 170 { 171 int iKey = CurUnoDialog.getControlKey(actionEvent.Source, CurUnoDialog.ControlList); 172 switch (iKey) 173 { 174 case SOADDROW: 175 addRow(); 176 break; 177 178 case SOREMOVEROW: 179 removeRow(); 180 break; 181 182 default: 183 toggleComponent(); 184 break; 185 } 186 } 187 catch (Exception exception) 188 { 189 exception.printStackTrace(System.out); 190 } 191 } 192 } 193 getCount()194 public int getCount() 195 { 196 return Count; 197 } 198 insertControlGroup(int i, int ypos)199 protected void insertControlGroup(int i, int ypos) 200 { 201 if (i == 0) 202 { 203 int BaseID = 2300; 204 soptDetailQuery = CurUnoDialog.m_oResource.getResText(BaseID + 11); 205 soptSummaryQuery = CurUnoDialog.m_oResource.getResText(BaseID + 12); 206 slblAggregate = CurUnoDialog.m_oResource.getResText(BaseID + 16); 207 slblFieldNames = CurUnoDialog.m_oResource.getResText(BaseID + 17); 208 sFunctions = CurUnoDialog.m_oResource.getResArray(BaseID + 40, 4); 209 210 sDuplicateAggregateFunction = CurUnoDialog.m_oResource.getResText(BaseID + 90); 211 } 212 if (ControlRowVector == null) 213 { 214 ControlRowVector = new Vector(); 215 } 216 int locHelpID = curHelpIndex + (i * 2); 217 ControlRow oControlRow = new ControlRow(i, ypos, locHelpID); 218 ControlRowVector.add(oControlRow); 219 } 220 setControlGroupVisible(int _index, boolean _bIsVisible)221 protected void setControlGroupVisible(int _index, boolean _bIsVisible) 222 { 223 ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(_index); 224 oControlRow.setVisible(_bIsVisible); 225 if (_index >= (this.CurDBMetaData.AggregateFieldNames.length)) 226 { 227 oControlRow.settovoid(); 228 } 229 } 230 addRow()231 protected void addRow() 232 { 233 int fieldcount = super.getTotalFieldCount(); 234 registerControlGroupAtIndex(fieldcount); 235 if (fieldcount < super.getBlockIncrementation()) 236 { 237 ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(fieldcount); 238 oControlRow.setVisible(true); 239 oControlRow.settovoid(); 240 } 241 else 242 { 243 ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(super.getBlockIncrementation() - 1); 244 super.setScrollValue(getScrollValue() + 1, (fieldcount + 1)); 245 oControlRow.settovoid(); 246 } 247 fieldcount++; 248 super.setTotalFieldCount(fieldcount); 249 toggleButtons(); 250 CurUnoDialog.repaintDialogStep(); 251 } 252 removeRow()253 protected void removeRow() 254 { 255 int fieldcount = super.getTotalFieldCount(); 256 if (fieldcount > 0) 257 { 258 ControlRow oControlRow; 259 fieldcount--; 260 if ((fieldcount + 1) <= super.getBlockIncrementation()) 261 { 262 oControlRow = (ControlRow) ControlRowVector.elementAt(fieldcount); 263 oControlRow.setVisible(false); 264 } 265 super.setScrollValue(getScrollValue() - 1, (fieldcount)); 266 super.unregisterControlGroup(fieldcount); 267 268 } 269 toggleButtons(); 270 CurUnoDialog.repaintDialogStep(); 271 } 272 toggleButtons()273 protected void toggleButtons() 274 { 275 ControlRow curcontrolrow = null; 276 boolean biscomplete = true; 277 CurDBMetaData.Type = getQueryType(); 278 CurUnoDialog.setControlProperty("btnminus", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf((super.getTotalFieldCount() > 0) && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY))); 279 int fieldcount = super.getCurFieldCount(); 280 if (fieldcount > 0) 281 { 282 curcontrolrow = (ControlRow) ControlRowVector.elementAt(super.getCurFieldCount() - 1); 283 biscomplete = curcontrolrow.isComplete(); 284 } 285 CurUnoDialog.setControlProperty("btnplus", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(biscomplete && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY))); 286 togglefollowingDialogSteps(); 287 } 288 toggleComponent()289 public void toggleComponent() 290 { 291 CurDBMetaData.Type = getQueryType(); 292 boolean benableComponent = isAggregateComponentEnabled(); 293 CurUnoDialog.setControlProperty("lblAggregate", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableComponent)); 294 CurUnoDialog.setControlProperty("lblFieldnames", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableComponent)); 295 toggleButtons(); 296 super.toggleComponent(benableComponent); 297 super.toggleControls(benableComponent); 298 togglefollowingDialogSteps(); 299 } 300 isAggregateComponentEnabled()301 private boolean isAggregateComponentEnabled() 302 { 303 return (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY); 304 } 305 isGroupingpossible()306 public boolean isGroupingpossible() 307 { 308 try 309 { 310 boolean benableGroupPage = isAggregateComponentEnabled() && CurDBMetaData.xDBMetaData.supportsGroupBy() && hasonlycompletefunctions(); 311 String[][] sAggregateFieldNames = this.getAggregateFieldNames(); 312 if (benableGroupPage) 313 { 314 for (int i = 0; i < CurDBMetaData.NumericFieldNames.length; i++) 315 { 316 boolean bisthere = (JavaTools.FieldInTable(sAggregateFieldNames, CurDBMetaData.NumericFieldNames[i]) > -1); 317 if (!bisthere) 318 { 319 return true; 320 } 321 } 322 } 323 } 324 catch (SQLException e) 325 { 326 e.printStackTrace(System.out); 327 } 328 return false; 329 } 330 togglefollowingDialogSteps()331 private void togglefollowingDialogSteps() 332 { 333 boolean benabletherest = true; 334 boolean benableGroupPage = isGroupingpossible(); 335 CurUnoDialog.setStepEnabled(UIConsts.SOGROUPSELECTIONPAGE, benableGroupPage); 336 CurUnoDialog.setStepEnabled(UIConsts.SOGROUPFILTERPAGE, benableGroupPage && CurDBMetaData.GroupFieldNames.length > 0); 337 if (isAggregateComponentEnabled()) 338 { 339 benabletherest = hasonlycompletefunctions(); 340 } 341 CurUnoDialog.enablefromStep(UIConsts.SOTITLESPAGE, benabletherest); 342 CurUnoDialog.enableNextButton(benabletherest); 343 } 344 hideControlRowsfromindex(int _index)345 private void hideControlRowsfromindex(int _index) 346 { 347 if (_index < this.ControlRowVector.size()) 348 { 349 for (int i = _index; i < ControlRowVector.size(); i++) 350 { 351 ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(i); 352 // if (i == _index) 353 // oControlRow.settovoid(); 354 // else 355 oControlRow.setVisible(false); 356 } 357 } 358 359 } 360 getAggregateFieldNames()361 public String[][] getAggregateFieldNames() 362 { 363 try 364 { 365 CurDBMetaData.Type = getQueryType(); 366 if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY) 367 { 368 ArrayList<String[]> aggregatevector = new ArrayList<String[]>(); 369 PropertyValue[][] aggregatelist = this.getScrollFieldValues(); 370 PropertyValue[] currowproperties; 371 PropertyValue curaggregateproperty; 372 if (CurDBMetaData.AggregateFieldNames != null) 373 { 374 for (int i = 0; i < aggregatelist.length; i++) 375 { 376 currowproperties = aggregatelist[i]; 377 if ((currowproperties[0].Value != null) && (currowproperties[1].Value != null)) 378 { 379 short[] iselfield = (short[]) AnyConverter.toArray(currowproperties[1].Value); 380 short[] iselfunction = (short[]) AnyConverter.toArray(currowproperties[0].Value); 381 if ((iselfield.length > 0) && (iselfunction.length > 0)) 382 { 383 String[] curaggregatename = new String[2]; 384 curaggregatename[0] = CurDBMetaData.NumericFieldNames[iselfield[0]]; 385 curaggregatename[1] = this.sFunctionOperators[iselfunction[0]]; 386 aggregatevector.add(curaggregatename); 387 } 388 } 389 } 390 } 391 CurDBMetaData.AggregateFieldNames = new String[aggregatevector.size()][2]; 392 aggregatevector.toArray(CurDBMetaData.AggregateFieldNames); 393 } 394 395 int iduplicate = JavaTools.getDuplicateFieldIndex(CurDBMetaData.AggregateFieldNames); 396 if (iduplicate != -1) 397 { 398 sDuplicateAggregateFunction = JavaTools.replaceSubString(sDuplicateAggregateFunction, CurDBMetaData.AggregateFieldNames[iduplicate][0], "<NUMERICFIELD>"); 399 int index = JavaTools.FieldInList(sFunctionOperators, CurDBMetaData.AggregateFieldNames[iduplicate][1]); 400 String sDisplayFunction = sFunctions[index]; 401 sDuplicateAggregateFunction = JavaTools.replaceSubString(sDuplicateAggregateFunction, sDisplayFunction, "<FUNCTION>"); 402 CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sDuplicateAggregateFunction); 403 CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", 1, 2)); 404 return new String[][] 405 { 406 }; 407 } 408 else 409 { 410 return CurDBMetaData.AggregateFieldNames; 411 } 412 } 413 catch (Exception exception) 414 { 415 exception.printStackTrace(System.out); 416 return null; 417 } 418 } 419 initialize()420 public void initialize() 421 { 422 CurDBMetaData.setNumericFields(); 423 initializeScrollFields(); 424 int icount = CurDBMetaData.AggregateFieldNames.length; 425 if (icount == 0) 426 { 427 super.initialize(1); 428 hideControlRowsfromindex(1); 429 } 430 else 431 { 432 super.initialize(icount); 433 hideControlRowsfromindex(icount); 434 } 435 toggleComponent(); 436 CurUnoDialog.repaintDialogStep(); 437 } 438 initializeScrollFields()439 protected void initializeScrollFields() 440 { 441 ControlRow curControlRow; 442 if (CurDBMetaData.AggregateFieldNames != null) 443 { 444 for (int i = 0; i < this.getBlockIncrementation(); i++) 445 { 446 curControlRow = (ControlRow) ControlRowVector.elementAt(i); 447 curControlRow.insertFieldNames(); 448 } 449 for (int i = 0; i <= CurDBMetaData.AggregateFieldNames.length; i++) 450 { 451 registerControlGroupAtIndex(i); 452 } 453 } 454 } 455 registerControlGroupAtIndex(int _index)456 private void registerControlGroupAtIndex(int _index) 457 { 458 short[] iselfunctionlist = new short[] 459 { 460 }; 461 short[] iselfieldslist = new short[] 462 { 463 }; 464 PropertyValue[] currowproperties = new PropertyValue[2]; 465 if (_index < CurDBMetaData.AggregateFieldNames.length) 466 { 467 short iselfieldsindex = (short) JavaTools.FieldInList(CurDBMetaData.NumericFieldNames, CurDBMetaData.AggregateFieldNames[_index][0]); 468 iselfieldslist = new short[] 469 { 470 iselfieldsindex 471 }; 472 short iselfunctionindex = (short) JavaTools.FieldInList(sFunctionOperators, CurDBMetaData.AggregateFieldNames[_index][1]); 473 iselfunctionlist = new short[] 474 { 475 iselfunctionindex 476 }; 477 } 478 currowproperties[0] = Properties.createProperty(getFunctionControlName(_index), iselfunctionlist, _index); 479 currowproperties[1] = Properties.createProperty(getFieldsControlName(_index), iselfieldslist, _index); //getTitleName(i) 480 super.registerControlGroup(currowproperties, _index); 481 } 482 getFunctionControlName(int _index)483 private String getFunctionControlName(int _index) 484 { 485 String namesuffix = "_" + String.valueOf(_index + 1); 486 return "lstfunctions" + namesuffix; 487 } 488 getFieldsControlName(int _index)489 private String getFieldsControlName(int _index) 490 { 491 String namesuffix = "_" + String.valueOf(_index + 1); 492 return "lstFieldnames" + namesuffix; 493 } 494 hasonlycompletefunctions()495 private boolean hasonlycompletefunctions() 496 { 497 int maxfieldcount = super.getCurFieldCount(); 498 if (maxfieldcount > 0) 499 { 500 ControlRow curcontrolrow = (ControlRow) this.ControlRowVector.elementAt(maxfieldcount - 1); 501 return curcontrolrow.isComplete(); 502 } 503 else 504 { 505 return false; 506 } 507 } 508 509 protected class ControlRow 510 { 511 512 private XListBox xFieldListBox; 513 private XListBox xFunctionListBox; 514 private int index; 515 ControlRow(int _index, int ypos, int _curHelpID)516 protected ControlRow(int _index, int ypos, int _curHelpID) 517 { 518 try 519 { 520 this.index = _index; 521 xFunctionListBox = CurUnoDialog.insertListBox(getFunctionControlName(index), 1, null, new ItemListenerImpl(), 522 new String[] 523 { 524 "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 525 }, 526 new Object[] 527 { 528 Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 4), new Integer(ypos), UIConsts.INVISIBLESTEP, sFunctions, new Short(curtabindex++), 88 529 }); 530 531 xFieldListBox = CurUnoDialog.insertListBox(getFieldsControlName(index), 1, null, new ItemListenerImpl(), 532 new String[] 533 { 534 "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 535 }, 536 new Object[] 537 { 538 Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 98), new Integer(ypos), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 86 539 }); 540 lastHelpIndex = _curHelpID - 1; 541 } 542 catch (Exception exception) 543 { 544 exception.printStackTrace(System.out); 545 } 546 } 547 getSelectedFieldName()548 private String getSelectedFieldName() 549 { 550 return xFieldListBox.getSelectedItem(); 551 } 552 getSelectedFunction()553 private String getSelectedFunction() 554 { 555 return xFunctionListBox.getSelectedItem(); 556 } 557 setVisible(boolean _bvisible)558 private void setVisible(boolean _bvisible) 559 { 560 CurUnoDialog.setControlVisible(getFunctionControlName(index), _bvisible); 561 CurUnoDialog.setControlVisible(getFieldsControlName(index), _bvisible); 562 } 563 insertFieldNames()564 private void insertFieldNames() 565 { 566 Helper.setUnoPropertyValue(UnoDialog.getModel(xFieldListBox), PropertyNames.STRING_ITEM_LIST, CurDBMetaData.NumericFieldNames); 567 } 568 isComplete()569 private boolean isComplete() 570 { 571 boolean bfieldnameisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFieldListBox), PropertyNames.SELECTED_ITEMS) != null); 572 boolean bfunctionisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFunctionListBox), PropertyNames.SELECTED_ITEMS) != null); 573 return (bfieldnameisselected && bfunctionisselected); 574 } 575 settovoid()576 private void settovoid() 577 { 578 CurUnoDialog.deselectListBox(xFieldListBox); 579 CurUnoDialog.deselectListBox(xFunctionListBox); 580 } 581 582 protected class ItemListenerImpl implements com.sun.star.awt.XItemListener 583 { 584 itemStateChanged(com.sun.star.awt.ItemEvent EventObject)585 public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) 586 { 587 try 588 { 589 toggleButtons(); 590 togglefollowingDialogSteps(); 591 } 592 catch (Exception exception) 593 { 594 exception.printStackTrace(System.out); 595 } 596 } 597 disposing(com.sun.star.lang.EventObject eventObject)598 public void disposing(com.sun.star.lang.EventObject eventObject) 599 { 600 } 601 } 602 } 603 } 604