List of usage examples for java.awt Component setVisible
public void setVisible(boolean b)
From source file:edu.ku.brc.specify.datamodel.busrules.LoanBusRules.java
/** * @param doCreateLoanNoPreps the doCreateLoanNoPreps to set *///from w w w.ja v a2 s . com public void setDoCreateLoanNoPreps(boolean doCreateLoanNoPreps) { this.doCreateLoanNoPreps = doCreateLoanNoPreps; if (doCreateLoanNoPreps) { Component loanPreparations = formViewObj.getControlByName("loanPreparations"); if (loanPreparations != null) { loanPreparations.setVisible(false); } } }
From source file:oct.analysis.application.dat.OCTAnalysisManager.java
/** * This method will take care of interacting with the user in determining * where the fovea is within the OCT. It first lets the user inspect the * automatically identified locations where the fovea may be and then choose * the selection that is at the fovea. If none of the automated findings are * at the fovea the user has the option to manual specify it's location. * Finally, the chosen X coordinate (within the OCT) of the fovea is set in * the manager and can be obtained via the getFoveaCenterXPosition getter. * * @param fullAutoMode find the fovea automatically without user input when * true, otherwise find the fovea in semi-automatic mode involving user * interaction//w w w . j a v a2 s . c om */ public void findCenterOfFovea(boolean fullAutoMode) throws InterruptedException, ExecutionException { //disable clicking other components while processing by enabling glass pane JFrame topFrame = (JFrame) SwingUtilities.getWindowAncestor(imgPanel); Component glassPane = topFrame.getGlassPane(); glassPane.setVisible(true); //monitor progress of finding the fovea ProgressMonitor pm = new ProgressMonitor(imgPanel, "Analyzing OCT for fovea...", "", 0, 100); pm.setMillisToDecideToPopup(0); pm.setMillisToPopup(100); pm.setProgress(0); FoveaFindingTask fvtask = new FoveaFindingTask(!fullAutoMode, glassPane); fvtask.addPropertyChangeListener((PropertyChangeEvent evt) -> { if ("progress".equals(evt.getPropertyName())) { int progress1 = (Integer) evt.getNewValue(); pm.setProgress(progress1); } }); fvtask.execute(); }
From source file:edu.ku.brc.specify.datamodel.busrules.AgentBusRules.java
/** * Fix up labels in UI per the type of Agent * @param agent the current agent/*from w w w . j ava 2 s.c o m*/ * @param doSetOtherValues indicates it should set values */ protected void fixUpFormForAgentType(final Agent agent, final boolean doSetOtherValues) { boolean isPerson = agent.getAgentType() == null || agent.getAgentType() == Agent.PERSON; if (!isPerson) { agent.setFirstName(null); agent.setMiddleInitial(null); } enableFieldAndLabel("1", isPerson, doSetOtherValues ? agent.getTitle() : null, agent); // Title enableFieldAndLabel("5", isPerson, doSetOtherValues ? agent.getFirstName() : null, agent); // First Name enableFieldAndLabel("4", isPerson, doSetOtherValues ? agent.getMiddleInitial() : null, agent); // Middle Initial enableFieldAndLabel("19", isPerson, null, agent); // date Of Birth enableFieldAndLabel("20", isPerson, null, agent); // date Of Death enableFieldAndLabel("11", isPerson, doSetOtherValues ? agent.getGuid() : null, agent); // guid enableFieldAndLabel("12", isPerson, doSetOtherValues ? agent.getInitials() : null, agent); // initials enableFieldAndLabel("13", isPerson, doSetOtherValues ? agent.getInterests() : null, agent); // interests enableFieldAndLabel("14", isPerson, doSetOtherValues ? agent.getJobTitle() : null, agent); // jobTitle enableFieldAndLabel("16", true, doSetOtherValues ? agent.getRemarks() : null, agent); // remarks enableFieldAndLabel("17", true, doSetOtherValues ? agent.getUrl() : null, agent); // url // Last Name String lbl = UIRegistry.getResourceString(isPerson ? "AG_LASTNAME" : "AG_NAME"); lastLabel.setText(lbl + ":"); // Agent Variants boolean useAgentVariant = AppPreferences.getRemote().getBoolean( "Agent.Use.Variants." + AppContextMgr.getInstance().getClassObject(Discipline.class).getType(), Discipline.isCurrentDiscipline(DisciplineType.STD_DISCIPLINES.botany)); // I don't think this is needed anymore //Component agentVarSep = formViewObj.getCompById("100"); //if (agentVarSep != null) //{ // agentVarSep.setVisible(useAgentVariant); //} Component agentVarSubView = formViewObj.getCompById("10"); if (agentVarSubView != null) { agentVarSubView.setVisible(useAgentVariant); } Component groupPersonSubForm = formViewObj.getCompById("31"); if (groupPersonSubForm != null) { groupPersonSubForm.setVisible(agent.getAgentType() == Agent.GROUP); } }
From source file:edu.ku.brc.specify.datamodel.busrules.AgentBusRules.java
@Override public void afterFillForm(final Object dataObjArg) { Object dataObj = dataObjArg;/*from ww w .j av a 2 s . c o m*/ if (!(viewable instanceof FormViewObj) || !(dataObj instanceof Agent)) { if (dataObj == null) { Component agentVarSubView = formViewObj.getCompById("10"); if (agentVarSubView != null) { agentVarSubView.setVisible(false); } Component groupPersonSubForm = formViewObj.getCompById("31"); if (groupPersonSubForm != null) { groupPersonSubForm.setVisible(false); } Component addrSubView = formViewObj.getCompById("9"); if (addrSubView != null) { addrSubView.setVisible(false); } } return; } Agent agent = (Agent) dataObj; Byte agentType = agent.getAgentType(); fixUpFormForAgentType(agent, true); if (typeComp instanceof ValComboBox) { ValComboBox typeCBX = (ValComboBox) typeComp; if (typeCBX != null) { ignoreSet = true; typeCBX.getComboBox().setSelectedIndex(agentType == null ? Agent.PERSON : agentType); ignoreSet = false; fixUpTypeCBX(typeCBX.getComboBox()); } } else { JTextField typeTxt = (JTextField) typeComp; if (typeTxt != null) { typeTxt.setText(typeTitles[agentType]); } } boolean shouldBeVisible = agentType == Agent.PERSON || agentType == Agent.ORG; final Component addrSubView = formViewObj.getCompById("9"); if (addrSubView != null) { boolean isVisible = addrSubView.isVisible(); if (!isVisible != shouldBeVisible) { SwingUtilities.invokeLater(new Runnable() { public void run() { Component topComp = UIHelper.getWindow(addrSubView); Component topMost = UIRegistry.getTopWindow(); if (topComp != topMost && topComp != null) { ((Window) topComp).pack(); } } }); } addrSubView.setVisible(shouldBeVisible); } }
From source file:com.haulmont.ext.web.ui.Call.CallAccessData.java
public void visitComponent(Component component, Collection<Component> components) { if (component instanceof DatasourceComponent) { Datasource datasource = ((DatasourceComponent) component).getDatasource(); if (datasource != null && datasource.getMetaClass().equals((call).getMetaClass())) { MetaProperty property = ((DatasourceComponent) component).getMetaProperty(); FieldInfo fieldInfo = findField(property); if (fieldInfo != null) { Label label = findLabel(component, components); if (!fieldInfo.getVisible()) { component.setVisible(false); if (label != null) { label.setVisible(false); }//from www . ja va 2 s. co m } if (fieldInfo.getRequired() && component instanceof Field) { ((Field) component).setRequired(true); if (label != null && label.getText() != null) ((Field) component).setRequiredMessage( MessageProvider.getMessage(getClass(), "error.requiredValue") + " \"" + label.getText().toString() + "\""); } if (!StringUtils.isBlank(call.getSignatures()) && fieldInfo.getSigned() && component instanceof Field) { ((Field) component).setEditable(false); } } if (!StringUtils.isBlank(call.getSignatures()) && component instanceof Field) { SignatureService ss = ServiceLocator.lookup(SignatureService.NAME); boolean signed = ss.isPropertySigned(call, property); if (((Field) component).isEditable()) { ((Field) component).setEditable(!signed); } } } } }
From source file:com.haulmont.ext.web.ui.CauseGIBDD.CauseGIBDDAccessData.java
public void visitComponent(Component component, Collection<Component> components) { if (component instanceof DatasourceComponent) { Datasource datasource = ((DatasourceComponent) component).getDatasource(); if (datasource != null && datasource.getMetaClass().equals((cause).getMetaClass())) { MetaProperty property = ((DatasourceComponent) component).getMetaProperty(); FieldInfo fieldInfo = findField(property); if (fieldInfo != null) { Label label = findLabel(component, components); if (!fieldInfo.getVisible()) { component.setVisible(false); if (label != null) { label.setVisible(false); }/* ww w . j a v a 2 s. com*/ } if (fieldInfo.getRequired() && component instanceof Field) { ((Field) component).setRequired(true); if (label != null && label.getText() != null) ((Field) component).setRequiredMessage( MessageProvider.getMessage(getClass(), "error.requiredValue") + " \"" + label.getText().toString() + "\""); } if (!StringUtils.isBlank(cause.getSignatures()) && fieldInfo.getSigned() && component instanceof Field) { ((Field) component).setEditable(false); } } if (!StringUtils.isBlank(cause.getSignatures()) && component instanceof Field) { SignatureService ss = ServiceLocator.lookup(SignatureService.NAME); boolean signed = ss.isPropertySigned(cause, property); if (((Field) component).isEditable()) { ((Field) component).setEditable(!signed); } } } } }
From source file:com.mac.tarchan.desktop.event.EventQuery.java
/** * ????????/*from www. jav a 2 s. c o m*/ */ public void toggle() { for (Component child : list) { child.setVisible(!child.isVisible()); } }
From source file:com.mac.tarchan.desktop.event.EventQuery.java
/** * ????? */ public void show() { for (Component child : list) { child.setVisible(true); } }
From source file:com.mac.tarchan.desktop.event.EventQuery.java
/** * ????? */ public void hide() { for (Component child : list) { child.setVisible(false); } }
From source file:edu.ku.brc.specify.datamodel.busrules.LoanBusRules.java
@Override public void afterFillForm(final Object dataObj) { if (formViewObj != null && formViewObj.getDataObj() instanceof Loan) { formViewObj.setSkippingAttach(true); MultiView mvParent = formViewObj.getMVParent(); Loan loan = (Loan) formViewObj.getDataObj(); boolean isNewObj = loan.getId() == null;//MultiView.isOptionOn(mvParent.getOptions(), MultiView.IS_NEW_OBJECT); boolean isEdit = mvParent.isEditable(); Component comp = formViewObj.getControlByName("generateInvoice"); if (comp instanceof JCheckBox) { ((JCheckBox) comp).setVisible(isEdit); }/*w w w.j a va 2 s .c o m*/ boolean allResolved = true; for (LoanPreparation loanPrep : loan.getLoanPreparations()) { Boolean isResolved = loanPrep.getIsResolved(); if (isResolved == null || (isResolved != null && !isResolved)) { allResolved = false; break; } } comp = formViewObj.getControlByName("ReturnLoan"); if (comp instanceof JButton) { comp.setVisible(isEdit); Boolean isClosed = loan.getIsClosed(); comp.setEnabled(!isNewObj && (isClosed != null ? !loan.getIsClosed() : false) && !allResolved); if (allResolved) { ((JButton) comp).setText(UIRegistry.getResourceString("LOAN_ALL_PREPS_RETURNED")); } } if (isNewObj) { Component shipComp = formViewObj.getControlByName("shipmentNumber"); comp = formViewObj.getControlByName("loanNumber"); if (comp instanceof JTextField && shipComp instanceof JTextField) { JTextField loanTxt = (JTextField) comp; if (shipComp instanceof GetSetValueIFace) { GetSetValueIFace gsv = (GetSetValueIFace) shipComp; gsv.setValue(loanTxt.getText(), loanTxt.getText()); } else if (shipComp instanceof JTextField) { ((JTextField) shipComp).setText(loanTxt.getText()); } if (shipComp instanceof UIValidatable) { UIValidatable uiv = (UIValidatable) shipComp; uiv.setChanged(true); } } } } }